From b3b1b0e302afd6ede182ac0bca211c51eddbbbdb Mon Sep 17 00:00:00 2001 From: harisang Date: Wed, 13 Nov 2024 15:41:11 +0200 Subject: [PATCH 1/4] remove infura dependency and some other constants --- src/constants.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/constants.py b/src/constants.py index d1d9d1e4..13cdf950 100644 --- a/src/constants.py +++ b/src/constants.py @@ -28,20 +28,16 @@ SAFE_ADDRESS = Web3.to_checksum_address( ENV.get("SAFE_ADDRESS", "0xA03be496e67Ec29bC62F01a428683D7F9c204930") ) -# Found this exposed infura key on https://rpc.info/ -INFURA_KEY = ENV.get("INFURA_KEY", "9aa3d95b3bc440fa88ea12eaa4456161") + NETWORK_STRING = ENV.get("NETWORK", "mainnet") -NODE_URL = f"https://{NETWORK_STRING}.infura.io/v3/{INFURA_KEY}" +NODE_URL = ENV.get("NODE_URL") NETWORK = { "mainnet": EthereumNetwork.MAINNET, "gnosis": EthereumNetwork.GNOSIS, - "goerli": EthereumNetwork.GOERLI, }[NETWORK_STRING] SHORT_NAME = { "mainnet": "eth", - "rinkeby": "rin", "gnosis": "gno", - "goerli": "gor", }[NETWORK_STRING] CSV_APP_HASH = "Qme49gESuwpSvwANmEqo34yfCkzyQehooJ5yL7aHmKJnpZ" From e0d080a6eb7aeb5a97bec09d3512c371bf072646 Mon Sep 17 00:00:00 2001 From: harisang Date: Wed, 13 Nov 2024 15:46:37 +0200 Subject: [PATCH 2/4] update env.sample and pr workflow --- .env.sample | 3 ++- .github/workflows/pull-request.yaml | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.env.sample b/.env.sample index 31f79cf3..a974b5cc 100644 --- a/.env.sample +++ b/.env.sample @@ -5,10 +5,11 @@ DUNE_API_KEY= # Safe Transaction Service Requirements. SAFE_ADDRESS=0xA03be496e67Ec29bC62F01a428683D7F9c204930 -INFURA_KEY= NETWORK=mainnet PROPOSER_PK= +NODE_URL= + # Slack Bot Credentials SLACK_TOKEN= SLACK_CHANNEL= diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index 4244b3a0..43265093 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -26,6 +26,3 @@ jobs: - name: Unit Tests run: python -m pytest tests/unit - env: - # We make a rinkeby request in one unit test - INFURA_KEY: ${{ secrets.INFURA_KEY }} From 13971ea3d4b6c7dabd0864cf7040544b4790d4f7 Mon Sep 17 00:00:00 2001 From: harisang Date: Wed, 13 Nov 2024 16:00:37 +0200 Subject: [PATCH 3/4] switch to os.getenv --- src/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants.py b/src/constants.py index 13cdf950..c841e92b 100644 --- a/src/constants.py +++ b/src/constants.py @@ -30,7 +30,7 @@ ) NETWORK_STRING = ENV.get("NETWORK", "mainnet") -NODE_URL = ENV.get("NODE_URL") +NODE_URL = os.getenv("NODE_URL") NETWORK = { "mainnet": EthereumNetwork.MAINNET, "gnosis": EthereumNetwork.GNOSIS, From 5191e641e01146148c14a350d6aa9ea11ab221b3 Mon Sep 17 00:00:00 2001 From: harisang Date: Wed, 13 Nov 2024 16:14:49 +0200 Subject: [PATCH 4/4] add assert and revert previous commit --- src/constants.py | 2 +- src/fetch/transfer_file.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/constants.py b/src/constants.py index c841e92b..13cdf950 100644 --- a/src/constants.py +++ b/src/constants.py @@ -30,7 +30,7 @@ ) NETWORK_STRING = ENV.get("NETWORK", "mainnet") -NODE_URL = os.getenv("NODE_URL") +NODE_URL = ENV.get("NODE_URL") NETWORK = { "mainnet": EthereumNetwork.MAINNET, "gnosis": EthereumNetwork.GNOSIS, diff --git a/src/fetch/transfer_file.py b/src/fetch/transfer_file.py index 2a336d25..77b36ba2 100644 --- a/src/fetch/transfer_file.py +++ b/src/fetch/transfer_file.py @@ -69,6 +69,8 @@ def auto_propose( # Check for required env vars early # so not to wait for query execution to realize it's not available. signing_key = os.environ["PROPOSER_PK"] + + assert NODE_URL is not None, "NODE_URL env variable not set!" client = EthereumClient(URI(NODE_URL)) log_saver.print(Transfer.summarize(transfers), category=Category.TOTALS)