Skip to content

Commit

Permalink
Marko/dependency cleanup (#109)
Browse files Browse the repository at this point in the history
* Removed sp-io and sp-core

* fixed typeinfo

* feature list cleanup

* Fixed some of features problems

* Fixed feature hell
  • Loading branch information
markopoloparadox authored Dec 9, 2024
1 parent c711cb9 commit cfceb72
Show file tree
Hide file tree
Showing 26 changed files with 304 additions and 140 deletions.
32 changes: 21 additions & 11 deletions Cargo.lock

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

16 changes: 12 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ scale-info = { version = "2", default-features = false, features = ["derive"] }
# Polkadot SDK
binary-merkle-tree = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
sp-arithmetic = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
sp-core = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
sp-io = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
sp-std = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
sp-trie = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
sp-runtime = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
frame-support = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
sp-runtime-interface = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
sp-storage = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch-10", default-features = false }
sp-debug-derive = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch-10", default-features = false }

primitive-types = { version = "0.12.2", default-features = false, features = ["codec", "scale-info"] }

# Macros
derive_more = { version = "0.99.17", default-features = false, features = ["constructor", "from", "add", "deref", "mul", "into"] }
Expand All @@ -34,17 +36,23 @@ criterion = { version = "0.4", default-features = false }
# Serialization
serde = { version = "1.0.196", default-features = false, features = ["derive", "alloc"] }
hex = { version = "0.4", default-features = false, features = ["alloc", "serde"] }
serde_json = { version = "1" }
serde_json = { version = "1", default-features = false }
dusk-bytes = { version = "0.1.6", default-features = false }
impl-serde = { version = "0.5.0", default-features = false }

# Crypto
hash256-std-hasher = { version = "0.15.2", default-features = false }
tiny-keccak = { version = "2.0.2", default-features = false, features = ["keccak"] }
rand = { version = "0.8.4", features = ["alloc", "small_rng"], default-features = false }
rand_chacha = { version = "0.3", default-features = false }
blake2b_simd = { version = "1.0.2", default-features = false }
sha2 = { version = "0.10.7", default-features = false }
sha3 = { version = "0.10.0", default-features = false }

poly-multiproof = { git = "https://github.com/availproject/poly-multiproof", default-features = false, tag = "v0.0.1" }
dusk-plonk = { git = "https://github.com/availproject/plonk.git", tag = "v0.12.0-polygon-2" }
dusk-plonk = { git = "https://github.com/availproject/plonk.git", default-features = false, features = ["alloc"], tag = "v0.12.0-polygon-2" }

hash-db = { version = "0.16.0", default-features = false }

# Others
rayon = "1.5.2"
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Data Availability Core

# Dev Notes
When changes are made make sure to run `build_test.sh`. This will check if everything works correctly under all feature permutations.
35 changes: 35 additions & 0 deletions build_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
set -x

cd core

# Core
cargo check
cargo check --no-default-features
cargo check --no-default-features --features "serde"
cargo check --no-default-features --features "std"
cargo check --no-default-features --features "std, serde"
cargo check --target wasm32-unknown-unknown --no-default-features
cargo check --target wasm32-unknown-unknown --no-default-features --features "serde"
cargo check --target wasm32-unknown-unknown --no-default-features --features "runtime"
cargo check --target wasm32-unknown-unknown --no-default-features --features "runtime, serde"

# Kate
cd ../kate
cargo check
cargo check --no-default-features
cargo check --no-default-features --features "serde"
cargo check --no-default-features --features "std"
cargo check --no-default-features --features "std, serde"
cargo check --target wasm32-unknown-unknown --no-default-features
cargo check --target wasm32-unknown-unknown --no-default-features --features "serde"

# Kate Recovery
cd ../recovery
cargo check
cargo check --no-default-features
cargo check --no-default-features --features "serde"
cargo check --no-default-features --features "std"
cargo check --no-default-features --features "std, serde"
cargo check --target wasm32-unknown-unknown --no-default-features
cargo check --target wasm32-unknown-unknown --no-default-features --features "serde"
55 changes: 36 additions & 19 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ license = "Apache-2.0"

[dependencies]
# Others
hex = { workspace = true, optional = true }
serde = { workspace = true, optional = true }
impl-serde = { workspace = true, optional = true }
derive_more.workspace = true
ethabi-decode.workspace = true
hash256-std-hasher.workspace = true
hex = { workspace = true, optional = true }
log.workspace = true
serde = { workspace = true, optional = true }
static_assertions.workspace = true
thiserror-no-std.workspace = true
tiny-keccak.workspace = true
Expand All @@ -21,16 +22,22 @@ tiny-keccak.workspace = true
binary-merkle-tree = { workspace = true, optional = true }
bounded-collections.workspace = true
codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info.workspace = true
scale-info = { workspace = true }

frame-support = { workspace = true, optional = true }
sp-arithmetic.workspace = true
sp-core.workspace = true
sp-runtime = { workspace = true, optional = true }
sp-runtime-interface = { workspace = true, optional = true }
sp-trie = { workspace = true, optional = true }
sp-storage = { workspace = true, optional = true }
sp-debug-derive = { workspace = true, optional = true }
sp-arithmetic.workspace = true
sp-std.workspace = true
sp-trie.workspace = true
sp-io.workspace = true

blake2b_simd.workspace = true
sha2.workspace = true
sha3.workspace = true
primitive-types.workspace = true
hash-db.workspace = true

[dev-dependencies]
hex-literal.workspace = true
Expand All @@ -43,33 +50,43 @@ trybuild = "1.0.96"
[features]
default = [ "std" ]
std = [
"binary-merkle-tree?/std",
"bounded-collections/std",
"codec/std",
"derive_more/display",
"ethabi-decode/std",
"frame-support?/std",
"hash256-std-hasher/std",
"hex",
"hex/std",
"log/std",
"scale-info/std",
"serde/std",
"serde?/std",
"sp-std/std",
"sp-arithmetic/std",
"sp-core/std",
"sp-io/std",
"frame-support?/std",
"binary-merkle-tree?/std",
"sp-runtime-interface?/std",
"sp-runtime?/std",
"sp-std/std",
"sp-trie/std",
"sp-trie?/std",
"primitive-types/std",
]

runtime = [
"binary-merkle-tree",
"frame-support",
"serde",
"sp-runtime",
"sp-runtime-interface",
"sp-trie",
"sp-storage",
"sp-debug-derive",
"binary-merkle-tree",
"serde",
]
disable_panic_handler = [ "sp-io/disable_panic_handler" ]

try-runtime = [ "runtime", "sp-runtime/try-runtime" ]
serde = [ "dep:serde", "hex/serde", "log/serde" ]

serde = [
"dep:serde",
"hex/serde",
"log/serde",
"impl-serde",
"primitive-types/serde_no_std", # TODO If std is enabled then `primitive-types/serde` "should" be enabled. Don't want to deal with that rn.
"bounded-collections/serde"
]
14 changes: 7 additions & 7 deletions core/src/app_extrinsic.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
use crate::traits::GetAppId;
#[cfg(feature = "runtime")]
use codec::Codec;
use crate::AppId;
use codec::{Decode, Encode};
use derive_more::Constructor;
use scale_info::TypeInfo;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use sp_core::RuntimeDebug;
use sp_std::vec::Vec;

use crate::AppId;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
#[cfg(feature = "runtime")]
use {codec::Codec, sp_debug_derive::RuntimeDebug};

/// Raw Extrinsic with application id.
#[derive(Clone, TypeInfo, Default, Encode, Decode, RuntimeDebug, Constructor)]
#[derive(Clone, Default, Encode, Decode, Constructor, TypeInfo)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "runtime", derive(RuntimeDebug))]
pub struct AppExtrinsic {
pub app_id: AppId,
#[cfg_attr(feature = "serde", serde(with = "hex"))]
Expand Down
Loading

0 comments on commit cfceb72

Please sign in to comment.