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

Marko/dependency cleanup #109

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions Cargo.lock

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

12 changes: 10 additions & 2 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"] }

# Macros
derive_more = { version = "0.99.17", default-features = false, features = ["constructor", "from", "add", "deref", "mul", "into"] }
Expand All @@ -36,16 +38,22 @@ serde = { version = "1.0.196", default-features = false, features = ["derive", "
hex = { version = "0.4", default-features = false, features = ["alloc", "serde"] }
serde_json = { version = "1" }
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" }

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

# Others
rayon = "1.5.2"
once_cell = "1.8.0"
Expand Down
19 changes: 12 additions & 7 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,28 @@ serde = { workspace = true, optional = true }
static_assertions.workspace = true
thiserror-no-std.workspace = true
tiny-keccak.workspace = true
impl-serde = { workspace = true, optional = true }

# Parity
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, optional = 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-std.workspace = true
sp-trie.workspace = true
sp-io.workspace = true
sp-storage.workspace = true
sp-debug-derive.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 @@ -55,8 +62,6 @@ std = [
"scale-info/std",
"serde/std",
"sp-arithmetic/std",
"sp-core/std",
"sp-io/std",
"sp-runtime-interface?/std",
"sp-runtime?/std",
"sp-std/std",
Expand All @@ -68,8 +73,8 @@ runtime = [
"serde",
"sp-runtime",
"sp-runtime-interface",
"scale-info"
]
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" ]
15 changes: 7 additions & 8 deletions core/src/app_extrinsic.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
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, scale_info::TypeInfo, sp_debug_derive::RuntimeDebug};

/// Raw Extrinsic with application id.
#[derive(Clone, TypeInfo, Default, Encode, Decode, RuntimeDebug, Constructor)]
#[derive(Clone, Default, Encode, Decode, Constructor)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "runtime", derive(RuntimeDebug, TypeInfo))]
pub struct AppExtrinsic {
pub app_id: AppId,
#[cfg_attr(feature = "serde", serde(with = "hex"))]
Expand Down
36 changes: 19 additions & 17 deletions core/src/asdr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,33 @@ use crate::{
AppId, OpaqueExtrinsic,
};

use crate::from_substrate::blake2_256;
use codec::{Codec, Compact, Decode, Encode, EncodeLike, Error, Input};
use scale_info::{build::Fields, meta_type, Path, StaticTypeInfo, Type, TypeInfo, TypeParameter};
use sp_io::hashing::blake2_256;
use sp_runtime::MultiAddress;
use sp_std::{
fmt::{Debug, Formatter, Result as FmtResult},
vec,
vec::Vec,
};

#[cfg(all(not(feature = "std"), feature = "serde"))]
use sp_std::alloc::format;
#[cfg(feature = "runtime")]
use frame_support::{
dispatch::{DispatchInfo, GetDispatchInfo},
traits::ExtrinsicCall,
};
#[cfg(feature = "runtime")]
use sp_runtime::{
generic::CheckedExtrinsic,
traits::{
self, Checkable, Extrinsic, ExtrinsicMetadata, IdentifyAccount, MaybeDisplay, Member,
SignedExtension,
use {
frame_support::{
dispatch::{DispatchInfo, GetDispatchInfo},
traits::ExtrinsicCall,
},
sp_runtime::{
generic::CheckedExtrinsic,
traits::{
self, Checkable, Extrinsic, ExtrinsicMetadata, IdentifyAccount, MaybeDisplay, Member,
SignedExtension,
},
transaction_validity::{InvalidTransaction, TransactionValidityError},
},
transaction_validity::{InvalidTransaction, TransactionValidityError},
};
#[cfg(all(not(feature = "std"), feature = "serde"))]
use sp_std::alloc::format;

/// Current version of the [`UncheckedExtrinsic`] encoded format.
///
Expand Down Expand Up @@ -433,7 +434,7 @@ where
S: ::serde::Serializer,
{
let encoded = self.encode();
sp_core::bytes::serialize(&encoded, s)
impl_serde::serialize::serialize(&encoded, s)
}
}

Expand All @@ -449,7 +450,7 @@ where
where
D: serde::Deserializer<'a>,
{
let r = sp_core::bytes::deserialize(de)?;
let r = impl_serde::serialize::deserialize(de)?;
Decode::decode(&mut &r[..])
.map_err(|e| serde::de::Error::custom(format!("Decode error: {}", e)))
}
Expand Down Expand Up @@ -638,7 +639,8 @@ mod tests {
TEST_ACCOUNT,
TestSig(
TEST_ACCOUNT,
(vec![0u8; 257], TestExtra).using_encoded(blake2_256)[..].to_owned(),
(vec![0u8; 257], TestExtra).using_encoded(crate::from_substrate::blake2_256)[..]
.to_owned(),
),
TestExtra,
);
Expand Down
11 changes: 7 additions & 4 deletions core/src/da_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ use std::fmt;

use crate::traits::{ExtendedBlock, ExtendedHeader};
use codec::{Codec, Decode, Encode};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use sp_core::RuntimeDebug;
use sp_runtime::{
traits::{
self, Block as BlockT, Header as HeaderT, MaybeSerializeDeserialize, Member, NumberFor,
Expand All @@ -33,8 +30,14 @@ use sp_runtime::{
};
use sp_std::prelude::*;

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

/// Something to identify a block.
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)]
#[derive(PartialEq, Eq, Clone, Encode, Decode)]
#[cfg_attr(feature = "runtime", derive(RuntimeDebug))]
pub enum BlockId<Block: BlockT> {
/// Identify by block header hash.
Hash(Block::Hash),
Expand Down
2 changes: 1 addition & 1 deletion core/src/data_lookup/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use codec::{Decode, Encode, Input};
use core::convert::TryFrom;
use scale_info::{Type, TypeInfo};
use sp_core::RuntimeDebug;
use sp_debug_derive::RuntimeDebug;
use sp_std::vec;
use sp_std::{ops::Range, vec::Vec};
use thiserror_no_std::Error;
Expand Down
Loading
Loading