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

Add BOLD System Test That Successfully Completes a Challenge #1902

Merged
merged 74 commits into from
Oct 12, 2023

Conversation

rauljordan
Copy link
Contributor

@rauljordan rauljordan commented Oct 4, 2023

This PR makes the following changes to Nitro for the BOLD protocol:

  • Updates BOLD to latest commit on main
  • Fixes the challenge cache to deal with multiple challenge levels
  • Deletes all unused code from the new state provider logic
  • Fixes the function that actually fetches hashes from a machine in custom increments, called GetLeavesWithStepSize to deal with the more complex requirements of BOLD. Here's what it does:
    • If the machine start index is 0, the first hash in our desired state roots is keccak256("Machine finished:", machine.GlobalState().Hash())
    • Steps through the machine in stepSize increments until the machine is finished
    • If finished earlier than expected, pads the result by repeating the last root N times until we reach the desired number of hashes
  • Adds a full bold protocol system test with 5 challenge levels that can succeed
  • Simplifies the state provider logic and adds more unit tests to its key functions
  • Adds a function that can deal with the intricacies of batches and messages in the state provider called:
func (s *StateManager) StatesInBatchRange(
	fromHeight,
	toHeight l2stateprovider.Height,
	fromBatch,
	toBatch l2stateprovider.Batch,
) ([]common.Hash, []validator.GoGlobalState, error)

@rauljordan rauljordan changed the title Update BOLD Code to Succeed One Step Proofs Successfully Add BOLD System Test That Successfully Completes a Challenge Oct 11, 2023
@rauljordan rauljordan marked this pull request as ready for review October 12, 2023 01:03
@@ -313,7 +313,8 @@ func (s *HeaderReader) logIfHeaderIsOld() {
}
l1Timetamp := time.Unix(int64(storedHeader.Time), 0)
headerTime := time.Since(l1Timetamp)
if headerTime >= s.config().OldHeaderTimeout {
oldHeaderTimeout := time.Minute * 10
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to figure out how to override this in our test...

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@amsanghi amsanghi left a comment

Choose a reason for hiding this comment

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

LGTM! Huge thank you for this.

Ok to merge in bold branch for now, but before merging in to the master, I'd say let's have Lee's/Tsahi's review for validator folder at least.

@@ -313,7 +313,8 @@ func (s *HeaderReader) logIfHeaderIsOld() {
}
l1Timetamp := time.Unix(int64(storedHeader.Time), 0)
headerTime := time.Since(l1Timetamp)
if headerTime >= s.config().OldHeaderTimeout {
oldHeaderTimeout := time.Minute * 10
Copy link
Contributor

Choose a reason for hiding this comment

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

@rauljordan
Copy link
Contributor Author

Thanks for the review ! Definitely needs a lot of review before it can make it into master, but with this, we'll have the bold branch in nitro updated with master and working

@rauljordan rauljordan merged commit d0472ef into bold Oct 12, 2023
5 checks passed
@rauljordan rauljordan deleted the protocol-system-test branch October 12, 2023 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants