From aca9623f9cdd75d0009ff36708ac8d9b028efb8a Mon Sep 17 00:00:00 2001 From: Haris Angelidakis <64154020+harisang@users.noreply.github.com> Date: Wed, 13 Nov 2024 17:50:32 +0200 Subject: [PATCH] Remove infura dependency and some other constants (#430) This PR removes the dependency on infura, and also removes some irrelevant constants --- .env.sample | 3 ++- .github/workflows/pull-request.yaml | 3 --- src/constants.py | 8 ++------ src/fetch/transfer_file.py | 2 ++ 4 files changed, 6 insertions(+), 10 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 }} 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" 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)