Skip to content

Commit 7ef2be2

Browse files
authored
Merge pull request #1122 from galacticcouncil/feat/hyperbridge
feat: hyperbridge token gateway
2 parents 3376923 + 993f2d1 commit 7ef2be2

46 files changed

Lines changed: 4583 additions & 541 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 3544 additions & 515 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ serde = { version = "1.0.209", default-features = false }
6060
primitive-types = { version = "0.12.2", default-features = false }
6161

6262
affix = "0.1.2"
63+
alloy-primitives = { version = "0.7", default-features = false }
64+
alloy-sol-types = { version = "0.7", default-features = false }
65+
anyhow = { version = "1.0", default-features = false }
6366
approx = "0.5.1"
6467
async-trait = "0.1"
6568
bitflags = "1.3.2"
@@ -379,6 +382,20 @@ cumulus-client-pov-recovery = { git = "https://github.com/galacticcouncil/polkad
379382
cumulus-pallet-parachain-system-proc-macro = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch6" }
380383
cumulus-relay-chain-rpc-interface = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch6" }
381384

385+
# Hyperbridge
386+
pallet-hyperbridge = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409", default-features = false }
387+
pallet-token-gateway = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409", default-features = false }
388+
389+
pallet-ismp = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409", default-features = false }
390+
pallet-ismp-runtime-api = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409", default-features = false }
391+
392+
ismp = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409", default-features = false }
393+
ismp-parachain = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409", default-features = false }
394+
ismp-parachain-runtime-api = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409", default-features = false }
395+
396+
pallet-ismp-rpc = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409" }
397+
ismp-parachain-inherent = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409" }
398+
382399
[patch."https://github.com/moonbeam-foundation/open-runtime-module-library"]
383400
# ORML dependencies
384401
orml-benchmarking = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-stable2409" }
@@ -550,6 +567,7 @@ cumulus-pallet-parachain-system-proc-macro = { git = "https://github.com/galacti
550567
cumulus-relay-chain-rpc-interface = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch6" }
551568

552569
[patch."https://github.com/paritytech/polkadot-sdk"]
570+
polkadot-sdk = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch6" }
553571
frame-benchmarking = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch6" }
554572
frame-benchmarking-cli = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch6" }
555573
frame-executive = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch6" }
@@ -706,3 +724,7 @@ westend-runtime = { git = "https://github.com/galacticcouncil/polkadot-sdk", bra
706724
cumulus-client-pov-recovery = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch6" }
707725
cumulus-pallet-parachain-system-proc-macro = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch6" }
708726
cumulus-relay-chain-rpc-interface = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "stable2409-patch6" }
727+
728+
[patch."https://github.com/bifrost-io/open-runtime-module-library"]
729+
orml-xcm-support = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-stable2409" }
730+
orml-traits = { git = "https://github.com/galacticcouncil/open-runtime-module-library", branch = "polkadot-stable2409" }
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
endpoint: wss://nexus.ibp.network
2+
mock-signature-host: true
3+
db: ./hyperbridge.db.sqlite
4+
5+
import-storage:
6+
System:
7+
Account:
8+
-
9+
-
10+
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
11+
- data:
12+
free: '10000000000000000000'
13+
TechnicalCollective:
14+
Members: [5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY]
15+
Sudo:
16+
Key: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY

node/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hydradx"
3-
version = "14.4.2"
3+
version = "14.5.0"
44
description = "Hydration node"
55
authors = ["GalacticCouncil"]
66
edition = "2021"
@@ -112,6 +112,11 @@ fp-consensus = { workspace = true }
112112
fp-self-contained = { workspace = true }
113113
fp-evm = { workspace = true }
114114

115+
# Hyperbridge
116+
pallet-ismp-runtime-api = { workspace = true }
117+
pallet-ismp-rpc = { workspace = true }
118+
ismp-parachain-inherent = { workspace = true }
119+
115120
[features]
116121
default = [
117122
"frame-benchmarking-cli",

node/src/command.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ fn extract_genesis_wasm(chain_spec: &Box<dyn sc_service::ChainSpec>) -> Result<V
129129

130130
/// Parse and run command line arguments
131131
pub fn run() -> sc_cli::Result<()> {
132-
let cli = Cli::from_args();
132+
let mut cli = Cli::from_args();
133133

134134
match &cli.subcommand {
135135
Some(Subcommand::BuildSpec(cmd)) => {
@@ -277,6 +277,11 @@ pub fn run() -> sc_cli::Result<()> {
277277
return Err("It is not allowed to run a collator node with the benchmarking runtime.".into());
278278
};
279279

280+
// Enable for all full nodes by default to store ISMP request/responses
281+
if !config.role.is_authority() {
282+
cli.run.base.base.offchain_worker_params.indexing_enabled = true;
283+
}
284+
280285
let polkadot_cli = RelayChainCli::new(
281286
&config,
282287
[RelayChainCli::executable_name()]

node/src/rpc.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ pub use fc_rpc::{EthBlockDataCacheTask, StorageOverride, StorageOverrideHandler}
2929
pub use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool};
3030
use fp_rpc::{ConvertTransaction, ConvertTransactionRuntimeApi, EthereumRuntimeRPCApi};
3131
use hydradx_runtime::{opaque::Block, AccountId, Balance, Index};
32+
use pallet_ismp_rpc::{IsmpApiServer, IsmpRpcHandler};
3233
use sc_client_api::{
3334
backend::{Backend, StateBackend, StorageProvider},
3435
client::BlockchainEvents,
36+
BlockBackend, ProofProvider,
3537
};
3638
use sc_network::service::traits::NetworkService;
3739
use sc_network_sync::SyncingService;
@@ -107,11 +109,12 @@ pub type RpcExtension = jsonrpsee::RpcModule<()>;
107109
/// Instantiate all full RPC extensions.
108110
pub fn create_full<C, P, B>(deps: FullDeps<C, P, B>) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
109111
where
110-
C: ProvideRuntimeApi<Block>,
112+
C: ProvideRuntimeApi<Block> + BlockBackend<Block> + ProofProvider<Block>,
111113
C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError>,
112114
C: Send + Sync + 'static,
113115
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>,
114116
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
117+
C::Api: pallet_ismp_runtime_api::IsmpRuntimeApi<Block, sp_core::H256>,
115118
C::Api: BlockBuilderApi<Block>,
116119
P: TransactionPool + Sync + Send + 'static,
117120
B: sc_client_api::Backend<Block> + Send + Sync + 'static,
@@ -126,7 +129,9 @@ where
126129

127130
module.merge(System::new(client.clone(), pool).into_rpc())?;
128131
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
129-
module.merge(StateMigration::new(client, backend).into_rpc())?;
132+
module.merge(StateMigration::new(client.clone(), backend.clone()).into_rpc())?;
133+
134+
module.merge(IsmpRpcHandler::new(client, backend)?.into_rpc())?;
130135

131136
Ok(module)
132137
}

node/src/service.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,19 @@ fn start_consensus(
561561
client.clone(),
562562
);
563563

564+
let (client_clone, relay_chain_interface_clone) = (client.clone(), relay_chain_interface.clone());
564565
let params = AuraParams {
565-
create_inherent_data_providers: move |_, ()| async move { Ok(()) },
566+
create_inherent_data_providers: move |parent, ()| {
567+
let client = client_clone.clone();
568+
let relay_chain_interface = relay_chain_interface_clone.clone();
569+
async move {
570+
let inherent =
571+
ismp_parachain_inherent::ConsensusInherentProvider::create(parent, client, relay_chain_interface)
572+
.await?;
573+
574+
Ok(inherent)
575+
}
576+
},
566577
block_import,
567578
para_client: client.clone(),
568579
para_backend: backend.clone(),

pallets/circuit-breaker/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pallet-circuit-breaker"
3-
version = "1.2.2"
3+
version = "1.2.3"
44
authors = ["GalacticCouncil <hydradx@galacticcouncil.io>"]
55
edition = "2021"
66
license = "Apache-2.0"

pallets/circuit-breaker/src/tests/mock.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ impl pallet_currencies::Config for Test {
118118
type BoundErc20 = MockBoundErc20<Test>;
119119
type ReserveAccount = TreasuryAccount;
120120
type GetNativeCurrencyId = NativeCurrencyId;
121+
type RegistryInspect = MockBoundErc20<Test>;
121122
type WeightInfo = ();
122123
}
123124

pallets/currencies/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "pallet-currencies"
33
description = "Provide `MultiCurrency` implementation using `pallet-balances` and `orml-tokens` module."
44
repository = "https://github.com/open-web3-stack/open-runtime-module-library/tree/master/currencies"
55
license = "Apache-2.0"
6-
version = "3.2.0"
6+
version = "3.3.0"
77
authors = ["Laminar Developers <hello@laminar.one>"]
88
edition = "2021"
99

0 commit comments

Comments
 (0)