From e88e0b2b871f24684689f3fb0a3ddb71ed2533bf Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Mon, 11 Nov 2024 19:21:14 +0000 Subject: [PATCH 01/10] Implement custom bootstrap context to bootstrap Osmosis --- relayer/Cargo.lock | 2 + relayer/Cargo.toml | 1 + .../starknet-integration-tests/Cargo.toml | 2 + .../src/contexts/cosmos_bootstrap.rs | 207 ++++++++++++++++++ .../src/contexts/mod.rs | 1 + .../starknet-integration-tests/src/lib.rs | 2 + .../src/tests/light_client.rs | 8 +- 7 files changed, 219 insertions(+), 4 deletions(-) create mode 100644 relayer/crates/starknet-integration-tests/src/contexts/cosmos_bootstrap.rs diff --git a/relayer/Cargo.lock b/relayer/Cargo.lock index aa994977..c2876021 100644 --- a/relayer/Cargo.lock +++ b/relayer/Cargo.lock @@ -2359,6 +2359,7 @@ dependencies = [ "hermes-starknet-relayer", "hermes-starknet-test-components", "hermes-test-components", + "hermes-wasm-test-components", "ibc", "ibc-proto", "ibc-relayer", @@ -2370,6 +2371,7 @@ dependencies = [ "sha2 0.10.8", "starknet", "tokio", + "toml", "tracing", "url", ] diff --git a/relayer/Cargo.toml b/relayer/Cargo.toml index 03064862..6b8d8097 100644 --- a/relayer/Cargo.toml +++ b/relayer/Cargo.toml @@ -75,6 +75,7 @@ hermes-cosmos-test-components = { version = "0.1.0" } hermes-cosmos-integration-tests = { version = "0.1.0" } hermes-any-counterparty = { version = "0.1.0" } hermes-wasm-client-components = { version = "0.1.0" } +hermes-wasm-test-components = { version = "0.1.0" } hermes-wasm-encoding-components = { version = "0.1.0" } hermes-cli-components = { version = "0.1.0" } hermes-test-components = { version = "0.1.0" } diff --git a/relayer/crates/starknet-integration-tests/Cargo.toml b/relayer/crates/starknet-integration-tests/Cargo.toml index 8256300f..646046a5 100644 --- a/relayer/crates/starknet-integration-tests/Cargo.toml +++ b/relayer/crates/starknet-integration-tests/Cargo.toml @@ -22,6 +22,7 @@ hermes-starknet-test-components = { workspace = true } hermes-starknet-chain-context = { workspace = true } hermes-starknet-relayer = { workspace = true } hermes-cosmos-test-components = { workspace = true } +hermes-wasm-test-components = { workspace = true } hermes-chain-components = { workspace = true } hermes-cosmos-chain-components = { workspace = true } hermes-cosmos-integration-tests = { workspace = true } @@ -40,6 +41,7 @@ tokio = { workspace = true } serde_json = { workspace = true } rand = { workspace = true } sha2 = { workspace = true } +toml = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } tracing = { workspace = true } diff --git a/relayer/crates/starknet-integration-tests/src/contexts/cosmos_bootstrap.rs b/relayer/crates/starknet-integration-tests/src/contexts/cosmos_bootstrap.rs new file mode 100644 index 00000000..9b1d4014 --- /dev/null +++ b/relayer/crates/starknet-integration-tests/src/contexts/cosmos_bootstrap.rs @@ -0,0 +1,207 @@ +use alloc::sync::Arc; +use std::path::PathBuf; + +use cgp::core::error::{ErrorRaiserComponent, ErrorTypeComponent}; +use cgp::prelude::*; +use hermes_cosmos_integration_tests::impls::bootstrap::build_cosmos_chain::BuildCosmosChainWithNodeConfig; +use hermes_cosmos_integration_tests::impls::bootstrap::build_cosmos_chain_driver::BuildCosmosChainDriver; +use hermes_cosmos_integration_tests::impls::bootstrap::relayer_chain_config::BuildRelayerChainConfig; +use hermes_cosmos_integration_tests::impls::bootstrap::types::ProvideCosmosBootstrapChainTypes; +use hermes_cosmos_integration_tests::traits::bootstrap::build_chain::ChainBuilderWithNodeConfigComponent; +use hermes_cosmos_integration_tests::traits::bootstrap::compat_mode::CompatModeGetter; +use hermes_cosmos_integration_tests::traits::bootstrap::cosmos_builder::CosmosBuilderGetter; +use hermes_cosmos_integration_tests::traits::bootstrap::gas_denom::GasDenomGetter; +use hermes_cosmos_integration_tests::traits::bootstrap::relayer_chain_config::RelayerChainConfigBuilderComponent; +use hermes_cosmos_relayer::contexts::build::CosmosBuilder; +use hermes_cosmos_test_components::bootstrap::components::cosmos_sdk_legacy::*; +use hermes_cosmos_test_components::bootstrap::impls::generator::wallet_config::GenerateStandardWalletConfig; +use hermes_cosmos_test_components::bootstrap::impls::modifiers::no_modify_comet_config::NoModifyCometConfig; +use hermes_cosmos_test_components::bootstrap::impls::modifiers::no_modify_genesis_config::NoModifyGenesisConfig; +use hermes_cosmos_test_components::bootstrap::traits::chain::build_chain_driver::ChainDriverBuilderComponent; +use hermes_cosmos_test_components::bootstrap::traits::fields::account_prefix::AccountPrefixGetter; +use hermes_cosmos_test_components::bootstrap::traits::fields::chain_command_path::ChainCommandPathGetter; +use hermes_cosmos_test_components::bootstrap::traits::fields::chain_store_dir::ChainStoreDirGetter; +use hermes_cosmos_test_components::bootstrap::traits::fields::denom::{ + DenomForStaking, DenomForTransfer, DenomPrefixGetter, +}; +use hermes_cosmos_test_components::bootstrap::traits::fields::random_id::RandomIdFlagGetter; +use hermes_cosmos_test_components::bootstrap::traits::generator::generate_wallet_config::WalletConfigGeneratorComponent; +use hermes_cosmos_test_components::bootstrap::traits::modifiers::modify_comet_config::{ + CometConfigModifier, CometConfigModifierComponent, +}; +use hermes_cosmos_test_components::bootstrap::traits::modifiers::modify_genesis_config::CosmosGenesisConfigModifierComponent; +use hermes_error::handlers::debug::DebugError; +use hermes_error::impls::ProvideHermesError; +use hermes_runtime::types::runtime::HermesRuntime; +use hermes_runtime_components::traits::runtime::{ + ProvideDefaultRuntimeField, RuntimeGetterComponent, RuntimeTypeComponent, +}; +use hermes_test_components::chain_driver::traits::types::chain::ChainTypeComponent; +use hermes_test_components::driver::traits::types::chain_driver::ChainDriverTypeComponent; +use hermes_wasm_test_components::impls::bootstrap::build_chain_driver::BuildChainDriverAndInitWasmClient; +use hermes_wasm_test_components::impls::bootstrap::genesis_config::ModifyWasmGenesisConfig; +use hermes_wasm_test_components::impls::bootstrap::node_config::ModifyWasmNodeConfig; +use hermes_wasm_test_components::traits::bootstrap::client_byte_code::WasmClientByteCodeGetter; +use hermes_wasm_test_components::traits::bootstrap::gov_authority::GovernanceProposalAuthorityGetter; +use ibc_relayer::config::compat_mode::CompatMode; +use toml::Value; + +/** + A bootstrap context for bootstrapping a new Cosmos chain, and builds + a `CosmosChainDriver`. +*/ +#[derive(HasField)] +pub struct CosmosWithWasmClientBootstrap { + pub runtime: HermesRuntime, + pub builder: Arc, + pub should_randomize_identifiers: bool, + pub chain_store_dir: PathBuf, + pub chain_command_path: PathBuf, + pub account_prefix: String, + pub staking_denom: String, + pub transfer_denom: String, + pub wasm_client_byte_code: Vec, + pub governance_proposal_authority: String, +} + +impl CanUseLegacyCosmosSdkChainBootstrapper for CosmosWithWasmClientBootstrap {} + +pub struct CosmosWithWasmClientBootstrapComponents; + +impl HasComponents for CosmosWithWasmClientBootstrap { + type Components = CosmosWithWasmClientBootstrapComponents; +} + +with_legacy_cosmos_sdk_bootstrap_components! { + delegate_components! { + CosmosWithWasmClientBootstrapComponents { + @LegacyCosmosSdkBootstrapComponents: LegacyCosmosSdkBootstrapComponents, + } + } +} + +delegate_components! { + CosmosWithWasmClientBootstrapComponents { + ErrorTypeComponent: ProvideHermesError, + ErrorRaiserComponent: DebugError, + [ + RuntimeTypeComponent, + RuntimeGetterComponent, + ]: + ProvideDefaultRuntimeField, + WalletConfigGeneratorComponent: GenerateStandardWalletConfig, + [ + ChainTypeComponent, + ChainDriverTypeComponent, + ]: + ProvideCosmosBootstrapChainTypes, + RelayerChainConfigBuilderComponent: + BuildRelayerChainConfig, + ChainBuilderWithNodeConfigComponent: + BuildCosmosChainWithNodeConfig, + ChainDriverBuilderComponent: + BuildChainDriverAndInitWasmClient, + CosmosGenesisConfigModifierComponent: + ModifyWasmGenesisConfig, + CometConfigModifierComponent: + ModifyWasmNodeConfig, + } +} + +pub struct ModifyOsmosisConfig; + +impl CometConfigModifier for ModifyOsmosisConfig +where + Bootstrap: CanRaiseError<&'static str>, +{ + fn modify_comet_config( + _bootstrap: &Bootstrap, + _comet_config: &mut Value, + ) -> Result<(), Bootstrap::Error> { + Ok(()) + } +} + +impl ChainStoreDirGetter + for CosmosWithWasmClientBootstrapComponents +{ + fn chain_store_dir(bootstrap: &CosmosWithWasmClientBootstrap) -> &PathBuf { + &bootstrap.chain_store_dir + } +} + +impl ChainCommandPathGetter + for CosmosWithWasmClientBootstrapComponents +{ + fn chain_command_path(bootstrap: &CosmosWithWasmClientBootstrap) -> &PathBuf { + &bootstrap.chain_command_path + } +} + +impl RandomIdFlagGetter for CosmosWithWasmClientBootstrapComponents { + fn should_randomize_identifiers(bootstrap: &CosmosWithWasmClientBootstrap) -> bool { + bootstrap.should_randomize_identifiers + } +} + +impl DenomPrefixGetter + for CosmosWithWasmClientBootstrapComponents +{ + fn denom_prefix(bootstrap: &CosmosWithWasmClientBootstrap, _label: DenomForStaking) -> &str { + &bootstrap.staking_denom + } +} + +impl DenomPrefixGetter + for CosmosWithWasmClientBootstrapComponents +{ + fn denom_prefix(bootstrap: &CosmosWithWasmClientBootstrap, _label: DenomForTransfer) -> &str { + &bootstrap.transfer_denom + } +} + +impl AccountPrefixGetter + for CosmosWithWasmClientBootstrapComponents +{ + fn account_prefix(bootstrap: &CosmosWithWasmClientBootstrap) -> &str { + &bootstrap.account_prefix + } +} + +impl CompatModeGetter for CosmosWithWasmClientBootstrapComponents { + fn compat_mode(_bootstrap: &CosmosWithWasmClientBootstrap) -> Option<&CompatMode> { + const COMPAT_MODE: CompatMode = CompatMode::V0_37; + + Some(&COMPAT_MODE) + } +} + +impl GasDenomGetter for CosmosWithWasmClientBootstrapComponents { + fn gas_denom(bootstrap: &CosmosWithWasmClientBootstrap) -> &str { + &bootstrap.staking_denom + } +} + +impl CosmosBuilderGetter + for CosmosWithWasmClientBootstrapComponents +{ + fn cosmos_builder(bootstrap: &CosmosWithWasmClientBootstrap) -> &CosmosBuilder { + &bootstrap.builder + } +} + +impl WasmClientByteCodeGetter + for CosmosWithWasmClientBootstrapComponents +{ + fn wasm_client_byte_code(bootstrap: &CosmosWithWasmClientBootstrap) -> &Vec { + &bootstrap.wasm_client_byte_code + } +} + +impl GovernanceProposalAuthorityGetter + for CosmosWithWasmClientBootstrapComponents +{ + fn governance_proposal_authority(bootstrap: &CosmosWithWasmClientBootstrap) -> &String { + &bootstrap.governance_proposal_authority + } +} diff --git a/relayer/crates/starknet-integration-tests/src/contexts/mod.rs b/relayer/crates/starknet-integration-tests/src/contexts/mod.rs index dce731ca..e0b0155f 100644 --- a/relayer/crates/starknet-integration-tests/src/contexts/mod.rs +++ b/relayer/crates/starknet-integration-tests/src/contexts/mod.rs @@ -1,2 +1,3 @@ pub mod bootstrap; pub mod chain_driver; +pub mod cosmos_bootstrap; diff --git a/relayer/crates/starknet-integration-tests/src/lib.rs b/relayer/crates/starknet-integration-tests/src/lib.rs index 4c4e8044..392380c0 100644 --- a/relayer/crates/starknet-integration-tests/src/lib.rs +++ b/relayer/crates/starknet-integration-tests/src/lib.rs @@ -1,5 +1,7 @@ #![recursion_limit = "256"] +extern crate alloc; + pub mod contexts; #[cfg(test)] diff --git a/relayer/crates/starknet-integration-tests/src/tests/light_client.rs b/relayer/crates/starknet-integration-tests/src/tests/light_client.rs index 9c19715a..10f222eb 100644 --- a/relayer/crates/starknet-integration-tests/src/tests/light_client.rs +++ b/relayer/crates/starknet-integration-tests/src/tests/light_client.rs @@ -16,7 +16,6 @@ use hermes_cosmos_integration_tests::init::init_test_runtime; use hermes_cosmos_relayer::contexts::build::CosmosBuilder; use hermes_cosmos_relayer::contexts::chain::CosmosChain; use hermes_cosmos_relayer::contexts::encoding::CosmosEncoding; -use hermes_cosmos_wasm_relayer::context::cosmos_bootstrap::CosmosWithWasmClientBootstrap; use hermes_encoding_components::traits::convert::CanConvert; use hermes_error::types::Error; use hermes_relayer_components::chain::traits::payload_builders::create_client::CanBuildCreateClientPayload; @@ -50,6 +49,7 @@ use starknet::macros::short_string; use tracing::info; use crate::contexts::bootstrap::StarknetBootstrap; +use crate::contexts::cosmos_bootstrap::CosmosWithWasmClientBootstrap; #[test] fn test_starknet_light_client() -> Result<(), Error> { @@ -91,12 +91,12 @@ fn test_starknet_light_client() -> Result<(), Error> { builder: cosmos_builder, should_randomize_identifiers: true, chain_store_dir: store_dir.join("chains"), - chain_command_path: "simd".into(), - account_prefix: "cosmos".into(), + chain_command_path: "osmosisd".into(), + account_prefix: "osmo".into(), staking_denom: "stake".into(), transfer_denom: "coin".into(), wasm_client_byte_code: wasm_client_byte_code_gzip, - governance_proposal_authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn".into(), // TODO: don't hard code this + governance_proposal_authority: "osmo10d07y265gmmuvt4z0w9aw880jnsr700jjeq4qp".into(), // TODO: don't hard code this }); let starknet_bootstrap = StarknetBootstrap { From 675bb4b18cee06f539d755be0390e8262d24075b Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Wed, 4 Dec 2024 14:30:16 +0100 Subject: [PATCH 02/10] osmosis via cosmos-nix --- flake.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flake.nix b/flake.nix index c40910ea..bab747c4 100644 --- a/flake.nix +++ b/flake.nix @@ -61,6 +61,8 @@ wasm-simapp = cosmos-nix.ibc-go-v8-wasm-simapp; + osmosis = cosmos-nix.osmosis; + starknet-devnet = import ./nix/starknet-devnet.nix { inherit nixpkgs; inherit (inputs) starknet-devnet-src; @@ -92,6 +94,7 @@ scarb universal-sierra-compiler wasm-simapp + osmosis ; }; From 6b86a7947958a415f76ab2661a657e12307a45d8 Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Wed, 4 Dec 2024 14:31:20 +0100 Subject: [PATCH 03/10] cosmos-nix update --- flake.lock | 90 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 64 insertions(+), 26 deletions(-) diff --git a/flake.lock b/flake.lock index 61a86981..48f562f0 100644 --- a/flake.lock +++ b/flake.lock @@ -137,15 +137,16 @@ "cometbft-src": { "flake": false, "locked": { - "narHash": "sha256-G5gchJMn/BFzwYx8/ikPDL5fS/TuFIBF4DKJbkalp/M=", + "lastModified": 1723450629, + "narHash": "sha256-2QO4KeEUX4HHT1AKhEdPplJHjBhalfM11Dn3/urIVig=", "owner": "cometbft", "repo": "cometbft", - "rev": "66a5a9da9f7a3306f382eb9142ccb9c9f7997d3f", + "rev": "e1b4453baf0af6487ad187c7f17dc50517126673", "type": "github" }, "original": { "owner": "cometbft", - "ref": "v0.38.0", + "ref": "v0.38.11", "repo": "cometbft", "type": "github" } @@ -194,6 +195,7 @@ "gaia17-src": "gaia17-src", "gaia18-src": "gaia18-src", "gaia19-src": "gaia19-src", + "gaia20-src": "gaia20-src", "gaia5-src": "gaia5-src", "gaia6-ordered-src": "gaia6-ordered-src", "gaia6-src": "gaia6-src", @@ -259,14 +261,15 @@ "wasmvm_2_0_0-src": "wasmvm_2_0_0-src", "wasmvm_2_0_3-src": "wasmvm_2_0_3-src", "wasmvm_2_1_0-src": "wasmvm_2_1_0-src", - "wasmvm_2_1_2-src": "wasmvm_2_1_2-src" + "wasmvm_2_1_2-src": "wasmvm_2_1_2-src", + "wasmvm_2_1_3-src": "wasmvm_2_1_3-src" }, "locked": { - "lastModified": 1728982270, - "narHash": "sha256-iAzKmzrUm6BD6Vwb6rtbkTy1e/nFTsgo+Y5WNrrY2vc=", + "lastModified": 1733317488, + "narHash": "sha256-Kr/h0A92hdsnFGAX4ujwLrwlk1voYJkkBp7pHwa4/ag=", "owner": "informalsystems", "repo": "cosmos.nix", - "rev": "8b7f6e8d2c2e6455fcc9d86ef098e7f182827637", + "rev": "a615496057a069e03674f804e2b089ac67aac925", "type": "github" }, "original": { @@ -552,11 +555,11 @@ "systems": "systems_7" }, "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -728,6 +731,23 @@ "type": "github" } }, + "gaia20-src": { + "flake": false, + "locked": { + "lastModified": 1726853009, + "narHash": "sha256-N7x3k56AtPbIbbJjqKmlEJIytKElALJwj14lZ2pewZg=", + "owner": "cosmos", + "repo": "gaia", + "rev": "2dba9d471ef73b0a99e844bf55a44ddae700ea06", + "type": "github" + }, + "original": { + "owner": "cosmos", + "ref": "v20.0.0", + "repo": "gaia", + "type": "github" + } + }, "gaia5-src": { "flake": false, "locked": { @@ -1186,15 +1206,16 @@ "interchain-security-src": { "flake": false, "locked": { - "narHash": "sha256-adBzn51PKoRsCL9gIzC5Tcqmu7u3GjxTcDj2jpZ/da8=", + "lastModified": 1726849313, + "narHash": "sha256-1WEvV3LoXfGvZC9fXOb8mBLKVGCVBiXZcwUewSPit+8=", "owner": "cosmos", "repo": "interchain-security", - "rev": "03aada4af3243dbf739a12adfacc7b37232df694", + "rev": "1e60637f9d8f3505208282416abfbb87fabc4795", "type": "github" }, "original": { "owner": "cosmos", - "ref": "feat/ics-misbehaviour-handling", + "ref": "v6.1.0", "repo": "interchain-security", "type": "github" } @@ -1515,11 +1536,11 @@ }, "nixpkgs_6": { "locked": { - "lastModified": 1729265718, - "narHash": "sha256-4HQI+6LsO3kpWTYuVGIzhJs1cetFcwT7quWCk/6rqeo=", + "lastModified": 1733097829, + "narHash": "sha256-9hbb1rqGelllb4kVUCZ307G2k3/UhmA8PPGBoyuWaSw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ccc0c2126893dd20963580b6478d1a10a4512185", + "rev": "2c15aa59df0017ca140d9ba302412298ab4bf22a", "type": "github" }, "original": { @@ -1548,16 +1569,16 @@ "osmosis-src": { "flake": false, "locked": { - "lastModified": 1719537675, - "narHash": "sha256-8Lb2SppNfq3+JwP3uanmCxuCek6tXOO/GcG27XGxRrE=", + "lastModified": 1731942173, + "narHash": "sha256-Ie+LKLrWthkGgJGlVpiTDwBvgA+Mo77Isa65vIOr1Ao=", "owner": "osmosis-labs", "repo": "osmosis", - "rev": "b973bffdf127866f45624d7e5a81f31fdc8e8e0b", + "rev": "100ba81036f01a348271ed59917881e2b83d0fbc", "type": "github" }, "original": { "owner": "osmosis-labs", - "ref": "v25.2.0", + "ref": "v27.0.1", "repo": "osmosis", "type": "github" } @@ -1695,11 +1716,11 @@ "nixpkgs": "nixpkgs_7" }, "locked": { - "lastModified": 1729477859, - "narHash": "sha256-r0VyeJxy4O4CgTB/PNtfQft9fPfN1VuGvnZiCxDArvg=", + "lastModified": 1733279627, + "narHash": "sha256-NCNDAGPkdFdu+DLErbmNbavmVW9AwkgP7azROFFSB0U=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "ada8266712449c4c0e6ee6fcbc442b3c217c79e1", + "rev": "4da5a80ef76039e80468c902f1e9f5c0eab87d96", "type": "github" }, "original": { @@ -1825,11 +1846,11 @@ "starknet-devnet-src": { "flake": false, "locked": { - "lastModified": 1728925224, - "narHash": "sha256-Be+k9Y3jcYUDKKjf5QIoNQNeuFSJwKF4OgX3d85By80=", + "lastModified": 1732210861, + "narHash": "sha256-8PT1hGYu6AuF8vfzgGja0R9ZpIwgJxSLoqCGSqyJtxQ=", "owner": "0xSpaceShard", "repo": "starknet-devnet-rs", - "rev": "093add70f99c6a3f46b28a377b04a981f0dab341", + "rev": "038d94612c6b6e51f06dc124bb320085485f588d", "type": "github" }, "original": { @@ -2286,6 +2307,23 @@ "repo": "wasmvm", "type": "github" } + }, + "wasmvm_2_1_3-src": { + "flake": false, + "locked": { + "lastModified": 1727089467, + "narHash": "sha256-gYrK2EHhXnearJgLX38O6NLI6TfoGtpzA9be/7S/0ZU=", + "owner": "CosmWasm", + "repo": "wasmvm", + "rev": "2a104d140a5b2974dab7c15044da652769018cbe", + "type": "github" + }, + "original": { + "owner": "CosmWasm", + "ref": "v2.1.3", + "repo": "wasmvm", + "type": "github" + } } }, "root": "root", From 028c22e7dd924f3701158a99ee9b1453f9fa5fa8 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Mon, 9 Dec 2024 13:48:18 +0000 Subject: [PATCH 04/10] Fixing merge errors --- .../src/contexts/cosmos_bootstrap.rs | 46 ++++++++++--------- .../src/impls/dynamic_gas.rs | 11 +++++ .../src/impls/mod.rs | 1 + .../starknet-integration-tests/src/lib.rs | 1 + 4 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 relayer/crates/starknet-integration-tests/src/impls/dynamic_gas.rs create mode 100644 relayer/crates/starknet-integration-tests/src/impls/mod.rs diff --git a/relayer/crates/starknet-integration-tests/src/contexts/cosmos_bootstrap.rs b/relayer/crates/starknet-integration-tests/src/contexts/cosmos_bootstrap.rs index 9b1d4014..66546316 100644 --- a/relayer/crates/starknet-integration-tests/src/contexts/cosmos_bootstrap.rs +++ b/relayer/crates/starknet-integration-tests/src/contexts/cosmos_bootstrap.rs @@ -2,20 +2,24 @@ use alloc::sync::Arc; use std::path::PathBuf; use cgp::core::error::{ErrorRaiserComponent, ErrorTypeComponent}; +use cgp::core::field::impls::use_field::WithField; +use cgp::core::types::impls::WithType; use cgp::prelude::*; use hermes_cosmos_integration_tests::impls::bootstrap::build_cosmos_chain::BuildCosmosChainWithNodeConfig; use hermes_cosmos_integration_tests::impls::bootstrap::build_cosmos_chain_driver::BuildCosmosChainDriver; use hermes_cosmos_integration_tests::impls::bootstrap::relayer_chain_config::BuildRelayerChainConfig; use hermes_cosmos_integration_tests::impls::bootstrap::types::ProvideCosmosBootstrapChainTypes; use hermes_cosmos_integration_tests::traits::bootstrap::build_chain::ChainBuilderWithNodeConfigComponent; -use hermes_cosmos_integration_tests::traits::bootstrap::compat_mode::CompatModeGetter; +use hermes_cosmos_integration_tests::traits::bootstrap::compat_mode::{ + CompatModeGetter, CompatModeGetterComponent, UseCompatMode37, +}; use hermes_cosmos_integration_tests::traits::bootstrap::cosmos_builder::CosmosBuilderGetter; -use hermes_cosmos_integration_tests::traits::bootstrap::gas_denom::GasDenomGetter; use hermes_cosmos_integration_tests::traits::bootstrap::relayer_chain_config::RelayerChainConfigBuilderComponent; use hermes_cosmos_relayer::contexts::build::CosmosBuilder; use hermes_cosmos_test_components::bootstrap::components::cosmos_sdk_legacy::*; use hermes_cosmos_test_components::bootstrap::impls::generator::wallet_config::GenerateStandardWalletConfig; use hermes_cosmos_test_components::bootstrap::impls::modifiers::no_modify_comet_config::NoModifyCometConfig; +use hermes_cosmos_test_components::bootstrap::impls::modifiers::no_modify_cosmos_sdk_config::NoModifyCosmosSdkConfig; use hermes_cosmos_test_components::bootstrap::impls::modifiers::no_modify_genesis_config::NoModifyGenesisConfig; use hermes_cosmos_test_components::bootstrap::traits::chain::build_chain_driver::ChainDriverBuilderComponent; use hermes_cosmos_test_components::bootstrap::traits::fields::account_prefix::AccountPrefixGetter; @@ -24,18 +28,18 @@ use hermes_cosmos_test_components::bootstrap::traits::fields::chain_store_dir::C use hermes_cosmos_test_components::bootstrap::traits::fields::denom::{ DenomForStaking, DenomForTransfer, DenomPrefixGetter, }; +use hermes_cosmos_test_components::bootstrap::traits::fields::dynamic_gas_fee::DynamicGasGetterComponent; use hermes_cosmos_test_components::bootstrap::traits::fields::random_id::RandomIdFlagGetter; use hermes_cosmos_test_components::bootstrap::traits::generator::generate_wallet_config::WalletConfigGeneratorComponent; use hermes_cosmos_test_components::bootstrap::traits::modifiers::modify_comet_config::{ CometConfigModifier, CometConfigModifierComponent, }; +use hermes_cosmos_test_components::bootstrap::traits::modifiers::modify_cosmos_sdk_config::CosmosSdkConfigModifierComponent; use hermes_cosmos_test_components::bootstrap::traits::modifiers::modify_genesis_config::CosmosGenesisConfigModifierComponent; use hermes_error::handlers::debug::DebugError; use hermes_error::impls::ProvideHermesError; use hermes_runtime::types::runtime::HermesRuntime; -use hermes_runtime_components::traits::runtime::{ - ProvideDefaultRuntimeField, RuntimeGetterComponent, RuntimeTypeComponent, -}; +use hermes_runtime_components::traits::runtime::{RuntimeGetterComponent, RuntimeTypeComponent}; use hermes_test_components::chain_driver::traits::types::chain::ChainTypeComponent; use hermes_test_components::driver::traits::types::chain_driver::ChainDriverTypeComponent; use hermes_wasm_test_components::impls::bootstrap::build_chain_driver::BuildChainDriverAndInitWasmClient; @@ -43,9 +47,10 @@ use hermes_wasm_test_components::impls::bootstrap::genesis_config::ModifyWasmGen use hermes_wasm_test_components::impls::bootstrap::node_config::ModifyWasmNodeConfig; use hermes_wasm_test_components::traits::bootstrap::client_byte_code::WasmClientByteCodeGetter; use hermes_wasm_test_components::traits::bootstrap::gov_authority::GovernanceProposalAuthorityGetter; -use ibc_relayer::config::compat_mode::CompatMode; use toml::Value; +use crate::impls::dynamic_gas::NoDynamicGas; + /** A bootstrap context for bootstrapping a new Cosmos chain, and builds a `CosmosChainDriver`. @@ -73,9 +78,11 @@ impl HasComponents for CosmosWithWasmClientBootstrap { } with_legacy_cosmos_sdk_bootstrap_components! { - delegate_components! { - CosmosWithWasmClientBootstrapComponents { - @LegacyCosmosSdkBootstrapComponents: LegacyCosmosSdkBootstrapComponents, + | Components | { + delegate_components! { + CosmosWithWasmClientBootstrapComponents { + Components: LegacyCosmosSdkBootstrapComponents, + } } } } @@ -84,11 +91,8 @@ delegate_components! { CosmosWithWasmClientBootstrapComponents { ErrorTypeComponent: ProvideHermesError, ErrorRaiserComponent: DebugError, - [ - RuntimeTypeComponent, - RuntimeGetterComponent, - ]: - ProvideDefaultRuntimeField, + RuntimeTypeComponent: WithType, + RuntimeGetterComponent: WithField, WalletConfigGeneratorComponent: GenerateStandardWalletConfig, [ ChainTypeComponent, @@ -105,6 +109,12 @@ delegate_components! { ModifyWasmGenesisConfig, CometConfigModifierComponent: ModifyWasmNodeConfig, + CosmosSdkConfigModifierComponent: + NoModifyCosmosSdkConfig, + CompatModeGetterComponent: + UseCompatMode37, + DynamicGasGetterComponent: + NoDynamicGas, } } @@ -168,14 +178,6 @@ impl AccountPrefixGetter } } -impl CompatModeGetter for CosmosWithWasmClientBootstrapComponents { - fn compat_mode(_bootstrap: &CosmosWithWasmClientBootstrap) -> Option<&CompatMode> { - const COMPAT_MODE: CompatMode = CompatMode::V0_37; - - Some(&COMPAT_MODE) - } -} - impl GasDenomGetter for CosmosWithWasmClientBootstrapComponents { fn gas_denom(bootstrap: &CosmosWithWasmClientBootstrap) -> &str { &bootstrap.staking_denom diff --git a/relayer/crates/starknet-integration-tests/src/impls/dynamic_gas.rs b/relayer/crates/starknet-integration-tests/src/impls/dynamic_gas.rs new file mode 100644 index 00000000..1d7add4c --- /dev/null +++ b/relayer/crates/starknet-integration-tests/src/impls/dynamic_gas.rs @@ -0,0 +1,11 @@ +use cgp::core::Async; +use hermes_cosmos_chain_components::types::config::gas::dynamic_gas_config::DynamicGasConfig; +use hermes_cosmos_test_components::bootstrap::traits::fields::dynamic_gas_fee::DynamicGasGetter; + +pub struct NoDynamicGas; + +impl DynamicGasGetter for NoDynamicGas { + fn dynamic_gas(_bootstrap: &Bootstrap) -> &Option { + &None + } +} diff --git a/relayer/crates/starknet-integration-tests/src/impls/mod.rs b/relayer/crates/starknet-integration-tests/src/impls/mod.rs new file mode 100644 index 00000000..b673ca8b --- /dev/null +++ b/relayer/crates/starknet-integration-tests/src/impls/mod.rs @@ -0,0 +1 @@ +pub mod dynamic_gas; diff --git a/relayer/crates/starknet-integration-tests/src/lib.rs b/relayer/crates/starknet-integration-tests/src/lib.rs index 392380c0..e8a859ab 100644 --- a/relayer/crates/starknet-integration-tests/src/lib.rs +++ b/relayer/crates/starknet-integration-tests/src/lib.rs @@ -3,6 +3,7 @@ extern crate alloc; pub mod contexts; +pub mod impls; #[cfg(test)] pub mod tests; From 67470e6a6d44cc464292b40a9ed4e2c85e2d89b4 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Mon, 9 Dec 2024 14:23:44 +0000 Subject: [PATCH 05/10] Try to get osmosisd working --- .../src/contexts/mod.rs | 3 +- .../src/contexts/osmosis_bootstrap.rs | 126 ++++++++++++++++++ .../src/impls/mod.rs | 1 + .../src/impls/wait.rs | 48 +++++++ .../src/tests/light_client.rs | 9 +- 5 files changed, 182 insertions(+), 5 deletions(-) create mode 100644 relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs create mode 100644 relayer/crates/starknet-integration-tests/src/impls/wait.rs diff --git a/relayer/crates/starknet-integration-tests/src/contexts/mod.rs b/relayer/crates/starknet-integration-tests/src/contexts/mod.rs index e0b0155f..8d6bb4d2 100644 --- a/relayer/crates/starknet-integration-tests/src/contexts/mod.rs +++ b/relayer/crates/starknet-integration-tests/src/contexts/mod.rs @@ -1,3 +1,4 @@ pub mod bootstrap; pub mod chain_driver; -pub mod cosmos_bootstrap; +// pub mod cosmos_bootstrap; +pub mod osmosis_bootstrap; diff --git a/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs b/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs new file mode 100644 index 00000000..e1eeddb0 --- /dev/null +++ b/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs @@ -0,0 +1,126 @@ +use std::path::PathBuf; + +use cgp::core::component::UseContext; +use cgp::core::error::{ErrorRaiserComponent, ErrorTypeComponent}; +use cgp::core::field::impls::use_field::WithField; +use cgp::core::types::impls::WithType; +use cgp::prelude::*; +use hermes_cosmos_chain_components::types::config::gas::dynamic_gas_config::DynamicGasConfig; +use hermes_cosmos_integration_tests::impls::bootstrap::build_cosmos_chain::BuildCosmosChainWithNodeConfig; +use hermes_cosmos_integration_tests::impls::bootstrap::build_cosmos_chain_driver::BuildCosmosChainDriver; +use hermes_cosmos_integration_tests::impls::bootstrap::relayer_chain_config::BuildRelayerChainConfig; +use hermes_cosmos_integration_tests::impls::bootstrap::types::ProvideCosmosBootstrapChainTypes; +use hermes_cosmos_integration_tests::traits::bootstrap::build_chain::ChainBuilderWithNodeConfigComponent; +use hermes_cosmos_integration_tests::traits::bootstrap::compat_mode::{ + CompatModeGetterComponent, UseCompatMode37, +}; +use hermes_cosmos_integration_tests::traits::bootstrap::cosmos_builder::CosmosBuilderGetterComponent; +use hermes_cosmos_integration_tests::traits::bootstrap::relayer_chain_config::RelayerChainConfigBuilderComponent; +use hermes_cosmos_relayer::contexts::build::CosmosBuilder; +use hermes_cosmos_test_components::bootstrap::components::cosmos_sdk_legacy::*; +use hermes_cosmos_test_components::bootstrap::impls::chain::build_wait::BuildAndWaitChainDriver; +use hermes_cosmos_test_components::bootstrap::impls::generator::wallet_config::GenerateStandardWalletConfig; +use hermes_cosmos_test_components::bootstrap::impls::modifiers::no_modify_comet_config::NoModifyCometConfig; +use hermes_cosmos_test_components::bootstrap::impls::modifiers::no_modify_cosmos_sdk_config::NoModifyCosmosSdkConfig; +use hermes_cosmos_test_components::bootstrap::impls::modifiers::no_modify_genesis_config::NoModifyGenesisConfig; +use hermes_cosmos_test_components::bootstrap::traits::chain::build_chain_driver::ChainDriverBuilderComponent; +use hermes_cosmos_test_components::bootstrap::traits::fields::account_prefix::AccountPrefixGetterComponent; +use hermes_cosmos_test_components::bootstrap::traits::fields::chain_command_path::ChainCommandPathGetterComponent; +use hermes_cosmos_test_components::bootstrap::traits::fields::chain_store_dir::ChainStoreDirGetterComponent; +use hermes_cosmos_test_components::bootstrap::traits::fields::denom::DenomPrefixGetterComponent; +use hermes_cosmos_test_components::bootstrap::traits::fields::dynamic_gas_fee::DynamicGasGetterComponent; +use hermes_cosmos_test_components::bootstrap::traits::fields::random_id::RandomIdFlagGetterComponent; +use hermes_cosmos_test_components::bootstrap::traits::generator::generate_wallet_config::WalletConfigGeneratorComponent; +use hermes_cosmos_test_components::bootstrap::traits::modifiers::modify_comet_config::CometConfigModifierComponent; +use hermes_cosmos_test_components::bootstrap::traits::modifiers::modify_cosmos_sdk_config::CosmosSdkConfigModifierComponent; +use hermes_cosmos_test_components::bootstrap::traits::modifiers::modify_genesis_config::CosmosGenesisConfigModifierComponent; +use hermes_error::handlers::debug::DebugError; +use hermes_error::impls::ProvideHermesError; +use hermes_runtime::types::runtime::HermesRuntime; +use hermes_runtime_components::traits::runtime::{RuntimeGetterComponent, RuntimeTypeComponent}; +use hermes_test_components::chain_driver::traits::types::chain::ChainTypeComponent; +use hermes_test_components::driver::traits::types::chain_driver::ChainDriverTypeComponent; +use hermes_wasm_test_components::impls::bootstrap::build_chain_driver::BuildChainDriverAndInitWasmClient; +use hermes_wasm_test_components::impls::bootstrap::genesis_config::ModifyWasmGenesisConfig; +use hermes_wasm_test_components::impls::bootstrap::node_config::ModifyWasmNodeConfig; +use hermes_wasm_test_components::traits::bootstrap::client_byte_code::WasmClientByteCodeGetterComponent; +use hermes_wasm_test_components::traits::bootstrap::gov_authority::GovernanceProposalAuthorityGetterComponent; + +/** + A bootstrap context for bootstrapping a new Cosmos chain, and builds + a `CosmosChainDriver`. +*/ +#[derive(HasField)] +pub struct OsmosisBootstrap { + pub runtime: HermesRuntime, + pub cosmos_builder: CosmosBuilder, + pub should_randomize_identifiers: bool, + pub chain_store_dir: PathBuf, + pub chain_command_path: PathBuf, + pub account_prefix: String, + pub staking_denom_prefix: String, + pub transfer_denom_prefix: String, + pub wasm_client_byte_code: Vec, + pub governance_proposal_authority: String, + pub dynamic_gas: Option, +} + +impl CanUseLegacyCosmosSdkChainBootstrapper for OsmosisBootstrap {} + +pub struct OsmosisBootstrapComponents; + +impl HasComponents for OsmosisBootstrap { + type Components = OsmosisBootstrapComponents; +} + +with_legacy_cosmos_sdk_bootstrap_components! { + | Components | { + delegate_components! { + OsmosisBootstrapComponents { + Components: LegacyCosmosSdkBootstrapComponents, + } + } + } +} + +delegate_components! { + OsmosisBootstrapComponents { + ErrorTypeComponent: ProvideHermesError, + ErrorRaiserComponent: DebugError, + RuntimeTypeComponent: WithType, + RuntimeGetterComponent: WithField, + WalletConfigGeneratorComponent: GenerateStandardWalletConfig, + [ + ChainTypeComponent, + ChainDriverTypeComponent, + ]: + ProvideCosmosBootstrapChainTypes, + [ + ChainStoreDirGetterComponent, + ChainCommandPathGetterComponent, + AccountPrefixGetterComponent, + DenomPrefixGetterComponent, + DynamicGasGetterComponent, + RandomIdFlagGetterComponent, + WasmClientByteCodeGetterComponent, + GovernanceProposalAuthorityGetterComponent, + CosmosBuilderGetterComponent, + ]: + UseContext, + CompatModeGetterComponent: + UseCompatMode37, + CosmosSdkConfigModifierComponent: + NoModifyCosmosSdkConfig, + RelayerChainConfigBuilderComponent: + BuildRelayerChainConfig, + ChainBuilderWithNodeConfigComponent: + BuildCosmosChainWithNodeConfig, + ChainDriverBuilderComponent: + BuildChainDriverAndInitWasmClient>, + // BuildChainDriverAndInitWasmClient>, + CosmosGenesisConfigModifierComponent: + ModifyWasmGenesisConfig, + CometConfigModifierComponent: + ModifyWasmNodeConfig, + } +} diff --git a/relayer/crates/starknet-integration-tests/src/impls/mod.rs b/relayer/crates/starknet-integration-tests/src/impls/mod.rs index b673ca8b..5cd07e53 100644 --- a/relayer/crates/starknet-integration-tests/src/impls/mod.rs +++ b/relayer/crates/starknet-integration-tests/src/impls/mod.rs @@ -1 +1,2 @@ pub mod dynamic_gas; +pub mod wait; diff --git a/relayer/crates/starknet-integration-tests/src/impls/wait.rs b/relayer/crates/starknet-integration-tests/src/impls/wait.rs new file mode 100644 index 00000000..049ae761 --- /dev/null +++ b/relayer/crates/starknet-integration-tests/src/impls/wait.rs @@ -0,0 +1,48 @@ +use core::marker::PhantomData; +use core::time::Duration; +use std::collections::BTreeMap; + +use cgp::prelude::HasErrorType; +use hermes_cosmos_test_components::bootstrap::traits::chain::build_chain_driver::ChainDriverBuilder; +use hermes_cosmos_test_components::bootstrap::traits::types::chain_node_config::HasChainNodeConfigType; +use hermes_cosmos_test_components::bootstrap::traits::types::genesis_config::HasChainGenesisConfigType; +use hermes_runtime_components::traits::os::child_process::{ChildProcessOf, HasChildProcessType}; +use hermes_runtime_components::traits::runtime::HasRuntime; +use hermes_runtime_components::traits::sleep::CanSleep; +use hermes_test_components::chain::traits::types::wallet::{HasWalletType, Wallet}; +use hermes_test_components::chain_driver::traits::types::chain::HasChainType; +use hermes_test_components::driver::traits::types::chain_driver::HasChainDriverType; + +pub struct BuildChainDriverAndPause(pub PhantomData); + +impl ChainDriverBuilder for BuildChainDriverAndPause +where + Bootstrap: HasRuntime + + HasChainType + + HasChainDriverType + + HasChainGenesisConfigType + + HasChainNodeConfigType + + HasErrorType, + InBuilder: ChainDriverBuilder, +{ + async fn build_chain_driver( + bootstrap: &Bootstrap, + genesis_config: Bootstrap::ChainGenesisConfig, + chain_node_config: Bootstrap::ChainNodeConfig, + wallets: BTreeMap>, + chain_process: ChildProcessOf, + ) -> Result { + let chain_driver = InBuilder::build_chain_driver( + bootstrap, + genesis_config, + chain_node_config, + wallets, + chain_process, + ) + .await?; + + bootstrap.runtime().sleep(Duration::from_secs(5)).await; + + Ok(chain_driver) + } +} diff --git a/relayer/crates/starknet-integration-tests/src/tests/light_client.rs b/relayer/crates/starknet-integration-tests/src/tests/light_client.rs index 7db61e52..ef1e65db 100644 --- a/relayer/crates/starknet-integration-tests/src/tests/light_client.rs +++ b/relayer/crates/starknet-integration-tests/src/tests/light_client.rs @@ -46,7 +46,7 @@ use starknet::macros::short_string; use tracing::info; use crate::contexts::bootstrap::StarknetBootstrap; -use crate::contexts::cosmos_bootstrap::CosmosWithWasmClientBootstrap; +use crate::contexts::osmosis_bootstrap::OsmosisBootstrap; #[test] fn test_starknet_light_client() -> Result<(), Error> { @@ -83,17 +83,18 @@ fn test_starknet_light_client() -> Result<(), Error> { info!("Reduced wasm client code size from {} to {} bytes", wasm_client_byte_code.len(), wasm_client_byte_code_gzip.len()); - let cosmos_bootstrap = Arc::new(CosmosWithWasmClientBootstrap { + let cosmos_bootstrap = Arc::new(OsmosisBootstrap { runtime: runtime.clone(), cosmos_builder, should_randomize_identifiers: true, chain_store_dir: store_dir.join("chains"), chain_command_path: "osmosisd".into(), account_prefix: "osmo".into(), - staking_denom: "stake".into(), - transfer_denom: "coin".into(), + staking_denom_prefix: "stake".into(), + transfer_denom_prefix: "coin".into(), wasm_client_byte_code: wasm_client_byte_code_gzip, governance_proposal_authority: "osmo10d07y265gmmuvt4z0w9aw880jnsr700jjeq4qp".into(), // TODO: don't hard code this + dynamic_gas: None, }); let starknet_bootstrap = StarknetBootstrap { From 06611013025e6cc235105eec1940fc87edece748 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Mon, 9 Dec 2024 14:30:19 +0000 Subject: [PATCH 06/10] Osmosis needs compat mode v0.34 --- .../src/contexts/osmosis_bootstrap.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs b/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs index e1eeddb0..2f495f5c 100644 --- a/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs +++ b/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs @@ -12,7 +12,7 @@ use hermes_cosmos_integration_tests::impls::bootstrap::relayer_chain_config::Bui use hermes_cosmos_integration_tests::impls::bootstrap::types::ProvideCosmosBootstrapChainTypes; use hermes_cosmos_integration_tests::traits::bootstrap::build_chain::ChainBuilderWithNodeConfigComponent; use hermes_cosmos_integration_tests::traits::bootstrap::compat_mode::{ - CompatModeGetterComponent, UseCompatMode37, + CompatModeGetterComponent, UseCompatMode34, }; use hermes_cosmos_integration_tests::traits::bootstrap::cosmos_builder::CosmosBuilderGetterComponent; use hermes_cosmos_integration_tests::traits::bootstrap::relayer_chain_config::RelayerChainConfigBuilderComponent; @@ -108,7 +108,7 @@ delegate_components! { ]: UseContext, CompatModeGetterComponent: - UseCompatMode37, + UseCompatMode34, CosmosSdkConfigModifierComponent: NoModifyCosmosSdkConfig, RelayerChainConfigBuilderComponent: @@ -117,7 +117,6 @@ delegate_components! { BuildCosmosChainWithNodeConfig, ChainDriverBuilderComponent: BuildChainDriverAndInitWasmClient>, - // BuildChainDriverAndInitWasmClient>, CosmosGenesisConfigModifierComponent: ModifyWasmGenesisConfig, CometConfigModifierComponent: From d80c362c705eef11e2ace23ff1d490b735a035c8 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Mon, 9 Dec 2024 18:53:48 +0000 Subject: [PATCH 07/10] Osmosis bootstrap is finally working --- relayer/Cargo.lock | 3 ++- relayer/Cargo.toml | 3 ++- .../crates/starknet-integration-tests/Cargo.toml | 1 + .../src/contexts/osmosis_bootstrap.rs | 9 ++++----- .../src/tests/light_client.rs | 14 ++++++++++++-- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/relayer/Cargo.lock b/relayer/Cargo.lock index efbca67a..f130f42e 100644 --- a/relayer/Cargo.lock +++ b/relayer/Cargo.lock @@ -2488,6 +2488,7 @@ dependencies = [ "serde_json", "sha2 0.10.8", "starknet", + "tendermint-rpc", "tokio", "toml", "tracing", @@ -2530,7 +2531,7 @@ dependencies = [ [[package]] name = "hermes-test-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git?branch=soares/fix-osmosis-bootstrap#fd4d2ceadd55b215d8bc22f670486ae94d979288" dependencies = [ "cgp", "hermes-chain-type-components", diff --git a/relayer/Cargo.toml b/relayer/Cargo.toml index 05f0579e..96847bc1 100644 --- a/relayer/Cargo.toml +++ b/relayer/Cargo.toml @@ -53,6 +53,7 @@ http = { version = "1.0.0" } ibc = { version = "0.56.0" } ibc-proto = { version = "0.51.1" } ibc-client-starknet-types = { version = "0.1.0" } +tendermint-rpc = { version = "0.40" } hermes-runtime-components = { version = "0.1.0" } hermes-async-runtime-components = { version = "0.1.0" } @@ -141,7 +142,7 @@ hermes-protobuf-encoding-components = { git = "https://github.com/informalsyste hermes-logging-components = { git = "https://github.com/informalsystems/hermes-sdk.git" } hermes-tracing-logging-components = { git = "https://github.com/informalsystems/hermes-sdk.git" } hermes-logger = { git = "https://github.com/informalsystems/hermes-sdk.git" } -hermes-test-components = { git = "https://github.com/informalsystems/hermes-sdk.git" } +hermes-test-components = { git = "https://github.com/informalsystems/hermes-sdk.git", branch = "soares/fix-osmosis-bootstrap" } hermes-ibc-test-suite = { git = "https://github.com/informalsystems/hermes-sdk.git" } hermes-any-counterparty = { git = "https://github.com/informalsystems/hermes-sdk.git" } hermes-cosmos-chain-components = { git = "https://github.com/informalsystems/hermes-sdk.git" } diff --git a/relayer/crates/starknet-integration-tests/Cargo.toml b/relayer/crates/starknet-integration-tests/Cargo.toml index a1e0dae9..5e72df80 100644 --- a/relayer/crates/starknet-integration-tests/Cargo.toml +++ b/relayer/crates/starknet-integration-tests/Cargo.toml @@ -31,6 +31,7 @@ hermes-cosmos-wasm-relayer = { workspace = true } ibc = { workspace = true } ibc-proto = { workspace = true } +tendermint-rpc = { workspace = true } starknet = { workspace = true } url = { workspace = true } diff --git a/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs b/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs index 2f495f5c..be03ed08 100644 --- a/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs +++ b/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs @@ -11,9 +11,7 @@ use hermes_cosmos_integration_tests::impls::bootstrap::build_cosmos_chain_driver use hermes_cosmos_integration_tests::impls::bootstrap::relayer_chain_config::BuildRelayerChainConfig; use hermes_cosmos_integration_tests::impls::bootstrap::types::ProvideCosmosBootstrapChainTypes; use hermes_cosmos_integration_tests::traits::bootstrap::build_chain::ChainBuilderWithNodeConfigComponent; -use hermes_cosmos_integration_tests::traits::bootstrap::compat_mode::{ - CompatModeGetterComponent, UseCompatMode34, -}; +use hermes_cosmos_integration_tests::traits::bootstrap::compat_mode::CompatModeGetterComponent; use hermes_cosmos_integration_tests::traits::bootstrap::cosmos_builder::CosmosBuilderGetterComponent; use hermes_cosmos_integration_tests::traits::bootstrap::relayer_chain_config::RelayerChainConfigBuilderComponent; use hermes_cosmos_relayer::contexts::build::CosmosBuilder; @@ -45,6 +43,7 @@ use hermes_wasm_test_components::impls::bootstrap::genesis_config::ModifyWasmGen use hermes_wasm_test_components::impls::bootstrap::node_config::ModifyWasmNodeConfig; use hermes_wasm_test_components::traits::bootstrap::client_byte_code::WasmClientByteCodeGetterComponent; use hermes_wasm_test_components::traits::bootstrap::gov_authority::GovernanceProposalAuthorityGetterComponent; +use tendermint_rpc::client::CompatMode; /** A bootstrap context for bootstrapping a new Cosmos chain, and builds @@ -63,6 +62,7 @@ pub struct OsmosisBootstrap { pub wasm_client_byte_code: Vec, pub governance_proposal_authority: String, pub dynamic_gas: Option, + pub compat_mode: Option, } impl CanUseLegacyCosmosSdkChainBootstrapper for OsmosisBootstrap {} @@ -105,10 +105,9 @@ delegate_components! { WasmClientByteCodeGetterComponent, GovernanceProposalAuthorityGetterComponent, CosmosBuilderGetterComponent, + CompatModeGetterComponent, ]: UseContext, - CompatModeGetterComponent: - UseCompatMode34, CosmosSdkConfigModifierComponent: NoModifyCosmosSdkConfig, RelayerChainConfigBuilderComponent: diff --git a/relayer/crates/starknet-integration-tests/src/tests/light_client.rs b/relayer/crates/starknet-integration-tests/src/tests/light_client.rs index ef1e65db..52c39ac4 100644 --- a/relayer/crates/starknet-integration-tests/src/tests/light_client.rs +++ b/relayer/crates/starknet-integration-tests/src/tests/light_client.rs @@ -8,6 +8,7 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH}; use flate2::write::GzEncoder; use flate2::Compression; use hermes_cosmos_chain_components::traits::message::ToCosmosMessage; +use hermes_cosmos_chain_components::types::config::gas::dynamic_gas_config::DynamicGasConfig; use hermes_cosmos_chain_components::types::messages::channel::open_ack::CosmosChannelOpenAckMessage; use hermes_cosmos_chain_components::types::messages::channel::open_init::CosmosChannelOpenInitMessage; use hermes_cosmos_chain_components::types::messages::connection::open_ack::CosmosConnectionOpenAckMessage; @@ -43,6 +44,7 @@ use ibc::core::connection::types::version::Version; use ibc_proto::ibc::core::channel::v1::{Channel, Counterparty}; use sha2::{Digest, Sha256}; use starknet::macros::short_string; +use tendermint_rpc::client::CompatMode; use tracing::info; use crate::contexts::bootstrap::StarknetBootstrap; @@ -81,8 +83,6 @@ fn test_starknet_light_client() -> Result<(), Error> { encoder.finish()? }; - info!("Reduced wasm client code size from {} to {} bytes", wasm_client_byte_code.len(), wasm_client_byte_code_gzip.len()); - let cosmos_bootstrap = Arc::new(OsmosisBootstrap { runtime: runtime.clone(), cosmos_builder, @@ -95,8 +95,18 @@ fn test_starknet_light_client() -> Result<(), Error> { wasm_client_byte_code: wasm_client_byte_code_gzip, governance_proposal_authority: "osmo10d07y265gmmuvt4z0w9aw880jnsr700jjeq4qp".into(), // TODO: don't hard code this dynamic_gas: None, + compat_mode: Some(CompatMode::V0_37), }); + // let cosmos_bootstrap = Arc::new(build_osmosis_bootstrap( + // runtime.clone(), + // true, + // "./test-data", + // "coin".into(), + // |_| Ok(()), + // |_| Ok(()), + // )); + let starknet_bootstrap = StarknetBootstrap { runtime: runtime.clone(), chain_command_path: "starknet-devnet".into(), From 9f61ea03d57ef76869d47a50181831c331826c2a Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Mon, 9 Dec 2024 19:02:10 +0000 Subject: [PATCH 08/10] Cleanup code --- .../starknet-integration-tests/Cargo.toml | 4 +- .../src/contexts/cosmos_bootstrap.rs | 209 ------------------ .../src/contexts/mod.rs | 1 - .../src/contexts/osmosis_bootstrap.rs | 8 +- .../src/impls/dynamic_gas.rs | 11 - .../src/impls/mod.rs | 2 - .../src/impls/wait.rs | 48 ---- .../starknet-integration-tests/src/lib.rs | 1 - .../src/tests/light_client.rs | 19 +- 9 files changed, 13 insertions(+), 290 deletions(-) delete mode 100644 relayer/crates/starknet-integration-tests/src/contexts/cosmos_bootstrap.rs delete mode 100644 relayer/crates/starknet-integration-tests/src/impls/dynamic_gas.rs delete mode 100644 relayer/crates/starknet-integration-tests/src/impls/mod.rs delete mode 100644 relayer/crates/starknet-integration-tests/src/impls/wait.rs diff --git a/relayer/crates/starknet-integration-tests/Cargo.toml b/relayer/crates/starknet-integration-tests/Cargo.toml index 5e72df80..8841043b 100644 --- a/relayer/crates/starknet-integration-tests/Cargo.toml +++ b/relayer/crates/starknet-integration-tests/Cargo.toml @@ -29,8 +29,8 @@ hermes-cosmos-integration-tests = { workspace = true } hermes-cosmos-relayer = { workspace = true } hermes-cosmos-wasm-relayer = { workspace = true } -ibc = { workspace = true } -ibc-proto = { workspace = true } +ibc = { workspace = true } +ibc-proto = { workspace = true } tendermint-rpc = { workspace = true } starknet = { workspace = true } diff --git a/relayer/crates/starknet-integration-tests/src/contexts/cosmos_bootstrap.rs b/relayer/crates/starknet-integration-tests/src/contexts/cosmos_bootstrap.rs deleted file mode 100644 index 66546316..00000000 --- a/relayer/crates/starknet-integration-tests/src/contexts/cosmos_bootstrap.rs +++ /dev/null @@ -1,209 +0,0 @@ -use alloc::sync::Arc; -use std::path::PathBuf; - -use cgp::core::error::{ErrorRaiserComponent, ErrorTypeComponent}; -use cgp::core::field::impls::use_field::WithField; -use cgp::core::types::impls::WithType; -use cgp::prelude::*; -use hermes_cosmos_integration_tests::impls::bootstrap::build_cosmos_chain::BuildCosmosChainWithNodeConfig; -use hermes_cosmos_integration_tests::impls::bootstrap::build_cosmos_chain_driver::BuildCosmosChainDriver; -use hermes_cosmos_integration_tests::impls::bootstrap::relayer_chain_config::BuildRelayerChainConfig; -use hermes_cosmos_integration_tests::impls::bootstrap::types::ProvideCosmosBootstrapChainTypes; -use hermes_cosmos_integration_tests::traits::bootstrap::build_chain::ChainBuilderWithNodeConfigComponent; -use hermes_cosmos_integration_tests::traits::bootstrap::compat_mode::{ - CompatModeGetter, CompatModeGetterComponent, UseCompatMode37, -}; -use hermes_cosmos_integration_tests::traits::bootstrap::cosmos_builder::CosmosBuilderGetter; -use hermes_cosmos_integration_tests::traits::bootstrap::relayer_chain_config::RelayerChainConfigBuilderComponent; -use hermes_cosmos_relayer::contexts::build::CosmosBuilder; -use hermes_cosmos_test_components::bootstrap::components::cosmos_sdk_legacy::*; -use hermes_cosmos_test_components::bootstrap::impls::generator::wallet_config::GenerateStandardWalletConfig; -use hermes_cosmos_test_components::bootstrap::impls::modifiers::no_modify_comet_config::NoModifyCometConfig; -use hermes_cosmos_test_components::bootstrap::impls::modifiers::no_modify_cosmos_sdk_config::NoModifyCosmosSdkConfig; -use hermes_cosmos_test_components::bootstrap::impls::modifiers::no_modify_genesis_config::NoModifyGenesisConfig; -use hermes_cosmos_test_components::bootstrap::traits::chain::build_chain_driver::ChainDriverBuilderComponent; -use hermes_cosmos_test_components::bootstrap::traits::fields::account_prefix::AccountPrefixGetter; -use hermes_cosmos_test_components::bootstrap::traits::fields::chain_command_path::ChainCommandPathGetter; -use hermes_cosmos_test_components::bootstrap::traits::fields::chain_store_dir::ChainStoreDirGetter; -use hermes_cosmos_test_components::bootstrap::traits::fields::denom::{ - DenomForStaking, DenomForTransfer, DenomPrefixGetter, -}; -use hermes_cosmos_test_components::bootstrap::traits::fields::dynamic_gas_fee::DynamicGasGetterComponent; -use hermes_cosmos_test_components::bootstrap::traits::fields::random_id::RandomIdFlagGetter; -use hermes_cosmos_test_components::bootstrap::traits::generator::generate_wallet_config::WalletConfigGeneratorComponent; -use hermes_cosmos_test_components::bootstrap::traits::modifiers::modify_comet_config::{ - CometConfigModifier, CometConfigModifierComponent, -}; -use hermes_cosmos_test_components::bootstrap::traits::modifiers::modify_cosmos_sdk_config::CosmosSdkConfigModifierComponent; -use hermes_cosmos_test_components::bootstrap::traits::modifiers::modify_genesis_config::CosmosGenesisConfigModifierComponent; -use hermes_error::handlers::debug::DebugError; -use hermes_error::impls::ProvideHermesError; -use hermes_runtime::types::runtime::HermesRuntime; -use hermes_runtime_components::traits::runtime::{RuntimeGetterComponent, RuntimeTypeComponent}; -use hermes_test_components::chain_driver::traits::types::chain::ChainTypeComponent; -use hermes_test_components::driver::traits::types::chain_driver::ChainDriverTypeComponent; -use hermes_wasm_test_components::impls::bootstrap::build_chain_driver::BuildChainDriverAndInitWasmClient; -use hermes_wasm_test_components::impls::bootstrap::genesis_config::ModifyWasmGenesisConfig; -use hermes_wasm_test_components::impls::bootstrap::node_config::ModifyWasmNodeConfig; -use hermes_wasm_test_components::traits::bootstrap::client_byte_code::WasmClientByteCodeGetter; -use hermes_wasm_test_components::traits::bootstrap::gov_authority::GovernanceProposalAuthorityGetter; -use toml::Value; - -use crate::impls::dynamic_gas::NoDynamicGas; - -/** - A bootstrap context for bootstrapping a new Cosmos chain, and builds - a `CosmosChainDriver`. -*/ -#[derive(HasField)] -pub struct CosmosWithWasmClientBootstrap { - pub runtime: HermesRuntime, - pub builder: Arc, - pub should_randomize_identifiers: bool, - pub chain_store_dir: PathBuf, - pub chain_command_path: PathBuf, - pub account_prefix: String, - pub staking_denom: String, - pub transfer_denom: String, - pub wasm_client_byte_code: Vec, - pub governance_proposal_authority: String, -} - -impl CanUseLegacyCosmosSdkChainBootstrapper for CosmosWithWasmClientBootstrap {} - -pub struct CosmosWithWasmClientBootstrapComponents; - -impl HasComponents for CosmosWithWasmClientBootstrap { - type Components = CosmosWithWasmClientBootstrapComponents; -} - -with_legacy_cosmos_sdk_bootstrap_components! { - | Components | { - delegate_components! { - CosmosWithWasmClientBootstrapComponents { - Components: LegacyCosmosSdkBootstrapComponents, - } - } - } -} - -delegate_components! { - CosmosWithWasmClientBootstrapComponents { - ErrorTypeComponent: ProvideHermesError, - ErrorRaiserComponent: DebugError, - RuntimeTypeComponent: WithType, - RuntimeGetterComponent: WithField, - WalletConfigGeneratorComponent: GenerateStandardWalletConfig, - [ - ChainTypeComponent, - ChainDriverTypeComponent, - ]: - ProvideCosmosBootstrapChainTypes, - RelayerChainConfigBuilderComponent: - BuildRelayerChainConfig, - ChainBuilderWithNodeConfigComponent: - BuildCosmosChainWithNodeConfig, - ChainDriverBuilderComponent: - BuildChainDriverAndInitWasmClient, - CosmosGenesisConfigModifierComponent: - ModifyWasmGenesisConfig, - CometConfigModifierComponent: - ModifyWasmNodeConfig, - CosmosSdkConfigModifierComponent: - NoModifyCosmosSdkConfig, - CompatModeGetterComponent: - UseCompatMode37, - DynamicGasGetterComponent: - NoDynamicGas, - } -} - -pub struct ModifyOsmosisConfig; - -impl CometConfigModifier for ModifyOsmosisConfig -where - Bootstrap: CanRaiseError<&'static str>, -{ - fn modify_comet_config( - _bootstrap: &Bootstrap, - _comet_config: &mut Value, - ) -> Result<(), Bootstrap::Error> { - Ok(()) - } -} - -impl ChainStoreDirGetter - for CosmosWithWasmClientBootstrapComponents -{ - fn chain_store_dir(bootstrap: &CosmosWithWasmClientBootstrap) -> &PathBuf { - &bootstrap.chain_store_dir - } -} - -impl ChainCommandPathGetter - for CosmosWithWasmClientBootstrapComponents -{ - fn chain_command_path(bootstrap: &CosmosWithWasmClientBootstrap) -> &PathBuf { - &bootstrap.chain_command_path - } -} - -impl RandomIdFlagGetter for CosmosWithWasmClientBootstrapComponents { - fn should_randomize_identifiers(bootstrap: &CosmosWithWasmClientBootstrap) -> bool { - bootstrap.should_randomize_identifiers - } -} - -impl DenomPrefixGetter - for CosmosWithWasmClientBootstrapComponents -{ - fn denom_prefix(bootstrap: &CosmosWithWasmClientBootstrap, _label: DenomForStaking) -> &str { - &bootstrap.staking_denom - } -} - -impl DenomPrefixGetter - for CosmosWithWasmClientBootstrapComponents -{ - fn denom_prefix(bootstrap: &CosmosWithWasmClientBootstrap, _label: DenomForTransfer) -> &str { - &bootstrap.transfer_denom - } -} - -impl AccountPrefixGetter - for CosmosWithWasmClientBootstrapComponents -{ - fn account_prefix(bootstrap: &CosmosWithWasmClientBootstrap) -> &str { - &bootstrap.account_prefix - } -} - -impl GasDenomGetter for CosmosWithWasmClientBootstrapComponents { - fn gas_denom(bootstrap: &CosmosWithWasmClientBootstrap) -> &str { - &bootstrap.staking_denom - } -} - -impl CosmosBuilderGetter - for CosmosWithWasmClientBootstrapComponents -{ - fn cosmos_builder(bootstrap: &CosmosWithWasmClientBootstrap) -> &CosmosBuilder { - &bootstrap.builder - } -} - -impl WasmClientByteCodeGetter - for CosmosWithWasmClientBootstrapComponents -{ - fn wasm_client_byte_code(bootstrap: &CosmosWithWasmClientBootstrap) -> &Vec { - &bootstrap.wasm_client_byte_code - } -} - -impl GovernanceProposalAuthorityGetter - for CosmosWithWasmClientBootstrapComponents -{ - fn governance_proposal_authority(bootstrap: &CosmosWithWasmClientBootstrap) -> &String { - &bootstrap.governance_proposal_authority - } -} diff --git a/relayer/crates/starknet-integration-tests/src/contexts/mod.rs b/relayer/crates/starknet-integration-tests/src/contexts/mod.rs index 8d6bb4d2..9e0d0983 100644 --- a/relayer/crates/starknet-integration-tests/src/contexts/mod.rs +++ b/relayer/crates/starknet-integration-tests/src/contexts/mod.rs @@ -1,4 +1,3 @@ pub mod bootstrap; pub mod chain_driver; -// pub mod cosmos_bootstrap; pub mod osmosis_bootstrap; diff --git a/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs b/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs index be03ed08..944e0a57 100644 --- a/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs +++ b/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs @@ -11,7 +11,9 @@ use hermes_cosmos_integration_tests::impls::bootstrap::build_cosmos_chain_driver use hermes_cosmos_integration_tests::impls::bootstrap::relayer_chain_config::BuildRelayerChainConfig; use hermes_cosmos_integration_tests::impls::bootstrap::types::ProvideCosmosBootstrapChainTypes; use hermes_cosmos_integration_tests::traits::bootstrap::build_chain::ChainBuilderWithNodeConfigComponent; -use hermes_cosmos_integration_tests::traits::bootstrap::compat_mode::CompatModeGetterComponent; +use hermes_cosmos_integration_tests::traits::bootstrap::compat_mode::{ + CompatModeGetterComponent, UseCompatMode37, +}; use hermes_cosmos_integration_tests::traits::bootstrap::cosmos_builder::CosmosBuilderGetterComponent; use hermes_cosmos_integration_tests::traits::bootstrap::relayer_chain_config::RelayerChainConfigBuilderComponent; use hermes_cosmos_relayer::contexts::build::CosmosBuilder; @@ -43,7 +45,6 @@ use hermes_wasm_test_components::impls::bootstrap::genesis_config::ModifyWasmGen use hermes_wasm_test_components::impls::bootstrap::node_config::ModifyWasmNodeConfig; use hermes_wasm_test_components::traits::bootstrap::client_byte_code::WasmClientByteCodeGetterComponent; use hermes_wasm_test_components::traits::bootstrap::gov_authority::GovernanceProposalAuthorityGetterComponent; -use tendermint_rpc::client::CompatMode; /** A bootstrap context for bootstrapping a new Cosmos chain, and builds @@ -62,7 +63,6 @@ pub struct OsmosisBootstrap { pub wasm_client_byte_code: Vec, pub governance_proposal_authority: String, pub dynamic_gas: Option, - pub compat_mode: Option, } impl CanUseLegacyCosmosSdkChainBootstrapper for OsmosisBootstrap {} @@ -105,7 +105,6 @@ delegate_components! { WasmClientByteCodeGetterComponent, GovernanceProposalAuthorityGetterComponent, CosmosBuilderGetterComponent, - CompatModeGetterComponent, ]: UseContext, CosmosSdkConfigModifierComponent: @@ -120,5 +119,6 @@ delegate_components! { ModifyWasmGenesisConfig, CometConfigModifierComponent: ModifyWasmNodeConfig, + CompatModeGetterComponent: UseCompatMode37, } } diff --git a/relayer/crates/starknet-integration-tests/src/impls/dynamic_gas.rs b/relayer/crates/starknet-integration-tests/src/impls/dynamic_gas.rs deleted file mode 100644 index 1d7add4c..00000000 --- a/relayer/crates/starknet-integration-tests/src/impls/dynamic_gas.rs +++ /dev/null @@ -1,11 +0,0 @@ -use cgp::core::Async; -use hermes_cosmos_chain_components::types::config::gas::dynamic_gas_config::DynamicGasConfig; -use hermes_cosmos_test_components::bootstrap::traits::fields::dynamic_gas_fee::DynamicGasGetter; - -pub struct NoDynamicGas; - -impl DynamicGasGetter for NoDynamicGas { - fn dynamic_gas(_bootstrap: &Bootstrap) -> &Option { - &None - } -} diff --git a/relayer/crates/starknet-integration-tests/src/impls/mod.rs b/relayer/crates/starknet-integration-tests/src/impls/mod.rs deleted file mode 100644 index 5cd07e53..00000000 --- a/relayer/crates/starknet-integration-tests/src/impls/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod dynamic_gas; -pub mod wait; diff --git a/relayer/crates/starknet-integration-tests/src/impls/wait.rs b/relayer/crates/starknet-integration-tests/src/impls/wait.rs deleted file mode 100644 index 049ae761..00000000 --- a/relayer/crates/starknet-integration-tests/src/impls/wait.rs +++ /dev/null @@ -1,48 +0,0 @@ -use core::marker::PhantomData; -use core::time::Duration; -use std::collections::BTreeMap; - -use cgp::prelude::HasErrorType; -use hermes_cosmos_test_components::bootstrap::traits::chain::build_chain_driver::ChainDriverBuilder; -use hermes_cosmos_test_components::bootstrap::traits::types::chain_node_config::HasChainNodeConfigType; -use hermes_cosmos_test_components::bootstrap::traits::types::genesis_config::HasChainGenesisConfigType; -use hermes_runtime_components::traits::os::child_process::{ChildProcessOf, HasChildProcessType}; -use hermes_runtime_components::traits::runtime::HasRuntime; -use hermes_runtime_components::traits::sleep::CanSleep; -use hermes_test_components::chain::traits::types::wallet::{HasWalletType, Wallet}; -use hermes_test_components::chain_driver::traits::types::chain::HasChainType; -use hermes_test_components::driver::traits::types::chain_driver::HasChainDriverType; - -pub struct BuildChainDriverAndPause(pub PhantomData); - -impl ChainDriverBuilder for BuildChainDriverAndPause -where - Bootstrap: HasRuntime - + HasChainType - + HasChainDriverType - + HasChainGenesisConfigType - + HasChainNodeConfigType - + HasErrorType, - InBuilder: ChainDriverBuilder, -{ - async fn build_chain_driver( - bootstrap: &Bootstrap, - genesis_config: Bootstrap::ChainGenesisConfig, - chain_node_config: Bootstrap::ChainNodeConfig, - wallets: BTreeMap>, - chain_process: ChildProcessOf, - ) -> Result { - let chain_driver = InBuilder::build_chain_driver( - bootstrap, - genesis_config, - chain_node_config, - wallets, - chain_process, - ) - .await?; - - bootstrap.runtime().sleep(Duration::from_secs(5)).await; - - Ok(chain_driver) - } -} diff --git a/relayer/crates/starknet-integration-tests/src/lib.rs b/relayer/crates/starknet-integration-tests/src/lib.rs index e8a859ab..392380c0 100644 --- a/relayer/crates/starknet-integration-tests/src/lib.rs +++ b/relayer/crates/starknet-integration-tests/src/lib.rs @@ -3,7 +3,6 @@ extern crate alloc; pub mod contexts; -pub mod impls; #[cfg(test)] pub mod tests; diff --git a/relayer/crates/starknet-integration-tests/src/tests/light_client.rs b/relayer/crates/starknet-integration-tests/src/tests/light_client.rs index 52c39ac4..832cced9 100644 --- a/relayer/crates/starknet-integration-tests/src/tests/light_client.rs +++ b/relayer/crates/starknet-integration-tests/src/tests/light_client.rs @@ -9,6 +9,7 @@ use flate2::write::GzEncoder; use flate2::Compression; use hermes_cosmos_chain_components::traits::message::ToCosmosMessage; use hermes_cosmos_chain_components::types::config::gas::dynamic_gas_config::DynamicGasConfig; +use hermes_cosmos_chain_components::types::config::gas::eip_type::EipQueryType; use hermes_cosmos_chain_components::types::messages::channel::open_ack::CosmosChannelOpenAckMessage; use hermes_cosmos_chain_components::types::messages::channel::open_init::CosmosChannelOpenInitMessage; use hermes_cosmos_chain_components::types::messages::connection::open_ack::CosmosConnectionOpenAckMessage; @@ -44,7 +45,6 @@ use ibc::core::connection::types::version::Version; use ibc_proto::ibc::core::channel::v1::{Channel, Counterparty}; use sha2::{Digest, Sha256}; use starknet::macros::short_string; -use tendermint_rpc::client::CompatMode; use tracing::info; use crate::contexts::bootstrap::StarknetBootstrap; @@ -94,19 +94,14 @@ fn test_starknet_light_client() -> Result<(), Error> { transfer_denom_prefix: "coin".into(), wasm_client_byte_code: wasm_client_byte_code_gzip, governance_proposal_authority: "osmo10d07y265gmmuvt4z0w9aw880jnsr700jjeq4qp".into(), // TODO: don't hard code this - dynamic_gas: None, - compat_mode: Some(CompatMode::V0_37), + dynamic_gas: Some(DynamicGasConfig { + multiplier: 1.1, + max: 1.6, + eip_query_type: EipQueryType::Osmosis, + denom: "stake".to_owned(), + }), }); - // let cosmos_bootstrap = Arc::new(build_osmosis_bootstrap( - // runtime.clone(), - // true, - // "./test-data", - // "coin".into(), - // |_| Ok(()), - // |_| Ok(()), - // )); - let starknet_bootstrap = StarknetBootstrap { runtime: runtime.clone(), chain_command_path: "starknet-devnet".into(), From e9baf1e094d291f1efc72bc41a3f23e029eff1f2 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Mon, 9 Dec 2024 19:10:32 +0000 Subject: [PATCH 09/10] Use back main branch --- relayer/Cargo.lock | 60 +++++++++---------- relayer/Cargo.toml | 2 +- .../src/contexts/osmosis_bootstrap.rs | 13 ++-- 3 files changed, 36 insertions(+), 39 deletions(-) diff --git a/relayer/Cargo.lock b/relayer/Cargo.lock index f130f42e..eb2bc018 100644 --- a/relayer/Cargo.lock +++ b/relayer/Cargo.lock @@ -1942,7 +1942,7 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermes-any-counterparty" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "hermes-cosmos-chain-components", @@ -1959,7 +1959,7 @@ dependencies = [ [[package]] name = "hermes-async-runtime-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "async-trait", "cgp", @@ -1982,7 +1982,7 @@ dependencies = [ [[package]] name = "hermes-chain-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "hermes-chain-type-components", @@ -1993,7 +1993,7 @@ dependencies = [ [[package]] name = "hermes-chain-type-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", ] @@ -2001,7 +2001,7 @@ dependencies = [ [[package]] name = "hermes-cli-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "clap", @@ -2019,7 +2019,7 @@ dependencies = [ [[package]] name = "hermes-comet-light-client-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "hermes-chain-type-components", @@ -2028,7 +2028,7 @@ dependencies = [ [[package]] name = "hermes-comet-light-client-context" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "eyre", @@ -2044,7 +2044,7 @@ dependencies = [ [[package]] name = "hermes-cosmos-chain-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "bech32 0.9.1", "cgp", @@ -2086,7 +2086,7 @@ dependencies = [ [[package]] name = "hermes-cosmos-encoding-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "hermes-encoding-components", @@ -2100,7 +2100,7 @@ dependencies = [ [[package]] name = "hermes-cosmos-integration-tests" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "eyre", @@ -2134,7 +2134,7 @@ dependencies = [ [[package]] name = "hermes-cosmos-relayer" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "dirs-next", @@ -2185,7 +2185,7 @@ dependencies = [ [[package]] name = "hermes-cosmos-test-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "hdpath", @@ -2212,7 +2212,7 @@ dependencies = [ [[package]] name = "hermes-cosmos-wasm-relayer" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "eyre", @@ -2263,7 +2263,7 @@ dependencies = [ [[package]] name = "hermes-encoding-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", ] @@ -2271,7 +2271,7 @@ dependencies = [ [[package]] name = "hermes-error" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "eyre", @@ -2281,7 +2281,7 @@ dependencies = [ [[package]] name = "hermes-ibc-test-suite" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "hermes-logging-components", @@ -2292,7 +2292,7 @@ dependencies = [ [[package]] name = "hermes-logger" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "hermes-logging-components", @@ -2304,7 +2304,7 @@ dependencies = [ [[package]] name = "hermes-logging-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", ] @@ -2312,7 +2312,7 @@ dependencies = [ [[package]] name = "hermes-protobuf-encoding-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "hermes-encoding-components", @@ -2323,7 +2323,7 @@ dependencies = [ [[package]] name = "hermes-relayer-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "hermes-chain-components", @@ -2336,7 +2336,7 @@ dependencies = [ [[package]] name = "hermes-relayer-components-extra" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "hermes-chain-type-components", @@ -2348,7 +2348,7 @@ dependencies = [ [[package]] name = "hermes-runtime" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "hermes-async-runtime-components", @@ -2360,7 +2360,7 @@ dependencies = [ [[package]] name = "hermes-runtime-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", ] @@ -2531,7 +2531,7 @@ dependencies = [ [[package]] name = "hermes-test-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git?branch=soares/fix-osmosis-bootstrap#fd4d2ceadd55b215d8bc22f670486ae94d979288" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "hermes-chain-type-components", @@ -2543,7 +2543,7 @@ dependencies = [ [[package]] name = "hermes-tokio-runtime-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "futures", @@ -2557,7 +2557,7 @@ dependencies = [ [[package]] name = "hermes-tracing-logging-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "hermes-logging-components", @@ -2569,7 +2569,7 @@ dependencies = [ [[package]] name = "hermes-wasm-client-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "hermes-cosmos-chain-components", @@ -2588,7 +2588,7 @@ dependencies = [ [[package]] name = "hermes-wasm-encoding-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "hermes-cosmos-encoding-components", @@ -2602,7 +2602,7 @@ dependencies = [ [[package]] name = "hermes-wasm-test-components" version = "0.1.0" -source = "git+https://github.com/informalsystems/hermes-sdk.git#e7bbfad66cf3bcd10f204c705b206252f7f10e2e" +source = "git+https://github.com/informalsystems/hermes-sdk.git#c262e33a44149267cbd3c992739e6f7626536832" dependencies = [ "cgp", "hermes-chain-type-components", @@ -4657,7 +4657,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" dependencies = [ "anyhow", - "itertools 0.13.0", + "itertools 0.12.1", "proc-macro2", "quote", "syn 2.0.87", diff --git a/relayer/Cargo.toml b/relayer/Cargo.toml index 96847bc1..a27f55fb 100644 --- a/relayer/Cargo.toml +++ b/relayer/Cargo.toml @@ -142,7 +142,7 @@ hermes-protobuf-encoding-components = { git = "https://github.com/informalsyste hermes-logging-components = { git = "https://github.com/informalsystems/hermes-sdk.git" } hermes-tracing-logging-components = { git = "https://github.com/informalsystems/hermes-sdk.git" } hermes-logger = { git = "https://github.com/informalsystems/hermes-sdk.git" } -hermes-test-components = { git = "https://github.com/informalsystems/hermes-sdk.git", branch = "soares/fix-osmosis-bootstrap" } +hermes-test-components = { git = "https://github.com/informalsystems/hermes-sdk.git" } hermes-ibc-test-suite = { git = "https://github.com/informalsystems/hermes-sdk.git" } hermes-any-counterparty = { git = "https://github.com/informalsystems/hermes-sdk.git" } hermes-cosmos-chain-components = { git = "https://github.com/informalsystems/hermes-sdk.git" } diff --git a/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs b/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs index 944e0a57..f86894d8 100644 --- a/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs +++ b/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs @@ -73,14 +73,11 @@ impl HasComponents for OsmosisBootstrap { type Components = OsmosisBootstrapComponents; } -with_legacy_cosmos_sdk_bootstrap_components! { - | Components | { - delegate_components! { - OsmosisBootstrapComponents { - Components: LegacyCosmosSdkBootstrapComponents, - } - } - } +impl DelegateComponent for OsmosisBootstrapComponents +where + Self: IsLegacyCosmosSdkBootstrapComponents +{ + type Delegate = LegacyCosmosSdkBootstrapComponents; } delegate_components! { From a3b697218bab33f1968129236b385c1e18ceaf09 Mon Sep 17 00:00:00 2001 From: Soares Chen Date: Mon, 9 Dec 2024 19:11:19 +0000 Subject: [PATCH 10/10] Fix formatting --- .../src/contexts/osmosis_bootstrap.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs b/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs index f86894d8..679fa7f1 100644 --- a/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs +++ b/relayer/crates/starknet-integration-tests/src/contexts/osmosis_bootstrap.rs @@ -75,7 +75,7 @@ impl HasComponents for OsmosisBootstrap { impl DelegateComponent for OsmosisBootstrapComponents where - Self: IsLegacyCosmosSdkBootstrapComponents + Self: IsLegacyCosmosSdkBootstrapComponents, { type Delegate = LegacyCosmosSdkBootstrapComponents; }