Skip to content

Commit

Permalink
Merge pull request #158 from darwinia-network/denny_fixing_eth_backing
Browse files Browse the repository at this point in the history
Fixing eth-backing modules
  • Loading branch information
hackfisher authored Dec 17, 2019
2 parents ae97dc5 + 4b0b62b commit d1397ed
Show file tree
Hide file tree
Showing 13 changed files with 490 additions and 84 deletions.
40 changes: 39 additions & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ members = [

"srml/balances",
"srml/eth-relay",
# "srml/eth-backing",
"srml/eth-backing",
"srml/kton",
"srml/staking",
"srml/support"
Expand Down
1 change: 1 addition & 0 deletions core/sr-eth-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ std = [
"keccak-hash/std",
"primitive-types/std",
"ethereum-types/std",
"ethereum-types/serialize",
"impl-codec/std",
"fixed-hash/std",
"impl-rlp/std",
Expand Down
13 changes: 11 additions & 2 deletions node/cli/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use grandpa_primitives::AuthorityId as GrandpaId;
use hex_literal::hex;
use im_online::sr25519::AuthorityId as ImOnlineId;
use node_runtime::{
constants::currency::*, BalancesConfig, Block, ContractsConfig, IndicesConfig, KtonConfig, SessionConfig,
SessionKeys, StakerStatus, StakingConfig, SudoConfig, SystemConfig, WASM_BINARY,
constants::currency::*, BalancesConfig, Block, ContractsConfig, EthBackingConfig, EthRelayConfig, IndicesConfig,
KtonConfig, SessionConfig, SessionKeys, StakerStatus, StakingConfig, SudoConfig, SystemConfig, WASM_BINARY,
};
use primitives::{crypto::UncheckedInto, sr25519, Pair, Public};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -263,6 +263,15 @@ pub fn darwinia_genesis(
slash_reward_fraction: Perbill::from_percent(10),
..Default::default()
}),
eth_relay: Some(EthRelayConfig { ..Default::default() }),
eth_backing: Some(EthBackingConfig {
ring_redeem_address: hex!["dbc888d701167cbfb86486c516aafbefc3a4de6e"].into(),
kton_redeem_address: hex!["dbc888d701167cbfb86486c516aafbefc3a4de6e"].into(),
deposit_redeem_address: hex!["ad52e0f67b6f44cd5b9a6f4fbc7c0f78f37e094b"].into(),
ring_locked: 2000000000,
kton_locked: 50000,
..Default::default()
}),
}
}

Expand Down
2 changes: 2 additions & 0 deletions node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ version = { package = "sr-version", git = "https://github.com/darwinia-network/s
# darwinia
balances = { package = "darwinia-balances", path = '../../srml/balances', default-features = false }
eth-relay = { package = "darwinia-eth-relay", path = "../../srml/eth-relay", default-features = false }
eth-backing = { package = "darwinia-eth-backing", path = "../../srml/eth-backing", default-features = false }
kton = { package = "darwinia-kton", path = '../../srml/kton', default-features = false }
node-primitives = { path = "../primitives", default-features = false }
staking = { package = "darwinia-staking", path = "../../srml/staking", default-features = false }
Expand Down Expand Up @@ -108,6 +109,7 @@ std = [
# darwinia
"balances/std",
"eth-relay/std",
"eth-backing/std",
"kton/std",
"node-primitives/std",
"staking/std",
Expand Down
21 changes: 17 additions & 4 deletions node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,23 @@ parameter_types! {
pub const EthMainet: u64 = 0;
pub const EthRopsten: u64 = 1;
}

impl eth_relay::Trait for Runtime {
type Event = Event;
type EthNetwork = EthRopsten;
}

impl eth_backing::Trait for Runtime {
type Event = Event;
type EthRelay = EthRelay;
type Ring = Balances;
type Kton = Kton;
type OnDepositRedeem = Staking;
type DetermineAccountId = eth_backing::AccountIdDeterminator<Runtime>;
type RingReward = ();
type KtonReward = ();
}

construct_runtime!(
pub enum Runtime where
Block = Block,
Expand All @@ -414,7 +426,7 @@ construct_runtime!(
{
// Basic stuff; balances is uncallable initially.
RandomnessCollectiveFlip: randomness_collective_flip::{Module, Call, Storage},
System: system::{Module, Call, Storage, Config, Event},
System: system::{Module, Call, Storage, Event, Config},

// Must be before session.
Babe: babe::{Module, Call, Storage, Config, Inherent(Timestamp)},
Expand All @@ -427,8 +439,8 @@ construct_runtime!(

// Consensus support.
Authorship: authorship::{Module, Call, Storage, Inherent},
Grandpa: grandpa::{Module, Call, Storage, Config, Event},
ImOnline: im_online::{Module, Call, Storage, Event<T>, ValidateUnsigned, Config<T>},
Grandpa: grandpa::{Module, Call, Storage, Event, Config},
ImOnline: im_online::{default, ValidateUnsigned},
FinalityTracker: finality_tracker::{Module, Call, Inherent},
Offences: offences::{Module, Call, Storage, Event},
Session: session::{Module, Call, Storage, Event, Config<T>},
Expand All @@ -438,7 +450,8 @@ construct_runtime!(
Sudo: sudo,
Utility: utility::{Module, Call, Event},

EthRelay: eth_relay::{Storage, Module, Event<T>, Call},
EthRelay: eth_relay::{Module, Call, Storage, Event<T>, Config},
EthBacking: eth_backing,
}
);

Expand Down
18 changes: 17 additions & 1 deletion srml/eth-backing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,42 @@ edition = "2018"

[dependencies]
# crates.io
serde = { version = "1.0.101", optional = true }
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
hex = { version = "0.4", default-features = false }
serde = { version = "1.0.101", optional = true }

# github.com
rstd = { package = "sr-std", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", default-features = false }
support = { package = "srml-support", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", default-features = false }
system = { package = "srml-system", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", default-features = false }
timestamp = { package = "srml-timestamp", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", default-features = false }
sr-primitives = { git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", default-features = false }
primitives = { package = "substrate-primitives", git = "https://github.com/darwinia-network/substrate.git", branch = "darwinia-develop", default-features = false }
ethabi = { git = "https://github.com/darwinia-network/ethabi.git", branch = "with_no_std", default-features = false }

# darwinia
darwinia-support = { package = "darwinia-support", path = "../support", default-features = false }
darwinia-eth-relay = { package = "darwinia-eth-relay", path = "../eth-relay", default-features = false }
sr-eth-primitives = { path = "../../core/sr-eth-primitives", default-features = false }

[dev-dependencies]
hex-literal = "0.2.1"

[features]
default = ["std"]
std = [
"codec/std",
"hex/std",
"serde/std",

"ethabi/std",
"rstd/std",
"sr-primitives/std",
"support/std",
"system/std",
"timestamp/std",

"darwinia-support/std",
"darwinia-eth-relay/std",
"sr-eth-primitives/std",
]
Loading

0 comments on commit d1397ed

Please sign in to comment.