-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat(primitives, storage): save prune checkpoints in database #3628
Conversation
Codecov Report
... and 205 files with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more.
|
890f491
to
5793f13
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this only defines another table and types and doesn't write to/create it.
perhaps we also want proptest for this?
lgtm otherwise, pending @joshieDo
@@ -17,7 +17,7 @@ pub enum PruneMode { | |||
#[cfg(test)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah we only need this for tests?
otherwise can use #[default]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, only for that part:
reth/crates/storage/codecs/derive/src/compact/generator.rs
Lines 31 to 34 in 73eeca0
#[test] | |
pub fn #test() { | |
#fuzz(#ident::default()) | |
} |
@mattsse PrunePart#[allow(non_snake_case)]
#[cfg(test)]
mod PrunePartTests {
use super::Compact;
extern crate test;
#[cfg(test)]
#[rustc_test_marker = "prune::part::PrunePartTests::proptest"]
pub const proptest: test::TestDescAndFn = test::TestDescAndFn {
desc: test::TestDesc {
name: test::StaticTestName("prune::part::PrunePartTests::proptest"),
ignore: false,
ignore_message: ::core::option::Option::None,
source_file: "crates/primitives/src/prune/part.rs",
start_line: 4usize,
start_col: 1usize,
end_line: 4usize,
end_col: 14usize,
compile_fail: false,
no_run: false,
should_panic: test::ShouldPanic::No,
test_type: test::TestType::UnitTest,
},
testfn: test::StaticTestFn(|| test::assert_test_result(proptest())),
};
fn proptest() {
let mut config = proptest::prelude::ProptestConfig::with_cases(256i32 as u32);
{
let mut config = config.__sugar_to_owned();
::proptest::sugar::force_no_fork(&mut config);
{
config.source_file = Some("crates/primitives/src/prune/part.rs");
let mut runner = ::proptest::test_runner::TestRunner::new(config);
let names = "field";
match runner.run(
&::proptest::strategy::Strategy::prop_map(
::proptest::arbitrary::any::<super::PrunePart>(),
|values| ::proptest::sugar::NamedArguments(names, values),
),
|::proptest::sugar::NamedArguments(_, field)| {
let _: () = {
{
let mut buf = ::alloc::vec::Vec::new();
let len = field.clone().to_compact(&mut buf);
let (decoded, _) = super::PrunePart::from_compact(&buf, len);
if !(field == decoded) {
::core::panicking::panic(
"assertion failed: field == decoded",
)
};
}
};
Ok(())
},
) {
Ok(_) => (),
Err(e) => {
::std::rt::panic_fmt(format_args!("{0}\n{1}", e, runner));
}
}
};
};
}
} PruneCheckpoint#[allow(non_snake_case)]
#[cfg(test)]
mod PruneCheckpointTests {
use super::Compact;
extern crate test;
#[cfg(test)]
#[rustc_test_marker = "prune::checkpoint::PruneCheckpointTests::proptest"]
pub const proptest: test::TestDescAndFn = test::TestDescAndFn {
desc: test::TestDesc {
name: test::StaticTestName("prune::checkpoint::PruneCheckpointTests::proptest"),
ignore: false,
ignore_message: ::core::option::Option::None,
source_file: "crates/primitives/src/prune/checkpoint.rs",
start_line: 5usize,
start_col: 1usize,
end_line: 5usize,
end_col: 14usize,
compile_fail: false,
no_run: false,
should_panic: test::ShouldPanic::No,
test_type: test::TestType::UnitTest,
},
testfn: test::StaticTestFn(|| test::assert_test_result(proptest())),
};
fn proptest() {
let mut config = proptest::prelude::ProptestConfig::with_cases(256i32 as u32);
{
let mut config = config.__sugar_to_owned();
::proptest::sugar::force_no_fork(&mut config);
{
config.source_file = Some("crates/primitives/src/prune/checkpoint.rs");
let mut runner = ::proptest::test_runner::TestRunner::new(config);
let names = "field";
match runner.run(
&::proptest::strategy::Strategy::prop_map(
::proptest::arbitrary::any::<super::PruneCheckpoint>(),
|values| ::proptest::sugar::NamedArguments(names, values),
),
|::proptest::sugar::NamedArguments(_, field)| {
let _: () = {
{
let mut buf = ::alloc::vec::Vec::new();
let len = field.clone().to_compact(&mut buf);
let (decoded, _) =
super::PruneCheckpoint::from_compact(&buf, len);
if !(field == decoded) {
::core::panicking::panic(
"assertion failed: field == decoded",
)
};
}
};
Ok(())
},
) {
Ok(_) => (),
Err(e) => {
::std::rt::panic_fmt(format_args!("{0}\n{1}", e, runner));
}
}
};
};
}
} |
Resolves #3432
Not a breaking change: we've added new table. Also, we're free to change it without breaking changes until we start writing into it.