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

Validation bugfix #2089

Merged
merged 17 commits into from
Oct 2, 2024
Merged

Validation bugfix #2089

merged 17 commits into from
Oct 2, 2024

Conversation

tbro
Copy link
Contributor

@tbro tbro commented Oct 1, 2024

Closes #2088
Closes #968

This PR:

Adds validation to replicas.

types/src/v0/impls/state.rs Outdated Show resolved Hide resolved
types/src/v0/impls/state.rs Outdated Show resolved Hide resolved
types/src/v0/impls/state.rs Outdated Show resolved Hide resolved
types/src/v0/impls/state.rs Outdated Show resolved Hide resolved
types/src/v0/impls/state.rs Outdated Show resolved Hide resolved
types/src/v0/impls/state.rs Outdated Show resolved Hide resolved
types/src/v0/impls/state.rs Outdated Show resolved Hide resolved
types/src/v0/impls/state.rs Outdated Show resolved Hide resolved
types/src/v0/impls/state.rs Outdated Show resolved Hide resolved
types/src/v0/impls/state.rs Outdated Show resolved Hide resolved
types/src/v0/impls/state.rs Outdated Show resolved Hide resolved
@tbro tbro marked this pull request as ready for review October 1, 2024 22:45
types/src/v0/impls/l1.rs Outdated Show resolved Hide resolved
@@ -663,6 +695,41 @@ impl HotShotState<SeqTypes> for ValidatedState {
.resolve()
.expect("Chain Config not found in validated state");

// Validate l1_finalized.
let Some(proposed_finalized) = proposed_header.l1_finalized() else {
tracing::error!("L1 finalized has None value.");
Copy link
Collaborator

@sveitser sveitser Oct 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean the proposer proposed an invalid block? I think in that case this should be warn at most? We should only log error if this is something unexpected and/or it's worth waking people up for.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appears to have been addressed here: 8f0d229

return Err(BlockError::InvalidBlockHeader);
};

let parent_finalized = parent_leaf.block_header().l1_finalized().unwrap().number();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're not adding tests now please open an issue for that (if we don't have it already) and link it in the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@sveitser sveitser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, some nits.

tbro and others added 15 commits October 2, 2024 09:07
validate l1_head is incrementing
also avoid hitting timestamp validation in previously existing
test (for the time being).
  * fix timestamp validation
  * fix system_time field in Error variant
Use this method in validation and in `wait_for_l1_finalized`.
This way we can tell which one failed
Co-authored-by: Mathis <sveitser@gmail.com>
@tbro tbro enabled auto-merge (squash) October 2, 2024 14:46
@tbro tbro merged commit b0604bb into main Oct 2, 2024
15 checks passed
@tbro tbro deleted the tb/fix/validation branch October 2, 2024 15:02
tbro added a commit that referenced this pull request Oct 2, 2024
Adds missing validation steps

  * validate timestamp (against system time and previous block)
  * wait for l1_finalized
  * wait for l1_head
  * validate blocks are not decrementing
  * small update to pee-existing tests to avoid hitting these cases
  * adds TODOs for followups

---------

Co-authored-by: tbro <tbro@users.noreply.github.com>
Co-authored-by: Jeb Bearer <jeb@espressosys.com>
Co-authored-by: Mathis <sveitser@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants