diff --git a/Cargo.lock b/Cargo.lock index 8403578e6..e100f67ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -357,7 +357,7 @@ dependencies = [ "ethabi", "ethereum-triedb", "ethers", - "evm-common", + "evm-state-machine", "geth-primitives", "hex", "hex-literal 0.4.1", @@ -4809,7 +4809,7 @@ dependencies = [ ] [[package]] -name = "evm-common" +name = "evm-state-machine" version = "0.1.1" dependencies = [ "alloy-primitives", @@ -7300,7 +7300,7 @@ dependencies = [ "console_error_panic_hook", "ethereum-triedb", "ethers", - "evm-common", + "evm-state-machine", "futures", "getrandom 0.2.15", "gloo-timers 0.3.0", @@ -7713,7 +7713,7 @@ version = "0.1.1" dependencies = [ "anyhow", "bsc-verifier", - "evm-common", + "evm-state-machine", "geth-primitives", "ismp", "log", @@ -7869,7 +7869,7 @@ dependencies = [ "arbitrum-verifier", "ethabi", "ethereum-triedb", - "evm-common", + "evm-state-machine", "frame-support 37.0.0", "frame-system", "geth-primitives", @@ -11383,7 +11383,7 @@ dependencies = [ "alloy-rlp-derive", "ethabi", "ethereum-triedb", - "evm-common", + "evm-state-machine", "geth-primitives", "hex", "hex-literal 0.4.1", @@ -12283,7 +12283,7 @@ dependencies = [ "alloy-rlp-derive", "ethabi", "ethereum-triedb", - "evm-common", + "evm-state-machine", "frame-support 37.0.0", "frame-system", "hash-db", @@ -12365,7 +12365,7 @@ dependencies = [ "dotenv", "env_logger 0.11.5", "ethereum-triedb", - "evm-common", + "evm-state-machine", "frame-support 37.0.0", "frame-system", "futures", @@ -12891,7 +12891,7 @@ version = "0.1.0" dependencies = [ "alloy-primitives", "alloy-rlp", - "evm-common", + "evm-state-machine", "frame-support 37.0.0", "frame-system", "ismp", @@ -23802,7 +23802,7 @@ dependencies = [ "ethereum-triedb", "ethers", "ethers-contract-abigen", - "evm-common", + "evm-state-machine", "frame-support 37.0.0", "futures", "geth-primitives", diff --git a/Cargo.toml b/Cargo.toml index f891ee747..5e4b7e0c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,6 @@ resolver = "2" members = [ # runtime "parachain/runtimes/gargantua", -# "parachain/runtimes/messier", "parachain/runtimes/nexus", # node @@ -27,19 +26,16 @@ members = [ "modules/ismp/pallets/token-gateway-inspector", "modules/ismp/pallets/hyperbridge", "modules/ismp/pallets/state-coprocessor", - "modules/ismp/testsuite", "modules/ismp/clients/sync-committee", "modules/ismp/clients/casper-ffg", "modules/ismp/clients/parachain/client", "modules/ismp/clients/parachain/inherent", "modules/ismp/clients/parachain/runtime-api", - "modules/ismp/state-machines/substrate", - "modules/ismp/state-machines/hyperbridge", "modules/ismp/clients/arbitrum", "modules/ismp/clients/optimism", - "modules/ismp/clients/sync-committee/evm-common", "modules/ismp/clients/bsc", "modules/ismp/clients/grandpa", + "modules/ismp/testsuite", # cryptography "modules/consensus/sync-committee/prover", @@ -58,6 +54,9 @@ members = [ "modules/trees/mmr/primitives", "modules/trees/mmr/gadget", "modules/trees/mmr/pallet/runtime-api", + "modules/ismp/state-machines/evm", + "modules/ismp/state-machines/substrate", + "modules/ismp/state-machines/hyperbridge", # evm stuff "evm/integration-tests", @@ -84,8 +83,6 @@ members = [ "tesseract/telemetry", "tesseract/config", "tesseract/fisherman", - - # integration tests "tesseract/integration-test", ] @@ -295,11 +292,11 @@ ismp-parachain = { version = "1.15.1", path = "./modules/ismp/clients/parachain/ ismp-parachain-inherent = { version = "1.15.1", path = "./modules/ismp/clients/parachain/inherent" } ismp-parachain-runtime-api = { version = "1.15.1", path = "./modules/ismp/clients/parachain/runtime-api", default-features = false } ismp-sync-committee = { path = "./modules/ismp/clients/sync-committee", default-features = false } -evm-common = { path = "./modules/ismp/clients/sync-committee/evm-common", default-features = false } arbitrum-verifier = { path = "./modules/ismp/clients/arbitrum", default-features = false } op-verifier = { path = "./modules/ismp/clients/optimism", default-features = false } # state machine clients +evm-state-machine = { path = "./modules/ismp/state-machines/evm", default-features = false } substrate-state-machine = { version = "1.15.1", path = "modules/ismp/state-machines/substrate", default-features = false } hyperbridge-client-machine = { path = "modules/ismp/state-machines/hyperbridge", default-features = false } diff --git a/modules/hyperclient/Cargo.toml b/modules/hyperclient/Cargo.toml index 2e919f68e..2c7301892 100644 --- a/modules/hyperclient/Cargo.toml +++ b/modules/hyperclient/Cargo.toml @@ -20,7 +20,7 @@ primitive-types = { workspace = true, features = ["serde"] } ethers = { workspace = true } ismp = { workspace = true, default-features = true } pallet-ismp = { workspace = true, features = ["disable-panic-handler"] } -evm-common = { workspace = true } +evm-state-machine = { workspace = true } sp-core = { workspace = true, features = ["serde"]} substrate-state-machine = { workspace = true } ismp-solidity-abi = { workspace = true } diff --git a/modules/hyperclient/src/providers/evm.rs b/modules/hyperclient/src/providers/evm.rs index 2a46a4cce..1956487de 100644 --- a/modules/hyperclient/src/providers/evm.rs +++ b/modules/hyperclient/src/providers/evm.rs @@ -17,7 +17,7 @@ use crate::{providers::interface::Client, types::BoxStream}; use codec::{Decode, Encode}; use ethereum_triedb::StorageProof; use ethers::prelude::Middleware; -use evm_common::{ +use evm_state_machine::{ presets::{ REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, @@ -29,7 +29,7 @@ use sp_mmr_primitives::utils::NodesUtils; use super::interface::Query; use crate::{ providers::interface::WithMetadata, - types::{EventMetadata, EvmStateProof, SubstrateStateProof}, + types::{EventMetadata, SubstrateStateProof}, }; use anyhow::{anyhow, Context, Error}; use core::time::Duration; @@ -38,6 +38,7 @@ use ethers::{ providers::{Http, Provider}, utils::keccak256, }; +use evm_state_machine::types::EvmStateProof; use futures::{stream, StreamExt}; use ismp::{ consensus::{ConsensusStateId, StateCommitment, StateMachineHeight, StateMachineId}, diff --git a/modules/hyperclient/src/types.rs b/modules/hyperclient/src/types.rs index ac620d1eb..2c03d656d 100644 --- a/modules/hyperclient/src/types.rs +++ b/modules/hyperclient/src/types.rs @@ -20,7 +20,6 @@ use crate::{ use anyhow::anyhow; use core::{fmt, pin::Pin}; use ethers::types::H160; -pub use evm_common::types::EvmStateProof; use futures::Stream; use hex_fmt::HexFmt; use ismp::{consensus::ConsensusStateId, host::StateMachine}; diff --git a/modules/ismp/clients/arbitrum/Cargo.toml b/modules/ismp/clients/arbitrum/Cargo.toml index 33a6ed19d..2804a6d72 100644 --- a/modules/ismp/clients/arbitrum/Cargo.toml +++ b/modules/ismp/clients/arbitrum/Cargo.toml @@ -12,7 +12,7 @@ publish = false ismp = { workspace = true } ethereum-triedb = { workspace = true } geth-primitives = { workspace = true } -evm-common = { workspace = true } +evm-state-machine = { workspace = true } # crates.io alloy-rlp = { workspace = true } @@ -40,5 +40,5 @@ std = [ "ethabi/std", "hex/std", "geth-primitives/std", - "evm-common/std" + "evm-state-machine/std" ] diff --git a/modules/ismp/clients/arbitrum/src/lib.rs b/modules/ismp/clients/arbitrum/src/lib.rs index c6e2b66e4..40a84f608 100644 --- a/modules/ismp/clients/arbitrum/src/lib.rs +++ b/modules/ismp/clients/arbitrum/src/lib.rs @@ -23,7 +23,7 @@ mod tests; use alloc::format; use alloy_rlp::Decodable; use ethabi::ethereum_types::{H160, H256, U256}; -use evm_common::{derive_map_key, get_contract_account, get_value_from_proof, prelude::*}; +use evm_state_machine::{derive_map_key, get_contract_account, get_value_from_proof, prelude::*}; use geth_primitives::{CodecHeader, Header}; use ismp::{ consensus::{ diff --git a/modules/ismp/clients/arbitrum/src/tests.rs b/modules/ismp/clients/arbitrum/src/tests.rs index 425b31b17..71927c96b 100644 --- a/modules/ismp/clients/arbitrum/src/tests.rs +++ b/modules/ismp/clients/arbitrum/src/tests.rs @@ -18,7 +18,7 @@ use ethers::prelude::*; use hex_literal::hex; use crate::NODES_SLOT; -use evm_common::derive_map_key; +use evm_state_machine::derive_map_key; use ismp_testsuite::mocks::Host; use sp_core::{H160, H256}; diff --git a/modules/ismp/clients/bsc/Cargo.toml b/modules/ismp/clients/bsc/Cargo.toml index 6575f7166..91320c9fd 100644 --- a/modules/ismp/clients/bsc/Cargo.toml +++ b/modules/ismp/clients/bsc/Cargo.toml @@ -18,7 +18,7 @@ ismp = { workspace = true } bsc-verifier = { workspace = true } sync-committee-primitives = { workspace = true } geth-primitives = { workspace = true } -evm-common = { workspace = true } +evm-state-machine = { workspace = true } pallet-ismp-host-executive = { workspace = true } [features] @@ -32,6 +32,6 @@ std = [ "bsc-verifier/std", "ismp/std", "sync-committee-primitives/std", - "evm-common/std", + "evm-state-machine/std", "pallet-ismp-host-executive/std" ] diff --git a/modules/ismp/clients/bsc/src/lib.rs b/modules/ismp/clients/bsc/src/lib.rs index 74807a941..bad763492 100644 --- a/modules/ismp/clients/bsc/src/lib.rs +++ b/modules/ismp/clients/bsc/src/lib.rs @@ -12,7 +12,7 @@ use bsc_verifier::{ verify_bsc_header, NextValidators, VerificationResult, }; use codec::{Decode, Encode}; -use evm_common::EvmStateMachine; +use evm_state_machine::EvmStateMachine; use geth_primitives::Header; use ismp::{ consensus::{ diff --git a/modules/ismp/clients/optimism/Cargo.toml b/modules/ismp/clients/optimism/Cargo.toml index 0e283d706..5a6733c65 100644 --- a/modules/ismp/clients/optimism/Cargo.toml +++ b/modules/ismp/clients/optimism/Cargo.toml @@ -11,7 +11,7 @@ publish = false ismp = { workspace = true } ethereum-triedb = { workspace = true } geth-primitives = { workspace = true } -evm-common = { workspace = true } +evm-state-machine = { workspace = true } # crates.io alloy-rlp = { workspace = true } @@ -35,5 +35,5 @@ std = [ "ethabi/std", "hex/std", "geth-primitives/std", - "evm-common/std" + "evm-state-machine/std" ] diff --git a/modules/ismp/clients/optimism/src/lib.rs b/modules/ismp/clients/optimism/src/lib.rs index 55c5ce1eb..d9e65f828 100644 --- a/modules/ismp/clients/optimism/src/lib.rs +++ b/modules/ismp/clients/optimism/src/lib.rs @@ -20,7 +20,7 @@ extern crate alloc; use alloc::format; use alloy_rlp::Decodable; use ethabi::ethereum_types::{H160, H256, U128, U256}; -use evm_common::{ +use evm_state_machine::{ derive_array_item_key, derive_map_key, get_contract_account, get_value_from_proof, prelude::*, }; use geth_primitives::{CodecHeader, Header}; diff --git a/modules/ismp/clients/sync-committee/Cargo.toml b/modules/ismp/clients/sync-committee/Cargo.toml index e5138975d..cc6e22e8e 100644 --- a/modules/ismp/clients/sync-committee/Cargo.toml +++ b/modules/ismp/clients/sync-committee/Cargo.toml @@ -15,7 +15,7 @@ sync-committee-verifier = { workspace = true, default-features = false } ethereum-triedb = { workspace = true, default-features = false } pallet-ismp = { workspace = true, default-features = false } geth-primitives = { workspace = true, default-features = false } -evm-common = { workspace = true } +evm-state-machine = { workspace = true } arbitrum-verifier = { workspace = true } op-verifier = { workspace = true } pallet-ismp-host-executive = { workspace = true } @@ -52,7 +52,7 @@ std = [ "sp-core/std", "pallet-ismp/std", "geth-primitives/std", - "evm-common/std", + "evm-state-machine/std", "arbitrum-verifier/std", "op-verifier/std" ] diff --git a/modules/ismp/clients/sync-committee/src/beacon_client.rs b/modules/ismp/clients/sync-committee/src/beacon_client.rs index 942a58d72..9212948bb 100644 --- a/modules/ismp/clients/sync-committee/src/beacon_client.rs +++ b/modules/ismp/clients/sync-committee/src/beacon_client.rs @@ -16,13 +16,13 @@ use alloc::{collections::BTreeMap, format, string::ToString}; use arbitrum_verifier::verify_arbitrum_payload; use codec::{Decode, Encode}; -use evm_common::construct_intermediate_state; +use evm_state_machine::construct_intermediate_state; use crate::{ pallet::{self, SupportedStatemachines}, types::{BeaconClientUpdate, ConsensusState, L2Consensus}, }; -use evm_common::EvmStateMachine; +use evm_state_machine::EvmStateMachine; use ismp::{ consensus::{ ConsensusClient, ConsensusClientId, ConsensusStateId, StateMachineClient, diff --git a/modules/ismp/pallets/relayer/Cargo.toml b/modules/ismp/pallets/relayer/Cargo.toml index 383e108b6..a758e1b40 100644 --- a/modules/ismp/pallets/relayer/Cargo.toml +++ b/modules/ismp/pallets/relayer/Cargo.toml @@ -15,7 +15,7 @@ sp-runtime = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } pallet-ismp = { workspace = true } -evm-common = { workspace = true } +evm-state-machine = { workspace = true } pallet-ismp-host-executive = { workspace = true } pallet-hyperbridge = { workspace = true } @@ -62,7 +62,7 @@ std = [ "alloy-primitives/std", "alloy-rlp/std", "ethabi/std", - "evm-common/std", + "evm-state-machine/std", "pallet-ismp-host-executive/std" ] diff --git a/modules/ismp/pallets/relayer/src/lib.rs b/modules/ismp/pallets/relayer/src/lib.rs index 43424da3e..9fcf0c6e2 100644 --- a/modules/ismp/pallets/relayer/src/lib.rs +++ b/modules/ismp/pallets/relayer/src/lib.rs @@ -27,7 +27,7 @@ use alloc::{collections::BTreeMap, vec, vec::Vec}; use alloy_primitives::Address; use codec::Encode; use ethabi::ethereum_types::H256; -use evm_common::{ +use evm_state_machine::{ presets::{ REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, diff --git a/modules/ismp/pallets/state-coprocessor/Cargo.toml b/modules/ismp/pallets/state-coprocessor/Cargo.toml index a21d4ab83..167ff67fd 100644 --- a/modules/ismp/pallets/state-coprocessor/Cargo.toml +++ b/modules/ismp/pallets/state-coprocessor/Cargo.toml @@ -22,7 +22,7 @@ log = { workspace = true } ismp = { workspace = true } pallet-ismp = { workspace = true } mmr-primitives = { workspace = true } -evm-common = { workspace = true } +evm-state-machine = { workspace = true } pallet-ismp-relayer = { workspace = true } alloy-rlp = { workspace = true } @@ -44,7 +44,7 @@ std = [ "ismp/std", "pallet-ismp/std", "mmr-primitives/std", - "evm-common/std", + "evm-state-machine/std", "pallet-ismp-relayer/std", "alloy-primitives/std" ] diff --git a/modules/ismp/pallets/state-coprocessor/src/impls.rs b/modules/ismp/pallets/state-coprocessor/src/impls.rs index 09413a505..cfa662bf6 100644 --- a/modules/ismp/pallets/state-coprocessor/src/impls.rs +++ b/modules/ismp/pallets/state-coprocessor/src/impls.rs @@ -18,7 +18,7 @@ use super::{Config, Pallet}; use alloc::{string::ToString, vec, vec::Vec}; use codec::{Decode, Encode}; -use evm_common::{derive_unhashed_map_key, presets::REQUEST_COMMITMENTS_SLOT}; +use evm_state_machine::{derive_unhashed_map_key, presets::REQUEST_COMMITMENTS_SLOT}; use ismp::{ events::RequestResponseHandled, handlers::validate_state_machine, diff --git a/modules/ismp/pallets/testsuite/Cargo.toml b/modules/ismp/pallets/testsuite/Cargo.toml index 11cbc6982..3ff06f379 100644 --- a/modules/ismp/pallets/testsuite/Cargo.toml +++ b/modules/ismp/pallets/testsuite/Cargo.toml @@ -31,7 +31,7 @@ hash-db = { workspace = true } xcm-simulator-example = { workspace = true } xcm-simulator = { workspace = true } pallet-assets = { workspace = true, default-features = true } -evm-common = { workspace = true, default-features = true} +evm-state-machine = { workspace = true, default-features = true} ismp = { workspace = true, default-features = true } ismp-testsuite = { workspace = true, default-features = true } diff --git a/modules/ismp/pallets/testsuite/src/tests/pallet_ismp_relayer.rs b/modules/ismp/pallets/testsuite/src/tests/pallet_ismp_relayer.rs index 0f520bc3f..bb92900b1 100644 --- a/modules/ismp/pallets/testsuite/src/tests/pallet_ismp_relayer.rs +++ b/modules/ismp/pallets/testsuite/src/tests/pallet_ismp_relayer.rs @@ -18,7 +18,7 @@ use alloy_primitives::hex; use codec::{Decode, Encode}; use ethereum_triedb::{keccak::KeccakHasher, MemoryDB, StorageProof}; -use evm_common::types::EvmStateProof; +use evm_state_machine::types::EvmStateProof; use frame_support::crypto::ecdsa::ECDSAExt; use ismp::{ consensus::{StateCommitment, StateMachineHeight, StateMachineId}, diff --git a/modules/ismp/clients/sync-committee/evm-common/Cargo.toml b/modules/ismp/state-machines/evm/Cargo.toml similarity index 97% rename from modules/ismp/clients/sync-committee/evm-common/Cargo.toml rename to modules/ismp/state-machines/evm/Cargo.toml index 78e089c89..f16444205 100644 --- a/modules/ismp/clients/sync-committee/evm-common/Cargo.toml +++ b/modules/ismp/state-machines/evm/Cargo.toml @@ -1,12 +1,11 @@ [package] -name = "evm-common" +name = "evm-state-machine" version = "0.1.1" edition = "2021" description = "Contains methods and types commonly used in evm state verification" authors = ["Polytope Labs "] publish = false - [dependencies] # polytope labs ismp = { workspace = true } diff --git a/modules/ismp/clients/sync-committee/evm-common/src/lib.rs b/modules/ismp/state-machines/evm/src/lib.rs similarity index 100% rename from modules/ismp/clients/sync-committee/evm-common/src/lib.rs rename to modules/ismp/state-machines/evm/src/lib.rs diff --git a/modules/ismp/clients/sync-committee/evm-common/src/presets.rs b/modules/ismp/state-machines/evm/src/presets.rs similarity index 100% rename from modules/ismp/clients/sync-committee/evm-common/src/presets.rs rename to modules/ismp/state-machines/evm/src/presets.rs diff --git a/modules/ismp/clients/sync-committee/evm-common/src/types.rs b/modules/ismp/state-machines/evm/src/types.rs similarity index 100% rename from modules/ismp/clients/sync-committee/evm-common/src/types.rs rename to modules/ismp/state-machines/evm/src/types.rs diff --git a/modules/ismp/clients/sync-committee/evm-common/src/utils.rs b/modules/ismp/state-machines/evm/src/utils.rs similarity index 100% rename from modules/ismp/clients/sync-committee/evm-common/src/utils.rs rename to modules/ismp/state-machines/evm/src/utils.rs diff --git a/tesseract/evm/Cargo.toml b/tesseract/evm/Cargo.toml index 60febca91..34e9a70fa 100644 --- a/tesseract/evm/Cargo.toml +++ b/tesseract/evm/Cargo.toml @@ -42,7 +42,7 @@ geth-primitives = { workspace = true, default-features = true } ismp-sync-committee = { workspace = true, default-features = true } ethereum-triedb = { workspace = true, default-features = true } mmr-primitives = { workspace = true, default-features = true } -evm-common = { workspace = true, default-features = true } +evm-state-machine = { workspace = true, default-features = true } sp-mmr-primitives = { workspace = true, default-features = true } tesseract-primitives = { workspace = true, default-features = true } diff --git a/tesseract/evm/src/lib.rs b/tesseract/evm/src/lib.rs index 93f7bb14e..ff5a8e352 100644 --- a/tesseract/evm/src/lib.rs +++ b/tesseract/evm/src/lib.rs @@ -10,7 +10,7 @@ use ethers::{ use frame_support::crypto::ecdsa::ECDSAExt; use ismp::{consensus::ConsensusStateId, events::Event, host::StateMachine, messaging::Message}; -use evm_common::presets::{ +use evm_state_machine::presets::{ REQUEST_COMMITMENTS_SLOT, REQUEST_RECEIPTS_SLOT, RESPONSE_COMMITMENTS_SLOT, RESPONSE_RECEIPTS_SLOT, }; diff --git a/tesseract/evm/src/provider.rs b/tesseract/evm/src/provider.rs index fd8bc7d5c..5829f95cc 100644 --- a/tesseract/evm/src/provider.rs +++ b/tesseract/evm/src/provider.rs @@ -11,7 +11,7 @@ use ethers::{ providers::Middleware, types::{CallFrame, GethDebugTracingCallOptions, GethTrace, GethTraceFrame}, }; -use evm_common::types::EvmStateProof; +use evm_state_machine::types::EvmStateProof; use ismp::{ consensus::{ConsensusStateId, StateMachineId}, events::{Event, StateCommitmentVetoed}, diff --git a/tesseract/evm/src/test.rs b/tesseract/evm/src/test.rs index 118f6c8e7..d3bafa1e2 100644 --- a/tesseract/evm/src/test.rs +++ b/tesseract/evm/src/test.rs @@ -1,7 +1,7 @@ use crate::{EvmClient, EvmConfig}; use codec::Decode; use ethers::providers::Middleware; -use evm_common::{ +use evm_state_machine::{ get_contract_account, get_value_from_proof, types::EvmStateProof, verify_membership, }; use hex_literal::hex; diff --git a/tesseract/integration-test/src/lib.rs b/tesseract/integration-test/src/lib.rs index ee332a5de..c821bb42a 100644 --- a/tesseract/integration-test/src/lib.rs +++ b/tesseract/integration-test/src/lib.rs @@ -434,8 +434,8 @@ async fn get_request_works() -> Result<(), anyhow::Error> { Ok(()) } -// #[tokio::test(flavor = "multi_thread")] -// #[ignore] +#[tokio::test(flavor = "multi_thread")] +#[ignore] async fn run_integration_tests() -> Result<(), anyhow::Error> { let _ = log_setup(); let (chain_a_sub_client, chain_b_sub_client) = create_clients().await?;