Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Commit

Permalink
Fix last confirmed blocks (#281)
Browse files Browse the repository at this point in the history
* Fix last confirmed blocks

* Fix checking

* Fix tests

* add ethereum network type support, fixed #272

* add reset_last_confirmed_header

* add migration

* rename function

* update types

* remove: unused thing

* udpate: fix r/w & todo verify continuous

* update: code owners

Co-authored-by: Xavier Lau <c.estlavie@icloud.com>
  • Loading branch information
hackfisher and AurevoirXavier authored Sep 14, 2020
1 parent 4b0efe8 commit 23adbf7
Show file tree
Hide file tree
Showing 14 changed files with 339 additions and 237 deletions.
29 changes: 27 additions & 2 deletions bin/node-template/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,33 @@ fn testnet_genesis(
}),
darwinia_ethereum_relay: Some(EthereumRelayConfig {
genesis_header_info: (
0,
b"A\x94\x10#h\t#\xe0\xfeMt\xa3K\xda\xc8\x14\x1f%@\xe3\xae\x90b7\x18\xe4}f\xd1\xcaJ-".into(),
vec![
249, 2, 20, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 29, 204, 77, 232, 222, 199, 93, 122, 171,
133, 181, 103, 182, 204, 212, 26, 211, 18, 69, 27, 148, 138, 116, 19, 240, 161,
66, 253, 64, 212, 147, 71, 148, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 160, 215, 248, 151, 79, 181, 172, 120, 217, 172, 9, 155, 154, 213,
1, 139, 237, 194, 206, 10, 114, 218, 209, 130, 122, 23, 9, 218, 48, 88, 15, 5,
68, 160, 86, 232, 31, 23, 27, 204, 85, 166, 255, 131, 69, 230, 146, 192, 248,
110, 91, 72, 224, 27, 153, 108, 173, 192, 1, 98, 47, 181, 227, 99, 180, 33,
160, 86, 232, 31, 23, 27, 204, 85, 166, 255, 131, 69, 230, 146, 192, 248, 110,
91, 72, 224, 27, 153, 108, 173, 192, 1, 98, 47, 181, 227, 99, 180, 33, 185, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 4, 0,
0, 0, 0, 128, 130, 19, 136, 128, 128, 160, 17, 187, 232, 219, 78, 52, 123, 78,
140, 147, 124, 28, 131, 112, 228, 181, 237, 51, 173, 179, 219, 105, 203, 219,
122, 56, 225, 229, 11, 27, 130, 250, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 136, 0, 0, 0, 0, 0,
0, 0, 66,
],
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00".into()
),
dags_merkle_roots_loader: DagsMerkleRootsLoaderR::from_file(
Expand Down
6 changes: 5 additions & 1 deletion bin/node-template/runtime/darwinia_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@
"header_hash": "H256"
},
"EthereumReceiptProofThing": "(EthereumHeader, EthereumReceiptProof, MMRProof)",
"MMRProof": "Vec<H256>",
"MMRProof": {
"member_leaf_index": "u64",
"last_leaf_index": "u64",
"proof": "Vec<H256>"
},
"__[pallet.claims]__": {},
"OtherSignature": {
"_enum": {
Expand Down
2 changes: 2 additions & 0 deletions bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,10 +842,12 @@ type EnsureRootOrHalfTechnicalComittee = EnsureOneOf<
>;
parameter_types! {
pub const EthereumRelayModuleId: ModuleId = ModuleId(*b"da/ethrl");
pub const EthereumNetwork: ethereum_primitives::EthereumNetworkType = ethereum_primitives::EthereumNetworkType::Ropsten;
}
impl darwinia_ethereum_relay::Trait for Runtime {
type ModuleId = EthereumRelayModuleId;
type Event = Event;
type EthereumNetwork = EthereumNetwork;
type Call = Call;
type Currency = Ring;
type RelayerGame = EthereumRelayerGame;
Expand Down
3 changes: 2 additions & 1 deletion docs/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
/frame/balances/rpc/ @AurevoirXavier
/frame/balances/rpc/runtime-api/ @AurevoirXavier

/frame/bridge/relayer-game/ @AurevoirXavier @yanganto
/frame/bridge/crab/issuing @AurevoirXavier @HackFisher
/frame/bridge/ethereum/backing/ @AurevoirXavier @HackFisher
/frame/bridge/ethereum/linear-relay/ @AurevoirXavier @clearloop @HackFisher
/frame/bridge/ethereum/offchain/ @AurevoirXavier @yanganto
/frame/bridge/ethereum/relay/ @AurevoirXavier @HackFisher @yanganto
/frame/bridge/relayer-game/ @AurevoirXavier @yanganto

/frame/claims/ @AurevoirXavier @HackFisher

Expand Down
3 changes: 1 addition & 2 deletions frame/bridge/ethereum/backing/src/test_with_linear_relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ use sp_runtime::{traits::Dispatchable, AccountId32};
// --- darwinia ---
use crate::*;
use array_bytes::hex_bytes_unchecked;
use darwinia_ethereum_linear_relay::EthereumNetworkType;
use darwinia_staking::{RewardDestination, StakingBalance, StakingLedger, TimeDepositItem};
use darwinia_support::balance::lock::StakingLock;
use ethereum_primitives::{header::EthereumHeader, receipt::EthereumReceiptProof};
use ethereum_primitives::{EthereumNetworkType, header::EthereumHeader, receipt::EthereumReceiptProof};

type EthereumRelay = darwinia_ethereum_linear_relay::Module<Test>;

Expand Down
Loading

0 comments on commit 23adbf7

Please sign in to comment.