Skip to content

Commit

Permalink
companion: for #250
Browse files Browse the repository at this point in the history
  • Loading branch information
aurexav committed Aug 29, 2020
1 parent a7701c0 commit cb95a94
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions runtime/crab/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ darwinia-ethereum-backing = { default-features = false, git = "https:/
darwinia-ethereum-relay = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
darwinia-header-mmr = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
darwinia-header-mmr-rpc-runtime-api = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
darwinia-relay-primitives = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
darwinia-relayer-game = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
darwinia-staking = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
darwinia-staking-rpc-runtime-api = { default-features = false, git = "https://github.com/darwinia-network/darwinia-common.git", branch = "master" }
Expand Down Expand Up @@ -95,6 +96,7 @@ std = [
"darwinia-ethereum-relay/std",
"darwinia-header-mmr/std",
"darwinia-header-mmr-rpc-runtime-api/std",
"darwinia-relay-primitives/std",
"darwinia-relayer-game/std",
"darwinia-staking/std",
"darwinia-staking-rpc-runtime-api/std",
Expand Down
8 changes: 4 additions & 4 deletions runtime/crab/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ pub mod relay {
// --- darwinia ---
use super::currency::*;
use crate::*;
use darwinia_support::relay::*;
use darwinia_relay_primitives::*;

pub struct EthereumRelayerGameAdjustor;
impl AdjustableRelayerGame for EthereumRelayerGameAdjustor {
type Moment = BlockNumber;
type Balance = Balance;
type TcBlockNumber = <EthereumRelay as darwinia_support::relay::Relayable>::TcBlockNumber;
type TcBlockNumber = <EthereumRelay as Relayable>::BlockNumber;

fn challenge_time(round: Round) -> Self::Moment {
match round {
Expand All @@ -113,11 +113,11 @@ pub mod relay {
}
}

fn round_from_chain_len(chain_len: u64) -> Round {
fn round_of_samples_count(chain_len: u64) -> Round {
chain_len - 1
}

fn chain_len_from_round(round: Round) -> u64 {
fn samples_count_of_round(round: Round) -> u64 {
round + 1
}

Expand Down
6 changes: 3 additions & 3 deletions runtime/crab/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ impl InstanceFilter<Call> for ProxyType {
Call::Multisig(..) |
Call::EthereumBacking(..) |
Call::EthereumRelay(..) |
Call::RelayerGame(..) |
Call::EthereumRelayerGame(..) |
Call::HeaderMMR(..)
),
ProxyType::Staking => matches!(c, Call::Staking(..) | Call::Utility(..)),
Expand Down Expand Up @@ -754,7 +754,7 @@ impl darwinia_ethereum_relay::Trait for Runtime {
type ModuleId = EthereumRelayModuleId;
type Event = Event;
type Currency = Ring;
type RelayerGame = RelayerGame;
type RelayerGame = EthereumRelayerGame;
type ApproveOrigin = ApproveOrigin;
type RejectOrigin = EnsureRootOrHalfCouncil;
type WeightInfo = ();
Expand Down Expand Up @@ -841,7 +841,7 @@ construct_runtime!(

EthereumBacking: darwinia_ethereum_backing::{Module, Call, Storage, Config<T>, Event<T>},
EthereumRelay: darwinia_ethereum_relay::{Module, Call, Storage, Config<T>, Event<T>},
RelayerGame: darwinia_relayer_game::<Instance0>::{Module, Call, Storage, Event<T>},
EthereumRelayerGame: darwinia_relayer_game::<Instance0>::{Module, Call, Storage, Event<T>},

// Consensus support.
HeaderMMR: darwinia_header_mmr::{Module, Call, Storage},
Expand Down

0 comments on commit cb95a94

Please sign in to comment.