From 531270a0bba46463ddc255925beda7a1a956dc21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ros=C5=82aniec?= Date: Sun, 24 May 2026 06:33:33 +0000 Subject: [PATCH 1/2] chore(ethereum/test): read mainnet RPC URL from env, drop hardcoded key 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. --- pkg/chain/ethereum/ethereum_integration_test.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pkg/chain/ethereum/ethereum_integration_test.go b/pkg/chain/ethereum/ethereum_integration_test.go index 319a84016f..5e802bc6b5 100644 --- a/pkg/chain/ethereum/ethereum_integration_test.go +++ b/pkg/chain/ethereum/ethereum_integration_test.go @@ -5,6 +5,7 @@ package ethereum import ( "fmt" + "os" "reflect" "testing" "time" @@ -17,9 +18,22 @@ import ( // TODO: Include integration test in the CI. // To run the tests execute `go test -v -tags=integration ./...` -const ethereumURL = "https://mainnet.infura.io/v3/f41c6e3d505d44c182a5e5adefdaa43f" +// ethereumURLEnvVar is the name of the env variable holding the mainnet +// Ethereum JSON-RPC endpoint used by this integration test. The previous +// hardcoded Infura URL was checked into the repository and must be treated +// as compromised; rotate the key on the provider side and inject the new +// URL via this env variable. +const ethereumURLEnvVar = "KEEP_TEST_ETHEREUM_URL" func TestBaseChain_GetBlockNumberByTimestamp(t *testing.T) { + ethereumURL := os.Getenv(ethereumURLEnvVar) + if ethereumURL == "" { + t.Skipf( + "skipping: env variable [%s] with Ethereum mainnet JSON-RPC URL is not set", + ethereumURLEnvVar, + ) + } + client, err := ethclient.Dial(ethereumURL) if err != nil { t.Fatal(err) From 72a8af8c628dcba8038f32464efeebcca6486d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ros=C5=82aniec?= Date: Sun, 24 May 2026 06:54:16 +0000 Subject: [PATCH 2/2] chore(ethereum/test): use ETHEREUM_MAINNET_RPC_URL env var 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). --- pkg/chain/ethereum/ethereum_integration_test.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/chain/ethereum/ethereum_integration_test.go b/pkg/chain/ethereum/ethereum_integration_test.go index 5e802bc6b5..35db5ad8aa 100644 --- a/pkg/chain/ethereum/ethereum_integration_test.go +++ b/pkg/chain/ethereum/ethereum_integration_test.go @@ -18,12 +18,16 @@ import ( // TODO: Include integration test in the CI. // To run the tests execute `go test -v -tags=integration ./...` -// ethereumURLEnvVar is the name of the env variable holding the mainnet -// Ethereum JSON-RPC endpoint used by this integration test. The previous -// hardcoded Infura URL was checked into the repository and must be treated -// as compromised; rotate the key on the provider side and inject the new -// URL via this env variable. -const ethereumURLEnvVar = "KEEP_TEST_ETHEREUM_URL" +// ethereumURLEnvVar is the name of the env variable holding the Ethereum +// mainnet JSON-RPC endpoint used by this integration test. The test asserts +// against well-known historical block numbers on mainnet, so the URL MUST +// point to mainnet (not a testnet) or assertions will silently fail. +// +// The previous hardcoded Infura URL was checked into the repository and +// must be treated as compromised; rotate the key on the provider side and +// inject the new URL via this env variable (matches the existing org +// secret name). +const ethereumURLEnvVar = "ETHEREUM_MAINNET_RPC_URL" func TestBaseChain_GetBlockNumberByTimestamp(t *testing.T) { ethereumURL := os.Getenv(ethereumURLEnvVar)