From 0873760c53bac70d19df858dde8658bbac5e783e Mon Sep 17 00:00:00 2001 From: Victoria Zotova Date: Mon, 5 Feb 2024 13:32:24 -0500 Subject: [PATCH 1/7] Draft of proof bot script using ape --- .gitignore | 14 ++++++ ape-config.yaml | 14 ++++++ contracts/IReceiver.sol | 5 ++ requirements.txt | 6 +++ scripts/proof_bot.py | 100 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 139 insertions(+) create mode 100644 .gitignore create mode 100644 ape-config.yaml create mode 100644 contracts/IReceiver.sol create mode 100644 requirements.txt create mode 100644 scripts/proof_bot.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eba7a81 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +__pycache__ +.env +build/ +venv/ +.python-version +bin/ +.vscode/ +.idea/ +node_modules/ +.build +contracts/.cache +env +.cache/ +dist/ diff --git a/ape-config.yaml b/ape-config.yaml new file mode 100644 index 0000000..e6bed51 --- /dev/null +++ b/ape-config.yaml @@ -0,0 +1,14 @@ +name: train45 +contracts_folder: contracts + +plugins: + - name: solidity + - name: ape-etherscan + +solidity: + version: 0.8.23 + evm_version: paris + +ethereum: + mainnet: + transaction_acceptance_timeout: 600 # 10 minutes diff --git a/contracts/IReceiver.sol b/contracts/IReceiver.sol new file mode 100644 index 0000000..3424e3f --- /dev/null +++ b/contracts/IReceiver.sol @@ -0,0 +1,5 @@ +pragma solidity ^0.8.0; + +interface IReceiver { + function receiveMessage(bytes memory inputData) external; +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..947929b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +-i https://pypi.org/simple +ape-infura==0.7.0 +ape-solidity==0.7.1 +ape-etherscan==0.7.1 +eth-ape==0.7.7 +eth-rlp==0.3.0 ; python_version >= '3.7' and python_version < '4' diff --git a/scripts/proof_bot.py b/scripts/proof_bot.py new file mode 100644 index 0000000..32be252 --- /dev/null +++ b/scripts/proof_bot.py @@ -0,0 +1,100 @@ +#!/usr/bin/python3 + +import requests +from ape import project +import rlp +from eth_typing import HexStr +from eth_utils import to_bytes, to_int +from ape.api import AccountAPI +from ape.contracts import ContractInstance +from ape.cli import get_user_selected_account +from ape.exceptions import ContractLogicError + + +def hex_to_bytes(data: str) -> bytes: + return to_bytes(hexstr=HexStr(data)) + +def get_polygon_last_block_number(account: AccountAPI, fx_base_channel_root_tunnel: ContractInstance) -> int: + + last_blocknumber = 0 + for tx in account.history: + if tx.method_called and tx.method_called.name == 'receiveMessage': + last_proof_data = hex_to_bytes(tx.transaction.dict()['data']) + last_proof = fx_base_channel_root_tunnel.decode_input(last_proof_data)[1]['inputData'] + decoded = rlp.decode(last_proof) + blocknumber = to_int(decoded[2]) + if blocknumber > last_blocknumber: + last_blocknumber = blocknumber + + return last_blocknumber + + +def get_message_sent_events(graphql_endpoint: str, last_blocknumber: int) -> [dict]: + + gql = """ + query AllMessagesSent { + messageSents(where: {blockNumber_gte: """ + str(last_blocknumber) + """}, orderBy: blockNumber) { + transactionHash + } + } + """ + + s = requests.session() + s.headers = { + 'Accept': 'application/json', + 'Content-Type': 'application/json' + } + + response = s.post(graphql_endpoint, json={'query': gql}) + + data = response.json() + messages = data['data']['messageSents'] + return messages + +def push_proof(account: AccountAPI, fx_base_channel_root_tunnel: ContractInstance, proof: bytes): + try: + fx_base_channel_root_tunnel.receiveMessage(proof, sender=account) + except ContractLogicError as e: + if e.message != "EXIT_ALREADY_PROCESSED": + raise e + print("processed") + + +def get_and_push_proof( + account: AccountAPI, + fx_base_channel_root_tunnel: ContractInstance, + messages: [dict], + event_signature: str, + proof_generator: str + ): + + for event in messages: + txhash = event['transactionHash'] + s = requests.session() + response = s.get(proof_generator + txhash, params={'eventSignature': event_signature}) + if response.status_code != 200: + assert False, "No proof" + proof = response.json()['result'] + push_proof(account, fx_base_channel_root_tunnel, proof) + + +def main(): + + account = get_user_selected_account() + polygon_root_address = "0x720754c84f0b1737801bf63c950914E0C1d4aCa2" + + graphql_endpoint = "https://api.studio.thegraph.com/query/24143/polygonchildmumbai/version/latest" + + event_signature = '0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036' + proof_generator = "https://proof-generator.polygon.technology/api/v1/mumbai/exit-payload/" + + receiver = project.IReceiver.at(polygon_root_address) + last_blocknumber = get_polygon_last_block_number(account, receiver) + messages = get_message_sent_events(graphql_endpoint, last_blocknumber) + + print(messages) + if len(messages) == 0: + print("Nothing to push") + return + + get_and_push_proof(account, receiver, messages, event_signature, proof_generator) \ No newline at end of file From 298cbf2aecd60b6a440abe521f5d06c29a1e4c8a Mon Sep 17 00:00:00 2001 From: Victoria Zotova Date: Wed, 7 Feb 2024 15:38:48 -0500 Subject: [PATCH 2/7] Added click options --- scripts/proof_bot.py | 56 +++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/scripts/proof_bot.py b/scripts/proof_bot.py index 32be252..be9abd5 100644 --- a/scripts/proof_bot.py +++ b/scripts/proof_bot.py @@ -1,14 +1,19 @@ #!/usr/bin/python3 +from urllib.parse import urljoin + +import click import requests -from ape import project import rlp -from eth_typing import HexStr -from eth_utils import to_bytes, to_int +from ape import project from ape.api import AccountAPI +from ape.cli import ConnectedProviderCommand, get_user_selected_account from ape.contracts import ContractInstance -from ape.cli import get_user_selected_account from ape.exceptions import ContractLogicError +from eth_typing import HexStr +from eth_utils import to_bytes, to_int + +EVENT_SIGNATURE = "0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036" def hex_to_bytes(data: str) -> bytes: @@ -71,24 +76,43 @@ def get_and_push_proof( for event in messages: txhash = event['transactionHash'] s = requests.session() - response = s.get(proof_generator + txhash, params={'eventSignature': event_signature}) + response = s.get(urljoin(proof_generator, txhash), params={'eventSignature': event_signature}) if response.status_code != 200: - assert False, "No proof" + print("No proof") + return proof = response.json()['result'] push_proof(account, fx_base_channel_root_tunnel, proof) -def main(): +@click.command(cls=ConnectedProviderCommand) +@click.option( + "--fx-root-tunnel", + "-fxrt", + help="Address of FxBaseRootTunnel contract", + default=None, + required=True, + type=click.STRING, +) +@click.option( + "--graphql-endpoint", + "-ge", + help="GraphQL endpoint", + default=None, + required=True, + type=click.STRING, +) +@click.option( + "--proof-generator", + "-pg", + help="Proof generator URI", + default=None, + required=True, + type=click.STRING, +) +def cli(fx_root_tunnel, graphql_endpoint, proof_generator): account = get_user_selected_account() - polygon_root_address = "0x720754c84f0b1737801bf63c950914E0C1d4aCa2" - - graphql_endpoint = "https://api.studio.thegraph.com/query/24143/polygonchildmumbai/version/latest" - - event_signature = '0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036' - proof_generator = "https://proof-generator.polygon.technology/api/v1/mumbai/exit-payload/" - - receiver = project.IReceiver.at(polygon_root_address) + receiver = project.IReceiver.at(fx_root_tunnel) last_blocknumber = get_polygon_last_block_number(account, receiver) messages = get_message_sent_events(graphql_endpoint, last_blocknumber) @@ -97,4 +121,4 @@ def main(): print("Nothing to push") return - get_and_push_proof(account, receiver, messages, event_signature, proof_generator) \ No newline at end of file + get_and_push_proof(account, receiver, messages, EVENT_SIGNATURE, proof_generator) From 217edba298e04aac72d00a0607ef95896f15fd10 Mon Sep 17 00:00:00 2001 From: Victoria Zotova Date: Wed, 7 Feb 2024 18:44:45 -0500 Subject: [PATCH 3/7] Improves logging --- scripts/proof_bot.py | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/scripts/proof_bot.py b/scripts/proof_bot.py index be9abd5..22d8f47 100644 --- a/scripts/proof_bot.py +++ b/scripts/proof_bot.py @@ -10,10 +10,12 @@ from ape.cli import ConnectedProviderCommand, get_user_selected_account from ape.contracts import ContractInstance from ape.exceptions import ContractLogicError +from ape.logging import logger from eth_typing import HexStr from eth_utils import to_bytes, to_int EVENT_SIGNATURE = "0x8c5261668696ce22758910d05bab8f186d6eb247ceac2af2e82c7dc17669b036" +EXIT_ALREADY_PROCESSED_ERROR = "EXIT_ALREADY_PROCESSED" def hex_to_bytes(data: str) -> bytes: @@ -30,7 +32,7 @@ def get_polygon_last_block_number(account: AccountAPI, fx_base_channel_root_tunn blocknumber = to_int(decoded[2]) if blocknumber > last_blocknumber: last_blocknumber = blocknumber - + return last_blocknumber @@ -56,13 +58,15 @@ def get_message_sent_events(graphql_endpoint: str, last_blocknumber: int) -> [di messages = data['data']['messageSents'] return messages -def push_proof(account: AccountAPI, fx_base_channel_root_tunnel: ContractInstance, proof: bytes): +def push_proof(account: AccountAPI, fx_base_channel_root_tunnel: ContractInstance, proof: bytes) -> bool: try: fx_base_channel_root_tunnel.receiveMessage(proof, sender=account) + return True except ContractLogicError as e: - if e.message != "EXIT_ALREADY_PROCESSED": + if e.message != EXIT_ALREADY_PROCESSED_ERROR: raise e - print("processed") + logger.info("Transaction was processed") + return False def get_and_push_proof( @@ -71,17 +75,22 @@ def get_and_push_proof( messages: [dict], event_signature: str, proof_generator: str - ): + ) -> int: + processed = 0 for event in messages: txhash = event['transactionHash'] s = requests.session() response = s.get(urljoin(proof_generator, txhash), params={'eventSignature': event_signature}) if response.status_code != 200: - print("No proof") - return + logger.warning("Transaction is not checkpointed") + return processed + proof = response.json()['result'] - push_proof(account, fx_base_channel_root_tunnel, proof) + if push_proof(account, fx_base_channel_root_tunnel, proof): + processed += 1 + + return processed @click.command(cls=ConnectedProviderCommand) @@ -114,11 +123,14 @@ def cli(fx_root_tunnel, graphql_endpoint, proof_generator): account = get_user_selected_account() receiver = project.IReceiver.at(fx_root_tunnel) last_blocknumber = get_polygon_last_block_number(account, receiver) + logger.debug("Last processed block number: %d", last_blocknumber) + messages = get_message_sent_events(graphql_endpoint, last_blocknumber) + logger.info("Got %d messages", len(messages)) - print(messages) if len(messages) == 0: - print("Nothing to push") + logger.info("No new transactions") return - get_and_push_proof(account, receiver, messages, EVENT_SIGNATURE, proof_generator) + processed = get_and_push_proof(account, receiver, messages, EVENT_SIGNATURE, proof_generator) + logger.info("Processed %d transactions", processed) From 1dcdbddc73f5715251b31f06445d411430ace2ae Mon Sep 17 00:00:00 2001 From: Victoria Zotova Date: Wed, 7 Feb 2024 18:56:56 -0500 Subject: [PATCH 4/7] README draft and pre-commit hooks --- .pre-commit-config.yaml | 15 ++++++++++ README.md | 16 ++++++++++ scripts/proof_bot.py | 65 +++++++++++++++++++++++------------------ 3 files changed, 68 insertions(+), 28 deletions(-) create mode 100644 .pre-commit-config.yaml create mode 100644 README.md diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..eaa6390 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,15 @@ +repos: + - repo: https://github.com/psf/black + rev: 23.11.0 + hooks: + - id: black + + - repo: https://github.com/pycqa/flake8 + rev: 6.1.0 + hooks: + - id: flake8 + + - repo: https://github.com/pre-commit/mirrors-isort + rev: v5.10.1 + hooks: + - id: isort diff --git a/README.md b/README.md new file mode 100644 index 0000000..bf88871 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# State Transfer Bot Polygon → Ethereum + +Stateless bot monitors GraphQL endpoint for new events `MessageSent` that occurs on Polygon network. And then transfers proof to Ethereum root contract. + +## Installation + +We use [Ape](https://docs.apeworx.io/ape/stable/index.html) as the testing and deployment framework of this project. + +### Configuring Pre-commit + +To install pre-commit locally: + +```bash +pre-commit install +``` + diff --git a/scripts/proof_bot.py b/scripts/proof_bot.py index 22d8f47..b6052d3 100644 --- a/scripts/proof_bot.py +++ b/scripts/proof_bot.py @@ -21,13 +21,17 @@ def hex_to_bytes(data: str) -> bytes: return to_bytes(hexstr=HexStr(data)) -def get_polygon_last_block_number(account: AccountAPI, fx_base_channel_root_tunnel: ContractInstance) -> int: +def get_polygon_last_block_number( + account: AccountAPI, fx_base_channel_root_tunnel: ContractInstance +) -> int: last_blocknumber = 0 for tx in account.history: - if tx.method_called and tx.method_called.name == 'receiveMessage': - last_proof_data = hex_to_bytes(tx.transaction.dict()['data']) - last_proof = fx_base_channel_root_tunnel.decode_input(last_proof_data)[1]['inputData'] + if tx.method_called and tx.method_called.name == "receiveMessage": + last_proof_data = hex_to_bytes(tx.transaction.dict()["data"]) + last_proof = fx_base_channel_root_tunnel.decode_input(last_proof_data)[1][ + "inputData" + ] decoded = rlp.decode(last_proof) blocknumber = to_int(decoded[2]) if blocknumber > last_blocknumber: @@ -37,28 +41,31 @@ def get_polygon_last_block_number(account: AccountAPI, fx_base_channel_root_tunn def get_message_sent_events(graphql_endpoint: str, last_blocknumber: int) -> [dict]: - - gql = """ + gql = ( + """ query AllMessagesSent { - messageSents(where: {blockNumber_gte: """ + str(last_blocknumber) + """}, orderBy: blockNumber) { + messageSents(where: {blockNumber_gte: """ + + str(last_blocknumber) + + """}, orderBy: blockNumber) { transactionHash } } """ + ) s = requests.session() - s.headers = { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - } + s.headers = {"Accept": "application/json", "Content-Type": "application/json"} - response = s.post(graphql_endpoint, json={'query': gql}) + response = s.post(graphql_endpoint, json={"query": gql}) data = response.json() - messages = data['data']['messageSents'] + messages = data["data"]["messageSents"] return messages -def push_proof(account: AccountAPI, fx_base_channel_root_tunnel: ContractInstance, proof: bytes) -> bool: + +def push_proof( + account: AccountAPI, fx_base_channel_root_tunnel: ContractInstance, proof: bytes +) -> bool: try: fx_base_channel_root_tunnel.receiveMessage(proof, sender=account) return True @@ -70,23 +77,24 @@ def push_proof(account: AccountAPI, fx_base_channel_root_tunnel: ContractInstanc def get_and_push_proof( - account: AccountAPI, - fx_base_channel_root_tunnel: ContractInstance, - messages: [dict], - event_signature: str, - proof_generator: str - ) -> int: - + account: AccountAPI, + fx_base_channel_root_tunnel: ContractInstance, + messages: [dict], + event_signature: str, + proof_generator: str, +) -> int: processed = 0 for event in messages: - txhash = event['transactionHash'] + txhash = event["transactionHash"] s = requests.session() - response = s.get(urljoin(proof_generator, txhash), params={'eventSignature': event_signature}) + response = s.get( + urljoin(proof_generator, txhash), params={"eventSignature": event_signature} + ) if response.status_code != 200: logger.warning("Transaction is not checkpointed") return processed - - proof = response.json()['result'] + + proof = response.json()["result"] if push_proof(account, fx_base_channel_root_tunnel, proof): processed += 1 @@ -119,7 +127,6 @@ def get_and_push_proof( type=click.STRING, ) def cli(fx_root_tunnel, graphql_endpoint, proof_generator): - account = get_user_selected_account() receiver = project.IReceiver.at(fx_root_tunnel) last_blocknumber = get_polygon_last_block_number(account, receiver) @@ -127,10 +134,12 @@ def cli(fx_root_tunnel, graphql_endpoint, proof_generator): messages = get_message_sent_events(graphql_endpoint, last_blocknumber) logger.info("Got %d messages", len(messages)) - + if len(messages) == 0: logger.info("No new transactions") return - processed = get_and_push_proof(account, receiver, messages, EVENT_SIGNATURE, proof_generator) + processed = get_and_push_proof( + account, receiver, messages, EVENT_SIGNATURE, proof_generator + ) logger.info("Processed %d transactions", processed) From 30339d10f4bba6f5c18a825f657935e45913e1fc Mon Sep 17 00:00:00 2001 From: Victoria Zotova Date: Fri, 9 Feb 2024 14:28:35 -0500 Subject: [PATCH 5/7] Added autosigning --- scripts/proof_bot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/proof_bot.py b/scripts/proof_bot.py index b6052d3..7db1cd8 100644 --- a/scripts/proof_bot.py +++ b/scripts/proof_bot.py @@ -7,7 +7,7 @@ import rlp from ape import project from ape.api import AccountAPI -from ape.cli import ConnectedProviderCommand, get_user_selected_account +from ape.cli import ConnectedProviderCommand, select_account, account_option from ape.contracts import ContractInstance from ape.exceptions import ContractLogicError from ape.logging import logger @@ -102,6 +102,7 @@ def get_and_push_proof( @click.command(cls=ConnectedProviderCommand) +@account_option() @click.option( "--fx-root-tunnel", "-fxrt", @@ -126,8 +127,8 @@ def get_and_push_proof( required=True, type=click.STRING, ) -def cli(fx_root_tunnel, graphql_endpoint, proof_generator): - account = get_user_selected_account() +def cli(account, fx_root_tunnel, graphql_endpoint, proof_generator): + account.set_autosign(enabled=True) receiver = project.IReceiver.at(fx_root_tunnel) last_blocknumber = get_polygon_last_block_number(account, receiver) logger.debug("Last processed block number: %d", last_blocknumber) From 1f6e248b1b60c0a985a3b1c11c7b638260c629a9 Mon Sep 17 00:00:00 2001 From: Victoria Zotova Date: Sun, 11 Feb 2024 17:04:25 -0500 Subject: [PATCH 6/7] Slightly improves readme and comments in script --- README.md | 8 ++++++++ scripts/proof_bot.py | 27 +++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bf88871..1d2e440 100644 --- a/README.md +++ b/README.md @@ -14,3 +14,11 @@ To install pre-commit locally: pre-commit install ``` +## Example of usage + +```bash +export WEB3_INFURA_PROJECT_ID= +export APE_ACCOUNTS_BOT_PASSPHRASE= + +ape run proof_bot --fx-root-tunnel 0x720754c84f0b1737801bf63c950914E0C1d4aCa2 --graphql-endpoint https://api.studio.thegraph.com/query/24143/polygonchildmumbai/version/latest --proof-generator https://proof-generator.polygon.technology/api/v1/mumbai/exit-payload/ --network :goerli:infura --account BOT +``` \ No newline at end of file diff --git a/scripts/proof_bot.py b/scripts/proof_bot.py index 7db1cd8..8df781e 100644 --- a/scripts/proof_bot.py +++ b/scripts/proof_bot.py @@ -7,7 +7,7 @@ import rlp from ape import project from ape.api import AccountAPI -from ape.cli import ConnectedProviderCommand, select_account, account_option +from ape.cli import ConnectedProviderCommand, account_option from ape.contracts import ContractInstance from ape.exceptions import ContractLogicError from ape.logging import logger @@ -25,10 +25,15 @@ def hex_to_bytes(data: str) -> bytes: def get_polygon_last_block_number( account: AccountAPI, fx_base_channel_root_tunnel: ContractInstance ) -> int: + """ + Search in tx history for the last `receiveMessage` tx, + extracts block number (from Polygon) using that data + """ + last_blocknumber = 0 for tx in account.history: if tx.method_called and tx.method_called.name == "receiveMessage": - last_proof_data = hex_to_bytes(tx.transaction.dict()["data"]) + last_proof_data = hex_to_bytes(tx.transaction.model_dump()["data"]) last_proof = fx_base_channel_root_tunnel.decode_input(last_proof_data)[1][ "inputData" ] @@ -40,7 +45,12 @@ def get_polygon_last_block_number( return last_blocknumber -def get_message_sent_events(graphql_endpoint: str, last_blocknumber: int) -> [dict]: +def get_message_sent_events(graphql_endpoint: str, last_blocknumber: int) -> list[dict]: + """ + Queries GraphQL endpoint to retreive all new `MessageSent` events + on Polygon network + """ + gql = ( """ query AllMessagesSent { @@ -66,6 +76,8 @@ def get_message_sent_events(graphql_endpoint: str, last_blocknumber: int) -> [di def push_proof( account: AccountAPI, fx_base_channel_root_tunnel: ContractInstance, proof: bytes ) -> bool: + """Sends `receiveMessage` tx with the provided proof""" + try: fx_base_channel_root_tunnel.receiveMessage(proof, sender=account) return True @@ -79,10 +91,15 @@ def push_proof( def get_and_push_proof( account: AccountAPI, fx_base_channel_root_tunnel: ContractInstance, - messages: [dict], + messages: list[dict], event_signature: str, proof_generator: str, ) -> int: + """ + Iterates over all new messages, checks proof for each of them + and executes tx on Ethereum side of the channel + """ + processed = 0 for event in messages: txhash = event["transactionHash"] @@ -128,6 +145,8 @@ def get_and_push_proof( type=click.STRING, ) def cli(account, fx_root_tunnel, graphql_endpoint, proof_generator): + """Provides proof from Polygon network to Ethereum""" + account.set_autosign(enabled=True) receiver = project.IReceiver.at(fx_root_tunnel) last_blocknumber = get_polygon_last_block_number(account, receiver) From ec4fbb7d8367ef3f60c8ce924459e07de43e866d Mon Sep 17 00:00:00 2001 From: Victoria Date: Mon, 12 Feb 2024 16:42:49 +0200 Subject: [PATCH 7/7] Apply suggestions from code review Co-authored-by: Manuel Montenegro --- .pre-commit-config.yaml | 21 ++++++++++----------- scripts/proof_bot.py | 4 ++-- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eaa6390..0910ebb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,15 +1,14 @@ repos: - - repo: https://github.com/psf/black - rev: 23.11.0 + - repo: https://github.com/akaihola/darker + rev: 1.7.2 hooks: - - id: black + - id: darker + args: ["--check"] + stages: [push] + - id: darker + stages: [commit] - - repo: https://github.com/pycqa/flake8 - rev: 6.1.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: 'v0.1.4' hooks: - - id: flake8 - - - repo: https://github.com/pre-commit/mirrors-isort - rev: v5.10.1 - hooks: - - id: isort + - id: ruff \ No newline at end of file diff --git a/scripts/proof_bot.py b/scripts/proof_bot.py index 8df781e..440d103 100644 --- a/scripts/proof_bot.py +++ b/scripts/proof_bot.py @@ -47,7 +47,7 @@ def get_polygon_last_block_number( def get_message_sent_events(graphql_endpoint: str, last_blocknumber: int) -> list[dict]: """ - Queries GraphQL endpoint to retreive all new `MessageSent` events + Queries GraphQL endpoint to retrieve all new `MessageSent` events on Polygon network """ @@ -84,7 +84,7 @@ def push_proof( except ContractLogicError as e: if e.message != EXIT_ALREADY_PROCESSED_ERROR: raise e - logger.info("Transaction was processed") + logger.info("Transaction already processed") return False