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

Commit

Permalink
Merge remote-tracking branch 'origin/master' into mku-serialize-for-p…
Browse files Browse the repository at this point in the history
…ara-id
  • Loading branch information
michalkucharczyk committed Jun 1, 2023
2 parents dd63ce1 + 26b4a21 commit c93fb62
Show file tree
Hide file tree
Showing 16 changed files with 220 additions and 214 deletions.
374 changes: 187 additions & 187 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master
polkadot-parachain = { path = "../../parachain", default-features = false }
schnorrkel = "0.9.1"
thiserror = "1.0.31"
serde = { version = "1.0.137", features = ["derive"] }
serde = { version = "1.0.163", features = ["derive"] }

[target.'cfg(not(target_os = "unknown"))'.dependencies]
zstd = { version = "0.11.2", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion node/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", bran
futures = "0.3.21"
hex-literal = "0.4.1"
gum = { package = "tracing-gum", path = "../gum/" }
serde = { version = "1.0.137", features = ["derive"] }
serde = { version = "1.0.163", features = ["derive"] }
serde_json = "1.0.96"
thiserror = "1.0.31"
kvdb = "0.13.0"
Expand Down
2 changes: 1 addition & 1 deletion parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ derive_more = "0.99.11"
bounded-collections = { version = "0.1.7", default-features = false, features = ["serde"] }

# all optional crates.
serde = { version = "1.0.137", default-features = false, features = ["derive", "alloc"] }
serde = { version = "1.0.163", default-features = false, features = ["derive", "alloc"] }

[features]
default = ["std"]
Expand Down
2 changes: 1 addition & 1 deletion primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
hex-literal = "0.4.1"
parity-scale-codec = { version = "3.4.0", default-features = false, features = ["bit-vec", "derive"] }
scale-info = { version = "2.5.0", default-features = false, features = ["bit-vec", "derive", "serde"] }
serde = { version = "1.0.137", default-features = false, features = ["derive", "alloc"] }
serde = { version = "1.0.163", default-features = false, features = ["derive", "alloc"] }

application-crypto = { package = "sp-application-crypto", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] }
inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ parity-scale-codec = { version = "3.4.0", default-features = false, features = [
log = { version = "0.4.17", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.139", default-features = false, features = ["alloc"] }
serde = { version = "1.0.163", default-features = false, features = ["alloc"] }
serde_derive = { version = "1.0.117" }
static_assertions = "1.1.0"

Expand Down
2 changes: 1 addition & 1 deletion runtime/kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ parity-scale-codec = { version = "3.4.0", default-features = false, features = [
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
log = { version = "0.4.17", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false }
serde = { version = "1.0.139", default-features = false }
serde = { version = "1.0.163", default-features = false }
serde_derive = { version = "1.0.117", optional = true }
static_assertions = "1.1.0"
smallvec = "1.8.0"
Expand Down
2 changes: 1 addition & 1 deletion runtime/parachains/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ parity-scale-codec = { version = "3.4.0", default-features = false, features = [
log = { version = "0.4.17", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.139", default-features = false, features = ["derive", "alloc"] }
serde = { version = "1.0.163", default-features = false, features = ["derive", "alloc"] }
derive_more = "0.99.17"
bitflags = "1.3.2"

Expand Down
2 changes: 1 addition & 1 deletion runtime/polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ parity-scale-codec = { version = "3.4.0", default-features = false, features = [
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
log = { version = "0.4.17", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false }
serde = { version = "1.0.139", default-features = false }
serde = { version = "1.0.163", default-features = false }
serde_derive = { version = "1.0.117", optional = true }
static_assertions = "1.1.0"
smallvec = "1.8.0"
Expand Down
2 changes: 1 addition & 1 deletion runtime/rococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition.workspace = true
parity-scale-codec = { version = "3.4.0", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
log = { version = "0.4.17", default-features = false }
serde = { version = "1.0.139", default-features = false }
serde = { version = "1.0.163", default-features = false }
serde_derive = { version = "1.0.117", optional = true }
static_assertions = "1.1.0"
smallvec = "1.8.0"
Expand Down
32 changes: 19 additions & 13 deletions runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use pallet_session::historical as session_historical;
use pallet_transaction_payment::{CurrencyAdapter, FeeDetails, RuntimeDispatchInfo};
use sp_core::{ConstU128, OpaqueMetadata, H256};
use sp_mmr_primitives as mmr;
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{
Expand Down Expand Up @@ -1281,6 +1280,16 @@ impl pallet_beefy::Config for Runtime {
pallet_beefy::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
}

/// MMR helper types.
mod mmr {
use super::Runtime;
pub use pallet_mmr::primitives::*;

pub type Leaf = <<Runtime as pallet_mmr::Config>::LeafData as LeafDataProvider>::LeafData;
pub type Hashing = <Runtime as pallet_mmr::Config>::Hashing;
pub type Hash = <Hashing as sp_runtime::traits::Hash>::Output;
}

impl pallet_mmr::Config for Runtime {
const INDEXING_PREFIX: &'static [u8] = mmr::INDEXING_PREFIX;
type Hashing = Keccak256;
Expand Down Expand Up @@ -1314,7 +1323,7 @@ impl BeefyDataProvider<H256> for ParasProvider {
.filter_map(|id| Paras::para_head(&id).map(|head| (id.into(), head.0)))
.collect();
para_heads.sort();
binary_merkle_tree::merkle_root::<<Runtime as pallet_mmr::Config>::Hashing, _>(
binary_merkle_tree::merkle_root::<mmr::Hashing, _>(
para_heads.into_iter().map(|pair| pair.encode()),
)
.into()
Expand Down Expand Up @@ -1731,8 +1740,6 @@ mod benches {
);
}

pub type MmrHashing = <Runtime as pallet_mmr::Config>::Hashing;

#[cfg(not(feature = "disable-runtime-api"))]
sp_api::impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
Expand Down Expand Up @@ -1972,8 +1979,8 @@ sp_api::impl_runtime_apis! {
}

#[api_version(2)]
impl mmr::MmrApi<Block, Hash, BlockNumber> for Runtime {
fn mmr_root() -> Result<Hash, mmr::Error> {
impl mmr::MmrApi<Block, mmr::Hash, BlockNumber> for Runtime {
fn mmr_root() -> Result<mmr::Hash, mmr::Error> {
Ok(Mmr::mmr_root())
}

Expand All @@ -1984,7 +1991,7 @@ sp_api::impl_runtime_apis! {
fn generate_proof(
block_numbers: Vec<BlockNumber>,
best_known_block_number: Option<BlockNumber>,
) -> Result<(Vec<mmr::EncodableOpaqueLeaf>, mmr::Proof<Hash>), mmr::Error> {
) -> Result<(Vec<mmr::EncodableOpaqueLeaf>, mmr::Proof<mmr::Hash>), mmr::Error> {
Mmr::generate_proof(block_numbers, best_known_block_number).map(
|(leaves, proof)| {
(
Expand All @@ -1998,24 +2005,23 @@ sp_api::impl_runtime_apis! {
)
}

fn verify_proof(leaves: Vec<mmr::EncodableOpaqueLeaf>, proof: mmr::Proof<Hash>)
fn verify_proof(leaves: Vec<mmr::EncodableOpaqueLeaf>, proof: mmr::Proof<mmr::Hash>)
-> Result<(), mmr::Error>
{
pub type MmrLeaf = <<Runtime as pallet_mmr::Config>::LeafData as mmr::LeafDataProvider>::LeafData;
let leaves = leaves.into_iter().map(|leaf|
leaf.into_opaque_leaf()
.try_decode()
.ok_or(mmr::Error::Verify)).collect::<Result<Vec<MmrLeaf>, mmr::Error>>()?;
.ok_or(mmr::Error::Verify)).collect::<Result<Vec<mmr::Leaf>, mmr::Error>>()?;
Mmr::verify_leaves(leaves, proof)
}

fn verify_proof_stateless(
root: Hash,
root: mmr::Hash,
leaves: Vec<mmr::EncodableOpaqueLeaf>,
proof: mmr::Proof<Hash>
proof: mmr::Proof<mmr::Hash>
) -> Result<(), mmr::Error> {
let nodes = leaves.into_iter().map(|leaf|mmr::DataOrHash::Data(leaf.into_opaque_leaf())).collect();
pallet_mmr::verify_leaves_proof::<MmrHashing, _>(root, nodes, proof)
pallet_mmr::verify_leaves_proof::<mmr::Hashing, _>(root, nodes, proof)
}
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/test-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ parity-scale-codec = { version = "3.4.0", default-features = false, features = [
log = { version = "0.4.17", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.139", default-features = false }
serde = { version = "1.0.163", default-features = false }
serde_derive = { version = "1.0.117", optional = true }
smallvec = "1.8.0"

Expand Down
2 changes: 1 addition & 1 deletion runtime/westend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ parity-scale-codec = { version = "3.4.0", default-features = false, features = [
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
log = { version = "0.4.17", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false }
serde = { version = "1.0.139", default-features = false }
serde = { version = "1.0.163", default-features = false }
serde_derive = { version = "1.0.117", optional = true }
smallvec = "1.8.0"

Expand Down
2 changes: 1 addition & 1 deletion utils/staking-miner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tracing-subscriber = { version = "0.3.11", features = ["env-filter"] }
jsonrpsee = { version = "0.16.2", features = ["ws-client", "macros"] }
log = "0.4.17"
paste = "1.0.7"
serde = "1.0.137"
serde = "1.0.163"
serde_json = "1.0"
thiserror = "1.0.31"
tokio = { version = "1.24.2", features = ["macros", "rt-multi-thread", "sync"] }
Expand Down
2 changes: 1 addition & 1 deletion xcm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ log = { version = "0.4.17", default-features = false }
parity-scale-codec = { version = "3.4.0", default-features = false, features = [ "derive", "max-encoded-len" ] }
scale-info = { version = "2.5.0", default-features = false, features = ["derive", "serde"] }
sp-weights = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, feature = ["serde "] }
serde = { version = "1.0.136", default-features = false, features = ["alloc", "derive"] }
serde = { version = "1.0.163", default-features = false, features = ["alloc", "derive"] }
xcm-procedural = { path = "procedural" }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion xcm/pallet-xcm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version.workspace = true
bounded-collections = { version = "0.1.7", default-features = false }
codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.137", optional = true, features = ["derive"] }
serde = { version = "1.0.163", optional = true, features = ["derive"] }
log = { version = "0.4.17", default-features = false }

frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
Expand Down

0 comments on commit c93fb62

Please sign in to comment.