Skip to content

chore(ethereum/test): read mainnet RPC URL from env, drop hardcoded key#3997

Open
piotr-roslaniec wants to merge 2 commits into
mainfrom
chore/integration-test-infura-key-from-env
Open

chore(ethereum/test): read mainnet RPC URL from env, drop hardcoded key#3997
piotr-roslaniec wants to merge 2 commits into
mainfrom
chore/integration-test-infura-key-from-env

Conversation

@piotr-roslaniec
Copy link
Copy Markdown
Collaborator

Summary

  • pkg/chain/ethereum/ethereum_integration_test.go contained a hardcoded https://mainnet.infura.io/v3/<key> URL with an embedded Infura API key. The key is in git history and on the public mirror, so it must be treated as compromised and rotated on the Infura side independently of this PR.
  • This change makes the test read the JSON-RPC endpoint from a KEEP_TEST_ETHEREUM_URL env variable instead, and skip when the variable is not set. That removes the leak from the source tree and avoids relying on a single shared credential.

Notes

  • This test is already failing on main for a separate reason: mainnet blocks now contain EIP-7702 type-4 transactions that go-ethereum v1.13.x cannot decode (cannot get current block: [transaction type not supported]). That's tracked separately and requires a go-ethereum bump.
  • The skip behaviour here means CI will no longer spuriously fail when no URL is configured.

Follow-ups

  • Rotate the leaked Infura key on the provider side
  • Wire KEEP_TEST_ETHEREUM_URL into the relevant CI workflow if/when integration tests should run there
  • Bump go-ethereum to a version with EIP-7702 support to actually unblock the test against current mainnet

Test plan

  • go test -tags=integration -c -o /dev/null ./pkg/chain/ethereum/ compiles
  • Test is skipped (not failed) when KEEP_TEST_ETHEREUM_URL is unset

The integration test contained a hardcoded Infura URL with an embedded
API key. Treat the leaked key as compromised and rotate it on the
provider side; this change makes the test read the JSON-RPC URL from
the `KEEP_TEST_ETHEREUM_URL` env variable and skip when it is not set.

Note: this test was already failing on mainnet against go-ethereum
v1.13.x because the latest blocks contain EIP-7702 type-4 transactions
that this version cannot decode. Fixing that is tracked separately; the
skip behaviour avoids spurious CI failures in the meantime.
Rename the env var to match the existing org secret. Also document
explicitly that the URL must point to mainnet (the test asserts against
historical mainnet block numbers, so a testnet URL would silently
produce wrong results).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant