mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(no_std): fixed no_std compiler errors in reth-primitives-traits (#9572)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -8042,7 +8042,6 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"test-fuzz",
|
||||
"thiserror-no-std",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@ -341,7 +341,7 @@ reth-payload-builder = { path = "crates/payload/builder" }
|
||||
reth-payload-primitives = { path = "crates/payload/primitives" }
|
||||
reth-payload-validator = { path = "crates/payload/validator" }
|
||||
reth-primitives = { path = "crates/primitives" }
|
||||
reth-primitives-traits = { path = "crates/primitives-traits" }
|
||||
reth-primitives-traits = { path = "crates/primitives-traits", default-features = false }
|
||||
reth-provider = { path = "crates/storage/provider" }
|
||||
reth-prune = { path = "crates/prune/prune" }
|
||||
reth-prune-types = { path = "crates/prune/types" }
|
||||
|
||||
@ -17,7 +17,6 @@ reth-consensus.workspace = true
|
||||
reth-db = { workspace = true, features = ["mdbx"] }
|
||||
reth-db-api.workspace = true
|
||||
reth-downloaders.workspace = true
|
||||
reth-optimism-primitives.workspace = true
|
||||
reth-provider.workspace = true
|
||||
reth-prune.workspace = true
|
||||
reth-stages.workspace = true
|
||||
@ -26,6 +25,9 @@ reth-execution-types.workspace = true
|
||||
reth-node-core.workspace = true
|
||||
reth-primitives.workspace = true
|
||||
|
||||
## optimisim
|
||||
reth-optimism-primitives.workspace = true
|
||||
|
||||
reth-chainspec.workspace = true
|
||||
reth-stages-types.workspace = true
|
||||
reth-node-events.workspace = true
|
||||
|
||||
@ -25,7 +25,6 @@ derive_more.workspace = true
|
||||
revm-primitives = { workspace = true, features = ["serde"] }
|
||||
|
||||
# misc
|
||||
thiserror-no-std = { workspace = true, default-features = false }
|
||||
roaring = "0.10.2"
|
||||
byteorder = "1"
|
||||
|
||||
@ -40,6 +39,8 @@ proptest = { workspace = true, optional = true }
|
||||
proptest-arbitrary-interop = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
alloy-primitives = { workspace = true, features = ["arbitrary"] }
|
||||
alloy-consensus = { workspace = true, features = ["arbitrary"] }
|
||||
arbitrary = { workspace = true, features = ["derive"] }
|
||||
proptest.workspace = true
|
||||
proptest-arbitrary-interop.workspace = true
|
||||
@ -50,10 +51,12 @@ serde_json.workspace = true
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = ["thiserror-no-std/std"]
|
||||
std = []
|
||||
test-utils = ["arbitrary"]
|
||||
arbitrary = [
|
||||
"std",
|
||||
"alloy-consensus/arbitrary",
|
||||
"alloy-primitives/arbitrary",
|
||||
"dep:arbitrary",
|
||||
"dep:proptest",
|
||||
"dep:proptest-arbitrary-interop",
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
use std::time::Duration;
|
||||
use core::time::Duration;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use alloc::string::String;
|
||||
|
||||
/// Represents one Kilogas, or `1_000` gas.
|
||||
pub const KILOGAS: u64 = 1_000;
|
||||
|
||||
@ -5,6 +5,8 @@ use core::{
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use alloc::boxed::Box;
|
||||
#[cfg(not(feature = "std"))]
|
||||
extern crate alloc;
|
||||
|
||||
/// A pair of values, one of which is expected and one of which is actual.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
|
||||
@ -140,16 +140,26 @@ impl<'a> Arbitrary<'a> for IntegerList {
|
||||
}
|
||||
|
||||
/// Primitives error type.
|
||||
#[derive(Debug, thiserror_no_std::Error)]
|
||||
#[derive(Debug)]
|
||||
pub enum RoaringBitmapError {
|
||||
/// The provided input is invalid.
|
||||
#[error("the provided input is invalid")]
|
||||
InvalidInput,
|
||||
/// Failed to deserialize data into type.
|
||||
#[error("failed to deserialize data into type")]
|
||||
FailedToDeserialize,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for RoaringBitmapError {}
|
||||
|
||||
impl fmt::Display for RoaringBitmapError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::InvalidInput => f.write_str("the provided input is invalid"),
|
||||
Self::FailedToDeserialize {} => f.write_str("failed to deserialize data into type"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@ -9,6 +9,10 @@
|
||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
#[macro_use]
|
||||
extern crate alloc;
|
||||
|
||||
#[cfg(feature = "alloy-compat")]
|
||||
mod alloy_compat;
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@ secp256k1.workspace = true
|
||||
|
||||
[features]
|
||||
default = ["c-kzg", "alloy-compat", "std", "reth-codec"]
|
||||
std = ["thiserror-no-std/std"]
|
||||
std = ["thiserror-no-std/std", "reth-primitives-traits/std"]
|
||||
reth-codec = ["dep:reth-codecs", "dep:zstd", "dep:modular-bitfield"]
|
||||
asm-keccak = ["alloy-primitives/asm-keccak"]
|
||||
arbitrary = [
|
||||
|
||||
Reference in New Issue
Block a user