Skip to content

Commit f72b48d

Browse files
drewstoneseunlanlegeWizdave97
authoredFeb 28, 2025··
Add hyperbridge (#894)
* feat: add hyperbridge on polkadot2407 * chore: cleanup and integrate into testnet runtime * chore: remove token-gateway * chore: fix commit hash * chore: fix dep link * chore: remove unused trait * chore: fix state machine id * chore: update branch * chore: fix * Update runtime/testnet/src/hyperbridge.rs Co-authored-by: Seun Lanlege <seunlanlege@gmail.com> * chore: add token gateway * chore: add token gateway to hyperbridge router * chore: merge main and remove sp-mmr-primitives * chore: increase testnet block size limit * chore: use 8mb * Update runtime/testnet/src/hyperbridge.rs Co-authored-by: David Salami <31099392+Wizdave97@users.noreply.github.com> --------- Co-authored-by: Seun Lanlege <seunlanlege@gmail.com> Co-authored-by: David Salami <31099392+Wizdave97@users.noreply.github.com>
1 parent 6ff4d71 commit f72b48d

File tree

8 files changed

+876
-234
lines changed

8 files changed

+876
-234
lines changed
 

‎Cargo.lock

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

‎Cargo.toml

+47-37
Original file line numberDiff line numberDiff line change
@@ -271,48 +271,48 @@ sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk", branch
271271
sp-genesis-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2407", default-features = false }
272272

273273
# Frontier Client
274-
fc-cli = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
275-
fc-consensus = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407" }
276-
fc-db = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
277-
fc-mapping-sync = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
278-
fc-rpc = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
279-
fc-rpc-core = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407" }
280-
fc-storage = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407" }
281-
fc-api = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
274+
fc-cli = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
275+
fc-consensus = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407" }
276+
fc-db = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
277+
fc-mapping-sync = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
278+
fc-rpc = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
279+
fc-rpc-core = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407" }
280+
fc-storage = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407" }
281+
fc-api = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
282282

283283
# Frontier Primitive
284-
fp-account = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false, features = [
284+
fp-account = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false, features = [
285285
"serde",
286286
] }
287-
fp-consensus = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
288-
fp-dynamic-fee = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
289-
fp-ethereum = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
290-
fp-evm = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false, features = [
287+
fp-consensus = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
288+
fp-dynamic-fee = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
289+
fp-ethereum = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
290+
fp-evm = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false, features = [
291291
"serde",
292292
] }
293-
fp-rpc = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
294-
fp-self-contained = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false, features = [
293+
fp-rpc = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
294+
fp-self-contained = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false, features = [
295295
"serde",
296296
] }
297-
fp-storage = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
297+
fp-storage = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
298298

299299
# Frontier FRAME
300-
pallet-base-fee = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
301-
pallet-dynamic-fee = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
302-
pallet-ethereum = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
303-
pallet-evm = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
304-
pallet-evm-chain-id = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
305-
pallet-evm-precompile-blake2 = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
306-
pallet-evm-precompile-bn128 = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
307-
pallet-evm-precompile-curve25519 = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
308-
pallet-evm-precompile-dispatch = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
309-
pallet-evm-precompile-ed25519 = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
310-
pallet-evm-precompile-modexp = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
311-
pallet-evm-precompile-sha3fips = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
312-
pallet-evm-precompile-simple = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
313-
pallet-evm-test-vector-support = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407" }
314-
pallet-hotfix-sufficients = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
315-
precompile-utils = { git = "https://github.com/paritytech/frontier.git", branch = "stable2407", default-features = false }
300+
pallet-base-fee = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
301+
pallet-dynamic-fee = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
302+
pallet-ethereum = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
303+
pallet-evm = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
304+
pallet-evm-chain-id = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
305+
pallet-evm-precompile-blake2 = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
306+
pallet-evm-precompile-bn128 = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
307+
pallet-evm-precompile-curve25519 = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
308+
pallet-evm-precompile-dispatch = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
309+
pallet-evm-precompile-ed25519 = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
310+
pallet-evm-precompile-modexp = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
311+
pallet-evm-precompile-sha3fips = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
312+
pallet-evm-precompile-simple = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
313+
pallet-evm-test-vector-support = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407" }
314+
pallet-hotfix-sufficients = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
315+
precompile-utils = { git = "https://github.com/polkadot-evm/frontier", branch = "stable2407", default-features = false }
316316

317317
# Local precompiles
318318
evm-erc20-utils = { path = "precompiles/erc20-utils", default-features = false }
@@ -375,11 +375,21 @@ rpc-trace = { path = "client/rpc/trace" }
375375
rpc-txpool = { path = "client/rpc/txpool" }
376376
evm-tracer = { path = "evm-tracer", default-features = false }
377377

378-
# Polkadot XCM
379-
xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "stable2407", default-features = false }
380-
xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "stable2407", default-features = false }
381-
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "stable2407", default-features = false }
382-
polkadot-parachain-primitives = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "stable2407", default-features = false }
378+
# Hyperbridge EVM necessary dependencies
379+
alloy-sol-macro = "0.7.7"
380+
alloy-sol-types = { version = "0.7.7", default-features = false }
381+
alloy-primitives = { version = "0.7.7", default-features = false, features = ["rlp"] }
382+
383+
# Hyperbridge
384+
token-gateway-primitives = { path = "pallets/token-gateway/primitives" }
385+
pallet-token-gateway = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2407-1", default-features = false }
386+
pallet-ismp = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2407-1", default-features = false }
387+
pallet-ismp-rpc = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2407-1" }
388+
pallet-ismp-runtime-api = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2407-1", default-features = false }
389+
ismp-grandpa = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2407-1", default-features = false }
390+
ismp = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2407-1", default-features = false }
391+
pallet-hyperbridge = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2407-1", default-features = false }
392+
anyhow = { version = "1.0.93", default-features = false }
383393

384394
# Subxt
385395
subxt = { version = "0.39.0", default-features = false }

‎runtime/testnet/Cargo.toml

+16-14
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ pallet-evm-precompile-sha3fips = { workspace = true }
124124
pallet-evm-precompile-simple = { workspace = true }
125125
pallet-hotfix-sufficients = { workspace = true }
126126

127-
## Tangle precompiles
127+
# Tangle precompiles
128128
pallet-evm-precompile-batch = { workspace = true }
129129
pallet-evm-precompile-call-permit = { workspace = true }
130130
pallet-evm-precompile-democracy = { workspace = true }
@@ -142,16 +142,18 @@ pallet-evm-precompile-multi-asset-delegation = { workspace = true }
142142
pallet-evm-precompile-services = { workspace = true }
143143
pallet-evm-precompile-tangle-lst = { workspace = true }
144144
precompile-utils = { workspace = true }
145-
146145
evm-tracer = { workspace = true }
147146
rpc-primitives-debug = { workspace = true }
148147
rpc-primitives-txpool = { workspace = true }
149148

150-
# XCM
151-
xcm = { workspace = true }
152-
xcm-builder = { workspace = true }
153-
xcm-executor = { workspace = true }
154-
polkadot-parachain-primitives = { workspace = true }
149+
# Hyperbridge
150+
pallet-ismp = { workspace = true, features = ["unsigned"] }
151+
pallet-ismp-runtime-api = { workspace = true }
152+
pallet-hyperbridge = { workspace = true }
153+
pallet-token-gateway = { workspace = true }
154+
ismp = { workspace = true }
155+
ismp-grandpa = { workspace = true }
156+
anyhow = { workspace = true }
155157

156158
[features]
157159
runtime-benchmarks = [
@@ -176,8 +178,6 @@ runtime-benchmarks = [
176178
# Tangle
177179
"pallet-services/runtime-benchmarks",
178180
"pallet-airdrop-claims/runtime-benchmarks",
179-
180-
"xcm-builder/runtime-benchmarks",
181181
"pallet-multi-asset-delegation/runtime-benchmarks",
182182
"pallet-tangle-lst-benchmarking/runtime-benchmarks",
183183
"pallet-rewards/runtime-benchmarks"
@@ -308,11 +308,13 @@ std = [
308308
"pallet-evm-precompile-services/std",
309309
"pallet-evm-precompile-tangle-lst/std",
310310

311-
# XCM
312-
"xcm/std",
313-
"xcm-builder/std",
314-
"xcm-executor/std",
315-
"polkadot-parachain-primitives/std",
311+
# Hyperbridge
312+
"pallet-hyperbridge/std",
313+
"pallet-ismp/std",
314+
"pallet-token-gateway/std",
315+
"ismp/std",
316+
"ismp-grandpa/std",
317+
"pallet-ismp-runtime-api/std",
316318
]
317319
integration-tests = ["tangle-primitives/integration-tests"]
318320
with-rocksdb-weights = []

‎runtime/testnet/src/hyperbridge.rs

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
// This file is part of Tangle.
2+
3+
// Copyright (C) Tangle Foundation
4+
// Copyright (C) Liebi Technologies PTE. LTD.
5+
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
6+
7+
// This program is free software: you can redistribute it and/or modify
8+
// it under the terms of the GNU General Public License as published by
9+
// the Free Software Foundation, either version 3 of the License, or
10+
// (at your option) any later version.
11+
12+
// This program is distributed in the hope that it will be useful,
13+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
// GNU General Public License for more details.
16+
17+
// You should have received a copy of the GNU General Public License
18+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
20+
use crate::{
21+
AccountId, Assets, Balances, EnsureRoot, EnsureRootOrHalfCouncil, Get, Ismp, Runtime,
22+
RuntimeEvent, Timestamp, TokenGateway, Treasury, H160,
23+
};
24+
use frame_support::parameter_types;
25+
use ismp::{host::StateMachine, module::IsmpModule, router::IsmpRouter};
26+
use pallet_token_gateway::types::EvmToSubstrate;
27+
use sp_std::boxed::Box;
28+
use sp_std::vec::Vec;
29+
use tangle_primitives::Balance;
30+
31+
impl pallet_hyperbridge::Config for Runtime {
32+
type RuntimeEvent = RuntimeEvent;
33+
// pallet-ismp implements the IsmpHost
34+
type IsmpHost = Ismp;
35+
}
36+
37+
parameter_types! {
38+
// The hyperbridge parachain on Polkadot
39+
pub const Coprocessor: Option<StateMachine> = Some(StateMachine::Kusama(4009));
40+
// The host state machine of this pallet, your state machine id goes here
41+
pub const HostStateMachine: StateMachine = StateMachine::Substrate(*b"TNGL");
42+
}
43+
44+
impl pallet_ismp::Config for Runtime {
45+
type RuntimeEvent = RuntimeEvent;
46+
// Modify the consensus client's permissions, for example, TechAdmin
47+
type AdminOrigin = EnsureRootOrHalfCouncil;
48+
// The state machine identifier of the chain -- parachain id
49+
type HostStateMachine = HostStateMachine;
50+
type TimestampProvider = Timestamp;
51+
// The router provides the implementation for the IsmpModule as the module id.
52+
type Router = Router;
53+
type Balance = Balance;
54+
// The token used to collect fees, only stablecoins are supported
55+
type Currency = Balances;
56+
// Co-processor
57+
type Coprocessor = Coprocessor;
58+
// A tuple of types implementing the ConsensusClient interface, which defines all consensus algorithms supported by this protocol deployment
59+
type ConsensusClients = (::ismp_grandpa::consensus::GrandpaConsensusClient<Runtime>,);
60+
type WeightProvider = ();
61+
type OffchainDB = ();
62+
}
63+
64+
impl ::ismp_grandpa::Config for Runtime {
65+
type RuntimeEvent = RuntimeEvent;
66+
type IsmpHost = pallet_ismp::Pallet<Runtime>;
67+
type WeightInfo = crate::weights::ismp_grandpa::WeightInfo<Runtime>;
68+
}
69+
70+
#[derive(Default)]
71+
pub struct Router;
72+
73+
impl IsmpRouter for Router {
74+
fn module_for_id(&self, id: Vec<u8>) -> Result<Box<dyn IsmpModule>, anyhow::Error> {
75+
match id.as_slice() {
76+
pallet_hyperbridge::PALLET_HYPERBRIDGE_ID => {
77+
Ok(Box::new(pallet_hyperbridge::Pallet::<Runtime>::default()))
78+
},
79+
id if TokenGateway::is_token_gateway(id) => Ok(Box::new(TokenGateway::default())),
80+
_ => Err(ismp::Error::ModuleNotFound(id))?,
81+
}
82+
}
83+
}
84+
85+
pub struct EvmToSubstrateFactory;
86+
87+
impl EvmToSubstrate<Runtime> for EvmToSubstrateFactory {
88+
fn convert(addr: H160) -> AccountId {
89+
let mut account = [0u8; 32];
90+
account[12..].copy_from_slice(&addr.0);
91+
account.into()
92+
}
93+
}
94+
95+
/// Should provide an account that is funded and can be used to pay for asset creation
96+
pub struct AssetAdmin;
97+
impl Get<AccountId> for AssetAdmin {
98+
fn get() -> AccountId {
99+
Treasury::account_id()
100+
}
101+
}
102+
103+
parameter_types! {
104+
// A constant that should represent the native asset id, this id must be unique to the native currency
105+
pub const NativeAssetId: u32 = 0;
106+
// Set the correct decimals for the native currency
107+
pub const Decimals: u8 = 18;
108+
}
109+
110+
impl ::pallet_token_gateway::Config for Runtime {
111+
// configure the runtime event
112+
type RuntimeEvent = RuntimeEvent;
113+
// Configured as Pallet Ismp
114+
type Dispatcher = pallet_hyperbridge::Pallet<Runtime>;
115+
// Configured as Pallet Assets
116+
type Assets = Assets;
117+
// Configured as Pallet balances
118+
type NativeCurrency = Balances;
119+
// AssetAdmin account
120+
type AssetAdmin = AssetAdmin;
121+
// The Native asset Id
122+
type NativeAssetId = NativeAssetId;
123+
// The precision of the native asset
124+
type Decimals = Decimals;
125+
type EvmToSubstrate = EvmToSubstrateFactory;
126+
type WeightInfo = crate::weights::pallet_token_gateway::SubstrateWeight<Runtime>;
127+
type CreateOrigin = EnsureRoot<AccountId>;
128+
}

‎runtime/testnet/src/lib.rs

+50-1
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
2323

2424
mod filters;
2525
pub mod frontier_evm;
26+
pub mod hyperbridge;
2627
pub mod impls;
2728
pub mod migrations;
2829
pub mod precompiles;
2930
pub mod tangle_services;
3031
pub mod voter_bags;
32+
pub mod weights;
3133

3234
use frame_election_provider_support::{
3335
bounds::{ElectionBounds, ElectionBoundsBuilder},
@@ -45,6 +47,11 @@ use frame_support::{
4547
};
4648
use frame_system::EnsureSignedBy;
4749
use frontier_evm::DefaultBaseFeePerGas;
50+
use ismp::{
51+
consensus::{ConsensusClientId, StateMachineHeight, StateMachineId},
52+
host::StateMachine,
53+
router::{Request, Response},
54+
};
4855
use pallet_election_provider_multi_phase::{GeometricDepositBase, SolutionAccuracyOf};
4956
use pallet_evm::GasWeightMapping;
5057
use pallet_grandpa::{
@@ -184,7 +191,7 @@ pub fn native_version() -> NativeVersion {
184191
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
185192
}
186193

187-
pub const MAXIMUM_BLOCK_LENGTH: u32 = 5 * 1024 * 1024;
194+
pub const MAXIMUM_BLOCK_LENGTH: u32 = 8 * 1024 * 1024;
188195

189196
parameter_types! {
190197
pub const Version: RuntimeVersion = VERSION;
@@ -1309,6 +1316,10 @@ construct_runtime!(
13091316
Lst: pallet_tangle_lst = 52,
13101317
Rewards: pallet_rewards = 53,
13111318

1319+
Ismp: pallet_ismp = 55,
1320+
IsmpGrandpa: ismp_grandpa = 56,
1321+
Hyperbridge: pallet_hyperbridge = 57,
1322+
TokenGateway: pallet_token_gateway = 58,
13121323
}
13131324
);
13141325

@@ -2240,6 +2251,44 @@ impl_runtime_apis! {
22402251
}
22412252
}
22422253

2254+
impl pallet_ismp_runtime_api::IsmpRuntimeApi<Block, <Block as BlockT>::Hash> for Runtime {
2255+
fn host_state_machine() -> StateMachine {
2256+
<Runtime as pallet_ismp::Config>::HostStateMachine::get()
2257+
}
2258+
2259+
fn challenge_period(state_machine_id: StateMachineId) -> Option<u64> {
2260+
pallet_ismp::Pallet::<Runtime>::challenge_period(state_machine_id)
2261+
}
2262+
2263+
fn block_events() -> Vec<::ismp::events::Event> {
2264+
pallet_ismp::Pallet::<Runtime>::block_events()
2265+
}
2266+
2267+
fn block_events_with_metadata() -> Vec<(::ismp::events::Event, Option<u32>)> {
2268+
pallet_ismp::Pallet::<Runtime>::block_events_with_metadata()
2269+
}
2270+
2271+
fn consensus_state(id: ConsensusClientId) -> Option<Vec<u8>> {
2272+
pallet_ismp::Pallet::<Runtime>::consensus_states(id)
2273+
}
2274+
2275+
fn state_machine_update_time(height: StateMachineHeight) -> Option<u64> {
2276+
pallet_ismp::Pallet::<Runtime>::state_machine_update_time(height)
2277+
}
2278+
2279+
fn latest_state_machine_height(id: StateMachineId) -> Option<u64> {
2280+
pallet_ismp::Pallet::<Runtime>::latest_state_machine_height(id)
2281+
}
2282+
2283+
fn requests(commitments: Vec<H256>) -> Vec<Request> {
2284+
pallet_ismp::Pallet::<Runtime>::requests(commitments)
2285+
}
2286+
2287+
fn responses(commitments: Vec<H256>) -> Vec<Response> {
2288+
pallet_ismp::Pallet::<Runtime>::responses(commitments)
2289+
}
2290+
}
2291+
22432292
#[cfg(feature = "runtime-benchmarks")]
22442293
impl frame_benchmarking::Benchmark<Block> for Runtime {
22452294
fn benchmark_metadata(extra: bool) -> (
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
2+
//! Autogenerated weights for `ismp_grandpa`
3+
//!
4+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 42.0.0
5+
//! DATE: 2024-12-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
6+
//! WORST CASE MAP SIZE: `1000000`
7+
//! HOSTNAME: `polytope-labs`, CPU: `AMD Ryzen Threadripper PRO 5995WX 64-Cores`
8+
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024
9+
10+
// Executed Command:
11+
// target/release/hyperbridge
12+
// benchmark
13+
// pallet
14+
// --wasm-execution=compiled
15+
// --pallet=ismp_grandpa
16+
// --extrinsic=*
17+
// --steps=50
18+
// --repeat=20
19+
// --genesis-builder=runtime
20+
// --runtime=./target/release/wbuild/gargantua-runtime/gargantua_runtime.compact.wasm
21+
// --output=parachain/runtimes/gargantua/src/weights/ismp_grandpa.rs
22+
23+
#![cfg_attr(rustfmt, rustfmt_skip)]
24+
#![allow(unused_parens)]
25+
#![allow(unused_imports)]
26+
#![allow(missing_docs)]
27+
28+
use frame_support::{traits::Get, weights::Weight};
29+
use core::marker::PhantomData;
30+
31+
/// Weight functions for `ismp_grandpa`.
32+
pub struct WeightInfo<T>(PhantomData<T>);
33+
impl<T: frame_system::Config> ismp_grandpa::WeightInfo for WeightInfo<T> {
34+
/// Storage: `IsmpGrandpa::SupportedStateMachines` (r:0 w:100)
35+
/// Proof: `IsmpGrandpa::SupportedStateMachines` (`max_values`: None, `max_size`: None, mode: `Measured`)
36+
/// The range of component `n` is `[1, 100]`.
37+
fn add_state_machines(n: u32, ) -> Weight {
38+
// Proof Size summary in bytes:
39+
// Measured: `0`
40+
// Estimated: `0`
41+
// Minimum execution time: 6_913_000 picoseconds.
42+
Weight::from_parts(7_832_568, 0)
43+
.saturating_add(Weight::from_parts(0, 0))
44+
// Standard Error: 7_710
45+
.saturating_add(Weight::from_parts(1_434_418, 0).saturating_mul(n.into()))
46+
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
47+
}
48+
/// Storage: `IsmpGrandpa::SupportedStateMachines` (r:0 w:100)
49+
/// Proof: `IsmpGrandpa::SupportedStateMachines` (`max_values`: None, `max_size`: None, mode: `Measured`)
50+
/// The range of component `n` is `[1, 100]`.
51+
fn remove_state_machines(n: u32, ) -> Weight {
52+
// Proof Size summary in bytes:
53+
// Measured: `0`
54+
// Estimated: `0`
55+
// Minimum execution time: 7_204_000 picoseconds.
56+
Weight::from_parts(5_126_127, 0)
57+
.saturating_add(Weight::from_parts(0, 0))
58+
// Standard Error: 8_195
59+
.saturating_add(Weight::from_parts(1_417_249, 0).saturating_mul(n.into()))
60+
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
61+
}
62+
}

‎runtime/testnet/src/weights/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pub mod ismp_grandpa;
2+
pub mod pallet_token_gateway;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
//! Autogenerated weights for pallet_token_gateway
2+
//!
3+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 42.0.0
4+
//! DATE: 2025-02-03, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
5+
//! HOSTNAME: `192.168.1.5`, CPU: `<UNKNOWN>`
6+
//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
7+
8+
// Executed Command:
9+
// ./target/release/cere
10+
// benchmark
11+
// pallet
12+
// --chain
13+
// dev
14+
// --wasm-execution=compiled
15+
// --pallet
16+
// pallet_token_gateway
17+
// --extrinsic
18+
// *
19+
// --steps
20+
// 50
21+
// --repeat
22+
// 20
23+
// --output=./runtime/cere-dev/src/weights/pallet_token_gateway.rs
24+
// --template=./.maintain/frame-weight-template.hbs
25+
26+
#![cfg_attr(rustfmt, rustfmt_skip)]
27+
#![allow(unused_parens)]
28+
#![allow(unused_imports)]
29+
30+
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
31+
use sp_std::marker::PhantomData;
32+
33+
34+
/// Weights for pallet_token_gateway using the Substrate node and recommended hardware.
35+
pub struct SubstrateWeight<T>(PhantomData<T>);
36+
impl<T: frame_system::Config> pallet_token_gateway::WeightInfo for SubstrateWeight<T> {
37+
// Storage: `Hyperbridge::HostParams` (r:1 w:0)
38+
// Proof: `Hyperbridge::HostParams` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
39+
// Storage: `Ismp::Nonce` (r:1 w:1)
40+
// Proof: `Ismp::Nonce` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
41+
// Storage: `TokenGateway::Precisions` (r:0 w:100)
42+
// Proof: `TokenGateway::Precisions` (`max_values`: None, `max_size`: None, mode: `Measured`)
43+
// Storage: `TokenGateway::NativeAssets` (r:0 w:1)
44+
// Proof: `TokenGateway::NativeAssets` (`max_values`: None, `max_size`: None, mode: `Measured`)
45+
// Storage: `TokenGateway::LocalAssets` (r:0 w:1)
46+
// Proof: `TokenGateway::LocalAssets` (`max_values`: None, `max_size`: None, mode: `Measured`)
47+
// Storage: `TokenGateway::SupportedAssets` (r:0 w:1)
48+
// Proof: `TokenGateway::SupportedAssets` (`max_values`: None, `max_size`: None, mode: `Measured`)
49+
// Storage: UNKNOWN KEY `0x52657175657374436f6d6d69746d656e747356aa03068021c89766e6f0dc869c` (r:1 w:1)
50+
// Proof: UNKNOWN KEY `0x52657175657374436f6d6d69746d656e747356aa03068021c89766e6f0dc869c` (r:1 w:1)
51+
// Storage: UNKNOWN KEY `0x526571756573745061796d656e7456aa03068021c89766e6f0dc869cadd7cfc2` (r:0 w:1)
52+
// Proof: UNKNOWN KEY `0x526571756573745061796d656e7456aa03068021c89766e6f0dc869cadd7cfc2` (r:0 w:1)
53+
/// The range of component `x` is `[1, 100]`.
54+
fn create_erc6160_asset(x: u32, ) -> Weight {
55+
Weight::from_parts(22_256_047_u64, 0)
56+
// Standard Error: 3_063
57+
.saturating_add(Weight::from_parts(1_733_865_u64, 0).saturating_mul(x as u64))
58+
.saturating_add(T::DbWeight::get().reads(3_u64))
59+
.saturating_add(T::DbWeight::get().writes(6_u64))
60+
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(x as u64)))
61+
}
62+
// Storage: `TokenGateway::SupportedAssets` (r:1 w:0)
63+
// Proof: `TokenGateway::SupportedAssets` (`max_values`: None, `max_size`: None, mode: `Measured`)
64+
// Storage: `TokenGateway::NativeAssets` (r:1 w:0)
65+
// Proof: `TokenGateway::NativeAssets` (`max_values`: None, `max_size`: None, mode: `Measured`)
66+
// Storage: `System::Account` (r:1 w:1)
67+
// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
68+
// Storage: `TokenGateway::Precisions` (r:1 w:0)
69+
// Proof: `TokenGateway::Precisions` (`max_values`: None, `max_size`: None, mode: `Measured`)
70+
// Storage: `Hyperbridge::HostParams` (r:1 w:0)
71+
// Proof: `Hyperbridge::HostParams` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
72+
// Storage: `Ismp::Nonce` (r:1 w:1)
73+
// Proof: `Ismp::Nonce` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
74+
// Storage: UNKNOWN KEY `0x52657175657374436f6d6d69746d656e74733d1fa1ad95382c59b20b8fe912a8` (r:1 w:1)
75+
// Proof: UNKNOWN KEY `0x52657175657374436f6d6d69746d656e74733d1fa1ad95382c59b20b8fe912a8` (r:1 w:1)
76+
// Storage: UNKNOWN KEY `0x526571756573745061796d656e743d1fa1ad95382c59b20b8fe912a8853bf587` (r:0 w:1)
77+
// Proof: UNKNOWN KEY `0x526571756573745061796d656e743d1fa1ad95382c59b20b8fe912a8853bf587` (r:0 w:1)
78+
fn teleport() -> Weight {
79+
Weight::from_parts(62_000_000_u64, 0)
80+
.saturating_add(T::DbWeight::get().reads(7_u64))
81+
.saturating_add(T::DbWeight::get().writes(4_u64))
82+
}
83+
// Storage: `TokenGateway::TokenGatewayAddresses` (r:0 w:1)
84+
// Proof: `TokenGateway::TokenGatewayAddresses` (`max_values`: None, `max_size`: None, mode: `Measured`)
85+
/// The range of component `x` is `[1, 100]`.
86+
fn set_token_gateway_addresses(_x: u32, ) -> Weight {
87+
Weight::from_parts(3_897_505_u64, 0)
88+
.saturating_add(T::DbWeight::get().writes(1_u64))
89+
}
90+
// Storage: `Hyperbridge::HostParams` (r:1 w:0)
91+
// Proof: `Hyperbridge::HostParams` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
92+
// Storage: `Ismp::Nonce` (r:1 w:1)
93+
// Proof: `Ismp::Nonce` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
94+
// Storage: UNKNOWN KEY `0x52657175657374436f6d6d69746d656e747399c5cd93560a9d5b3112b189670f` (r:1 w:1)
95+
// Proof: UNKNOWN KEY `0x52657175657374436f6d6d69746d656e747399c5cd93560a9d5b3112b189670f` (r:1 w:1)
96+
// Storage: UNKNOWN KEY `0x526571756573745061796d656e7499c5cd93560a9d5b3112b189670f2bf0f746` (r:0 w:1)
97+
// Proof: UNKNOWN KEY `0x526571756573745061796d656e7499c5cd93560a9d5b3112b189670f2bf0f746` (r:0 w:1)
98+
fn update_erc6160_asset() -> Weight {
99+
Weight::from_parts(21_000_000_u64, 0)
100+
.saturating_add(T::DbWeight::get().reads(3_u64))
101+
.saturating_add(T::DbWeight::get().writes(3_u64))
102+
}
103+
// Storage: `TokenGateway::Precisions` (r:0 w:100)
104+
// Proof: `TokenGateway::Precisions` (`max_values`: None, `max_size`: None, mode: `Measured`)
105+
/// The range of component `x` is `[1, 100]`.
106+
fn update_asset_precision(x: u32, ) -> Weight {
107+
Weight::from_parts(1_255_030_u64, 0)
108+
// Standard Error: 2_019
109+
.saturating_add(Weight::from_parts(1_723_090_u64, 0).saturating_mul(x as u64))
110+
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(x as u64)))
111+
}
112+
}

0 commit comments

Comments
 (0)
Please sign in to comment.