Skip to content

Commit 6624fa6

Browse files
test: increase e2e stability (#419)
1 parent e981ff2 commit 6624fa6

32 files changed

+150
-107
lines changed

.github/actions/foundry-setup/action.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ name: foundry-setup
33
runs:
44
using: composite
55
steps:
6-
- name: Install stable toolchain
7-
uses: actions-rs/toolchain@v1
6+
- name: Set up Rust
7+
uses: dtolnay/rust-toolchain@stable
88
with:
9-
profile: minimal
10-
toolchain: stable
119
components: rustfmt, clippy
1210
- name: Install Foundry
1311
uses: foundry-rs/foundry-toolchain@v1

.github/workflows/rust.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,11 @@ jobs:
110110
continue-on-error: true
111111
steps:
112112
- uses: actions/checkout@v4
113-
- name: Install stable toolchain
114-
uses: actions-rs/toolchain@v1
113+
- name: Set up Rust
114+
uses: dtolnay/rust-toolchain@stable
115115
with:
116-
profile: minimal
117-
toolchain: stable
118116
components: rustfmt, clippy
119-
target: wasm32-unknown-unknown
117+
targets: wasm32-unknown-unknown
120118
- name: Install cargo-run-script and cosmwasm-check
121119
uses: actions-rs/cargo@v1
122120
with:

Cargo.lock

+26-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ members = [
88
"packages/solidity",
99
"packages/relayer-lib",
1010
"packages/sp1-ics07-tendermint-prover",
11-
"packages/sp1-ics07-tendermint-utils",
11+
"packages/utils",
1212

1313
"programs/relayer",
1414
"programs/operator",
@@ -27,8 +27,8 @@ keywords = ["cosmos", "ibc", "sp1", "tendermint", "ethereum", "bridge", "solid
2727
[workspace.dependencies]
2828
ibc-eureka-solidity-types = { path = "packages/solidity", default-features = false }
2929
ibc-eureka-relayer-lib = { path = "packages/relayer-lib", default-features = false }
30+
ibc-eureka-utils = { path = "packages/utils", default-features = false }
3031
sp1-ics07-tendermint-prover = { path = "packages/sp1-ics07-tendermint-prover", default-features = false }
31-
sp1-ics07-tendermint-utils = { path = "packages/sp1-ics07-tendermint-utils", default-features = false }
3232
sp1-ics07-tendermint-update-client = { path = "programs/sp1-programs/update-client", default-features = false }
3333
sp1-ics07-tendermint-membership = { path = "programs/sp1-programs/membership", default-features = false }
3434
ethereum-trie-db = { path = "packages/ethereum/ethereum-trie-db", default-features = false }
@@ -67,6 +67,7 @@ time = { version = "0.3", default-features = false }
6767
dotenv = { version = "0.15", default-features = false }
6868
thiserror = { version = "2.0", default-features = false }
6969
reqwest = { version = "0.12", default-features = false }
70+
reqwest_0_11 = { package = "reqwest", version = "0.11", default-features = false }
7071

7172
tendermint = { version = "0.40", default-features = false }
7273
tendermint-rpc = { version = "0.40", default-features = false }

e2e/interchaintestv8/chainconfig/kurtosis.go

+14-7
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ var (
3737
CLImage: "ethpandaops/lodestar:unstable",
3838
ELType: "geth",
3939
ELImage: "ethpandaops/geth:prague-devnet-6",
40+
ELExtraParams: []string{"--gcmode=archive"},
4041
ELLogLevel: "info",
4142
ValidatorCount: 64,
4243
},
@@ -80,12 +81,13 @@ type kurtosisNetworkParams struct {
8081
}
8182

8283
type kurtosisParticipant struct {
83-
CLType string `json:"cl_type"`
84-
CLImage string `json:"cl_image"`
85-
ELType string `json:"el_type"`
86-
ELImage string `json:"el_image"`
87-
ELLogLevel string `json:"el_log_level"`
88-
ValidatorCount uint64 `json:"validator_count"`
84+
CLType string `json:"cl_type"`
85+
CLImage string `json:"cl_image"`
86+
ELType string `json:"el_type"`
87+
ELImage string `json:"el_image"`
88+
ELExtraParams []string `json:"el_extra_params"`
89+
ELLogLevel string `json:"el_log_level"`
90+
ValidatorCount uint64 `json:"validator_count"`
8991
}
9092

9193
type kurtosisNetworkConfigParams struct {
@@ -153,8 +155,13 @@ func SpinUpKurtosisPoS(ctx context.Context) (EthKurtosisChain, error) {
153155
beaconRPC := fmt.Sprintf("http://localhost:%d", beaconPortSpec.GetNumber())
154156

155157
// Wait for the chain to finalize
156-
beaconAPIClient := ethereum.NewBeaconAPIClient(beaconRPC)
158+
var beaconAPIClient ethereum.BeaconAPIClient
157159
err = testutil.WaitForCondition(30*time.Minute, 5*time.Second, func() (bool, error) {
160+
beaconAPIClient, err = ethereum.NewBeaconAPIClient(ctx, beaconRPC)
161+
if err != nil {
162+
return false, nil
163+
}
164+
158165
finalizedBlocksResp, err := beaconAPIClient.GetFinalizedBlocks()
159166
fmt.Printf("Waiting for chain to finalize, finalizedBlockResp: %+v, err: %s\n", finalizedBlocksResp, err)
160167
if err != nil {

e2e/interchaintestv8/e2esuite/grpc_query.go

+38-1
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ func populateQueryReqToPath(ctx context.Context, chain *cosmos.CosmosChain) erro
4444

4545
func ABCIQuery(ctx context.Context, chain *cosmos.CosmosChain, req *abci.RequestQuery) (*abci.ResponseQuery, error) {
4646
// Create a connection to the gRPC server.
47+
path := "cosmos.base.tendermint.v1beta1.Service/ABCIQuery"
4748
grpcConn, err := grpc.Dial(
4849
chain.GetHostGRPCAddress(),
4950
grpc.WithTransportCredentials(insecure.NewCredentials()),
51+
retryConfig(),
5052
)
5153
if err != nil {
5254
return &abci.ResponseQuery{}, err
@@ -55,7 +57,7 @@ func ABCIQuery(ctx context.Context, chain *cosmos.CosmosChain, req *abci.Request
5557
defer grpcConn.Close()
5658

5759
resp := &abci.ResponseQuery{}
58-
err = grpcConn.Invoke(ctx, "cosmos.base.tendermint.v1beta1.Service/ABCIQuery", req, resp)
60+
err = grpcConn.Invoke(ctx, path, req, resp)
5961
if err != nil {
6062
return &abci.ResponseQuery{}, err
6163
}
@@ -74,6 +76,7 @@ func GRPCQuery[T any](ctx context.Context, chain *cosmos.CosmosChain, req proto.
7476
grpcConn, err := grpc.Dial(
7577
chain.GetHostGRPCAddress(),
7678
grpc.WithTransportCredentials(insecure.NewCredentials()),
79+
retryConfig(),
7780
)
7881
if err != nil {
7982
return nil, err
@@ -95,6 +98,7 @@ func queryFileDescriptors(ctx context.Context, chain *cosmos.CosmosChain) (*refl
9598
grpcConn, err := grpc.Dial(
9699
chain.GetHostGRPCAddress(),
97100
grpc.WithTransportCredentials(insecure.NewCredentials()),
101+
retryConfig(),
98102
)
99103
if err != nil {
100104
return nil, err
@@ -113,3 +117,36 @@ func queryFileDescriptors(ctx context.Context, chain *cosmos.CosmosChain) (*refl
113117

114118
return resp, nil
115119
}
120+
121+
func retryConfig() grpc.DialOption {
122+
policy := `{
123+
"methodConfig": [{
124+
"name": [{}],
125+
"retryPolicy": {
126+
"MaxAttempts": 4,
127+
"InitialBackoff": ".01s",
128+
"MaxBackoff": ".01s",
129+
"BackoffMultiplier": 1.0,
130+
"RetryableStatusCodes": [
131+
"CANCELLED",
132+
"UNKNOWN",
133+
"DEADLINE_EXCEEDED",
134+
"NOT_FOUND",
135+
"ALREADY_EXISTS",
136+
"PERMISSION_DENIED",
137+
"RESOURCE_EXHAUSTED",
138+
"FAILED_PRECONDITION",
139+
"ABORTED",
140+
"OUT_OF_RANGE",
141+
"UNIMPLEMENTED",
142+
"INTERNAL",
143+
"UNAVAILABLE",
144+
"DATA_LOSS",
145+
"UNAUTHENTICATED"
146+
]
147+
}
148+
}]
149+
}`
150+
151+
return grpc.WithDefaultServiceConfig(policy)
152+
}

e2e/interchaintestv8/ethereum/beaconapi.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,17 @@ func (b BeaconAPIClient) Close() {
7070
b.cancel()
7171
}
7272

73-
func NewBeaconAPIClient(beaconAPIAddress string) BeaconAPIClient {
74-
ctx, cancel := context.WithCancel(context.Background())
73+
func NewBeaconAPIClient(ctx context.Context, beaconAPIAddress string) (BeaconAPIClient, error) {
74+
ctx, cancel := context.WithCancel(ctx)
7575
client, err := ethttp.New(ctx,
7676
// WithAddress supplies the address of the beacon node, as a URL.
7777
ethttp.WithAddress(beaconAPIAddress),
7878
// LogLevel supplies the level of logging to carry out.
7979
ethttp.WithLogLevel(zerolog.WarnLevel),
8080
)
8181
if err != nil {
82-
panic(err)
82+
cancel()
83+
return BeaconAPIClient{}, err
8384
}
8485

8586
return BeaconAPIClient{
@@ -89,13 +90,13 @@ func NewBeaconAPIClient(beaconAPIAddress string) BeaconAPIClient {
8990
url: beaconAPIAddress,
9091
Retries: 60,
9192
RetryWait: 10 * time.Second,
92-
}
93+
}, nil
9394
}
9495

9596
func retry[T any](retries int, waitTime time.Duration, fn func() (T, error)) (T, error) {
9697
var err error
9798
var result T
98-
for i := 0; i < retries; i++ {
99+
for range retries {
99100
result, err = fn()
100101
if err == nil {
101102
return result, nil

e2e/interchaintestv8/ethereum/ethereum.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (e *Ethereum) BroadcastTx(ctx context.Context, userKey *ecdsa.PrivateKey, g
102102

103103
func (e Ethereum) ForgeScript(deployer *ecdsa.PrivateKey, solidityContract string, args ...string) ([]byte, error) {
104104
args = append(args, "script", "--rpc-url", e.RPC, "--private-key",
105-
hex.EncodeToString(deployer.D.Bytes()), "--broadcast",
105+
hex.EncodeToString(crypto.FromECDSA(deployer)), "--broadcast",
106106
"--non-interactive", "-vvvv", solidityContract,
107107
)
108108
cmd := exec.Command(
@@ -162,7 +162,7 @@ func (e Ethereum) SendEth(key *ecdsa.PrivateKey, toAddress string, amount math.I
162162
"send",
163163
toAddress,
164164
"--value", amount.String(),
165-
"--private-key", fmt.Sprintf("0x%s", ethcommon.Bytes2Hex(key.D.Bytes())),
165+
"--private-key", fmt.Sprintf("0x%s", hex.EncodeToString(crypto.FromECDSA(key))),
166166
"--rpc-url", e.RPC,
167167
)
168168
cmd.Stdout = os.Stdout

packages/relayer-lib/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ license = { workspace = true }
88
[features]
99
default = ["sp1-toolchain"]
1010
# sp1-toolchain requires sp1 toolchain to be installed to build
11-
sp1-toolchain = ["dep:sp1-ics07-tendermint-prover", "dep:sp1-ics07-tendermint-utils"]
11+
sp1-toolchain = ["dep:sp1-ics07-tendermint-prover", "dep:ibc-eureka-utils"]
1212

1313
[dependencies]
1414
ibc-eureka-solidity-types = { workspace = true, features = ["rpc"] }
15+
ibc-eureka-utils = { workspace = true, optional = true }
1516

1617
sp1-ics07-tendermint-prover = { workspace = true, optional = true }
17-
sp1-ics07-tendermint-utils = { workspace = true, optional = true }
1818

1919
ethereum-apis = { workspace = true }
2020
ethereum-light-client = { workspace = true }

packages/relayer-lib/src/tx_builder/cosmos_to_cosmos.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//! the Cosmos SDK chain from events received from another Cosmos SDK chain.
33
44
use anyhow::Result;
5+
use ibc_eureka_utils::{light_block::LightBlockExt, rpc::TendermintRpcExt};
56
use ibc_proto_eureka::{
67
cosmos::tx::v1beta1::TxBody,
78
google::protobuf::Any,
@@ -11,7 +12,6 @@ use ibc_proto_eureka::{
1112
},
1213
};
1314
use prost::Message;
14-
use sp1_ics07_tendermint_utils::{light_block::LightBlockExt, rpc::TendermintRpcExt};
1515
use tendermint_rpc::HttpClient;
1616

1717
use crate::{

packages/relayer-lib/src/tx_builder/cosmos_to_eth.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ use ibc_eureka_solidity_types::{
1414
msgs::IICS07TendermintMsgs::ClientState,
1515
sp1_ics07::sp1_ics07_tendermint,
1616
};
17-
17+
use ibc_eureka_utils::rpc::TendermintRpcExt;
1818
use sp1_ics07_tendermint_prover::prover::Sp1Prover;
19-
use sp1_ics07_tendermint_utils::rpc::TendermintRpcExt;
2019
use tendermint_rpc::HttpClient;
2120

2221
use sp1_prover::components::SP1ProverComponents;

packages/relayer-lib/src/tx_builder/eth_to_cosmos.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use ethereum_types::consensus::light_client_header::{
1515
use ethereum_types::consensus::sync_committee::SyncCommittee;
1616
use ethereum_types::execution::account_proof::AccountProof;
1717
use ibc_eureka_solidity_types::ics26::router::routerInstance;
18+
use ibc_eureka_utils::rpc::TendermintRpcExt;
1819
use ibc_proto_eureka::cosmos::tx::v1beta1::TxBody;
1920
use ibc_proto_eureka::google::protobuf::Any;
2021
use ibc_proto_eureka::ibc::core::client::v1::{Height, MsgUpdateClient};
@@ -23,7 +24,6 @@ use ibc_proto_eureka::ibc::lightclients::wasm::v1::{
2324
ClientState as WasmClientState, ConsensusState as WasmConsensusState,
2425
};
2526
use prost::Message;
26-
use sp1_ics07_tendermint_utils::rpc::TendermintRpcExt;
2727
use tendermint_rpc::{Client, HttpClient};
2828

2929
use crate::utils::{cosmos, wait_for_condition, wait_for_condition_with_capture};

packages/relayer-lib/src/utils/cosmos.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ use ethereum_light_client::membership::evm_ics26_commitment_path;
77
use ethereum_types::execution::storage_proof::StorageProof;
88
use futures::future;
99
use ibc_eureka_solidity_types::ics26::IICS26RouterMsgs::Packet;
10+
use ibc_eureka_utils::rpc::TendermintRpcExt;
1011
use ibc_proto_eureka::{
1112
ibc::core::{
1213
channel::v2::{Acknowledgement, MsgAcknowledgement, MsgRecvPacket, MsgTimeout},
1314
client::v1::Height,
1415
},
1516
Protobuf,
1617
};
17-
use sp1_ics07_tendermint_utils::rpc::TendermintRpcExt;
1818
use tendermint_rpc::HttpClient;
1919

2020
use crate::events::{EurekaEvent, EurekaEventWithHeight};

0 commit comments

Comments
 (0)