From a51dcbd3c3e11fddd8938e1aae94fbe944c01550 Mon Sep 17 00:00:00 2001 From: Seun Lanlege Date: Thu, 19 Sep 2024 13:42:25 +0000 Subject: [PATCH] simplify ismp-grandpa --- Cargo.lock | 101 ++---------------- Cargo.toml | 6 +- .../sync-committee/primitives/Cargo.toml | 4 +- .../primitives/src/consensus_types.rs | 94 ++++++++-------- .../primitives/src/ssz/byte_list.rs | 2 +- .../primitives/src/ssz/byte_vector.rs | 2 +- modules/hyperclient/Cargo.toml | 4 +- modules/hyperclient/src/interfaces.rs | 2 +- modules/hyperclient/src/types.rs | 4 +- modules/ismp/clients/grandpa/README.md | 17 +-- modules/ismp/clients/grandpa/src/consensus.rs | 17 ++- modules/ismp/clients/grandpa/src/lib.rs | 96 ++++------------- modules/ismp/core/Cargo.toml | 4 +- modules/ismp/core/src/consensus.rs | 4 +- modules/ismp/core/src/events.rs | 8 +- modules/ismp/core/src/messaging.rs | 6 +- modules/ismp/core/src/router.rs | 28 ++--- modules/utils/serde/Cargo.toml | 14 +-- parachain/node/Cargo.toml | 6 +- parachain/node/src/chain_spec.rs | 50 --------- parachain/node/src/command.rs | 33 ------ parachain/node/src/service.rs | 9 -- parachain/runtimes/messier/src/lib.rs | 6 +- scripts/release-crates.sh | 2 +- tesseract/evm/Cargo.toml | 2 +- tesseract/evm/src/lib.rs | 2 +- tesseract/substrate/Cargo.toml | 2 +- tesseract/substrate/src/lib.rs | 2 +- 28 files changed, 146 insertions(+), 381 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c16fd5ddb..972a65235 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7185,7 +7185,6 @@ dependencies = [ "ismp-parachain-runtime-api", "jsonrpsee 0.23.2", "log", - "messier-runtime", "mmr-gadget 29.0.1", "nexus-runtime", "pallet-ismp", @@ -7279,7 +7278,7 @@ dependencies = [ "parity-scale-codec", "primitive-types", "serde", - "serde-utils", + "serde-hex-utils", "serde-wasm-bindgen 0.6.5", "serde_json", "sp-core 34.0.0", @@ -7663,7 +7662,7 @@ dependencies = [ "primitive-types", "scale-info", "serde", - "serde-utils", + "serde-hex-utils", "serde_json", ] @@ -10027,91 +10026,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "messier-runtime" -version = "0.1.1" -dependencies = [ - "cumulus-pallet-aura-ext", - "cumulus-pallet-dmp-queue", - "cumulus-pallet-parachain-system", - "cumulus-pallet-session-benchmarking", - "cumulus-pallet-xcm", - "cumulus-pallet-xcmp-queue", - "cumulus-primitives-aura", - "cumulus-primitives-core", - "cumulus-primitives-timestamp", - "cumulus-primitives-utility", - "frame-benchmarking", - "frame-executive", - "frame-metadata-hash-extension", - "frame-support 37.0.0", - "frame-system", - "frame-system-benchmarking", - "frame-system-rpc-runtime-api", - "frame-try-runtime 0.43.0", - "hex-literal 0.4.1", - "hyperbridge-client-machine", - "ismp", - "ismp-bsc", - "ismp-parachain", - "ismp-parachain-runtime-api", - "ismp-sync-committee", - "log", - "orml-traits", - "orml-xcm-support", - "pallet-asset-gateway", - "pallet-asset-rate", - "pallet-assets", - "pallet-aura", - "pallet-authorship", - "pallet-balances", - "pallet-call-decompressor", - "pallet-collator-selection", - "pallet-collective", - "pallet-ismp", - "pallet-ismp-demo", - "pallet-ismp-host-executive", - "pallet-ismp-relayer", - "pallet-ismp-runtime-api", - "pallet-message-queue", - "pallet-mmr 0.1.1", - "pallet-mmr-runtime-api", - "pallet-session", - "pallet-sudo", - "pallet-timestamp", - "pallet-token-governor", - "pallet-transaction-payment", - "pallet-transaction-payment-rpc-runtime-api", - "pallet-treasury", - "pallet-xcm", - "parachains-common", - "parity-scale-codec", - "polkadot-parachain-primitives", - "polkadot-runtime-common", - "scale-info", - "simnode-runtime-api", - "smallvec", - "sp-api 34.0.0", - "sp-block-builder 34.0.0", - "sp-consensus-aura 0.40.0", - "sp-core 34.0.0", - "sp-genesis-builder 0.15.0", - "sp-inherents 34.0.0", - "sp-mmr-primitives", - "sp-offchain 34.0.0", - "sp-runtime 39.0.0", - "sp-session 35.0.0", - "sp-std 14.0.0", - "sp-storage 21.0.0", - "sp-transaction-pool 34.0.0", - "sp-version 37.0.0", - "staging-parachain-info", - "staging-xcm", - "staging-xcm-builder", - "staging-xcm-executor", - "substrate-wasm-builder", -] - [[package]] name = "metrics" version = "0.18.1" @@ -19954,15 +19868,12 @@ dependencies = [ ] [[package]] -name = "serde-utils" +name = "serde-hex-utils" version = "0.1.0" dependencies = [ "anyhow", "hex", - "ismp", - "primitive-types", "serde", - "serde_json", ] [[package]] @@ -23449,7 +23360,7 @@ dependencies = [ "parity-scale-codec", "primitive-types", "serde", - "serde-utils", + "serde-hex-utils", "ssz-rs", ] @@ -23761,7 +23672,7 @@ dependencies = [ "reqwest-middleware", "reqwest-retry", "serde", - "serde-utils", + "serde-hex-utils", "serde_json", "sp-core 34.0.0", "sp-mmr-primitives", @@ -23885,7 +23796,7 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.12.3", "serde", - "serde-utils", + "serde-hex-utils", "sp-core 34.0.0", "substrate-state-machine", "subxt", diff --git a/Cargo.toml b/Cargo.toml index 10f4467ec..27c9c2e1e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "2" members = [ # runtime "parachain/runtimes/gargantua", - "parachain/runtimes/messier", +# "parachain/runtimes/messier", "parachain/runtimes/nexus", # node @@ -260,7 +260,7 @@ ismp-solidity-abi = { path = "./evm/abi", default-features = false } simnode-tests = { path = "parachain/simtests" } hyperclient = { path = "modules/hyperclient", default-features = false } subxt-utils = { path = "modules/utils/subxt", default-features = false } -serde-utils = { version = "0.1.0", path = "modules/utils/serde", default-features = false } +serde-hex-utils = { version = "0.1.0", path = "modules/utils/serde", default-features = false } # consensus provers & verifiers beefy-verifier-primitives = { path = "./modules/consensus/beefy/primitives", default-features = false } @@ -313,7 +313,7 @@ mmr-primitives = { version = "1.15.0", path = "modules/trees/mmr/primitives", de # runtimes gargantua-runtime = { path = "./parachain/runtimes/gargantua", default-features = false } -messier-runtime = { path = "./parachain/runtimes/messier", default-features = false } +#messier-runtime = { path = "./parachain/runtimes/messier", default-features = false } nexus-runtime = { path = "./parachain/runtimes/nexus", default-features = false } # tesseract diff --git a/modules/consensus/sync-committee/primitives/Cargo.toml b/modules/consensus/sync-committee/primitives/Cargo.toml index 8de4fb467..3c08e1c3a 100644 --- a/modules/consensus/sync-committee/primitives/Cargo.toml +++ b/modules/consensus/sync-committee/primitives/Cargo.toml @@ -20,7 +20,7 @@ anyhow = {workspace = true, default-features = false} ark-ec = { version = "0.4.2", default-features = false } ark-bls12-381 = { version = "0.4.0", default-features = false } bls_on_arkworks = { version = "0.2.2", default-features = false } -serde-utils = { workspace = true, default-features = false } +serde-hex-utils = { workspace = true, default-features = false } [features] default = ["std"] @@ -35,6 +35,6 @@ std = [ "ark-bls12-381/std", "primitive-types/std", "serde", - "serde-utils/std" + "serde-hex-utils/std" ] diff --git a/modules/consensus/sync-committee/primitives/src/consensus_types.rs b/modules/consensus/sync-committee/primitives/src/consensus_types.rs index 06edd6090..85794fedb 100644 --- a/modules/consensus/sync-committee/primitives/src/consensus_types.rs +++ b/modules/consensus/sync-committee/primitives/src/consensus_types.rs @@ -13,9 +13,9 @@ use ssz_rs::{prelude::*, Deserialize, List, Vector}; #[derive(Default, Debug, SimpleSerialize, Clone, PartialEq, Eq, codec::Encode, codec::Decode)] #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct BeaconBlockHeader { - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub slot: u64, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub proposer_index: u64, pub parent_root: Root, pub state_root: Root, @@ -25,7 +25,7 @@ pub struct BeaconBlockHeader { #[derive(Default, Clone, Debug, SimpleSerialize, PartialEq, Eq, codec::Encode, codec::Decode)] #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct Checkpoint { - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub epoch: u64, pub root: Root, } @@ -34,7 +34,7 @@ pub struct Checkpoint { #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct Eth1Data { pub deposit_root: Root, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub deposit_count: u64, pub block_hash: Hash32, } @@ -45,17 +45,17 @@ pub struct Validator { #[cfg_attr(feature = "std", serde(rename = "pubkey"))] pub public_key: BlsPublicKey, pub withdrawal_credentials: Bytes32, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub effective_balance: Gwei, pub slashed: bool, // Status epochs - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub activation_eligibility_epoch: Epoch, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub activation_epoch: Epoch, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub exit_epoch: Epoch, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub withdrawable_epoch: Epoch, } @@ -76,7 +76,7 @@ pub struct SignedBeaconBlockHeader { #[derive(Default, Debug, SimpleSerialize, Clone, PartialEq, Eq, codec::Encode, codec::Decode)] #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct IndexedAttestation { - #[cfg_attr(feature = "std", serde(with = "serde_utils::seq_of_str"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::seq_of_str"))] pub attesting_indices: List, pub data: AttestationData, pub signature: BlsSignature, @@ -85,9 +85,9 @@ pub struct IndexedAttestation { #[derive(Default, Clone, Debug, SimpleSerialize, PartialEq, Eq, codec::Encode, codec::Decode)] #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct AttestationData { - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub slot: u64, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub index: u64, pub beacon_block_root: Root, pub source: Checkpoint, @@ -122,7 +122,7 @@ pub struct DepositData { #[cfg_attr(feature = "std", serde(rename = "pubkey"))] pub public_key: BlsPublicKey, pub withdrawal_credentials: Hash32, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub amount: u64, pub signature: BlsSignature, } @@ -130,9 +130,9 @@ pub struct DepositData { #[derive(Default, Debug, SimpleSerialize, codec::Encode, codec::Decode, Clone, PartialEq, Eq)] #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct VoluntaryExit { - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub epoch: u64, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub validator_index: u64, } @@ -162,19 +162,19 @@ pub struct SyncCommittee { #[derive(Default, Debug, Clone, SimpleSerialize, PartialEq, Eq, codec::Encode, codec::Decode)] #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct Withdrawal { - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub index: WithdrawalIndex, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub validator_index: ValidatorIndex, pub address: ExecutionAddress, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub amount: Gwei, } #[derive(Default, Debug, Clone, SimpleSerialize, PartialEq, Eq, codec::Encode, codec::Decode)] #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct BlsToExecutionChange { - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub validator_index: ValidatorIndex, #[cfg_attr(feature = "std", serde(rename = "from_bls_pubkey"))] pub from_bls_public_key: BlsPublicKey, @@ -205,22 +205,22 @@ pub struct ExecutionPayload< pub receipts_root: Bytes32, pub logs_bloom: ByteVector, pub prev_randao: Bytes32, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub block_number: u64, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub gas_limit: u64, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub gas_used: u64, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub timestamp: u64, pub extra_data: ByteList, pub base_fee_per_gas: U256, pub block_hash: Hash32, pub transactions: List, MAX_TRANSACTIONS_PER_PAYLOAD>, pub withdrawals: List, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub blob_gas_used: u64, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub excess_blob_gas: u64, } @@ -236,22 +236,22 @@ pub struct ExecutionPayloadHeader< pub receipts_root: Bytes32, pub logs_bloom: ByteVector, pub prev_randao: Bytes32, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub block_number: u64, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub gas_limit: u64, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub gas_used: u64, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub timestamp: u64, pub extra_data: ByteList, pub base_fee_per_gas: U256, pub block_hash: Hash32, pub transactions_root: Root, pub withdrawals_root: Root, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub blob_gas_used: u64, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub excess_blob_gas: u64, } @@ -312,9 +312,9 @@ pub struct BeaconBlock< const MAX_BLS_TO_EXECUTION_CHANGES: usize, const MAX_BLOB_COMMITMENTS_PER_BLOCK: usize, > { - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub slot: Slot, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub proposer_index: ValidatorIndex, pub parent_root: Root, pub state_root: Root, @@ -338,18 +338,18 @@ pub struct BeaconBlock< #[derive(Default, Debug, SimpleSerialize, Clone, PartialEq, Eq, codec::Encode, codec::Decode)] #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct Fork { - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_hex"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_hex"))] pub previous_version: Version, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_hex"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_hex"))] pub current_version: Version, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub epoch: Epoch, } #[derive(Default, Debug, SimpleSerialize, Clone, codec::Encode, codec::Decode)] #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct ForkData { - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_hex"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_hex"))] pub current_version: Version, pub genesis_validators_root: Root, } @@ -375,10 +375,10 @@ pub struct BeaconState< const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize, > { - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub genesis_time: u64, pub genesis_validators_root: Root, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub slot: Slot, pub fork: Fork, pub latest_block_header: BeaconBlockHeader, @@ -387,31 +387,31 @@ pub struct BeaconState< pub historical_roots: List, pub eth1_data: Eth1Data, pub eth1_data_votes: List, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub eth1_deposit_index: u64, pub validators: List, - #[cfg_attr(feature = "std", serde(with = "serde_utils::seq_of_str"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::seq_of_str"))] pub balances: List, pub randao_mixes: Vector, - #[cfg_attr(feature = "std", serde(with = "serde_utils::seq_of_str"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::seq_of_str"))] pub slashings: Vector, - #[cfg_attr(feature = "std", serde(with = "serde_utils::seq_of_str"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::seq_of_str"))] pub previous_epoch_participation: List, - #[cfg_attr(feature = "std", serde(with = "serde_utils::seq_of_str"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::seq_of_str"))] pub current_epoch_participation: List, pub justification_bits: Bitvector, pub previous_justified_checkpoint: Checkpoint, pub current_justified_checkpoint: Checkpoint, pub finalized_checkpoint: Checkpoint, - #[cfg_attr(feature = "std", serde(with = "serde_utils::seq_of_str"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::seq_of_str"))] pub inactivity_scores: List, pub current_sync_committee: SyncCommittee, pub next_sync_committee: SyncCommittee, pub latest_execution_payload_header: ExecutionPayloadHeader, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub next_withdrawal_index: WithdrawalIndex, - #[cfg_attr(feature = "std", serde(with = "serde_utils::as_string"))] + #[cfg_attr(feature = "std", serde(with = "serde_hex_utils::as_string"))] pub next_withdrawal_validator_index: ValidatorIndex, pub historical_summaries: List, } diff --git a/modules/consensus/sync-committee/primitives/src/ssz/byte_list.rs b/modules/consensus/sync-committee/primitives/src/ssz/byte_list.rs index 6ba165723..9fa982bb1 100644 --- a/modules/consensus/sync-committee/primitives/src/ssz/byte_list.rs +++ b/modules/consensus/sync-committee/primitives/src/ssz/byte_list.rs @@ -10,7 +10,7 @@ use ssz_rs::prelude::*; #[derive(Default, Clone, Eq, SimpleSerialize, codec::Encode, codec::Decode)] #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct ByteList( - #[cfg_attr(feature = "serde", serde(with = "serde_utils::as_hex"))] List, + #[cfg_attr(feature = "serde", serde(with = "serde_hex_utils::as_hex"))] List, ); impl TryFrom<&[u8]> for ByteList { diff --git a/modules/consensus/sync-committee/primitives/src/ssz/byte_vector.rs b/modules/consensus/sync-committee/primitives/src/ssz/byte_vector.rs index bb2dcfa5e..56903d721 100644 --- a/modules/consensus/sync-committee/primitives/src/ssz/byte_vector.rs +++ b/modules/consensus/sync-committee/primitives/src/ssz/byte_vector.rs @@ -10,7 +10,7 @@ use ssz_rs::prelude::*; #[derive(Default, Clone, Eq, SimpleSerialize, codec::Encode, codec::Decode)] #[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] pub struct ByteVector( - #[cfg_attr(feature = "serde", serde(with = "serde_utils::as_hex"))] Vector, + #[cfg_attr(feature = "serde", serde(with = "serde_hex_utils::as_hex"))] Vector, ); impl TryFrom<&[u8]> for ByteVector { diff --git a/modules/hyperclient/Cargo.toml b/modules/hyperclient/Cargo.toml index 272ef6fc8..bab0ac657 100644 --- a/modules/hyperclient/Cargo.toml +++ b/modules/hyperclient/Cargo.toml @@ -29,7 +29,7 @@ ethereum-triedb = { workspace = true } subxt-utils = { workspace = true } mmr-primitives = { workspace = true } sp-mmr-primitives = { workspace = true } -serde-utils = { workspace = true } +serde-hex-utils = { workspace = true } # crates.io getrandom = { version = "0.2", default-features = false, features = ["js"] } @@ -61,7 +61,7 @@ std = [ "subxt/jsonrpsee", "subxt-utils/std", "sp-core/std", - "serde-utils/std", + "serde-hex-utils/std", "substrate-state-machine/std", ] testing = [] diff --git a/modules/hyperclient/src/interfaces.rs b/modules/hyperclient/src/interfaces.rs index c59d87170..a1e8072c4 100644 --- a/modules/hyperclient/src/interfaces.rs +++ b/modules/hyperclient/src/interfaces.rs @@ -252,7 +252,7 @@ pub struct JsPostResponse { /// The request that triggered this response. pub post: JsPost, /// The response message. - #[serde(with = "serde_utils::as_hex")] + #[serde(with = "serde_hex_utils::as_hex")] pub response: Vec, /// Timestamp at which this response expires in seconds. #[serde(rename = "timeoutTimestamp")] diff --git a/modules/hyperclient/src/types.rs b/modules/hyperclient/src/types.rs index 905858216..12c8942a7 100644 --- a/modules/hyperclient/src/types.rs +++ b/modules/hyperclient/src/types.rs @@ -143,7 +143,7 @@ pub enum MessageStatusWithMetadata { #[serde(flatten)] meta: EventMetadata, /// Calldata that encodes the proof for the message to be sent to the destination. - #[serde(with = "serde_utils::as_hex")] + #[serde(with = "serde_hex_utils::as_hex")] calldata: Bytes, }, /// Delivered to destination @@ -236,7 +236,7 @@ pub enum TimeoutStatus { /// Encoded call data to be submitted to source chain TimeoutMessage { /// Calldata that encodes the proof for the timeout message on the source. - #[serde(with = "serde_utils::as_hex")] + #[serde(with = "serde_hex_utils::as_hex")] calldata: Bytes, }, } diff --git a/modules/ismp/clients/grandpa/README.md b/modules/ismp/clients/grandpa/README.md index 90871ec52..aaf7d2dd3 100644 --- a/modules/ismp/clients/grandpa/README.md +++ b/modules/ismp/clients/grandpa/README.md @@ -6,21 +6,22 @@ The consensus client relies on a pallet which stores a list of parachains and St ## Overview -The Pallet allows the [`AdminOrigin`](https://docs.rs/pallet-ismp/latest/pallet_ismp/pallet/trait.Config.html#associatedtype.AdminOrigin) configured in [`pallet-ismp`](https://docs.rs/pallet-ismp/latest/pallet_ismp) to dispatch calls for adding and removing parachains or standalone chains from the pallet whitelist. +The Pallet allows the [`AdminOrigin`](https://docs.rs/pallet-ismp/latest/pallet_ismp/pallet/trait.Config.html#associatedtype.AdminOrigin) configured in [`pallet-ismp`](https://docs.rs/pallet-ismp/latest/pallet_ismp) to dispatch calls for adding and removing substrate-based chains from the pallet whitelist. ## Setting up When using this consensus client the following should be done in order: -- Create the consensus state using [`create_consensus_client`](https://docs.rs/pallet-ismp/latest/pallet_ismp/pallet/dispatchables/fn.create_consensus_client.html) + +- Create the consensus state using [`create_consensus_client`](https://docs.rs/pallet-ismp/latest/pallet_ismp/pallet/dispatchables/fn.create_consensus_client.html) -- The supported parachain ids or state machine identifiers should be whitelisted in the pallet by calling `add_parachains` or `add_state_machines` from the [`AdminOrigin`].
- Note, if a parachain id is not found in the whitelist state machine updates for that parachain will be unavailable.
- If a state machine identifier of a solo chain is not found in the whitelist, ismp messages from that chain will be rejected. +- The supported state machine identifiers should be whitelisted in the pallet by calling `add_state_machines` from the [`AdminOrigin`].
+ +## Note -### Dispatchable Functions +If a state machine identifier is not found in the whitelist, ismp datagrams from that chain will be rejected. + +## Dispatchable Functions -- `add_parachains` - Adds some parachains to the list of whitelisted parachains. -- `remove_parachains` - Removes some parachains from the whitelisted parachains. - `add_state_machines` - Adds some standalone chain state machine identifiers to the whitelist. - `remove_state_machines` - Removes some standalone chain state machine identifiers from the whitelist. diff --git a/modules/ismp/clients/grandpa/src/consensus.rs b/modules/ismp/clients/grandpa/src/consensus.rs index f110b3903..dbd455ce2 100644 --- a/modules/ismp/clients/grandpa/src/consensus.rs +++ b/modules/ismp/clients/grandpa/src/consensus.rs @@ -14,7 +14,7 @@ use crate::{ messages::{ConsensusMessage, SubstrateHeader}, - Parachains, SupportedStateMachines, + SupportedStateMachines, }; use alloc::{boxed::Box, collections::BTreeMap, format, vec::Vec}; use codec::{Decode, Encode}; @@ -98,13 +98,16 @@ where consensus_state, headers_with_finality_proof, ) - .map_err(|_| Error::Custom(format!("Error verifying parachain headers")))?; + .map_err(|_| Error::Custom("Error verifying parachain headers".into()))?; let parachain_headers = parachain_headers .into_iter() // filter out unknown para ids .filter_map(|(para_id, header)| { - if let Some(slot_duration) = Parachains::::get(para_id) { + if let Some(slot_duration) = + SupportedStateMachines::::get(StateMachine::Polkadot(para_id)) + .or(SupportedStateMachines::::get(StateMachine::Kusama(para_id))) + { Some((para_id, header, slot_duration)) } else { None @@ -162,7 +165,6 @@ where Ok((consensus_state.encode(), intermediates)) }, - ConsensusMessage::StandaloneChainMessage(standalone_chain_message) => { let (consensus_state, header, _, _) = verify_grandpa_finality_proof( consensus_state, @@ -316,12 +318,7 @@ where } fn state_machine(&self, id: StateMachine) -> Result, Error> { - let is_supported_para = match &id { - StateMachine::Polkadot(id) | StateMachine::Kusama(id) => - Parachains::::contains_key(*id), - _ => false, - }; - if SupportedStateMachines::::contains_key(id) || is_supported_para { + if SupportedStateMachines::::contains_key(id) { Ok(Box::new(SubstrateStateMachine::::default())) } else { Err(Error::Custom(format!("Unsupported State Machine {id:?}"))) diff --git a/modules/ismp/clients/grandpa/src/lib.rs b/modules/ismp/clients/grandpa/src/lib.rs index 63da8a024..dc8c4f1c4 100644 --- a/modules/ismp/clients/grandpa/src/lib.rs +++ b/modules/ismp/clients/grandpa/src/lib.rs @@ -19,7 +19,7 @@ pub mod consensus; pub mod messages; use alloc::vec::Vec; -use ismp::consensus::ConsensusStateId; +use ismp::host::StateMachine; pub use pallet::*; #[frame_support::pallet] @@ -27,10 +27,7 @@ pub mod pallet { use super::*; use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; - use ismp::{ - consensus::StateMachineId, - host::{IsmpHost, StateMachine}, - }; + use ismp::host::IsmpHost; #[pallet::pallet] #[pallet::without_storage_info] @@ -42,6 +39,7 @@ pub mod pallet { /// The overarching event type type RuntimeEvent: From> + IsType<::RuntimeEvent>; + /// IsmpHost implementation type IsmpHost: IsmpHost + Default; } @@ -49,23 +47,13 @@ pub mod pallet { #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { - /// Parachains with the `para_ids` have been added to the whitelist - ParachainsAdded { - /// The parachains in question - para_ids: Vec<(u32, u64)>, - }, - /// Parachains with the `para_ids` have been removed from the whitelist - ParachainsRemoved { - /// The parachains in question - para_ids: Vec, - }, - /// Standalone Chain Added to whitelist - StandaloneChainsAdded { + /// State machines have been added to whitelist + StateMachineAdded { /// The state machines in question state_machines: Vec, }, - /// Standalone have been removed from the whitelist - StandaloneChainsRemoved { + /// State machines have been removed from the whitelist + StateMachineRemoved { /// The state machines in question state_machines: Vec, }, @@ -91,11 +79,7 @@ pub mod pallet { #[pallet::storage] #[pallet::getter(fn state_machines)] pub type SupportedStateMachines = - StorageMap<_, Twox64Concat, StateMachine, bool, OptionQuery>; - - /// List of parachains that this state machine is interested in. - #[pallet::storage] - pub type Parachains = StorageMap<_, Identity, u32, u64>; + StorageMap<_, Twox64Concat, StateMachine, u64, OptionQuery>; #[pallet::call] impl Pallet { @@ -104,14 +88,18 @@ pub mod pallet { #[pallet::weight((0, DispatchClass::Mandatory))] pub fn add_state_machines( origin: OriginFor, - state_machines: Vec, + new_state_machines: Vec, ) -> DispatchResult { T::AdminOrigin::ensure_origin(origin)?; - for state_machine in state_machines { - SupportedStateMachines::::insert(state_machine, true) + let state_machines = + new_state_machines.iter().map(|a| a.state_machine.clone()).collect(); + for AddStateMachine { state_machine, slot_duration } in new_state_machines { + SupportedStateMachines::::insert(state_machine, slot_duration); } + Self::deposit_event(Event::StateMachineAdded { state_machines }); + Ok(()) } @@ -128,58 +116,18 @@ pub mod pallet { SupportedStateMachines::::remove(state_machine) } - Self::deposit_event(Event::StandaloneChainsRemoved { state_machines }); - - Ok(()) - } - - /// Add some new parachains to the parachains whitelist - #[pallet::call_index(2)] - #[pallet::weight(::DbWeight::get().writes(data.parachains.len() as u64))] - pub fn add_parachains(origin: OriginFor, data: ParachainData) -> DispatchResult { - T::AdminOrigin::ensure_origin(origin)?; - let host = ::default(); - for (para, slot_duration) in &data.parachains { - let state_id = match ::Coprocessor::get() { - Some(StateMachine::Kusama(_)) => StateMachine::Kusama(*para), - Some(StateMachine::Polkadot(_)) => StateMachine::Polkadot(*para), - _ => continue, - }; - Parachains::::insert(*para, slot_duration); - let _ = host.store_challenge_period( - StateMachineId { state_id, consensus_state_id: data.consensus_state_id }, - data.challenge_period, - ); - } - - Self::deposit_event(Event::ParachainsAdded { para_ids: data.parachains }); - - Ok(()) - } - - /// Removes some parachains from the parachains whitelist - #[pallet::call_index(3)] - #[pallet::weight(::DbWeight::get().writes(para_ids.len() as u64))] - pub fn remove_parachains(origin: OriginFor, para_ids: Vec) -> DispatchResult { - T::AdminOrigin::ensure_origin(origin)?; - for id in ¶_ids { - Parachains::::remove(id); - } - - Self::deposit_event(Event::ParachainsRemoved { para_ids }); + Self::deposit_event(Event::StateMachineRemoved { state_machines }); Ok(()) } } } -/// Update the parachain whitelist +/// Update the state machine whitelist #[derive(Clone, codec::Encode, codec::Decode, scale_info::TypeInfo, Debug, PartialEq, Eq)] -pub struct ParachainData { - /// Consensus state id for the parachains - pub consensus_state_id: ConsensusStateId, - /// A list of parachain ids and slot duration - pub parachains: Vec<(u32, u64)>, - /// Challenge period for the parachains - pub challenge_period: u64, +pub struct AddStateMachine { + /// State machine to add + pub state_machine: StateMachine, + /// It's slot duration + pub slot_duration: u64, } diff --git a/modules/ismp/core/Cargo.toml b/modules/ismp/core/Cargo.toml index 8b69f2444..98b6c5176 100644 --- a/modules/ismp/core/Cargo.toml +++ b/modules/ismp/core/Cargo.toml @@ -21,7 +21,7 @@ derive_more = { version = "0.99.17", default-features = false, features = ["from serde_json = { version = "1.0.99", default-features = false, features = ["alloc"] } hex = { version = "0.4.3", features = ["alloc"], default-features = false } anyhow = {workspace = true, default-features = false} -serde-utils = { workspace = true, default-features = false } +serde-hex-utils = { workspace = true, default-features = false } [features] default = ["std"] @@ -34,5 +34,5 @@ std = [ "anyhow/std", "hex/std", "serde_json/std", - "serde-utils/std" + "serde-hex-utils/std" ] diff --git a/modules/ismp/core/src/consensus.rs b/modules/ismp/core/src/consensus.rs index ce3e0429f..603567d84 100644 --- a/modules/ismp/core/src/consensus.rs +++ b/modules/ismp/core/src/consensus.rs @@ -94,10 +94,10 @@ pub struct IntermediateState { )] pub struct StateMachineId { /// The state machine identifier - #[serde(with = "serde_utils::as_string")] + #[serde(with = "serde_hex_utils::as_string")] pub state_id: StateMachine, /// It's consensus state identifier - #[serde(with = "serde_utils::as_utf8_string")] + #[serde(with = "serde_hex_utils::as_utf8_string")] pub consensus_state_id: ConsensusStateId, } diff --git a/modules/ismp/core/src/events.rs b/modules/ismp/core/src/events.rs index f9496d341..36a388064 100644 --- a/modules/ismp/core/src/events.rs +++ b/modules/ismp/core/src/events.rs @@ -41,7 +41,7 @@ pub struct StateCommitmentVetoed { /// The state commitment identifier pub height: StateMachineHeight, /// The account responsible - #[serde(with = "serde_utils::as_hex")] + #[serde(with = "serde_hex_utils::as_hex")] pub fisherman: Vec, } @@ -53,7 +53,7 @@ pub struct RequestResponseHandled { /// The commitment to the request or response pub commitment: H256, /// The address of the relayer responsible for relaying the request - #[serde(with = "serde_utils::as_hex")] + #[serde(with = "serde_hex_utils::as_hex")] pub relayer: Vec, } @@ -65,10 +65,10 @@ pub struct TimeoutHandled { /// The commitment to the request or response pub commitment: H256, /// The source chain of the message - #[serde(with = "serde_utils::as_string")] + #[serde(with = "serde_hex_utils::as_string")] pub source: StateMachine, /// The destination chain of the message - #[serde(with = "serde_utils::as_string")] + #[serde(with = "serde_hex_utils::as_string")] pub dest: StateMachine, } diff --git a/modules/ismp/core/src/messaging.rs b/modules/ismp/core/src/messaging.rs index 433579d87..92746e1cb 100644 --- a/modules/ismp/core/src/messaging.rs +++ b/modules/ismp/core/src/messaging.rs @@ -88,13 +88,13 @@ pub struct StateCommitmentHeight { )] pub struct CreateConsensusState { /// Scale encoded consensus state - #[serde(with = "serde_utils::as_hex")] + #[serde(with = "serde_hex_utils::as_hex")] pub consensus_state: Vec, /// Consensus client id - #[serde(with = "serde_utils::as_utf8_string")] + #[serde(with = "serde_hex_utils::as_utf8_string")] pub consensus_client_id: ConsensusClientId, /// The consensus state Id - #[serde(with = "serde_utils::as_utf8_string")] + #[serde(with = "serde_hex_utils::as_utf8_string")] pub consensus_state_id: ConsensusStateId, /// Unbonding period for this consensus state. pub unbonding_period: u64, diff --git a/modules/ismp/core/src/router.rs b/modules/ismp/core/src/router.rs index 40a454f52..ef00b336e 100644 --- a/modules/ismp/core/src/router.rs +++ b/modules/ismp/core/src/router.rs @@ -34,23 +34,23 @@ use core::{fmt::Formatter, time::Duration}; )] pub struct PostRequest { /// The source state machine of this request. - #[serde(with = "serde_utils::as_string")] + #[serde(with = "serde_hex_utils::as_string")] pub source: StateMachine, /// The destination state machine of this request. - #[serde(with = "serde_utils::as_string")] + #[serde(with = "serde_hex_utils::as_string")] pub dest: StateMachine, /// The nonce of this request on the source chain pub nonce: u64, /// Module identifier of the sending module - #[serde(with = "serde_utils::as_hex")] + #[serde(with = "serde_hex_utils::as_hex")] pub from: Vec, /// Module identifier of the receiving module - #[serde(with = "serde_utils::as_hex")] + #[serde(with = "serde_hex_utils::as_hex")] pub to: Vec, /// Timestamp which this request expires in seconds. pub timeout_timestamp: u64, /// Encoded request body - #[serde(with = "serde_utils::as_hex")] + #[serde(with = "serde_hex_utils::as_hex")] pub body: Vec, } @@ -95,15 +95,15 @@ impl core::fmt::Display for PostRequest { )] pub struct GetRequest { /// The source state machine of this request. - #[serde(with = "serde_utils::as_string")] + #[serde(with = "serde_hex_utils::as_string")] pub source: StateMachine, /// The destination state machine of this request. - #[serde(with = "serde_utils::as_string")] + #[serde(with = "serde_hex_utils::as_string")] pub dest: StateMachine, /// The nonce of this request on the source chain pub nonce: u64, /// Module identifier of the sending module - #[serde(with = "serde_utils::as_hex")] + #[serde(with = "serde_hex_utils::as_hex")] pub from: Vec, /// Raw Storage keys that would be used to fetch the values from the counterparty /// For deriving storage keys for ink contract fields follow the guide in the link below @@ -119,12 +119,12 @@ pub struct GetRequest { /// For fetching keys from EVM contracts each key should either be 52 bytes or 20 bytes /// For 52 byte keys we expect it to be a concatenation of contract address and slot hash /// For 20 bytes we expect it to be a contract or account address - #[serde(with = "serde_utils::seq_of_hex")] + #[serde(with = "serde_hex_utils::seq_of_hex")] pub keys: Vec>, /// Height at which to read the state machine. pub height: u64, /// Some application-specific metadata relating to this request - #[serde(with = "serde_utils::as_hex")] + #[serde(with = "serde_hex_utils::as_hex")] pub context: Vec, /// Host timestamp at which this request expires in seconds pub timeout_timestamp: u64, @@ -294,7 +294,7 @@ pub struct PostResponse { /// The request that triggered this response. pub post: PostRequest, /// The response message. - #[serde(with = "serde_utils::as_hex")] + #[serde(with = "serde_hex_utils::as_hex")] pub response: Vec, /// Timestamp at which this response expires in seconds. pub timeout_timestamp: u64, @@ -408,11 +408,11 @@ impl GetResponse { )] pub struct StorageValue { /// The request storage keys - #[serde(with = "serde_utils::as_hex")] + #[serde(with = "serde_hex_utils::as_hex")] pub key: Vec, /// The verified value - #[serde(serialize_with = "serde_utils::as_hex::serialize_option")] - #[serde(deserialize_with = "serde_utils::as_hex::deserialize_option")] + #[serde(serialize_with = "serde_hex_utils::as_hex::serialize_option")] + #[serde(deserialize_with = "serde_hex_utils::as_hex::deserialize_option")] pub value: Option>, } diff --git a/modules/utils/serde/Cargo.toml b/modules/utils/serde/Cargo.toml index 01b358381..185a398c3 100644 --- a/modules/utils/serde/Cargo.toml +++ b/modules/utils/serde/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "serde-utils" +name = "serde-hex-utils" version = "0.1.0" edition = "2021" authors = ["Polytope Labs "] license = "Apache-2.0" repository = "https://github.com/polytope-labs/hyperbridge" -documentation = "https://docs.rs/serde-utils" -description = "Collection of useful (De)serialization utilities for serde" +documentation = "https://docs.rs/serde-hex-utils" +description = "Collection of hexadecimal (De)serialization utilities for serde" keywords = ["serde", "utilities"] readme = "./README.md" @@ -14,7 +14,7 @@ readme = "./README.md" # crates.io serde = { workspace = true, features = ["derive"] } hex = { version = "0.4.3", features = ["alloc"], default-features = false } -anyhow = {workspace = true, default-features = false} +anyhow = {workspace = true, default-features = false } [features] default = ["std"] @@ -25,6 +25,6 @@ std = [ ] [dev-dependencies] -ismp = { workspace = true, default-features = true } -primitive-types = { workspace = true, features = ["codec", "scale-info", "serde_no_std"] } -serde_json = { version = "1.0.99", default-features = false, features = ["alloc"] } +#ismp = { workspace = true, default-features = true } +#primitive-types = { workspace = true, features = ["codec", "scale-info", "serde_no_std"] } +#serde_json = { version = "1.0.99", default-features = false, features = ["alloc"] } diff --git a/parachain/node/Cargo.toml b/parachain/node/Cargo.toml index 6d69492c3..6c35248f9 100644 --- a/parachain/node/Cargo.toml +++ b/parachain/node/Cargo.toml @@ -23,7 +23,7 @@ serde_json = "1.0.108" # local gargantua-runtime = { path = "../runtimes/gargantua" } -messier-runtime = { path = "../runtimes/messier" } +#messier-runtime = { path = "../runtimes/messier" } nexus-runtime = { path = "../runtimes/nexus" } pallet-ismp-rpc = { workspace = true } pallet-ismp-runtime-api = { workspace = true } @@ -106,12 +106,12 @@ default = [] runtime-benchmarks = [ "try-runtime-cli/try-runtime", "gargantua-runtime/runtime-benchmarks", - "messier-runtime/runtime-benchmarks", +# "messier-runtime/runtime-benchmarks", "nexus-runtime/runtime-benchmarks", "polkadot-cli/runtime-benchmarks", ] try-runtime = [ "try-runtime-cli/try-runtime", "gargantua-runtime/try-runtime", - "messier-runtime/try-runtime" +# "messier-runtime/try-runtime" ] diff --git a/parachain/node/src/chain_spec.rs b/parachain/node/src/chain_spec.rs index 821442981..fcabd0118 100644 --- a/parachain/node/src/chain_spec.rs +++ b/parachain/node/src/chain_spec.rs @@ -127,56 +127,6 @@ pub fn gargantua_development_config(id: u32) -> ChainSpec { .build() } -pub fn messier_development_config(id: u32) -> ChainSpec { - // Give your base currency a unit name and decimal places - let mut properties = sc_chain_spec::Properties::new(); - properties.insert("tokenSymbol".into(), "DEV".into()); - properties.insert("tokenDecimals".into(), 12.into()); - properties.insert("ss58Format".into(), 42.into()); - - ChainSpec::builder( - messier_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"), - Extensions { - relay_chain: "rococo-local".into(), - // You MUST set this to the correct network! - para_id: id, - }, - ) - .with_name("messier-dev") - .with_id("messier") - .with_chain_type(ChainType::Development) - .with_genesis_config_patch(testnet_genesis( - // initial collators. - vec![ - ( - get_account_id_from_seed::("Alice"), - get_collator_keys_from_seed("Alice"), - ), - ( - get_account_id_from_seed::("Bob"), - get_collator_keys_from_seed("Bob"), - ), - ], - vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Charlie"), - get_account_id_from_seed::("Dave"), - get_account_id_from_seed::("Eve"), - get_account_id_from_seed::("Ferdie"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - get_account_id_from_seed::("Charlie//stash"), - get_account_id_from_seed::("Dave//stash"), - get_account_id_from_seed::("Eve//stash"), - get_account_id_from_seed::("Ferdie//stash"), - ], - get_account_id_from_seed::("Alice"), - id, - )) - .build() -} - pub fn nexus_development_config(id: u32) -> ChainSpec { // Give your base currency a unit name and decimal places let mut properties = sc_chain_spec::Properties::new(); diff --git a/parachain/node/src/command.rs b/parachain/node/src/command.rs index d3b331e4e..f44b3ec5c 100644 --- a/parachain/node/src/command.rs +++ b/parachain/node/src/command.rs @@ -40,9 +40,6 @@ fn load_spec(id: &str) -> std::result::Result, String> { "dev" | "gargantua" => Box::new(chain_spec::ChainSpec::from_json_bytes( include_bytes!("../../chainspec/gargantua.paseo.json").to_vec(), )?), - "messier" => Box::new(chain_spec::ChainSpec::from_json_bytes( - include_bytes!("../../chainspec/messier.json").to_vec(), - )?), "" | "nexus" => Box::new(chain_spec::ChainSpec::from_json_bytes( include_bytes!("../../chainspec/nexus.json").to_vec(), )?), @@ -51,11 +48,6 @@ fn load_spec(id: &str) -> std::result::Result, String> { let id = u32::from_str(id).expect("can't parse Id into u32"); Box::new(chain_spec::gargantua_development_config(id)) }, - name if name.starts_with("messier-") => { - let id = name.split('-').last().expect("dev chainspec should have chain id"); - let id = u32::from_str(id).expect("can't parse Id into u32"); - Box::new(chain_spec::messier_development_config(id)) - }, name if name.starts_with("nexus-") => { let id = name.split('-').last().expect("dev chainspec should have chain id"); let id = u32::from_str(id).expect("can't parse Id into u32"); @@ -157,13 +149,6 @@ macro_rules! construct_async_run { Ok::<_, sc_cli::Error>(( { $( $code )* }, $components.task_manager)) }) } - chain if chain.contains("messier") => { - runner.async_run(|$config| { - let executor = sc_service::new_wasm_executor::(&$config); - let $components = new_partial::(&$config, executor)?; - Ok::<_, sc_cli::Error>(( { $( $code )* }, $components.task_manager)) - }) - } chain if chain.contains("nexus") => { runner.async_run(|$config| { let executor = sc_service::new_wasm_executor::(&$config); @@ -249,12 +234,6 @@ pub fn run() -> Result<()> { cmd.run(components.client.clone()) }, - chain if chain.contains("messier") => { - let components = - new_partial::(&config, executor)?; - - cmd.run(components.client.clone()) - }, chain if chain.contains("nexus") => { let components = new_partial::(&config, executor)?; @@ -297,11 +276,6 @@ pub fn run() -> Result<()> { new_partial::(&config, executor)?; cmd.run(components.client) }, - chain if chain.contains("messier") => { - let components = - new_partial::(&config, executor)?; - cmd.run(components.client) - }, chain if chain.contains("nexus") => { let components = new_partial::(&config, executor)?; @@ -329,13 +303,6 @@ pub fn run() -> Result<()> { let storage = components.backend.expose_storage(); cmd.run(config, components.client.clone(), db, storage) }, - chain if chain.contains("messier") => { - let components = - new_partial::(&config, executor)?; - let db = components.backend.expose_db(); - let storage = components.backend.expose_storage(); - cmd.run(config, components.client.clone(), db, storage) - }, chain if chain.contains("nexus") => { let components = new_partial::(&config, executor)?; diff --git a/parachain/node/src/service.rs b/parachain/node/src/service.rs index f6b93da9f..065e75f69 100644 --- a/parachain/node/src/service.rs +++ b/parachain/node/src/service.rs @@ -513,15 +513,6 @@ pub async fn start_parachain_node( hwbench, ) .await, - chain if chain.contains("messier") => - start_node_impl::( - parachain_config, - polkadot_config, - collator_options, - para_id, - hwbench, - ) - .await, chain if chain.contains("nexus") => start_node_impl::( parachain_config, diff --git a/parachain/runtimes/messier/src/lib.rs b/parachain/runtimes/messier/src/lib.rs index c42fdcc83..2872c2987 100644 --- a/parachain/runtimes/messier/src/lib.rs +++ b/parachain/runtimes/messier/src/lib.rs @@ -590,7 +590,7 @@ where fn create_asset_kind(seed: u32) -> A { Location { parents: 0, - interior: staging_xcm::latest::Junction::X1(alloc::sync::Arc::new([ + interior: staging_xcm::latest::Junctions::X1(alloc::sync::Arc::new([ staging_xcm::latest::Junction::GeneralIndex(seed as u128), ])), } @@ -610,8 +610,8 @@ where fn create_asset_kind(seed: u32) -> A { Location { parents: 0, - interior: staging_xcm::latest::Junction::X1(alloc::sync::Arc::new([ - staging_xcm::latest::Junction::GeneralIndex(seed as u128), + interior: staging_xcm::latest::Location::X1(alloc::sync::Arc::new([ + staging_xcm::latest::Junctions::GeneralIndex(seed as u128), ])), } .into() diff --git a/scripts/release-crates.sh b/scripts/release-crates.sh index 1a5f644b9..62f0f816f 100755 --- a/scripts/release-crates.sh +++ b/scripts/release-crates.sh @@ -1,7 +1,7 @@ #!/bin/bash cargo release \ --p serde-utils \ +-p serde-hex-utils \ -p ismp \ -p mmr-primitives \ -p pallet-hyperbridge \ diff --git a/tesseract/evm/Cargo.toml b/tesseract/evm/Cargo.toml index c76eb47f7..56186eb40 100644 --- a/tesseract/evm/Cargo.toml +++ b/tesseract/evm/Cargo.toml @@ -53,7 +53,7 @@ ismp-testsuite = { workspace = true, default-features = true } reconnecting-jsonrpsee-ws-client = { workspace = true, default-features = true } jsonrpsee = { version = "0.21", features = ["ws-client"]} pallet-ismp-host-executive = { workspace = true, default-features = true } -serde-utils = { workspace = true, default-features = false } +serde-hex-utils = { workspace = true, default-features = false } [dev-dependencies] alloy-rlp = { workspace = true, default-features = true } diff --git a/tesseract/evm/src/lib.rs b/tesseract/evm/src/lib.rs index 7a498a674..c57d723d0 100644 --- a/tesseract/evm/src/lib.rs +++ b/tesseract/evm/src/lib.rs @@ -60,7 +60,7 @@ pub struct EvmConfig { /// RPC urls for the execution client pub rpc_urls: Vec, /// State machine Identifier for this client on it's counterparties. - #[serde(with = "serde_utils::as_string")] + #[serde(with = "serde_hex_utils::as_string")] pub state_machine: StateMachine, /// Consensus state id for the consensus client on counterparty chain pub consensus_state_id: String, diff --git a/tesseract/substrate/Cargo.toml b/tesseract/substrate/Cargo.toml index 75d43cf57..857db2a4a 100644 --- a/tesseract/substrate/Cargo.toml +++ b/tesseract/substrate/Cargo.toml @@ -31,7 +31,7 @@ subxt-utils = { workspace = true, default-features = true } pallet-ismp-host-executive = { workspace = true, default-features = true } substrate-state-machine = { workspace = true, default-features = true } pallet-hyperbridge = { workspace = true, default-features = true } -serde-utils = { workspace = true, default-features = false } +serde-hex-utils = { workspace = true, default-features = false } pallet-state-coprocessor = { workspace = true, default-features = true } [features] diff --git a/tesseract/substrate/src/lib.rs b/tesseract/substrate/src/lib.rs index f34517e69..68d0c460e 100644 --- a/tesseract/substrate/src/lib.rs +++ b/tesseract/substrate/src/lib.rs @@ -49,7 +49,7 @@ mod testing; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SubstrateConfig { /// Hyperbridge network - #[serde(with = "serde_utils::as_string")] + #[serde(with = "serde_hex_utils::as_string")] pub state_machine: StateMachine, /// The hashing algorithm that substrate chain uses. pub hashing: Option,