mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add reth test-vectors compact --write|--read (#11954)
This commit is contained in:
@ -20,6 +20,7 @@ derive_more.workspace = true
|
||||
modular-bitfield.workspace = true
|
||||
serde.workspace = true
|
||||
thiserror.workspace = true
|
||||
arbitrary = { workspace = true, features = ["derive"], optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
arbitrary = { workspace = true, features = ["derive"] }
|
||||
@ -29,3 +30,13 @@ proptest-arbitrary-interop.workspace = true
|
||||
serde_json.workspace = true
|
||||
test-fuzz.workspace = true
|
||||
toml.workspace = true
|
||||
|
||||
[features]
|
||||
test-utils = [
|
||||
"dep:arbitrary",
|
||||
"reth-codecs/test-utils"
|
||||
]
|
||||
arbitrary = [
|
||||
"alloy-primitives/arbitrary",
|
||||
"reth-codecs/arbitrary"
|
||||
]
|
||||
|
||||
@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Saves the pruning progress of a stage.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize, Compact)]
|
||||
#[cfg_attr(test, derive(Default, arbitrary::Arbitrary))]
|
||||
#[cfg_attr(any(test, feature = "test-utils"), derive(Default, arbitrary::Arbitrary))]
|
||||
#[add_arbitrary_tests(compact)]
|
||||
pub struct PruneCheckpoint {
|
||||
/// Highest pruned block number. If it's [None], the pruning for block `0` is not finished yet.
|
||||
|
||||
@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
|
||||
/// Prune mode.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize, Compact)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[cfg_attr(test, derive(arbitrary::Arbitrary))]
|
||||
#[cfg_attr(any(test, feature = "test-utils"), derive(arbitrary::Arbitrary))]
|
||||
#[add_arbitrary_tests(compact)]
|
||||
pub enum PruneMode {
|
||||
/// Prune all blocks.
|
||||
@ -17,6 +17,13 @@ pub enum PruneMode {
|
||||
Before(BlockNumber),
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test-utils"))]
|
||||
impl Default for PruneMode {
|
||||
fn default() -> Self {
|
||||
Self::Full
|
||||
}
|
||||
}
|
||||
|
||||
impl PruneMode {
|
||||
/// Prune blocks up to the specified block number. The specified block number is also pruned.
|
||||
///
|
||||
@ -69,13 +76,6 @@ impl PruneMode {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
impl Default for PruneMode {
|
||||
fn default() -> Self {
|
||||
Self::Full
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{
|
||||
|
||||
Reference in New Issue
Block a user