Skip to content

Commit f0e09d4

Browse files
fix(test): skip ethereum mainnet integration when RPC URL is missing
Local runs of go test -tags=integration ./... now skip rather than fail when ETHEREUM_MAINNET_RPC_URL is not configured. CI still sets the var, so behavior there is unchanged. Also clarify that blockByNumber returns a header-only block.
1 parent f752cef commit f0e09d4

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

pkg/chain/ethereum/ethereum.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,8 @@ func (bc *baseChain) blockByNumber(number uint64) (*types.Block, error) {
450450

451451
// Fetch the header to avoid decoding full transactions (some providers
452452
// may return transaction types the client library does not support yet).
453+
// The returned *types.Block carries only header fields; transactions and
454+
// uncles are empty. Callers that need tx data must fetch the full block.
453455
header, err := bc.client.HeaderByNumber(ctx, big.NewInt(int64(number)))
454456
if err != nil {
455457
return nil, err

pkg/chain/ethereum/ethereum_integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
func TestBaseChain_GetBlockNumberByTimestamp(t *testing.T) {
2222
ethereumURL := os.Getenv("ETHEREUM_MAINNET_RPC_URL")
2323
if ethereumURL == "" {
24-
t.Fatal("ETHEREUM_MAINNET_RPC_URL not set")
24+
t.Skip("ETHEREUM_MAINNET_RPC_URL not set; skipping mainnet integration test")
2525
}
2626

2727
client, err := ethclient.Dial(ethereumURL)

0 commit comments

Comments
 (0)