Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nomad v1 primitives #79

Merged
833 changes: 776 additions & 57 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" }
aterentic-ethernal marked this conversation as resolved.
Show resolved Hide resolved
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
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
2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 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 Down
2 changes: 1 addition & 1 deletion pallets/system/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"]

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

# Other
impl-trait-for-tuples = "0.2.1"
Expand Down
2 changes: 1 addition & 1 deletion pallets/system/benchmarking/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 }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
sp-std = { version = "4.0.0-dev", default-features = false }
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 7 additions & 1 deletion primitives/src/header.rs → primitives/avail/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use parity_util_mem::{MallocSizeOf, MallocSizeOfOps};
use scale_info::TypeInfo;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
use sp_core::{RuntimeDebug, U256};
use sp_core::{RuntimeDebug, H256, U256};
use sp_runtime::{
traits::{
AtLeast32BitUnsigned, Hash as HashT, Header as HeaderT, MaybeDisplay, MaybeFromStr,
Expand Down Expand Up @@ -276,6 +276,12 @@ where

fn set_extrinsics_root(&mut self, root: Self::Root) { self.extrinsics_root = root; }

fn data_root(&self) -> H256 { self.extrinsics_root.data_root.into() }

fn set_data_root(&mut self, data_root: H256) {
self.extrinsics_root.data_root = data_root.into();
}

fn data_lookup(&self) -> &DataLookup { &self.app_data_lookup }

/// Creates new header.
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions primitives/src/traits.rs → primitives/avail/src/traits.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use sp_core::H256;
use sp_runtime::Digest;
use sp_std::vec::Vec;

Expand Down Expand Up @@ -36,6 +37,9 @@ pub trait ExtendedHeader {
fn extrinsics_root(&self) -> &Self::Root;
fn set_extrinsics_root(&mut self, root: Self::Root);

fn data_root(&self) -> H256;
fn set_data_root(&mut self, root: H256);

fn data_lookup(&self) -> &DataLookup;

/// Creates new header.
Expand Down
44 changes: 44 additions & 0 deletions primitives/nomad/merkle/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[package]
name = "merkle"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# Substrate
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "1.0", default-features = false, features = ["derive"] }
sp-std = { version = "4.0.0-dev", default-features = false }
sp-core = { version = "4.0.0-dev", default-features = false }
sp-io = { version = "4.0.0-dev", default-features = false }
sp-runtime = { version = "4.0.0-dev", default-features = false }
frame-support = { version = "4.0.0-dev", default-features = false }
parity-util-mem = { version = "0.10.2", default-features = false, features = ["primitive-types"] }
tiny-keccak = { version = "2.0.2", default-features = false, features = ["keccak"] }

primitive-types = { version = "0.10.1", default-features = false, features = ["scale-info", "codec"] }
lazy_static = { version = "1.4.0", features = ["spin_no_std"] }
thiserror-no-std = "2.0.2"
static_assertions = "1.1.0"

[dev-dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
ethers-core = "0.13.0"

[dependencies.serde]
version = "1.0"
default-features = false
optional = true
features = ["derive"]

[features]
default = ["std"]
std = [
"serde",
"primitive-types/serde",
"codec/std",
"scale-info/std",
"frame-support/std",
]
Loading