Skip to content

Commit

Permalink
Merge pull request #87 from maticnetwork/develop
Browse files Browse the repository at this point in the history
Data root, nomad primitives and executive pallet tests
  • Loading branch information
aterentic-ethernal authored Sep 21, 2022
2 parents 76e2b45 + 86af7d1 commit 062d946
Show file tree
Hide file tree
Showing 63 changed files with 5,897 additions and 540 deletions.
975 changes: 915 additions & 60 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ members = [
"kate/recovery",
"kate/proof",
"fuzzing",
"primitives",
"primitives/avail",
"primitives/nomad/merkle",
"primitives/nomad/signature",
"primitives/nomad/nomad-core",
"primitives/nomad/nomad-base",
"pallets/executive",
"pallets/system",
"pallets/dactr",
Expand All @@ -22,6 +26,10 @@ dusk-plonk = { git = "https://github.com/maticnetwork/plonk.git", branch = "v0.8
frame-system = { path = "pallets/system" }
frame-executive = { path = "pallets/executive" }
frame-system-rpc-runtime-api = { path = "pallets/system/rpc/runtime-api" }
syn = { git = "https://github.com/dtolnay/syn.git", tag = "1.0.96" }
tokio = { git = "https://github.com/tokio-rs/tokio", tag = "tokio-1.19.2" }
primitive-types = { git = "https://github.com/paritytech/parity-common.git", tag = "parity-util-mem-v0.10.1" }
parity-db = { git = "https://github.com/paritytech/parity-db.git", tag = "v0.3.12" }

# Substrate (polkadot-v0.9.13).
sc-cli = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.13" }
Expand Down
5 changes: 5 additions & 0 deletions avail-subxt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ pub struct KateCommitment {
pub rows: u16,
/// Cols
pub cols: u16,
/// The merkle root of the data submissions
#[serde(rename = "dataRoot")]
pub data_root: H256,
}

impl MallocSizeOf for KateCommitment {
Expand All @@ -233,6 +236,7 @@ impl MallocSizeOf for KateCommitment {
+ self.commitment.size_of(ops)
+ self.rows.size_of(ops)
+ self.cols.size_of(ops)
+ self.data_root.size_of(ops)
}
}

Expand Down Expand Up @@ -301,6 +305,7 @@ impl Header for DaHeader {
commitment: vec![],
rows: 0,
cols: 0,
data_root: H256([0; 32]),
},
digest,
app_data_lookup: DataLookup {
Expand Down
2 changes: 1 addition & 1 deletion fuzzing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2021"
afl = "*"
kate-recovery = {path = "../kate/recovery"}
kate = {path = "../kate"}
da-primitives = { path = "../primitives", default-features = false }
da-primitives = { path = "../primitives/avail", default-features = false }
hex-literal = "0.3.1"

[[bin]]
Expand Down
2 changes: 1 addition & 1 deletion kate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
da-primitives = { path = "../primitives", default-features = false }
da-primitives = { path = "../primitives/avail", default-features = false }

# Others
dusk-plonk = { git = "https://github.com/maticnetwork/plonk.git", branch = "v0.8.2-polygon-5", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "data-avail"
version = "1.0.0"
version = "1.1.0"
description = "Polygon Data Avilability Node."
authors = ["Anonymous"]
homepage = "https://polygon.technology/"
Expand All @@ -18,7 +18,7 @@ name = "data-avail"

[dependencies]
# Internals
da-primitives= { path = "../primitives" }
da-primitives= { path = "../primitives/avail" }
da-runtime = { path = "../runtime" }
da-control = { path = "../pallets/dactr" }
kate = { path = "../kate" }
Expand Down
2 changes: 1 addition & 1 deletion pallets/dactr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description = "Data Avail Control Module"
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
da-primitives = { path = "../../primitives", default-features = false }
da-primitives = { path = "../../primitives/avail", default-features = false }
kate = { path = "../../kate", default-features = false }

# Substrate
Expand Down
16 changes: 11 additions & 5 deletions pallets/dactr/src/extensions/check_app_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ use sp_runtime::{
InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransaction,
},
};
use sp_std::{
default::Default,
fmt::{self, Debug, Formatter},
marker::PhantomData,
};

use crate::{Call as DACall, Config, Pallet};

Expand Down Expand Up @@ -58,18 +63,19 @@ where
Ok(ValidTransaction::default())
}
}
impl<T: Config + Send + Sync> Default for CheckAppId<T> {
fn default() -> Self { Self(AppId::default(), PhantomData) }
}

impl<T> sp_std::fmt::Debug for CheckAppId<T>
impl<T> Debug for CheckAppId<T>
where
T: Config + Send + Sync,
{
#[cfg(feature = "std")]
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
write!(f, "CheckAppId: {}", self.0)
}
fn fmt(&self, f: &mut Formatter) -> fmt::Result { write!(f, "CheckAppId: {}", self.0) }

#[cfg(not(feature = "std"))]
fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { Ok(()) }
fn fmt(&self, _: &mut Formatter) -> fmt::Result { Ok(()) }
}

impl<T> SignedExtension for CheckAppId<T>
Expand Down
5 changes: 4 additions & 1 deletion pallets/executive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ readme = "README.md"
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
da-primitives = { path = "../../primitives", default-features = false }
da-primitives = { path = "../../primitives/avail", default-features = false }

codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = [
"derive",
Expand All @@ -36,6 +36,9 @@ pallet-balances = "4.0.0-dev"
pallet-transaction-payment = "4.0.0-dev"
sp-version = "4.0.0-dev"
sp-inherents = "4.0.0-dev"
pallet-babe = "4.0.0-dev"
mocked-runtime = { path = "../mocked_runtime" }
da-control = { path = "../dactr" }

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

0 comments on commit 062d946

Please sign in to comment.