Skip to content
This repository was archived by the owner on Mar 13, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
19bc83b
revamp
aurexav Jun 21, 2021
3251003
mmr-primitives part.1
aurexav Jun 22, 2021
9def0d9
`mmr-primitives` part.2
aurexav Jun 22, 2021
1a8629c
test new primitives
aurexav Jun 22, 2021
6572a03
offchain test
aurexav Jun 22, 2021
4d443a0
minor change
aurexav Jun 23, 2021
fb0c0b7
optimize test
aurexav Jun 23, 2021
3928013
`cargo update -p ckb-merkle-mountain-range`
aurexav Jun 23, 2021
ced75a2
enable tracing for test
aurexav Jun 23, 2021
5532b34
implement pruning algorithm
aurexav Jun 23, 2021
892801b
comments
aurexav Jun 23, 2021
dad86df
fix compile & todo MMR RPC
aurexav Jun 23, 2021
0f449f6
Merge remote-tracking branch 'origin/master' into xavier-mmr
aurexav Jun 23, 2021
5465682
update types
aurexav Jun 23, 2021
0b7e72d
enable `gen_proof_rpc`
aurexav Jun 23, 2021
c6b3e70
change as suggestion
aurexav Jun 23, 2021
8a959d6
revamp log prefix related
aurexav Jun 23, 2021
1f9705b
add `on_initialize`
aurexav Jun 23, 2021
3382452
add some utils fn
aurexav Jun 23, 2021
9c40180
eliminate warning
aurexav Jun 23, 2021
8f8fc8d
unit test `header_digest_should_work`
aurexav Jun 23, 2021
a25e5cd
unit test `hasher_should_work`
aurexav Jun 23, 2021
e76bd76
unit test `integration_testing_should_work`
aurexav Jun 24, 2021
a17339b
`codec_digest_should_work` & `serialize_digest_should_work`
aurexav Jun 24, 2021
d86acee
custom migration for Pangolin
aurexav Jun 24, 2021
06fbbf3
trace pruning
aurexav Jun 24, 2021
41dc879
use `fmt::Debug`
aurexav Jun 24, 2021
7b364d5
companion for `relay-authorities`
aurexav Jun 24, 2021
f415d4d
correct mock's genesis state
aurexav Jun 24, 2021
13ae355
add migration for Pangolin
aurexav Jun 24, 2021
553847f
add `MMRNodeList` pruning logic
aurexav Jun 24, 2021
6e21aab
trace pruned nodes
aurexav Jun 24, 2021
49bdead
`config_pruning`
aurexav Jun 25, 2021
fb7e307
optimize mock
aurexav Jun 25, 2021
5c2ed2d
`prune_darwinia_should_work`!!
aurexav Jun 25, 2021
3bdc687
test only
aurexav Jun 25, 2021
42556b2
change as suggestion
aurexav Jun 25, 2021
420728c
simplify initialization
aurexav Jun 25, 2021
44e173a
try-runtime
aurexav Jun 26, 2021
ceb3ced
revert test configuration
aurexav Jun 26, 2021
8909066
correct params for Pangolin
aurexav Jun 27, 2021
f17974d
update format
aurexav Jun 28, 2021
d2a3e75
fix `gen_proof_rpc` & add test
Jun 28, 2021
30622b8
optimize `get_root`
Jun 28, 2021
65ffd4b
correct storage item name
Jun 28, 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
31 changes: 18 additions & 13 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions bin/node/runtime/pangolin/polkadot-compatible-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
"prefix": "[u8; 4; Prefix]",
"parent_mmr_root": "Hash"
},
"NodeIndex": "u64",
"__[primitives.relay]__": {},
"OpCode": "[u8; 4; OpCode]",
"Term": "u32",
Expand Down
24 changes: 22 additions & 2 deletions bin/node/runtime/pangolin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ impl_runtime_apis! {
block_number_of_member_leaf: u64,
block_number_of_last_leaf: u64
) -> HeaderMMRRuntimeDispatchInfo<Hash> {
HeaderMMR::gen_proof_rpc(block_number_of_member_leaf, block_number_of_last_leaf )
HeaderMMR::gen_proof_rpc(block_number_of_member_leaf, block_number_of_last_leaf)
}
}

Expand Down Expand Up @@ -852,11 +852,31 @@ pub struct CustomOnRuntimeUpgrade;
impl OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
// <--- Hack for local test
use frame_support::traits::Currency;
let _ = Ring::deposit_creating(&BridgeMillauMessages::relayer_fund_account_id(), 1 << 50);
// --->

darwinia_header_mmr::migration::initialize_new_mmr_state::<Runtime>(b"HeaderMMR", 2);
darwinia_relay_authorities::migration::migrate::<Runtime, EthereumRelayAuthoritiesInstance>(
b"Instance1DarwiniaRelayAuthorities",
);

Ok(())
}

fn on_runtime_upgrade() -> Weight {
0
// <--- Hack for local test
// use frame_support::traits::Currency;
// let _ = Ring::deposit_creating(&BridgeMillauMessages::relayer_fund_account_id(), 1 << 50);
// --->

darwinia_header_mmr::migration::initialize_new_mmr_state::<Runtime>(b"HeaderMMR", 50);
darwinia_relay_authorities::migration::migrate::<Runtime, EthereumRelayAuthoritiesInstance>(
b"Instance1DarwiniaRelayAuthorities",
);

RuntimeBlockWeights::get().max_block
}
}

Expand Down
6 changes: 5 additions & 1 deletion bin/node/runtime/pangolin/src/pallets/header_mmr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
use crate::*;
use darwinia_header_mmr::Config;

impl Config for Runtime {}
impl Config for Runtime {
type WeightInfo = ();

const INDEXING_PREFIX: &'static [u8] = b"header-mmr-";
}
1 change: 1 addition & 0 deletions bin/node/runtime/pangolin/types.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
"prefix": "[u8; 4; Prefix]",
"parent_mmr_root": "Hash"
},
"NodeIndex": "u64",
"__[primitives.relay]__": {},
"OpCode": "[u8; 4; OpCode]",
"Term": "u32",
Expand Down
2 changes: 1 addition & 1 deletion frame/bridge/ethereum/backing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ pub mod pallet {
(<frame_system::Pallet<T>>::block_number().saturated_into::<u32>() / 10 * 10
+ 10)
.saturated_into(),
);
)?;
}

Ok(().into())
Expand Down
4 changes: 3 additions & 1 deletion frame/bridge/ethereum/backing/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ macro_rules! decl_tests {
impl RelayAuthorityProtocol<BlockNumber> for EcdsaAuthorities {
type Signer = EthereumAddress;

fn schedule_mmr_root(_: BlockNumber) {}
fn schedule_mmr_root(_: BlockNumber) -> DispatchResult {
Ok(())
}

fn check_authorities_change_to_sync(_: Term, _: Vec<Self::Signer>) -> DispatchResult {
Ok(())
Expand Down
11 changes: 7 additions & 4 deletions frame/bridge/relay-authorities/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ version = "2.4.0"
[dependencies]
# crates
codec = { package = "parity-scale-codec", version = "2.1.1", default-features = false, features = ["derive"] }
log = { version = "0.4.14" }
# darwinia
darwinia-relay-primitives = { default-features = false, path = "../../../primitives/relay" }
darwinia-support = { default-features = false, path = "../../support" }
Expand All @@ -25,11 +26,13 @@ sp-std = { default-features = false, git = "https://github.com/darwinia-n
# crates
array-bytes = { version = "1.3.3" }
# darwinia
darwinia-balances = { path = "../../balances" }
darwinia-support = { path = "../../support" }
darwinia-balances = { path = "../../balances" }
darwinia-header-mmr = { features = ["easy-testing"], path = "../../header-mmr" }
darwinia-support = { path = "../../support" }
# substrate
sp-core = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.1" }
sp-io = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.1" }
sp-core = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.1" }
sp-io = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.1" }
sp-tracing = { git = "https://github.com/darwinia-network/substrate.git", tag = "darwinia-v0.11.1" }

[features]
default = ["std"]
Expand Down
Loading