Skip to content

Commit

Permalink
Eth Beacon receiver in dancelight (#717)
Browse files Browse the repository at this point in the history
* eth receiver

* wip

* add eth client tests

* more tests

* add new tests

* add comments to tests

* fix a couple things

* first typescript test

* final tests

* lint and fmt

* zepter

* toml-maid

* solo-chains and typescript-api

* added weights

* use workspace dep

* fix errors2

* hex use

* toml

* remove dup

* stack size increase for fixtures

* only download files when current version does not match

* fix
  • Loading branch information
girazoki authored Oct 21, 2024
1 parent e422a31 commit 2e13202
Show file tree
Hide file tree
Showing 25 changed files with 2,028 additions and 373 deletions.
180 changes: 180 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ westend-runtime = { git = "https://github.com/moondance-labs/polkadot-sdk", bran
westend-runtime-constants = { git = "https://github.com/moondance-labs/polkadot-sdk", branch = "tanssi-polkadot-stable2407", default-features = false }
xcm-runtime-apis = { git = "https://github.com/moondance-labs/polkadot-sdk", branch = "tanssi-polkadot-stable2407", default-features = false }


# Bridges (wasm)
milagro-bls = { package = "snowbridge-milagro-bls", version = "1.5.4", default-features = false }
snowbridge-beacon-primitives = { git = "https://github.com/moondance-labs/polkadot-sdk", branch = "tanssi-polkadot-stable2407", default-features = false }
snowbridge-pallet-ethereum-client = { git = "https://github.com/moondance-labs/polkadot-sdk", branch = "tanssi-polkadot-stable2407", default-features = false }

# Polkadot (client)
polkadot-cli = { git = "https://github.com/moondance-labs/polkadot-sdk", branch = "tanssi-polkadot-stable2407" }
polkadot-node-subsystem = { git = "https://github.com/moondance-labs/polkadot-sdk", branch = "tanssi-polkadot-stable2407" }
Expand Down
14 changes: 14 additions & 0 deletions solo-chains/runtime/dancelight/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,14 @@ tanssi-runtime-common = { workspace = true }
# Moonkit
pallet-migrations = { workspace = true }

# Bridges
snowbridge-beacon-primitives = { workspace = true }
snowbridge-pallet-ethereum-client = { workspace = true }

[dev-dependencies]
keyring = { workspace = true }
milagro-bls = { workspace = true, features = [ "std" ] }
rand = { workspace = true, features = [ "std", "std_rng" ] }
remote-externalities = { workspace = true }
separator = { workspace = true }
serde_json = { workspace = true }
Expand Down Expand Up @@ -177,6 +183,7 @@ std = [
"inherents/std",
"keyring/std",
"log/std",
"milagro-bls/std",
"nimbus-primitives/std",
"offchain-primitives/std",
"pallet-asset-rate/std",
Expand Down Expand Up @@ -235,12 +242,16 @@ std = [
"parity-scale-codec/std",
"polkadot-parachain-primitives/std",
"primitives/std",
"rand/std",
"runtime-common/std",
"runtime-parachains/std",
"scale-info/std",
"serde/std",
"serde_derive",
"serde_json/std",
"snowbridge-beacon-primitives/std",
"snowbridge-pallet-ethereum-client/fuzzing",
"snowbridge-pallet-ethereum-client/std",
"sp-api/std",
"sp-arithmetic/std",
"sp-consensus-aura/std",
Expand Down Expand Up @@ -270,6 +281,7 @@ std = [
"xcm/std",
]
no_std = []

runtime-benchmarks = [
"cumulus-pallet-parachain-system/runtime-benchmarks",
"cumulus-primitives-core/runtime-benchmarks",
Expand Down Expand Up @@ -323,6 +335,7 @@ runtime-benchmarks = [
"primitives/runtime-benchmarks",
"runtime-common/runtime-benchmarks",
"runtime-parachains/runtime-benchmarks",
"snowbridge-pallet-ethereum-client/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"sp-staking/runtime-benchmarks",
"tanssi-runtime-common/runtime-benchmarks",
Expand Down Expand Up @@ -389,6 +402,7 @@ try-runtime = [
"pallet-xcm/try-runtime",
"runtime-common/try-runtime",
"runtime-parachains/try-runtime",
"snowbridge-pallet-ethereum-client/try-runtime",
"sp-runtime/try-runtime",
"tanssi-runtime-common/try-runtime",
]
Expand Down
91 changes: 91 additions & 0 deletions solo-chains/runtime/dancelight/src/bridge_to_ethereum_config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// Copyright (C) Moondance Labs Ltd.
// This file is part of Tanssi.

// Tanssi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Tanssi is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Tanssi. If not, see <http://www.gnu.org/licenses/>

//! The bridge to ethereum config
pub const SLOTS_PER_EPOCH: u32 = snowbridge_pallet_ethereum_client::config::SLOTS_PER_EPOCH as u32;
use crate::{parameter_types, weights, Runtime, RuntimeEvent};
use snowbridge_beacon_primitives::{Fork, ForkVersions};

// For tests, benchmarks and fast-runtime configurations we use the mocked fork versions
#[cfg(any(
feature = "std",
feature = "fast-runtime",
feature = "runtime-benchmarks",
test
))]
parameter_types! {
pub const ChainForkVersions: ForkVersions = ForkVersions {
genesis: Fork {
version: [0, 0, 0, 0], // 0x00000000
epoch: 0,
},
altair: Fork {
version: [1, 0, 0, 0], // 0x01000000
epoch: 0,
},
bellatrix: Fork {
version: [2, 0, 0, 0], // 0x02000000
epoch: 0,
},
capella: Fork {
version: [3, 0, 0, 0], // 0x03000000
epoch: 0,
},
deneb: Fork {
version: [4, 0, 0, 0], // 0x04000000
epoch: 0,
}
};
}

// Holesky: https://github.com/eth-clients/holesky
#[cfg(not(any(
feature = "std",
feature = "fast-runtime",
feature = "runtime-benchmarks",
test
)))]
parameter_types! {
pub const ChainForkVersions: ForkVersions = ForkVersions {
genesis: Fork {
version: hex_literal::hex!("01017000"), // 0x01017000
epoch: 0,
},
altair: Fork {
version: hex_literal::hex!("01017000"), // 0x01017000
epoch: 0,
},
bellatrix: Fork {
version: hex_literal::hex!("01017000"), // 0x01017000
epoch: 0,
},
capella: Fork {
version: hex_literal::hex!("01017001"), // 0x01017001
epoch: 256,
},
deneb: Fork {
version: hex_literal::hex!("01017002"), // 0x01017002
epoch: 29696,
},
};
}

impl snowbridge_pallet_ethereum_client::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type ForkVersions = ChainForkVersions;
type WeightInfo = weights::snowbridge_pallet_ethereum_client::SubstrateWeight<Runtime>;
}
Loading

0 comments on commit 2e13202

Please sign in to comment.