Skip to content

Commit cfceb72

Browse files
Marko/dependency cleanup (#109)
* Removed sp-io and sp-core * fixed typeinfo * feature list cleanup * Fixed some of features problems * Fixed feature hell
1 parent c711cb9 commit cfceb72

File tree

26 files changed

+304
-140
lines changed

26 files changed

+304
-140
lines changed

Cargo.lock

Lines changed: 21 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ scale-info = { version = "2", default-features = false, features = ["derive"] }
1111
# Polkadot SDK
1212
binary-merkle-tree = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
1313
sp-arithmetic = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
14-
sp-core = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
15-
sp-io = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
1614
sp-std = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
1715
sp-trie = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
1816
sp-runtime = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
1917
frame-support = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
2018
sp-runtime-interface = { git = "https://github.com/availproject/polkadot-sdk", tag = "polkadot-1.7.1-patch-10", default-features = false }
19+
sp-storage = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch-10", default-features = false }
20+
sp-debug-derive = { git = "https://github.com/availproject/polkadot-sdk.git", tag = "polkadot-1.7.1-patch-10", default-features = false }
21+
22+
primitive-types = { version = "0.12.2", default-features = false, features = ["codec", "scale-info"] }
2123

2224
# Macros
2325
derive_more = { version = "0.99.17", default-features = false, features = ["constructor", "from", "add", "deref", "mul", "into"] }
@@ -34,17 +36,23 @@ criterion = { version = "0.4", default-features = false }
3436
# Serialization
3537
serde = { version = "1.0.196", default-features = false, features = ["derive", "alloc"] }
3638
hex = { version = "0.4", default-features = false, features = ["alloc", "serde"] }
37-
serde_json = { version = "1" }
39+
serde_json = { version = "1", default-features = false }
3840
dusk-bytes = { version = "0.1.6", default-features = false }
41+
impl-serde = { version = "0.5.0", default-features = false }
3942

4043
# Crypto
4144
hash256-std-hasher = { version = "0.15.2", default-features = false }
4245
tiny-keccak = { version = "2.0.2", default-features = false, features = ["keccak"] }
4346
rand = { version = "0.8.4", features = ["alloc", "small_rng"], default-features = false }
4447
rand_chacha = { version = "0.3", default-features = false }
48+
blake2b_simd = { version = "1.0.2", default-features = false }
49+
sha2 = { version = "0.10.7", default-features = false }
50+
sha3 = { version = "0.10.0", default-features = false }
4551

4652
poly-multiproof = { git = "https://github.com/availproject/poly-multiproof", default-features = false, tag = "v0.0.1" }
47-
dusk-plonk = { git = "https://github.com/availproject/plonk.git", tag = "v0.12.0-polygon-2" }
53+
dusk-plonk = { git = "https://github.com/availproject/plonk.git", default-features = false, features = ["alloc"], tag = "v0.12.0-polygon-2" }
54+
55+
hash-db = { version = "0.16.0", default-features = false }
4856

4957
# Others
5058
rayon = "1.5.2"

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
# Data Availability Core
2+
3+
# Dev Notes
4+
When changes are made make sure to run `build_test.sh`. This will check if everything works correctly under all feature permutations.

build_test.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
set -x
3+
4+
cd core
5+
6+
# Core
7+
cargo check
8+
cargo check --no-default-features
9+
cargo check --no-default-features --features "serde"
10+
cargo check --no-default-features --features "std"
11+
cargo check --no-default-features --features "std, serde"
12+
cargo check --target wasm32-unknown-unknown --no-default-features
13+
cargo check --target wasm32-unknown-unknown --no-default-features --features "serde"
14+
cargo check --target wasm32-unknown-unknown --no-default-features --features "runtime"
15+
cargo check --target wasm32-unknown-unknown --no-default-features --features "runtime, serde"
16+
17+
# Kate
18+
cd ../kate
19+
cargo check
20+
cargo check --no-default-features
21+
cargo check --no-default-features --features "serde"
22+
cargo check --no-default-features --features "std"
23+
cargo check --no-default-features --features "std, serde"
24+
cargo check --target wasm32-unknown-unknown --no-default-features
25+
cargo check --target wasm32-unknown-unknown --no-default-features --features "serde"
26+
27+
# Kate Recovery
28+
cd ../recovery
29+
cargo check
30+
cargo check --no-default-features
31+
cargo check --no-default-features --features "serde"
32+
cargo check --no-default-features --features "std"
33+
cargo check --no-default-features --features "std, serde"
34+
cargo check --target wasm32-unknown-unknown --no-default-features
35+
cargo check --target wasm32-unknown-unknown --no-default-features --features "serde"

core/Cargo.toml

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ license = "Apache-2.0"
77

88
[dependencies]
99
# Others
10+
hex = { workspace = true, optional = true }
11+
serde = { workspace = true, optional = true }
12+
impl-serde = { workspace = true, optional = true }
1013
derive_more.workspace = true
1114
ethabi-decode.workspace = true
1215
hash256-std-hasher.workspace = true
13-
hex = { workspace = true, optional = true }
1416
log.workspace = true
15-
serde = { workspace = true, optional = true }
1617
static_assertions.workspace = true
1718
thiserror-no-std.workspace = true
1819
tiny-keccak.workspace = true
@@ -21,16 +22,22 @@ tiny-keccak.workspace = true
2122
binary-merkle-tree = { workspace = true, optional = true }
2223
bounded-collections.workspace = true
2324
codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "max-encoded-len"] }
24-
scale-info.workspace = true
25+
scale-info = { workspace = true }
2526

2627
frame-support = { workspace = true, optional = true }
27-
sp-arithmetic.workspace = true
28-
sp-core.workspace = true
2928
sp-runtime = { workspace = true, optional = true }
3029
sp-runtime-interface = { workspace = true, optional = true }
30+
sp-trie = { workspace = true, optional = true }
31+
sp-storage = { workspace = true, optional = true }
32+
sp-debug-derive = { workspace = true, optional = true }
33+
sp-arithmetic.workspace = true
3134
sp-std.workspace = true
32-
sp-trie.workspace = true
33-
sp-io.workspace = true
35+
36+
blake2b_simd.workspace = true
37+
sha2.workspace = true
38+
sha3.workspace = true
39+
primitive-types.workspace = true
40+
hash-db.workspace = true
3441

3542
[dev-dependencies]
3643
hex-literal.workspace = true
@@ -43,33 +50,43 @@ trybuild = "1.0.96"
4350
[features]
4451
default = [ "std" ]
4552
std = [
46-
"binary-merkle-tree?/std",
4753
"bounded-collections/std",
4854
"codec/std",
4955
"derive_more/display",
5056
"ethabi-decode/std",
51-
"frame-support?/std",
5257
"hash256-std-hasher/std",
53-
"hex",
58+
"hex/std",
5459
"log/std",
5560
"scale-info/std",
56-
"serde/std",
61+
"serde?/std",
62+
"sp-std/std",
5763
"sp-arithmetic/std",
58-
"sp-core/std",
59-
"sp-io/std",
64+
"frame-support?/std",
65+
"binary-merkle-tree?/std",
6066
"sp-runtime-interface?/std",
6167
"sp-runtime?/std",
62-
"sp-std/std",
63-
"sp-trie/std",
68+
"sp-trie?/std",
69+
"primitive-types/std",
6470
]
71+
6572
runtime = [
66-
"binary-merkle-tree",
6773
"frame-support",
68-
"serde",
6974
"sp-runtime",
7075
"sp-runtime-interface",
76+
"sp-trie",
77+
"sp-storage",
78+
"sp-debug-derive",
79+
"binary-merkle-tree",
80+
"serde",
7181
]
72-
disable_panic_handler = [ "sp-io/disable_panic_handler" ]
7382

7483
try-runtime = [ "runtime", "sp-runtime/try-runtime" ]
75-
serde = [ "dep:serde", "hex/serde", "log/serde" ]
84+
85+
serde = [
86+
"dep:serde",
87+
"hex/serde",
88+
"log/serde",
89+
"impl-serde",
90+
"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.
91+
"bounded-collections/serde"
92+
]

core/src/app_extrinsic.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
use crate::traits::GetAppId;
2-
#[cfg(feature = "runtime")]
3-
use codec::Codec;
2+
use crate::AppId;
43
use codec::{Decode, Encode};
54
use derive_more::Constructor;
65
use scale_info::TypeInfo;
7-
#[cfg(feature = "serde")]
8-
use serde::{Deserialize, Serialize};
9-
use sp_core::RuntimeDebug;
106
use sp_std::vec::Vec;
117

12-
use crate::AppId;
8+
#[cfg(feature = "serde")]
9+
use serde::{Deserialize, Serialize};
10+
#[cfg(feature = "runtime")]
11+
use {codec::Codec, sp_debug_derive::RuntimeDebug};
1312

1413
/// Raw Extrinsic with application id.
15-
#[derive(Clone, TypeInfo, Default, Encode, Decode, RuntimeDebug, Constructor)]
14+
#[derive(Clone, Default, Encode, Decode, Constructor, TypeInfo)]
1615
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
16+
#[cfg_attr(feature = "runtime", derive(RuntimeDebug))]
1717
pub struct AppExtrinsic {
1818
pub app_id: AppId,
1919
#[cfg_attr(feature = "serde", serde(with = "hex"))]

0 commit comments

Comments
 (0)