Snowbridge - Extract Ethereum Chain ID (#3501)

While adding runtime tests to
https://github.com/polkadot-fellows/runtimes/pull/130, I noticed the
Ethereum chain ID was hardcoded. For Kusama + Polkadot, the Ethereum
chain ID should 1 (Mainnet), whereas on Rococo it is 11155111 (Sepolia).

This PR also updates the Snowbridge crates versions to the current
versions on crates.io.

---------

Co-authored-by: claravanstaden <Cats 4 life!>
This commit is contained in:
Clara van Staden
2024-02-28 21:42:35 +02:00
committed by GitHub
parent 426136671a
commit 576681b867
18 changed files with 45 additions and 30 deletions
Generated
+14 -14
View File
@@ -17856,7 +17856,7 @@ dependencies = [
[[package]]
name = "snowbridge-beacon-primitives"
version = "0.0.0"
version = "0.2.0"
dependencies = [
"byte-slice-cast",
"frame-support",
@@ -17880,7 +17880,7 @@ dependencies = [
[[package]]
name = "snowbridge-core"
version = "0.0.0"
version = "0.2.0"
dependencies = [
"ethabi-decode",
"frame-support",
@@ -17903,7 +17903,7 @@ dependencies = [
[[package]]
name = "snowbridge-ethereum"
version = "0.1.0"
version = "0.3.0"
dependencies = [
"ethabi-decode",
"ethbloom",
@@ -17942,7 +17942,7 @@ dependencies = [
[[package]]
name = "snowbridge-outbound-queue-merkle-tree"
version = "0.1.1"
version = "0.3.0"
dependencies = [
"array-bytes 4.2.0",
"env_logger 0.9.3",
@@ -17957,7 +17957,7 @@ dependencies = [
[[package]]
name = "snowbridge-outbound-queue-runtime-api"
version = "0.0.0"
version = "0.2.0"
dependencies = [
"frame-support",
"parity-scale-codec",
@@ -17971,7 +17971,7 @@ dependencies = [
[[package]]
name = "snowbridge-pallet-ethereum-client"
version = "0.0.0"
version = "0.2.0"
dependencies = [
"bp-runtime",
"byte-slice-cast",
@@ -18017,7 +18017,7 @@ dependencies = [
[[package]]
name = "snowbridge-pallet-inbound-queue"
version = "0.0.0"
version = "0.2.0"
dependencies = [
"alloy-primitives",
"alloy-rlp",
@@ -18050,7 +18050,7 @@ dependencies = [
[[package]]
name = "snowbridge-pallet-inbound-queue-fixtures"
version = "0.9.0"
version = "0.10.0"
dependencies = [
"frame-benchmarking",
"frame-support",
@@ -18064,7 +18064,7 @@ dependencies = [
[[package]]
name = "snowbridge-pallet-outbound-queue"
version = "0.0.0"
version = "0.2.0"
dependencies = [
"bridge-hub-common",
"ethabi-decode",
@@ -18089,7 +18089,7 @@ dependencies = [
[[package]]
name = "snowbridge-pallet-system"
version = "0.0.0"
version = "0.2.0"
dependencies = [
"ethabi-decode",
"frame-benchmarking",
@@ -18117,7 +18117,7 @@ dependencies = [
[[package]]
name = "snowbridge-router-primitives"
version = "0.0.0"
version = "0.9.0"
dependencies = [
"ethabi-decode",
"frame-support",
@@ -18140,7 +18140,7 @@ dependencies = [
[[package]]
name = "snowbridge-runtime-common"
version = "0.0.0"
version = "0.2.0"
dependencies = [
"frame-support",
"frame-system",
@@ -18156,7 +18156,7 @@ dependencies = [
[[package]]
name = "snowbridge-runtime-test-common"
version = "0.0.0"
version = "0.2.0"
dependencies = [
"assets-common",
"bridge-hub-test-utils",
@@ -18233,7 +18233,7 @@ dependencies = [
[[package]]
name = "snowbridge-system-runtime-api"
version = "0.0.0"
version = "0.2.0"
dependencies = [
"parity-scale-codec",
"snowbridge-core",
@@ -1,7 +1,7 @@
[package]
name = "snowbridge-pallet-ethereum-client"
description = "Snowbridge Ethereum Client Pallet"
version = "0.0.0"
version = "0.2.0"
authors = ["Snowfork <contact@snowfork.com>"]
edition.workspace = true
repository.workspace = true
@@ -1,7 +1,7 @@
[package]
name = "snowbridge-pallet-inbound-queue"
description = "Snowbridge Inbound Queue Pallet"
version = "0.0.0"
version = "0.2.0"
authors = ["Snowfork <contact@snowfork.com>"]
edition.workspace = true
repository.workspace = true
@@ -1,7 +1,7 @@
[package]
name = "snowbridge-pallet-inbound-queue-fixtures"
description = "Snowbridge Inbound Queue Test Fixtures"
version = "0.9.0"
version = "0.10.0"
authors = ["Snowfork <contact@snowfork.com>"]
edition.workspace = true
repository.workspace = true
@@ -1,7 +1,7 @@
[package]
name = "snowbridge-pallet-outbound-queue"
description = "Snowbridge Outbound Queue Pallet"
version = "0.0.0"
version = "0.2.0"
authors = ["Snowfork <contact@snowfork.com>"]
edition.workspace = true
repository.workspace = true
@@ -1,7 +1,7 @@
[package]
name = "snowbridge-outbound-queue-merkle-tree"
description = "Snowbridge Outbound Queue Merkle Tree"
version = "0.1.1"
version = "0.3.0"
authors = ["Snowfork <contact@snowfork.com>"]
edition.workspace = true
repository.workspace = true
@@ -1,7 +1,7 @@
[package]
name = "snowbridge-outbound-queue-runtime-api"
description = "Snowbridge Outbound Queue Runtime API"
version = "0.0.0"
version = "0.2.0"
authors = ["Snowfork <contact@snowfork.com>"]
edition.workspace = true
repository.workspace = true
+1 -1
View File
@@ -1,7 +1,7 @@
[package]
name = "snowbridge-pallet-system"
description = "Snowbridge System Pallet"
version = "0.0.0"
version = "0.2.0"
authors = ["Snowfork <contact@snowfork.com>"]
edition.workspace = true
repository.workspace = true
@@ -1,7 +1,7 @@
[package]
name = "snowbridge-system-runtime-api"
description = "Snowbridge System Runtime API"
version = "0.0.0"
version = "0.2.0"
authors = ["Snowfork <contact@snowfork.com>"]
edition.workspace = true
repository.workspace = true
@@ -1,7 +1,7 @@
[package]
name = "snowbridge-beacon-primitives"
description = "Snowbridge Beacon Primitives"
version = "0.0.0"
version = "0.2.0"
authors = ["Snowfork <contact@snowfork.com>"]
edition.workspace = true
repository.workspace = true
@@ -1,7 +1,7 @@
[package]
name = "snowbridge-core"
description = "Snowbridge Core"
version = "0.0.0"
version = "0.2.0"
authors = ["Snowfork <contact@snowfork.com>"]
edition.workspace = true
repository.workspace = true
@@ -1,7 +1,7 @@
[package]
name = "snowbridge-ethereum"
description = "Snowbridge Ethereum"
version = "0.1.0"
version = "0.3.0"
authors = ["Snowfork <contact@snowfork.com>"]
edition.workspace = true
repository.workspace = true
@@ -1,7 +1,7 @@
[package]
name = "snowbridge-router-primitives"
description = "Snowbridge Router Primitives"
version = "0.0.0"
version = "0.9.0"
authors = ["Snowfork <contact@snowfork.com>"]
edition.workspace = true
repository.workspace = true
@@ -1,7 +1,7 @@
[package]
name = "snowbridge-runtime-common"
description = "Snowbridge Runtime Common"
version = "0.0.0"
version = "0.2.0"
authors = ["Snowfork <contact@snowfork.com>"]
edition.workspace = true
repository.workspace = true
@@ -1,7 +1,7 @@
[package]
name = "snowbridge-runtime-test-common"
description = "Snowbridge Runtime Tests"
version = "0.0.0"
version = "0.2.0"
authors = ["Snowfork <contact@snowfork.com>"]
edition = "2021"
license = "Apache-2.0"
@@ -40,6 +40,7 @@ where
}
pub fn send_transfer_token_message<Runtime, XcmConfig>(
ethereum_chain_id: u64,
assethub_parachain_id: u32,
weth_contract_address: H160,
destination_address: H160,
@@ -89,7 +90,7 @@ where
WithdrawAsset(Assets::from(vec![fee.clone()])),
BuyExecution { fees: fee, weight_limit: Unlimited },
ExportMessage {
network: Ethereum { chain_id: 11155111 },
network: Ethereum { chain_id: ethereum_chain_id },
destination: Here,
xcm: inner_xcm,
},
@@ -107,6 +108,7 @@ where
}
pub fn send_transfer_token_message_success<Runtime, XcmConfig>(
ethereum_chain_id: u64,
collator_session_key: CollatorSessionKeys<Runtime>,
runtime_para_id: u32,
assethub_parachain_id: u32,
@@ -149,6 +151,7 @@ pub fn send_transfer_token_message_success<Runtime, XcmConfig>(
initial_fund::<Runtime>(assethub_parachain_id, 5_000_000_000_000);
let outcome = send_transfer_token_message::<Runtime, XcmConfig>(
ethereum_chain_id,
assethub_parachain_id,
weth_contract_address,
destination_address,
@@ -205,6 +208,7 @@ pub fn ethereum_outbound_queue_processes_messages_before_message_queue_works<
XcmConfig,
AllPalletsWithoutSystem,
>(
ethereum_chain_id: u64,
collator_session_key: CollatorSessionKeys<Runtime>,
runtime_para_id: u32,
assethub_parachain_id: u32,
@@ -249,6 +253,7 @@ pub fn ethereum_outbound_queue_processes_messages_before_message_queue_works<
initial_fund::<Runtime>(assethub_parachain_id, 5_000_000_000_000);
let outcome = send_transfer_token_message::<Runtime, XcmConfig>(
ethereum_chain_id,
assethub_parachain_id,
weth_contract_address,
destination_address,
@@ -290,6 +295,7 @@ pub fn ethereum_outbound_queue_processes_messages_before_message_queue_works<
}
pub fn send_unpaid_transfer_token_message<Runtime, XcmConfig>(
ethereum_chain_id: u64,
collator_session_key: CollatorSessionKeys<Runtime>,
runtime_para_id: u32,
assethub_parachain_id: u32,
@@ -353,7 +359,7 @@ pub fn send_unpaid_transfer_token_message<Runtime, XcmConfig>(
let xcm = Xcm(vec![
UnpaidExecution { weight_limit: Unlimited, check_origin: None },
ExportMessage {
network: Ethereum { chain_id: 11155111 },
network: Ethereum { chain_id: ethereum_chain_id },
destination: Here,
xcm: inner_xcm,
},
@@ -375,6 +381,7 @@ pub fn send_unpaid_transfer_token_message<Runtime, XcmConfig>(
#[allow(clippy::too_many_arguments)]
pub fn send_transfer_token_message_failure<Runtime, XcmConfig>(
ethereum_chain_id: u64,
collator_session_key: CollatorSessionKeys<Runtime>,
runtime_para_id: u32,
assethub_parachain_id: u32,
@@ -414,6 +421,7 @@ pub fn send_transfer_token_message_failure<Runtime, XcmConfig>(
initial_fund::<Runtime>(assethub_parachain_id, initial_amount);
let outcome = send_transfer_token_message::<Runtime, XcmConfig>(
ethereum_chain_id,
assethub_parachain_id,
weth_contract_address,
destination_address,
@@ -40,10 +40,12 @@ git checkout "$branch_name"
# remove everything we think is not required for our needs
rm -rf rust-toolchain.toml
rm -rf codecov.yml
rm -rf $SNOWBRIDGE_FOLDER/.cargo
rm -rf $SNOWBRIDGE_FOLDER/.github
rm -rf $SNOWBRIDGE_FOLDER/SECURITY.md
rm -rf $SNOWBRIDGE_FOLDER/.gitignore
rm -rf $SNOWBRIDGE_FOLDER/rustfmt.toml
rm -rf $SNOWBRIDGE_FOLDER/templates
rm -rf $SNOWBRIDGE_FOLDER/pallets/ethereum-client/fuzz
@@ -51,6 +51,7 @@ fn collator_session_keys() -> bridge_hub_test_utils::CollatorSessionKeys<Runtime
#[test]
pub fn transfer_token_to_ethereum_works() {
snowbridge_runtime_test_common::send_transfer_token_message_success::<Runtime, XcmConfig>(
11155111,
collator_session_keys(),
1013,
1000,
@@ -69,6 +70,7 @@ pub fn transfer_token_to_ethereum_works() {
#[test]
pub fn unpaid_transfer_token_to_ethereum_fails_with_barrier() {
snowbridge_runtime_test_common::send_unpaid_transfer_token_message::<Runtime, XcmConfig>(
11155111,
collator_session_keys(),
1013,
1000,
@@ -80,6 +82,7 @@ pub fn unpaid_transfer_token_to_ethereum_fails_with_barrier() {
#[test]
pub fn transfer_token_to_ethereum_fee_not_enough() {
snowbridge_runtime_test_common::send_transfer_token_message_failure::<Runtime, XcmConfig>(
11155111,
collator_session_keys(),
1013,
1000,
@@ -95,6 +98,7 @@ pub fn transfer_token_to_ethereum_fee_not_enough() {
#[test]
pub fn transfer_token_to_ethereum_insufficient_fund() {
snowbridge_runtime_test_common::send_transfer_token_message_failure::<Runtime, XcmConfig>(
11155111,
collator_session_keys(),
1013,
1000,
@@ -146,6 +150,7 @@ pub fn ethereum_outbound_queue_processes_messages_before_message_queue_works() {
XcmConfig,
AllPalletsWithoutSystem,
>(
11155111,
collator_session_keys(),
1013,
1000,