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

Companion for: pallet-mmr: move offchain logic to client-side gadget #6321

Merged
merged 7 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Code review changes: 2nd iteration
  • Loading branch information
serban300 committed Nov 25, 2022
commit a7692cdcfa008a17c91f7a233d842d17c53d308a
1 change: 1 addition & 0 deletions node/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ beefy-gadget = { git = "https://github.com/paritytech/substrate", branch = "mast
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" }
grandpa = { package = "sc-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" }
mmr-gadget = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-mmr-primitives = { git = "https://github.com/paritytech/substrate", branch = "master"}
sc-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand Down
6 changes: 5 additions & 1 deletion node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,11 @@ where
task_manager.spawn_handle().spawn_blocking(
"mmr-gadget",
None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to assign a task group to beefy-gadget and mmr-gadget.

MmrGadget::start(client.clone(), backend.clone(), b"mmr".to_vec()),
MmrGadget::start(
client.clone(),
backend.clone(),
sp_mmr_primitives::INDEXING_PREFIX.to_vec(),
),
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,7 @@ sp_api::impl_runtime_apis! {
Err(mmr::Error::PalletNotIncluded)
}

fn mmr_leaves_count() -> Result<mmr::LeafIndex, mmr::Error> {
fn mmr_leaf_count() -> Result<mmr::LeafIndex, mmr::Error> {
Err(mmr::Error::PalletNotIncluded)
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1861,7 +1861,7 @@ sp_api::impl_runtime_apis! {
Err(mmr::Error::PalletNotIncluded)
}

fn mmr_leaves_count() -> Result<mmr::LeafIndex, mmr::Error> {
fn mmr_leaf_count() -> Result<mmr::LeafIndex, mmr::Error> {
Err(mmr::Error::PalletNotIncluded)
}

Expand Down
4 changes: 2 additions & 2 deletions runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ impl pallet_beefy::Config for Runtime {
type MmrHash = <Keccak256 as sp_runtime::traits::Hash>::Output;

impl pallet_mmr::Config for Runtime {
const INDEXING_PREFIX: &'static [u8] = b"mmr";
const INDEXING_PREFIX: &'static [u8] = mmr::INDEXING_PREFIX;
type Hashing = Keccak256;
type Hash = MmrHash;
type OnNewRoot = pallet_beefy_mmr::DepositBeefyDigest<Runtime>;
Expand Down Expand Up @@ -1723,7 +1723,7 @@ sp_api::impl_runtime_apis! {
Ok(Mmr::mmr_root())
}

fn mmr_leaves_count() -> Result<mmr::LeafIndex, mmr::Error> {
fn mmr_leaf_count() -> Result<mmr::LeafIndex, mmr::Error> {
Ok(Mmr::mmr_leaves())
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ sp_api::impl_runtime_apis! {
Err(mmr::Error::PalletNotIncluded)
}

fn mmr_leaves_count() -> Result<mmr::LeafIndex, mmr::Error> {
fn mmr_leaf_count() -> Result<mmr::LeafIndex, mmr::Error> {
Err(mmr::Error::PalletNotIncluded)
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,7 @@ sp_api::impl_runtime_apis! {
Err(mmr::Error::PalletNotIncluded)
}

fn mmr_leaves_count() -> Result<mmr::LeafIndex, mmr::Error> {
fn mmr_leaf_count() -> Result<mmr::LeafIndex, mmr::Error> {
Err(mmr::Error::PalletNotIncluded)
}

Expand Down