-
Notifications
You must be signed in to change notification settings - Fork 159
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
Added a new option --validate-tipsets in forest-cli validate command #3167
Conversation
forest-cli snapshot re-validate
forest-cli snapshot re-validate
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.
I would prefer it if it were part of the validate
command.
19e0e80
to
8fa4d7f
Compare
src/state_manager/mod.rs
Outdated
epochs: RangeInclusive<i64>, | ||
tipsets: itertools::Unfold<Option<Arc<Tipset>>, F>, |
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.
The range is not needed if we take a stream. Also, tipsets
should be anything that implements stream.
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.
fixed
src/state_manager/mod.rs
Outdated
let pb = crate::utils::io::ProgressBar::new((epochs.end() - epochs.start()) as u64); | ||
pb.message("Compute parent state: "); | ||
pb.set_max_refresh_rate(Some(std::time::Duration::from_millis(500))); | ||
|
||
tipsets | ||
.take_while(|tipset| tipset.epoch() >= *epochs.start()) |
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.
No need to trim the stream. The caller can do that if they want it.
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.
fixed
@lemmih I am also thinking of using |
src/cli/subcommands/snapshot_cmd.rs
Outdated
let tipsets = itertools::unfold(Some(end_tipset), |tipset| { | ||
let child = tipset.take()?; | ||
*tipset = state_manager | ||
.chain_store() | ||
.tipset_from_keys(child.parents()) | ||
.ok(); | ||
Some(child) |
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 is copy-pasted - can you refactor to a common get_all_ancestors
function please
src/state_manager/mod.rs
Outdated
self.validate_stream(epochs, tipsets) | ||
} | ||
|
||
pub fn validate_stream<F>( |
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.
I don't understand why this new function is necessary - could you help me understand?
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.
It's to avoid heaviest_tipset
, which is undefined outside of the daemon.
src/cli/subcommands/snapshot_cmd.rs
Outdated
ensure_params_downloaded().await?; | ||
// Prepare tipset stream to validate | ||
let heaviest_epoch = ts.epoch(); | ||
let end_tipset = state_manager |
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.
Aren't ts
and end_tipset
the same tipset?
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.
yes fixed
src/cli/subcommands/snapshot_cmd.rs
Outdated
ensure_params_downloaded().await?; | ||
// Prepare tipset stream to validate | ||
let tipsets = ts | ||
.chain(Arc::clone(&store)) |
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.
.chain(Arc::clone(&store)) | |
.chain(&store) |
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.
changed
src/state_manager/mod.rs
Outdated
@@ -1251,8 +1251,6 @@ where | |||
/// This is suspected to be due something in the VM or its `WASM` runtime. | |||
#[tracing::instrument(skip(self))] | |||
pub fn validate(self: &Arc<Self>, epochs: RangeInclusive<i64>) -> anyhow::Result<()> { |
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.
pub fn validate(self: &Arc<Self>, epochs: RangeInclusive<i64>) -> anyhow::Result<()> { | |
pub fn validate_range(self: &Arc<Self>, epochs: RangeInclusive<i64>) -> anyhow::Result<()> { |
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.
changed
src/state_manager/mod.rs
Outdated
self.validate_stream(tipsets) | ||
} | ||
|
||
pub fn validate_stream<T>(self: &Arc<Self>, tipsets: T) -> anyhow::Result<()> |
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.
pub fn validate_stream<T>(self: &Arc<Self>, tipsets: T) -> anyhow::Result<()> | |
pub fn validate_tipsets<T>(self: &Arc<Self>, tipsets: T) -> anyhow::Result<()> |
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.
changed
@aatifsyed @lemmih PR ready for review again |
src/cli/subcommands/snapshot_cmd.rs
Outdated
@@ -240,42 +249,71 @@ async fn validate_with_blockstore<BlockstoreT>( | |||
roots: Vec<Cid>, | |||
store: Arc<BlockstoreT>, | |||
recent_stateroots: &i64, | |||
) -> Result<(), anyhow::Error> | |||
validate_tipsets: &Option<i64>, |
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.
Not a blocker:
validate_tipsets: &Option<i64>, | |
validate_tipsets: Option<i64>, |
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.
changed
@@ -282,6 +282,15 @@ impl Tipset { | |||
} | |||
broken | |||
} | |||
/// Returns an iterator of all tipsets |
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.
Of all ancestor tipsets
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.
since it includes itself also, @lemmih suggested we keep it to Returns an iterator of all tipsets
Summary of changes
Changes introduced in this pull request:
--validate-tipsets
inforest-cli snapshot validate
to validate already computed tipsets.Reference issue to close (if applicable)
Closes #3071
Other information and links
Change checklist