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

Support the Arbitrum BoLD Challenge Protocol in Nitro #2362

Merged
merged 720 commits into from
Dec 6, 2024
Merged

Conversation

amsanghi
Copy link
Contributor

@amsanghi amsanghi commented May 31, 2024

Background

This PR includes the Arbitrum BoLD challenge protocol as part of a Nitro node, enabled optionally. The goal is to have Nitro master capable of supporting BoLD challenges on Arbitrum Sepolia once the upgrade occurs and on the existing BoLD testnet.

BoLD, standing for Bounded Liquidity Delay, is a protocol for resolving disputes over execution of the Arbitrum inbox. The BoLD protocol allows for permissionless validation of Arbitrum One and Nova. It also ensures an upper-bound on withdrawal delays from L2 to L1.

To learn more about the basics of BoLD, see the gentle introduction here, or the research paper here. A presentation explaining what the BoLD software does and how it works can be found here

BoLD Software Responsibilities

BoLD is a modular component of Nitro nodes that can do the following tasks:

  1. Continuously post assertions about executing the Arbitrum inbox to BoLD rollup contracts on Ethereum
  2. Challenge posted assertions that are invalid from the honest validator's perspective
  3. Participate in challenge games to completion as an honest validator
  4. Confirm assertions that are confirmable by time or by challenge win

All of these responsibilities are performed by the BoLD challenge manager service, which is currently included as a git submodule of Nitro, with its git repository OffchainLabs/bold, with long term plans to port it fully intro Nitro.

Supporting BoLD in Nitro

In order for Nitro to support this BoLD module, Nitro has to provide a dependency to the bold challenge manager that defines the following methods:

Screenshot 2024-06-11 at 09 00 21

We implement these methods in staker/bold_state_provider.go and also add a new RPC method to the validation node called GetMachineHashesWithStepSize that can execute an Arbitrator machine at a start program counter and collect machine hashes in increments of step_size as required by BoLD.

We also implement a new challengecache package which can cache hashes retrieved from the validation node in a filesystem hierarchy for fast access by the Nitro node during BoLD challenges. This cache is required for efficient computation of challenge moves, and is a new addition. It stores hashes as bytes in files nested by challenge level hierarchy.

Switching from Old Protocol to BoLD at Runtime

To change from the old staker to the BoLD staker at runtime, we provide a new service called MultiProtocolStaker, which holds a reference to the old, L1 staker, and the new BoLD staker and can swap to BoLD once it is supported. The way it works is it checks if the rollup contract supports a certain method called ExtraChallengeBlocks. If the method is unsupported, the Nitro validator should be switching to BoLD.

Changelog Summary

Git / Deps

  • Includes BoLD as a submodule
  • Adds BoLD to go.mod and upgrades go-ethereum version to v1.12.0

Arbitrator

  • No changes included to Arbitrator, however, BoLD benefits greatly from @eljobe's work on Merkleization optimizations

Nitro Node

  • Adds a BoLD StakeToken address field to the L2 chain info JSON
  • Initializes a MultiProtocolStaker instead of a Staker which is aware of BoLD and can switch protocols
  • Adds a challengecache package to cache hashes obtained from validation node computation to be used when making moves in BoLD

Validation Node API

  • Defines a GetMachineHashesWithStepSize method that can execute Arbitrator machines at specific program counters, step through them in custom step sizes, and collect machine hashes along the way

Multi Protocol Staker Definition

  • Adds a multi protocol staker that is aware of BoLD being activated on the parent chain and can switch to it while stopping the old protocol staker

Testing

  • Defines a system test called TestChallengeProtocolBOLD which runs a complete challenge, with an L1 node two different L2 nodes disagreeing about the execution of a certain batch posted to the Arbitrum inbox. It uses the BoLD dispute protocol to fully resolve the challenge
  • System test called TestChallengeProtocolBOLD_StateProvider which tests the invariants of the bold_state_provider.go implementation needed by the BoLD challenge manager

Missing Features

  • Supporting Redis streams for scaling validation node requests

This is now part of NIT-2793

@cla-bot cla-bot bot added the s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA. label May 31, 2024
@amsanghi amsanghi changed the title Bold review Integrate Bold May 31, 2024
@amsanghi amsanghi requested review from tsahee and rauljordan May 31, 2024 15:42
@amsanghi amsanghi marked this pull request as ready for review May 31, 2024 15:43
Copy link
Contributor

@tsahee tsahee left a comment

Choose a reason for hiding this comment

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

This is very initial. Didn't go over most of it - but already some points that we can start working on.

arbitrator/prover/src/lib.rs Outdated Show resolved Hide resolved
arbnode/dataposter/data_poster.go Outdated Show resolved Hide resolved
cmd/bold-deploy/main.go Outdated Show resolved Hide resolved
@@ -0,0 +1,318 @@
// Copyright 2023, Offchain Labs, Inc.
// For license information, see https://github.com/offchainlabs/bold/blob/main/LICENSE
package challengecache
Copy link
Contributor

Choose a reason for hiding this comment

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

note to self: this package not yet reviewed

staker/l1_validator.go Outdated Show resolved Hide resolved
staker/staker.go Outdated Show resolved Hide resolved
staker/staker.go Outdated Show resolved Hide resolved
staker/staker.go Outdated Show resolved Hide resolved
staker/staker.go Outdated Show resolved Hide resolved
staker/staker.go Outdated Show resolved Hide resolved
@rauljordan rauljordan marked this pull request as draft June 5, 2024 02:25
@rauljordan rauljordan changed the title Integrate Bold Support the Arbitrum BOLD Challenge Protocol in Nitro Jun 7, 2024
staker/bold/bold_staker.go Outdated Show resolved Hide resolved
staker/bold/bold_staker.go Outdated Show resolved Hide resolved
if err != nil {
return nil, err
}
creationBlock = node.CreatedAtBlock
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds good, since this only blocks L3 support I don't think it needs to block merging

validator/client/validation_client.go Outdated Show resolved Hide resolved
validator/server_arb/validator_spawner.go Outdated Show resolved Hide resolved
validator/valnode/validation_api.go Outdated Show resolved Hide resolved
@PlasmaPower
Copy link
Collaborator

@rauljordan I pushed up a commit with what I was thinking of re: useBoldMachine. Let me know what you think

@rauljordan
Copy link
Contributor

Looks great thanks @PlasmaPower I was struggling a bit with changing all the different places, as there were several interfaces and uses intertwined, but I'm glad we can just use a bool in most areas

PlasmaPower
PlasmaPower previously approved these changes Dec 6, 2024
Copy link
Collaborator

@PlasmaPower PlasmaPower left a comment

Choose a reason for hiding this comment

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

I haven't reviewed the tests fully, but I don't think that needs to block merging. LGTM

@PlasmaPower
Copy link
Collaborator

@rauljordan the BOLD challenge tests don't seem to be currently building https://github.com/OffchainLabs/nitro/actions/runs/12201699985/job/34040676723?pr=2362#step:29:837 I think it'd be good to fix that before merging

PlasmaPower
PlasmaPower previously approved these changes Dec 6, 2024
Copy link
Collaborator

@PlasmaPower PlasmaPower left a comment

Choose a reason for hiding this comment

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

LGTM

PlasmaPower
PlasmaPower previously approved these changes Dec 6, 2024
@PlasmaPower PlasmaPower enabled auto-merge December 6, 2024 19:35
@PlasmaPower PlasmaPower merged commit 802c4c6 into master Dec 6, 2024
17 checks passed
@PlasmaPower PlasmaPower deleted the bold-review branch December 6, 2024 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design-approved 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.

6 participants