From 710ade94c96b4f960a29ce3527aaa6b9856261da Mon Sep 17 00:00:00 2001 From: Piotr Roslaniec Date: Sun, 30 Nov 2025 13:43:55 +0100 Subject: [PATCH 1/7] test(electrum): extend retry window for public electrs --- pkg/bitcoin/electrum/electrum_integration_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/bitcoin/electrum/electrum_integration_test.go b/pkg/bitcoin/electrum/electrum_integration_test.go index 4de2a7e9fc..ee4ebcdad2 100644 --- a/pkg/bitcoin/electrum/electrum_integration_test.go +++ b/pkg/bitcoin/electrum/electrum_integration_test.go @@ -44,7 +44,7 @@ var testConfigs = map[string]testConfig{ clientConfig: electrum.Config{ URL: "tcp://electrum.blockstream.info:60001", RequestTimeout: requestTimeout * 2, - RequestRetryTimeout: requestRetryTimeout * 2, + RequestRetryTimeout: requestRetryTimeout * 6, // allow slower public electrum responses }, network: bitcoin.Testnet, }, @@ -52,7 +52,7 @@ var testConfigs = map[string]testConfig{ clientConfig: electrum.Config{ URL: "ssl://electrum.blockstream.info:60002", RequestTimeout: requestTimeout * 2, - RequestRetryTimeout: requestRetryTimeout * 2, + RequestRetryTimeout: requestRetryTimeout * 6, // allow slower public electrum responses }, network: bitcoin.Testnet, }, From c6ad0ac30aac1a66318b9d41f2551c37dc68b05f Mon Sep 17 00:00:00 2001 From: Piotr Roslaniec Date: Sun, 30 Nov 2025 14:17:37 +0100 Subject: [PATCH 2/7] test(ethereum): use env RPC for block timestamp integration --- pkg/chain/ethereum/ethereum_integration_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/chain/ethereum/ethereum_integration_test.go b/pkg/chain/ethereum/ethereum_integration_test.go index 319a84016f..a212a38f50 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,12 @@ 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" - func TestBaseChain_GetBlockNumberByTimestamp(t *testing.T) { + ethereumURL := os.Getenv("ETHEREUM_MAINNET_RPC_URL") + if ethereumURL == "" { + t.Skip("ETHEREUM_MAINNET_RPC_URL not set; skipping integration test") + } + client, err := ethclient.Dial(ethereumURL) if err != nil { t.Fatal(err) From afa2289ed2cf7afd026d43aa82372fcec69b5a04 Mon Sep 17 00:00:00 2001 From: Piotr Roslaniec Date: Sun, 30 Nov 2025 14:19:09 +0100 Subject: [PATCH 3/7] test(ethereum): require mainnet rpc env --- pkg/chain/ethereum/ethereum_integration_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/chain/ethereum/ethereum_integration_test.go b/pkg/chain/ethereum/ethereum_integration_test.go index a212a38f50..fd490633bc 100644 --- a/pkg/chain/ethereum/ethereum_integration_test.go +++ b/pkg/chain/ethereum/ethereum_integration_test.go @@ -21,7 +21,7 @@ import ( func TestBaseChain_GetBlockNumberByTimestamp(t *testing.T) { ethereumURL := os.Getenv("ETHEREUM_MAINNET_RPC_URL") if ethereumURL == "" { - t.Skip("ETHEREUM_MAINNET_RPC_URL not set; skipping integration test") + t.Fatal("ETHEREUM_MAINNET_RPC_URL not set") } client, err := ethclient.Dial(ethereumURL) From 2e7f09d555ca41eec328e67f3285c01c9facb3c9 Mon Sep 17 00:00:00 2001 From: Piotr Roslaniec Date: Sun, 30 Nov 2025 14:23:01 +0100 Subject: [PATCH 4/7] test(tbtcpg): fix expected error unmarshaling --- pkg/tbtcpg/internal/test/marshaling.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/tbtcpg/internal/test/marshaling.go b/pkg/tbtcpg/internal/test/marshaling.go index 2dd72dbaa0..372813fb25 100644 --- a/pkg/tbtcpg/internal/test/marshaling.go +++ b/pkg/tbtcpg/internal/test/marshaling.go @@ -3,6 +3,7 @@ package test import ( "encoding/hex" "encoding/json" + "errors" "fmt" "github.com/keep-network/keep-core/pkg/tbtcpg" "math/big" @@ -273,7 +274,9 @@ func (psts *ProposeSweepTestScenario) UnmarshalJSON(data []byte) error { // Unmarshal expected error if len(unmarshaled.ExpectedErr) > 0 { - psts.ExpectedErr = fmt.Errorf(unmarshaled.ExpectedErr) + // fmt.Errorf requires a constant format string; ExpectedErr is a + // plain string so use errors.New to avoid formatting interpretation. + psts.ExpectedErr = errors.New(unmarshaled.ExpectedErr) } return nil From 941b3efe12d364a6e0988159450224d514c23412 Mon Sep 17 00:00:00 2001 From: Piotr Roslaniec Date: Sun, 30 Nov 2025 15:40:59 +0100 Subject: [PATCH 5/7] ci: pass ETHEREUM_MAINNET_RPC_URL into integration job --- .github/workflows/client.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml index 7daced9b82..8f15398336 100644 --- a/.github/workflows/client.yml +++ b/.github/workflows/client.yml @@ -321,8 +321,11 @@ jobs: docker load --input /tmp/go-build-env-image.tar - name: Run Go Integration Tests + env: + ETHEREUM_MAINNET_RPC_URL: ${{ secrets.ETHEREUM_MAINNET_RPC_URL }} run: | docker run \ + -e ETHEREUM_MAINNET_RPC_URL \ --workdir /go/src/github.com/keep-network/keep-core \ go-build-env \ gotestsum -- -timeout 20m -tags=integration ./... From f752cef48698f97c52c89484fd662abfc33e17c8 Mon Sep 17 00:00:00 2001 From: Piotr Roslaniec Date: Sun, 30 Nov 2025 16:01:14 +0100 Subject: [PATCH 6/7] fix(ethereum): avoid tx decoding in block lookup --- pkg/chain/ethereum/ethereum.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/chain/ethereum/ethereum.go b/pkg/chain/ethereum/ethereum.go index 57b800edb0..796024e75e 100644 --- a/pkg/chain/ethereum/ethereum.go +++ b/pkg/chain/ethereum/ethereum.go @@ -448,7 +448,14 @@ func (bc *baseChain) blockByNumber(number uint64) (*types.Block, error) { ctx, cancelCtx := context.WithTimeout(context.Background(), 30*time.Second) defer cancelCtx() - return bc.client.BlockByNumber(ctx, big.NewInt(int64(number))) + // Fetch the header to avoid decoding full transactions (some providers + // may return transaction types the client library does not support yet). + header, err := bc.client.HeaderByNumber(ctx, big.NewInt(int64(number))) + if err != nil { + return nil, err + } + + return types.NewBlockWithHeader(header), nil } // headerByNumber returns the header for the given block number. Times out From f0e09d4988e18cdcc4b07dc472fb6b4b1952c773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ros=C5=82aniec?= Date: Sat, 23 May 2026 13:23:21 +0000 Subject: [PATCH 7/7] 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. --- pkg/chain/ethereum/ethereum.go | 2 ++ pkg/chain/ethereum/ethereum_integration_test.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/chain/ethereum/ethereum.go b/pkg/chain/ethereum/ethereum.go index 796024e75e..e65b807747 100644 --- a/pkg/chain/ethereum/ethereum.go +++ b/pkg/chain/ethereum/ethereum.go @@ -450,6 +450,8 @@ func (bc *baseChain) blockByNumber(number uint64) (*types.Block, error) { // Fetch the header to avoid decoding full transactions (some providers // may return transaction types the client library does not support yet). + // The returned *types.Block carries only header fields; transactions and + // uncles are empty. Callers that need tx data must fetch the full block. header, err := bc.client.HeaderByNumber(ctx, big.NewInt(int64(number))) if err != nil { return nil, err diff --git a/pkg/chain/ethereum/ethereum_integration_test.go b/pkg/chain/ethereum/ethereum_integration_test.go index fd490633bc..b904fbbe23 100644 --- a/pkg/chain/ethereum/ethereum_integration_test.go +++ b/pkg/chain/ethereum/ethereum_integration_test.go @@ -21,7 +21,7 @@ import ( func TestBaseChain_GetBlockNumberByTimestamp(t *testing.T) { ethereumURL := os.Getenv("ETHEREUM_MAINNET_RPC_URL") if ethereumURL == "" { - t.Fatal("ETHEREUM_MAINNET_RPC_URL not set") + t.Skip("ETHEREUM_MAINNET_RPC_URL not set; skipping mainnet integration test") } client, err := ethclient.Dial(ethereumURL)