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

feat: add block signature validation #77

Merged
merged 6 commits into from
May 22, 2024
Merged

Conversation

hal3e
Copy link
Contributor

@hal3e hal3e commented May 16, 2024

closes: #57

This PR introduces a new validator crate which holds a BlockValidator struct that can validate blocks coming from the fuel network. Once the block_watcher receives a new block it is validated by the BlockValidator and a new ValidatedFuelBlock is then propagated throughout the block committer.

Copy link
Contributor

@segfault-magnet segfault-magnet left a comment

Choose a reason for hiding this comment

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

Super clean! Have one thought I'd like to share:

Wdyt about creating our own fuel block type instead of just reexporting from fuel_core_client for the following reasons:

  • We can write fuzzing/parameterized tests for the block validation (since we can derive stuff for the block type)
  • We can remove the fuel_core_client dep from the ports

or just write tests for every hash input.

Mostly because of 1. since there is so much stuff that goes into the hash, we should probably cover all of it with tests -- i.e. test that any change in any of the inputs should render the block invalid since this is so sensitive in nature.

Ideally we'd do some form of fuzzing or something akin to it just so we cover as much as possible.

committer/src/errors.rs Outdated Show resolved Hide resolved
e2e/src/lib.rs Show resolved Hide resolved
packages/validator/src/validator.rs Outdated Show resolved Hide resolved
hal3e and others added 4 commits May 20, 2024 12:15
Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
Copy link
Member

@Br1ght0ne Br1ght0ne left a comment

Choose a reason for hiding this comment

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

LGTM, having read through the code. I'll not pass judgement as I don't have enough committer knowledge.

@hal3e hal3e merged commit 15e57f1 into master May 22, 2024
7 checks passed
@hal3e hal3e deleted the hal3e/verify-block-signature2 branch May 28, 2024 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Verify block validator signature before posting to L1
3 participants