Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add S2S to Darwinia/Crab #787

Merged
merged 43 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e36e75e
Remove Trailing Slash
aurexav Nov 18, 2021
cdd3ed1
Update Runtime Version
aurexav Nov 18, 2021
25da58c
Update Crate Version
aurexav Nov 18, 2021
032307a
Extract Constants Part.1
aurexav Nov 18, 2021
7f670be
Refine Primitives
aurexav Nov 18, 2021
0d08257
Add Bridge Dispatch Skeleton
aurexav Nov 18, 2021
bc67616
Move to Common Primitives
aurexav Nov 18, 2021
61a2a03
Add Bridge Primitives Skeleton
aurexav Nov 18, 2021
3afa8e1
Optimize Some Packages in Debug Mode
aurexav Nov 18, 2021
b3176da
Construct Bridge Dispatch Part.1
aurexav Nov 18, 2021
34aab2e
Filter Remote Call
aurexav Nov 18, 2021
b90881b
Construct Bridge Dispatch Part.2
aurexav Nov 18, 2021
c418053
Better Name
aurexav Nov 18, 2021
15cee92
Add Grandpa, Messages, Fee Market to Darwinia
aurexav Nov 21, 2021
bd4bc5c
Add RPCs and Use Global Primitives
aurexav Nov 21, 2021
aa6ac8e
Add Bridge Dispatch, Bridge Grandpa to Crab
aurexav Nov 21, 2021
723a2df
Correct Name
aurexav Nov 21, 2021
16df941
Add Fee Market, Bridge Messages to Crab
aurexav Nov 21, 2021
3842b3d
Add RPCs to Crab and Fix Macro
aurexav Nov 21, 2021
6c0723c
Use `[0; 4]` for Darwinia Crab Lane ID
aurexav Nov 22, 2021
0ef9132
Use `FeeMarketMessageConfirmedHandler`
aurexav Nov 22, 2021
c5e73fb
Remove `RialtoWeight`
aurexav Nov 22, 2021
387191c
Add Missing Docs
aurexav Nov 22, 2021
6ffe73b
Update `is_outbound_lane_enabled`
aurexav Nov 22, 2021
3e7fb09
Remove `SlashPerBlock`
aurexav Nov 22, 2021
03b6a65
Correct `BondingDurationInBlockNumber`
aurexav Nov 22, 2021
6dec03c
Add License
aurexav Nov 22, 2021
712cc0d
Set `Slot` to 600
aurexav Nov 22, 2021
c3323f2
Disable S2S Backing/Issuing
aurexav Nov 22, 2021
03668e2
Disable Paritytech Fee API
aurexav Nov 22, 2021
d5cb3d1
Rename to `FromThisChainMessageVerifier`
aurexav Nov 22, 2021
43e90d0
Set `CollateralPerOrder` to 50
aurexav Nov 22, 2021
cf37738
Update Description
aurexav Nov 22, 2021
9acab8f
Remove `derive_account*`
aurexav Nov 22, 2021
86bd22c
Remove `*_ownership_digest`
aurexav Nov 22, 2021
03c55cb
Remove Unused Import
aurexav Nov 22, 2021
e4160dd
Add Documentation
aurexav Nov 22, 2021
7e85b7b
Add Documentation
aurexav Nov 22, 2021
c81ba0e
Allow System Remark
aurexav Nov 22, 2021
d1058a8
Specify Chain Name for Dispatch Instance
aurexav Nov 22, 2021
29b71f0
Bump Parity Bridges Common and Darwinia Common
aurexav Nov 22, 2021
33c548a
Expose Some Runtime Calls
aurexav Nov 22, 2021
92c2119
Update Types
aurexav Nov 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
513 changes: 371 additions & 142 deletions Cargo.lock

Large diffs are not rendered by default.

73 changes: 64 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
authors = ["Darwinia Network <hello@darwinia.network>"]
description = "Darwinia node implementation in Rust"
edition = "2018"
homepage = "https://darwinia.network/"
homepage = "https://darwinia.network"
license = "GPL-3.0"
name = "darwinia"
repository = "https://github.com/darwinia-network/darwinia/"
version = "0.11.5"
repository = "https://github.com/darwinia-network/darwinia"
version = "0.11.6"

[[bin]]
name = "darwinia"
Expand All @@ -26,26 +26,81 @@ darwinia-service = { path = "node/service" }
[features]
default = ["darwinia-cli/wasmtime"]

dev = [
"darwinia-service/dev",
"darwinia-cli/dev",
]

try-runtime = ["darwinia-cli/try-runtime"]

runtime-benchmarks = ["darwinia-cli/runtime-benchmarks"]

[workspace]
members = [
"cli",
"primitives",
"primitives/bridge",
"primitives/common",
"rpc",
"runtime/common",
"runtime/crab",
"runtime/darwinia",
"node/service",
]

# The list of dependencies below (which can be both direct and indirect dependencies) are crates
# that are suspected to be CPU-intensive, and that are unlikely to require debugging (as some of
# their debug info might be missing) or to require to be frequently recompiled. We compile these
# dependencies with `opt-level=3` even in "dev" mode in order to make "dev" mode more usable.
# The majority of these crates are cryptographic libraries.
#
# Note that this does **not** affect crates that depend on Substrate. In other words, if you add
# a dependency on Substrate, you have to copy-paste this list in your own `Cargo.toml` (assuming
# that you want the same list). This list is only relevant when running `cargo build` from within
# the Substrate workspace.
#
# If you see an error mentioning "profile package spec ... did not match any packages", it
# probably concerns this list.
#
# This list is ordered alphabetically.
[profile.dev.package]
blake2 = { opt-level = 3 }
blake2-rfc = { opt-level = 3 }
blake2b_simd = { opt-level = 3 }
chacha20poly1305 = { opt-level = 3 }
cranelift-codegen = { opt-level = 3 }
cranelift-wasm = { opt-level = 3 }
crc32fast = { opt-level = 3 }
crossbeam-deque = { opt-level = 3 }
crypto-mac = { opt-level = 3 }
curve25519-dalek = { opt-level = 3 }
ed25519-dalek = { opt-level = 3 }
flate2 = { opt-level = 3 }
futures-channel = { opt-level = 3 }
hash-db = { opt-level = 3 }
hashbrown = { opt-level = 3 }
hmac = { opt-level = 3 }
httparse = { opt-level = 3 }
integer-sqrt = { opt-level = 3 }
keccak = { opt-level = 3 }
libm = { opt-level = 3 }
librocksdb-sys = { opt-level = 3 }
libsecp256k1 = { opt-level = 3 }
libz-sys = { opt-level = 3 }
mio = { opt-level = 3 }
nalgebra = { opt-level = 3 }
num-bigint = { opt-level = 3 }
parking_lot = { opt-level = 3 }
parking_lot_core = { opt-level = 3 }
percent-encoding = { opt-level = 3 }
primitive-types = { opt-level = 3 }
ring = { opt-level = 3 }
rustls = { opt-level = 3 }
sha2 = { opt-level = 3 }
sha3 = { opt-level = 3 }
smallvec = { opt-level = 3 }
snow = { opt-level = 3 }
twox-hash = { opt-level = 3 }
uint = { opt-level = 3 }
wasmi = { opt-level = 3 }
x25519-dalek = { opt-level = 3 }
yamux = { opt-level = 3 }
zeroize = { opt-level = 3 }

[profile.release]
# Darwinia runtime requires unwinding.
panic = "unwind"
8 changes: 3 additions & 5 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ authors = ["Darwinia Network <hello@darwinia.network>"]
build = "build.rs"
description = "Darwinia Client Node"
edition = "2018"
homepage = "https://darwinia.network/"
homepage = "https://darwinia.network"
license = "GPL-3.0"
name = "darwinia-cli"
repository = "https://github.com/darwinia-network/darwinia/"
version = "0.11.5"
repository = "https://github.com/darwinia-network/darwinia"
version = "0.11.6"

[lib]
crate-type = ["cdylib", "rlib"]
Expand Down Expand Up @@ -59,8 +59,6 @@ trie-memory-tracker = ["sp-trie/memory-tracker"]

wasmtime = ["sc-cli/wasmtime"]

dev = ["service/dev"]

runtime-benchmarks = [
# darwinia-network
"service/runtime-benchmarks",
Expand Down
32 changes: 14 additions & 18 deletions node/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
authors = ["Darwinia Network <hello@darwinia.network>"]
description = "Darwinia node service"
edition = "2018"
homepage = "https://darwinia.network/"
homepage = "https://darwinia.network"
license = "GPL-3.0"
name = "darwinia-service"
repository = "https://github.com/darwinia-network/darwinia/"
version = "0.11.5"
repository = "https://github.com/darwinia-network/darwinia"
version = "0.11.6"

[dependencies]
# crates.io
Expand All @@ -17,18 +17,19 @@ log = { version = "0.4" }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
# darwinia-network frame
darwinia-balances-rpc-runtime-api = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-1" }
darwinia-header-mmr-rpc-runtime-api = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-1" }
darwinia-staking-rpc-runtime-api = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-1" }
darwinia-balances-rpc-runtime-api = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-2" }
darwinia-fee-market-rpc-runtime-api = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-2" }
darwinia-header-mmr-rpc-runtime-api = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-2" }
darwinia-staking-rpc-runtime-api = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-2" }
# dvm
darwinia-evm = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-1" }
dc-db = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-1" }
dc-mapping-sync = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-1" }
dc-rpc = { features = ["rpc_binary_search_estimate"], git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-1" }
dp-rpc = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-1" }
dvm-rpc-runtime-api = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-1" }
darwinia-evm = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-2" }
dc-db = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-2" }
dc-mapping-sync = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-2" }
dc-rpc = { features = ["rpc_binary_search_estimate"], git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-2" }
dp-rpc = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-2" }
dvm-rpc-runtime-api = { git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-2" }
# darwinia-network primitives
darwinia-primitives = { path = "../../primitives" }
common-primitives = { path = "../../primitives/common" }
# darwinia-network rpc
darwinia-rpc = { path = "../../rpc" }
# darwinia-network runtime
Expand Down Expand Up @@ -95,8 +96,3 @@ try-runtime = [
"crab-runtime/try-runtime",
"darwinia-runtime/try-runtime",
]

dev = [
"crab-runtime/dev",
"darwinia-runtime/dev",
]
4 changes: 2 additions & 2 deletions node/service/src/chain_spec/crab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ use sp_core::{crypto::UncheckedInto, sr25519};
use sp_runtime::Perbill;
// --- darwinia-network ---
use super::*;
use crab_runtime::{constants::currency::COIN, *};
use darwinia_primitives::{AccountId, Balance};
use common_primitives::{AccountId, Balance, COIN};
use crab_runtime::*;

/// The `ChainSpec parametrised for Crab runtime`.
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig, Extensions>;
Expand Down
7 changes: 2 additions & 5 deletions node/service/src/chain_spec/darwinia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ use sp_core::{crypto::UncheckedInto, sr25519};
use sp_runtime::Perbill;
// --- darwinia-network ---
use super::*;
use darwinia_primitives::{AccountId, BlockNumber};
use darwinia_runtime::{
constants::{currency::COIN, time::DAYS},
*,
};
use common_primitives::{AccountId, BlockNumber, COIN, DAYS};
use darwinia_runtime::*;

/// The `ChainSpec parametrised for Darwinia runtime`.
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig, Extensions>;
Expand Down
6 changes: 3 additions & 3 deletions node/service/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use sp_consensus_babe::AuthorityId as BabeId;
use sp_core::{sr25519, Pair, Public};
use sp_runtime::traits::IdentifyAccount;
// --- darwinia-network ---
use darwinia_primitives::{AccountId, AccountPublic};
use common_primitives::{AccountId, AccountPublic};

const DEFAULT_PROTOCOL_ID: &str = "dar";

Expand All @@ -47,9 +47,9 @@ const DEFAULT_PROTOCOL_ID: &str = "dar";
#[serde(rename_all = "camelCase")]
pub struct Extensions {
/// Block numbers with known hashes.
pub fork_blocks: sc_client_api::ForkBlocks<darwinia_primitives::OpaqueBlock>,
pub fork_blocks: sc_client_api::ForkBlocks<common_primitives::OpaqueBlock>,
/// Known bad block hashes.
pub bad_blocks: sc_client_api::BadBlocks<darwinia_primitives::OpaqueBlock>,
pub bad_blocks: sc_client_api::BadBlocks<common_primitives::OpaqueBlock>,
}

/// Generate a crypto pair from seed.
Expand Down
7 changes: 5 additions & 2 deletions node/service/src/service/crab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ use crate::{
LightClient,
},
};
use darwinia_primitives::{AccountId, Balance, Hash, Nonce, OpaqueBlock as Block, Power};
use common_primitives::{AccountId, Balance, Hash, Nonce, OpaqueBlock as Block, Power};
use darwinia_rpc::{
crab::{FullDeps, LightDeps},
BabeDeps, DenyUnsafe, GrandpaDeps, RpcExtension, SubscriptionTaskExecutor,
Expand All @@ -81,7 +81,10 @@ sc_executor::native_executor_instance!(
frame_benchmarking::benchmarking::HostFunctions,
);

impl_runtime_apis!(dvm_rpc_runtime_api::EthereumRuntimeRPCApi<Block>);
impl_runtime_apis![
darwinia_fee_market_rpc_runtime_api::FeeMarketApi<Block, Balance>,
dvm_rpc_runtime_api::EthereumRuntimeRPCApi<Block>
];

// <--- dvm ---
pub fn dvm_database_dir(config: &Configuration) -> PathBuf {
Expand Down
4 changes: 2 additions & 2 deletions node/service/src/service/darwinia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ use crate::{
LightClient,
},
};
use darwinia_primitives::{AccountId, Balance, Hash, Nonce, OpaqueBlock as Block, Power};
use common_primitives::{AccountId, Balance, Hash, Nonce, OpaqueBlock as Block, Power};
use darwinia_rpc::{
darwinia::{FullDeps, LightDeps},
BabeDeps, DenyUnsafe, GrandpaDeps, RpcExtension, SubscriptionTaskExecutor,
Expand All @@ -72,7 +72,7 @@ sc_executor::native_executor_instance!(
frame_benchmarking::benchmarking::HostFunctions,
);

impl_runtime_apis!();
impl_runtime_apis![darwinia_fee_market_rpc_runtime_api::FeeMarketApi<Block, Balance>];

#[cfg(feature = "full-node")]
fn new_partial<RuntimeApi, Executor>(
Expand Down
6 changes: 3 additions & 3 deletions node/service/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ macro_rules! impl_runtime_apis {
+ darwinia_balances_rpc_runtime_api::BalancesApi<Block, AccountId, Balance>
+ darwinia_header_mmr_rpc_runtime_api::HeaderMMRApi<Block, Hash>
+ darwinia_staking_rpc_runtime_api::StakingApi<Block, AccountId, Power>
$(+ $extra_apis),*
$(+ $extra_apis)*
where
<Self as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
{
Expand All @@ -55,7 +55,7 @@ macro_rules! impl_runtime_apis {
+ darwinia_balances_rpc_runtime_api::BalancesApi<Block, AccountId, Balance>
+ darwinia_header_mmr_rpc_runtime_api::HeaderMMRApi<Block, Hash>
+ darwinia_staking_rpc_runtime_api::StakingApi<Block, AccountId, Power>
$(+ $extra_apis),*,
$(+ $extra_apis)*,
<Self as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
{
}
Expand Down Expand Up @@ -85,7 +85,7 @@ use sc_service::{
use sp_runtime::traits::BlakeTwo256;
use substrate_prometheus_endpoint::Registry;
// --- darwinia-network ---
use darwinia_primitives::OpaqueBlock as Block;
use common_primitives::OpaqueBlock as Block;

type FullBackend = TFullBackend<Block>;
type FullSelectChain = LongestChain<FullBackend, Block>;
Expand Down
37 changes: 0 additions & 37 deletions primitives/Cargo.toml

This file was deleted.

50 changes: 50 additions & 0 deletions primitives/bridge/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[package]
authors = ["Darwinia Network <hello@darwinia.network>"]
description = "Darwinia node runtime bridge primitives"
edition = "2018"
homepage = "https://darwinia.network"
license = "GPL-3.0"
name = "bridge-primitives"
repository = "https://github.com/darwinia-network/darwinia"
version = "0.11.6"

[dependencies]
# darwinia-network frame
darwinia-fee-market = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common", tag = "darwinia-v0.11.6-2" }
# darwinia-network primitives
common-primitives = { default-features = false, path = "../common" }
# paritytech bridge frame
pallet-bridge-dispatch = { default-features = false, git = "https://github.com/darwinia-network/parity-bridges-common", tag = "darwinia-v0.11.6-2" }
# paritytech bridge primitives
bp-messages = { default-features = false, git = "https://github.com/darwinia-network/parity-bridges-common", tag = "darwinia-v0.11.6-2" }
bp-runtime = { default-features = false, git = "https://github.com/darwinia-network/parity-bridges-common", tag = "darwinia-v0.11.6-2" }
bridge-runtime-common = { default-features = false, git = "https://github.com/darwinia-network/parity-bridges-common", tag = "darwinia-v0.11.6-2" }
# paritytech frame
frame-support = { default-features = false, git = "https://github.com/darwinia-network/substrate", tag = "darwinia-v0.11.6-1" }
# paritytech primitives
sp-api = { default-features = false, git = "https://github.com/darwinia-network/substrate", tag = "darwinia-v0.11.6-1" }
sp-core = { default-features = false, git = "https://github.com/darwinia-network/substrate", tag = "darwinia-v0.11.6-1" }
sp-runtime = { default-features = false, git = "https://github.com/darwinia-network/substrate", tag = "darwinia-v0.11.6-1" }
sp-std = { default-features = false, git = "https://github.com/darwinia-network/substrate", tag = "darwinia-v0.11.6-1" }

[features]
default = ["std"]

std = [
# darwinia-network frame
"darwinia-fee-market/std",
# darwinia-network primitives
"common-primitives/std",
# paritytech bridge frame
"pallet-bridge-dispatch/std",
# paritytech bridge primitives
"bp-messages/std",
"bp-runtime/std",
"bridge-runtime-common/std",
# paritytech frame
"frame-support/std",
# paritytech primitives
"sp-api/std",
"sp-runtime/std",
"sp-std/std",
]
Loading