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

Open
wants to merge 682 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
682 commits
Select commit Hold shift + click to select a range
4c63dfb
log line fixes
rauljordan Mar 30, 2024
3302de6
nogo
rauljordan Mar 30, 2024
dc88572
edit bold pin
rauljordan Mar 31, 2024
67c5ab4
update bold commit
rauljordan Apr 1, 2024
43b0529
bold commit
rauljordan Apr 2, 2024
37e2f1b
bold commit
rauljordan Apr 2, 2024
ed41af8
latest bold code
rauljordan Apr 5, 2024
09ec53c
go errors
rauljordan Apr 5, 2024
46aaca3
update bold
rauljordan Apr 11, 2024
1369f29
sync edits from master
rauljordan May 13, 2024
1cb57e3
update geth
rauljordan May 13, 2024
450ccd8
sync more edits
rauljordan May 13, 2024
cce4b22
update submods
rauljordan May 13, 2024
95df92b
update bold commit
rauljordan May 13, 2024
9cc5cdb
edits to build
rauljordan May 13, 2024
573110c
build system test
rauljordan May 13, 2024
7ba9dc2
update bold ref
rauljordan May 14, 2024
6158550
Merge branch 'master' into sepolia-tooling-merge
rauljordan May 14, 2024
3f2b6d7
bold commit
rauljordan May 14, 2024
296c0fc
fix build
rauljordan May 14, 2024
4746270
pass state provider tests again
rauljordan May 14, 2024
b9e2552
edit back tags
rauljordan May 14, 2024
574d7bd
edits testing perf
rauljordan May 14, 2024
0cc28bb
bold commit
rauljordan May 15, 2024
60fa5a0
Merge branch 'master' into sepolia-tooling-merge
amsanghi May 24, 2024
703630a
bold commit
rauljordan May 30, 2024
0d8cf2e
Merge branch 'sepolia-tooling-merge' of github.com:OffchainLabs/nitro…
rauljordan May 30, 2024
df66e5b
pass test
rauljordan May 30, 2024
90e5cc8
Cleanup data_poster.go
amsanghi May 31, 2024
cf718e5
clean up block_processor.go
amsanghi May 31, 2024
a6ca05b
clean up backlog_test.go
amsanghi May 31, 2024
7785926
clean up block_recorder.go
amsanghi May 31, 2024
162edd9
clean up executionengine.go
amsanghi May 31, 2024
d078915
clean up node.go
amsanghi May 31, 2024
3eb42c7
clean up nitro.log
amsanghi May 31, 2024
8d96ae9
clean up block_validator.go
amsanghi May 31, 2024
920ac59
clean up state_provider.go
amsanghi May 31, 2024
941d2a2
clean up stateless_block_validator.go
amsanghi May 31, 2024
5bba5e0
clean up assertion_on_large_number_of_block_test.go
amsanghi May 31, 2024
9d720a8
clean up bold_challenge_protocol_test.go
amsanghi May 31, 2024
2467ac0
clean up CreateBoldExecutionRun
amsanghi May 31, 2024
22ccdb7
Clean up manager call
amsanghi May 31, 2024
2a44c92
Merge branch 'master' into bold-review
amsanghi May 31, 2024
b8c6502
support bold main
rauljordan Jun 3, 2024
100ad6e
support config
rauljordan Jun 3, 2024
abbcd20
edits
rauljordan Jun 3, 2024
5935794
bold commit
rauljordan Jun 3, 2024
2cb59b9
get staked info
rauljordan Jun 4, 2024
a7f2fbe
support bold initialization in staker
rauljordan Jun 4, 2024
053cb36
support macos in download machine
rauljordan Jun 4, 2024
6c4c401
Merge branch 'master' into bold-review
rauljordan Jun 6, 2024
7b77f7f
address some review comments
rauljordan Jun 6, 2024
4e7b4a5
Merge branch 'bold-review' of github.com:OffchainLabs/nitro into bold…
rauljordan Jun 6, 2024
cbc3f7e
revert arbitrator edits
rauljordan Jun 6, 2024
983a1e8
revert some old stuff
rauljordan Jun 6, 2024
2a313c1
arbitrator
rauljordan Jun 6, 2024
6835a7b
cache comments
rauljordan Jun 7, 2024
099d03c
sync
rauljordan Jun 7, 2024
bfba244
commentary and cleanup
rauljordan Jun 7, 2024
5ccbbb4
edit names
rauljordan Jun 7, 2024
af8cc34
staker switch elsewhere
rauljordan Jun 7, 2024
ba2e3b1
bridgegen
rauljordan Jun 7, 2024
a171c95
more porting
rauljordan Jun 7, 2024
0375950
multiprotocol switcher
rauljordan Jun 7, 2024
b9c6c10
define the multiprotocol staker
rauljordan Jun 7, 2024
c3d8ec8
builds
rauljordan Jun 7, 2024
4e599d4
Merge branch 'master' into bold-review
rauljordan Jun 11, 2024
751f1d9
bold commit
rauljordan Jun 11, 2024
9a9012d
Merge branch 'bold-review' of github.com:OffchainLabs/nitro into bold…
rauljordan Jun 11, 2024
192e047
bold item
rauljordan Jun 11, 2024
6a33e3e
provide block validator
rauljordan Jun 11, 2024
33e2ca8
rev
rauljordan Jun 11, 2024
6470551
use stateless
rauljordan Jun 11, 2024
e57b0b0
add challenge tags
rauljordan Jun 11, 2024
737b99e
Merge branch 'master' into bold-review
rauljordan Jun 11, 2024
9ae02fc
Merge branch 'master' into bold-review
rauljordan Jun 11, 2024
28ba3e6
Merge branch 'bold-review' of github.com:OffchainLabs/nitro into bold…
rauljordan Jun 11, 2024
0b217ac
edit
rauljordan Jun 11, 2024
573880a
Merge branch 'master' into bold-review
rauljordan Jun 11, 2024
9363a29
build
rauljordan Jun 11, 2024
e721188
Merge branch 'bold-review' of github.com:OffchainLabs/nitro into bold…
rauljordan Jun 11, 2024
0b59ee3
master
rauljordan Jun 11, 2024
494d2a6
geth
rauljordan Jun 11, 2024
43d3da8
lint
rauljordan Jun 11, 2024
9aa0a82
Merge branch 'master' into bold-review
rauljordan Jun 12, 2024
99a6252
chal cache
rauljordan Jun 12, 2024
a2d9e45
check positive condition
rauljordan Jun 12, 2024
b2f8e53
config items
rauljordan Jun 12, 2024
06f49df
dedup
rauljordan Jun 12, 2024
6c2781e
logs on switch
rauljordan Jun 12, 2024
6704f92
ensure single instance init and use block latest validated state
rauljordan Jun 12, 2024
2c58a9e
ci for state provider pass
rauljordan Jun 13, 2024
c2b0f82
ci
rauljordan Jun 13, 2024
ad8b825
ci runs but need diff validators
rauljordan Jun 13, 2024
4426b46
ci challenge
rauljordan Jun 13, 2024
e5e4ea1
gotags
rauljordan Jun 13, 2024
6abb7cb
Merge branch 'master' into bold-review
rauljordan Jun 13, 2024
928a8f8
unit tests
rauljordan Jun 13, 2024
d66cc0e
Merge branch 'bold-review' of github.com:OffchainLabs/nitro into bold…
rauljordan Jun 13, 2024
d7efbab
chal timeout
rauljordan Jun 13, 2024
57a0d95
Merge branch 'master' into bold-review
rauljordan Jun 13, 2024
b3f29c0
test flakey when parallel
rauljordan Jun 13, 2024
9565823
rem
rauljordan Jun 13, 2024
528f868
Merge branch 'bold-review' of github.com:OffchainLabs/nitro into bold…
rauljordan Jun 13, 2024
69bc7bd
tags
rauljordan Jun 13, 2024
886a21d
much simpler execution run
rauljordan Jun 13, 2024
e9cc824
include server arb changes
rauljordan Jun 14, 2024
58e093f
exec run pass
rauljordan Jun 14, 2024
f89cbd8
bold commit
rauljordan Jun 14, 2024
6a8b741
Merge branch 'get-machine-hashes-with-step' into bold-review
rauljordan Jun 17, 2024
06663c2
include latest
rauljordan Jun 17, 2024
c3f737e
Merge branch 'bold-challenge-cache' into bold-review
rauljordan Jun 17, 2024
7ed6155
builds
rauljordan Jun 17, 2024
d770502
Merge branch 'get-machine-hashes-with-step' into bold-review
rauljordan Jun 17, 2024
8f8459d
state provider changes
rauljordan Jun 18, 2024
513bee2
Merge branch 'bold-challenge-cache' into bold-review
rauljordan Jun 18, 2024
30f125b
Merge branch 'master' into bold-review
rauljordan Jun 18, 2024
25d0437
Merge branch 'master' into bold-review
rauljordan Jun 20, 2024
8fb0788
bold item
rauljordan Jun 20, 2024
9ab81eb
bold commit
rauljordan Jun 20, 2024
59fc8a5
bold commit
rauljordan Jun 20, 2024
5774b3d
update bold branch
rauljordan Jun 21, 2024
8e3e19a
update bold
rauljordan Jun 24, 2024
0437e7b
add osp logging
rauljordan Jun 24, 2024
4bfe480
Merge branch 'master' into bold-review
rauljordan Jun 24, 2024
9973230
edits
rauljordan Jun 24, 2024
746978c
add in validator
rauljordan Jun 25, 2024
a6a2312
edits
rauljordan Jun 25, 2024
a6a29e1
edit bold commit
rauljordan Jun 25, 2024
a63950c
norace
rauljordan Jun 25, 2024
20a9857
edit bold main
rauljordan Jun 29, 2024
e0154ec
Merge branch 'master' into bold-review
amsanghi Jul 1, 2024
65819f0
Merge branch 'get-machine-hashes-with-step' into bold-review
amsanghi Jul 1, 2024
5589f2b
minor fix
amsanghi Jul 1, 2024
6656d0e
Merge branch 'bold-review' of github.com:OffchainLabs/nitro into bold…
rauljordan Jul 8, 2024
3b9ad4d
edits to state provider
rauljordan Jul 8, 2024
2506150
sync master
rauljordan Jul 8, 2024
7012c91
Merge branch 'master' into bold-review
rauljordan Jul 9, 2024
5f2e60d
edits
rauljordan Jul 9, 2024
658a5ce
commits
rauljordan Jul 9, 2024
7ce2089
Merge branch 'master' into bold-review
rauljordan Jul 10, 2024
8265691
Merge branch 'master' into bold-review
rauljordan Jul 12, 2024
a525bb1
Merge branch 'master' into bold-review
rauljordan Jul 15, 2024
0a078a7
Merge branch 'master' into bold-review
rauljordan Jul 18, 2024
051095f
Merge branch 'master' into bold-review
amsanghi Aug 5, 2024
c56a509
Changes based on PR comments
amsanghi Aug 5, 2024
d3e62a4
fix build and lint
amsanghi Aug 5, 2024
6011b74
Changes based on PR comments and fix build
amsanghi Aug 6, 2024
633f175
Merge branch 'master' into bold-review
amsanghi Aug 6, 2024
57af6a4
reword ExecutionStateAfterPreviousState comment
amsanghi Aug 6, 2024
533fceb
add dangerous option where validator is nil and node just assumes all…
amsanghi Aug 6, 2024
e3b8d70
checks for the wasmModuleRoot in the rollup and updates validator reg…
amsanghi Aug 6, 2024
c6faf78
Changes based on PR comments
amsanghi Aug 6, 2024
2d479d1
Merge branch 'master' into bold-review
amsanghi Aug 6, 2024
e1d40d3
fix test
amsanghi Aug 6, 2024
4914c34
fix test
amsanghi Aug 7, 2024
abdc7a1
rename function
amsanghi Aug 7, 2024
efdeb8d
Merge branch 'master' into bold-review
amsanghi Aug 13, 2024
8446078
Changes based on PR comments
amsanghi Aug 13, 2024
3b2cfdb
Send UpdateLatestStaked and UpdateLatestConfirmed notifications
amsanghi Aug 14, 2024
b28b78c
Merge branch 'master' into bold-review
amsanghi Aug 14, 2024
220d133
Merge branch 'master' into bold-review
amsanghi Aug 27, 2024
3c86220
clean up
amsanghi Aug 27, 2024
2205adb
Merge branch 'master' into bold-review
amsanghi Aug 28, 2024
d97ae8e
fix build
amsanghi Aug 28, 2024
748a9f6
fix build and panic
amsanghi Aug 28, 2024
f3bf2ac
fix test
amsanghi Aug 28, 2024
e734a4d
Add build tags
amsanghi Aug 29, 2024
88d143b
update bold main branch
rauljordan Sep 11, 2024
8e12821
update main
rauljordan Sep 11, 2024
c102262
Merge branch 'master' into bold-review
eljobe Sep 19, 2024
c80e048
Fix rawdb -> ethdb change
eljobe Sep 19, 2024
7975a06
Merge branch 'master' into bold-review
amsanghi Sep 25, 2024
5334e63
Merge branch 'master' into bold-review
amsanghi Sep 26, 2024
b6cb5a1
Changes based on PR comments
amsanghi Sep 26, 2024
027a13b
Merge branch 'master' into bold-review
amsanghi Oct 9, 2024
c305135
fix build
amsanghi Oct 9, 2024
b23ab2c
Merge branch 'master' into bold-review
eljobe Oct 17, 2024
66ebcfc
Update bold to include the history committment optimizations
eljobe Oct 17, 2024
7e77151
Merge branch 'master' into bold-review
eljobe Oct 17, 2024
b3dd61d
Changes based on PR comments
amsanghi Oct 18, 2024
344eb20
Changes based on PR comments
amsanghi Oct 18, 2024
7ededde
refractor
amsanghi Oct 18, 2024
77ff553
Merge branch 'master' into bold-review
amsanghi Oct 23, 2024
6497de1
Snapshot of trying to get bold tests passing again
eljobe Oct 23, 2024
f7588dc
Fix state provider and pull in bold unify-req-meta
PlasmaPower Oct 25, 2024
0a2f031
Update bold-review to the head of bold/main
eljobe Oct 25, 2024
10ffac0
Merge branch 'bold-review' into bold-fix-tests
eljobe Oct 25, 2024
dba3e46
Update to the tip of bold/unify-req-meta
eljobe Oct 25, 2024
a5f3cf7
Get's the bold_state_provider_test.go tests passing
eljobe Oct 25, 2024
5caa3a2
Get TestChallengeProtocolBOLD passing
PlasmaPower Oct 25, 2024
2b1de35
Fix the cache
eljobe Oct 28, 2024
ccdc7d8
Merge branch 'master' into bold-review
amsanghi Oct 28, 2024
60daa96
minor fix
amsanghi Oct 29, 2024
8606740
Merge branch 'master' into bold-review
amsanghi Oct 29, 2024
8e39be5
fix linter
amsanghi Oct 29, 2024
04a8d83
Add a test challenging the start step in BoLD
PlasmaPower Oct 31, 2024
4649a54
Update the pin for the bold submodule
eljobe Oct 31, 2024
b38a1fa
WIP: Add the boldmach wrapper
eljobe Nov 1, 2024
976a18f
Fix the two obviously errored hasStepped bits
eljobe Nov 1, 2024
4c316e5
Fix TestChallengeProtocolBOLDStartStepChallenge
PlasmaPower Nov 2, 2024
11afd69
Fix the execution_run tests
eljobe Nov 4, 2024
c3f806e
Attempt at fixing the virtual leaves issue
eljobe Nov 4, 2024
6e20fc6
Begin work on TestChallengeProtocolBOLDVirtualBlocks
PlasmaPower Nov 5, 2024
e0fd4df
Merge pull request #2769 from OffchainLabs/bold-start-step-test
eljobe Nov 5, 2024
463f167
Complete TestChallengeProtocolBOLDVirtualBlocks
PlasmaPower Nov 5, 2024
259a4eb
Handle challenges in the virtually padded part of the leaaves
eljobe Nov 5, 2024
30af4ff
Get the test to compile
eljobe Nov 6, 2024
e712059
Split virtual blocks test into first and near last virtual block tests
PlasmaPower Nov 6, 2024
d3266db
Update test to better handle virtual blocks returned by honest impl
PlasmaPower Nov 6, 2024
ae1d18a
Fix the CollectProof and CollectMachineHashes calls
eljobe Nov 7, 2024
7056809
Merge branch 'bold-fix-tests' of github.com:OffchainLabs/nitro into b…
eljobe Nov 7, 2024
2f0bc89
Get the branch building again
eljobe Nov 12, 2024
0abf704
Fix the wiring after the giant refactoring in bold repo
eljobe Nov 14, 2024
683d190
Merge branch 'master' into bold-review
eljobe Nov 18, 2024
d763207
Merge branch 'bold-review' into bold-fix-tests
eljobe Nov 18, 2024
bf1838e
Update to the same go-ethereum pin as master
eljobe Nov 18, 2024
d0bf3f4
Fix the path since it was moved down a dir
eljobe Nov 18, 2024
7c1140f
Update the bold pin and remove some logging
eljobe Nov 19, 2024
361a747
Fix 2 lint issues
eljobe Nov 19, 2024
e9373e7
Merge commit '36a7ab854b8d528a50286c680f4b7c1a81d4eee2' into bold-review
eljobe Nov 19, 2024
4a323c3
Merge branch 'bold-review' into bold-fix-tests
eljobe Nov 19, 2024
0aa337a
Merge pull request #2770 from OffchainLabs/bold-fix-tests
eljobe Nov 19, 2024
0f2fd1c
Merge branch 'master' into bold-review
eljobe Nov 19, 2024
7537061
Remove maxNumberOfBlocks from bold state provider
eljobe Nov 20, 2024
b053a14
Merge branch 'master' into bold-review
eljobe Nov 20, 2024
1e0461f
Merge branch 'master' into bold-review
eljobe Nov 21, 2024
6cc1d2f
Update the bold pin to use the tip of main
eljobe Nov 21, 2024
331c12e
Update bold pin and adjust nitro code accordingly
eljobe Nov 21, 2024
f36ed0d
Get the BoLD challenge tests compiling again
eljobe Nov 21, 2024
19bc1ef
Bump nitro-testnode to bold-upgrade branch for bold testing
PlasmaPower Nov 22, 2024
4aba248
Fix bold staker without block validation enabled
PlasmaPower Nov 22, 2024
72ba88d
Fix multi protocol staker legacy staker wallet initialization
PlasmaPower Nov 22, 2024
eed7b12
Sync in the latests changes from the bold repo
eljobe Nov 22, 2024
e0a4a0f
Validator wallet refactor for bold
PlasmaPower Nov 22, 2024
b4f9dad
Address PR comments
PlasmaPower Nov 23, 2024
c2ac13a
Add documentation for the EOA struct
PlasmaPower Nov 23, 2024
0aa0cf8
Make bold state validated check more sturdy
PlasmaPower Nov 24, 2024
2821084
Fix bold state provider test exiting loop early
PlasmaPower Nov 24, 2024
7b92647
bug fix
rauljordan Nov 25, 2024
dac6070
del
rauljordan Nov 25, 2024
1f259a9
add back tag
rauljordan Nov 25, 2024
f1de4c5
edit bold submodule
rauljordan Nov 25, 2024
11b270e
fix conflicts
rauljordan Nov 25, 2024
9e07266
bold submod
rauljordan Nov 25, 2024
8aff5ee
bold submod
rauljordan Nov 25, 2024
cdee55d
Merge branch 'bold-review' into val-wallet-refactor
rauljordan Nov 25, 2024
e9ecd45
Merge pull request #2804 from OffchainLabs/val-wallet-refactor
rauljordan Nov 25, 2024
bd7bd35
Merge branch 'master' into bold-review
rauljordan Nov 25, 2024
b6ee9d2
Make previousGlobalState a value instead of pointer
eljobe Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
redis:
image: redis
ports:
- 6379:6379
- 6379:6379

strategy:
fail-fast: false
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:

- name: run challenge tests
if: matrix.test-mode == 'challenge'
run: ${{ github.workspace }}/.github/workflows/gotestsum.sh --tags challengetest --run TestChallenge --cover
run: ${{ github.workspace }}/.github/workflows/gotestsum.sh --tags challengetest --run TestChallenge --timeout 60m --cover

- name: run stylus tests
if: matrix.test-mode == 'stylus'
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
[submodule "nitro-testnode"]
path = nitro-testnode
url = https://github.com/OffchainLabs/nitro-testnode.git
[submodule "bold"]
path = bold
url = https://github.com/OffchainLabs/bold.git
[submodule "arbitrator/langs/rust"]
path = arbitrator/langs/rust
url = https://github.com/OffchainLabs/stylus-sdk-rs.git
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ COPY ./safe-smart-account ./safe-smart-account
COPY ./solgen/gen.go ./solgen/
COPY ./fastcache ./fastcache
COPY ./go-ethereum ./go-ethereum
COPY ./bold ./bold
COPY --from=brotli-wasm-export / target/
COPY --from=contracts-builder workspace/contracts/build/contracts/src/precompiles/ contracts/build/contracts/src/precompiles/
COPY --from=contracts-builder workspace/contracts/node_modules/@offchainlabs/upgrade-executor/build/contracts/src/UpgradeExecutor.sol/UpgradeExecutor.json contracts/
Expand Down Expand Up @@ -234,6 +235,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
COPY go.mod go.sum ./
COPY go-ethereum/go.mod go-ethereum/go.sum go-ethereum/
COPY fastcache/go.mod fastcache/go.sum fastcache/
COPY bold/go.mod bold/go.sum bold/
RUN go mod download
COPY . ./
COPY --from=contracts-builder workspace/contracts/build/ contracts/build/
Expand Down
6 changes: 6 additions & 0 deletions arbitrator/prover/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ pub unsafe extern "C" fn arbitrator_load_wavm_binary(binary_path: *const c_char)
}
}

#[no_mangle]
#[cfg(feature = "native")]
pub unsafe extern "C" fn arbitrator_new_finished() -> *mut Machine {
Box::into_raw(Box::new(Machine::new_finished()))
}

unsafe fn cstr_to_string(c_str: *const c_char) -> String {
CStr::from_ptr(c_str).to_string_lossy().into_owned()
}
Expand Down
42 changes: 42 additions & 0 deletions arbitrator/prover/src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,39 @@ impl Machine {
Ok(mach)
}

// new_finished returns a Machine in the Finished state at step 0.
//
// This allows the Mahine to be set up to model the final state of the
// machine at the end of the execution of a block.
//
// Callers should use set_global_state to set the global state of the
// machine to the global state at the end of the block.
pub fn new_finished() -> Machine {
Machine {
steps: 0,
status: MachineStatus::Finished,
global_state: Default::default(),
// The machine is in the Finished state, so nothing else really matters.
// values_stacks and frame_stacks cannot be empty for proof serialization,
// but everything else can just be entirely blank.
thread_state: ThreadState::Main,
value_stacks: vec![Vec::new()],
frame_stacks: vec![Vec::new()],
internal_stack: Default::default(),
modules: Default::default(),
modules_merkle: Default::default(),
pc: Default::default(),
stdio_output: Default::default(),
inbox_contents: Default::default(),
first_too_far: Default::default(),
preimage_resolver: PreimageResolverWrapper::new(Arc::new(|_, _, _| None)),
stylus_modules: Default::default(),
initial_hash: Default::default(),
context: Default::default(),
debug_info: Default::default(),
}
}

pub fn new_from_wavm(wavm_binary: &Path) -> Result<Machine> {
let mut modules: Vec<Module> = {
let compressed = std::fs::read(wavm_binary)?;
Expand Down Expand Up @@ -2867,6 +2900,15 @@ impl Machine {
let mod_merkle = self.get_modules_merkle();
out!(mod_merkle.root());

if self.is_halted() {
// If the machine is halted, instead of serializing the module,
// serialize the global state and return.
// This is for the "kickstart" BoLD proof, but it's backwards compatible
// with the old OSP behavior which reads no further.
out!(self.global_state.serialize());
return data;
}

// End machine serialization, serialize module

let module = &self.modules[self.pc.module()];
Expand Down
14 changes: 12 additions & 2 deletions arbnode/dataposter/data_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,13 +712,23 @@ func (p *DataPoster) feeAndTipCaps(ctx context.Context, nonce uint64, gasLimit u
return newBaseFeeCap, newTipCap, newBlobFeeCap, nil
}

func (p *DataPoster) PostSimpleTransaction(ctx context.Context, nonce uint64, to common.Address, calldata []byte, gasLimit uint64, value *big.Int) (*types.Transaction, error) {
return p.PostTransaction(ctx, time.Now(), nonce, nil, to, calldata, gasLimit, value, nil, nil)
func (p *DataPoster) PostSimpleTransaction(ctx context.Context, to common.Address, calldata []byte, gasLimit uint64, value *big.Int) (*types.Transaction, error) {
p.mutex.Lock()
defer p.mutex.Unlock()
nonce, _, _, _, err := p.getNextNonceAndMaybeMeta(ctx, 1)
if err != nil {
return nil, err
}
return p.postTransactionWithMutex(ctx, time.Now(), nonce, nil, to, calldata, gasLimit, value, nil, nil)
}

func (p *DataPoster) PostTransaction(ctx context.Context, dataCreatedAt time.Time, nonce uint64, meta []byte, to common.Address, calldata []byte, gasLimit uint64, value *big.Int, kzgBlobs []kzg4844.Blob, accessList types.AccessList) (*types.Transaction, error) {
p.mutex.Lock()
defer p.mutex.Unlock()
return p.postTransactionWithMutex(ctx, dataCreatedAt, nonce, meta, to, calldata, gasLimit, value, kzgBlobs, accessList)
}

func (p *DataPoster) postTransactionWithMutex(ctx context.Context, dataCreatedAt time.Time, nonce uint64, meta []byte, to common.Address, calldata []byte, gasLimit uint64, value *big.Int, kzgBlobs []kzg4844.Blob, accessList types.AccessList) (*types.Transaction, error) {

if p.config().DisableNewTx {
return nil, fmt.Errorf("posting new transaction is disabled")
Expand Down
65 changes: 34 additions & 31 deletions arbnode/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ import (
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
"github.com/offchainlabs/nitro/solgen/go/rollupgen"
"github.com/offchainlabs/nitro/staker"
boldstaker "github.com/offchainlabs/nitro/staker/bold"
legacystaker "github.com/offchainlabs/nitro/staker/legacy"
multiprotocolstaker "github.com/offchainlabs/nitro/staker/multi_protocol"
"github.com/offchainlabs/nitro/staker/validatorwallet"
"github.com/offchainlabs/nitro/util/contracts"
"github.com/offchainlabs/nitro/util/headerreader"
Expand Down Expand Up @@ -79,22 +82,23 @@ func GenerateRollupConfig(prod bool, wasmModuleRoot common.Hash, rollupOwner com
}

type Config struct {
Sequencer bool `koanf:"sequencer"`
ParentChainReader headerreader.Config `koanf:"parent-chain-reader" reload:"hot"`
InboxReader InboxReaderConfig `koanf:"inbox-reader" reload:"hot"`
DelayedSequencer DelayedSequencerConfig `koanf:"delayed-sequencer" reload:"hot"`
BatchPoster BatchPosterConfig `koanf:"batch-poster" reload:"hot"`
MessagePruner MessagePrunerConfig `koanf:"message-pruner" reload:"hot"`
BlockValidator staker.BlockValidatorConfig `koanf:"block-validator" reload:"hot"`
Feed broadcastclient.FeedConfig `koanf:"feed" reload:"hot"`
Staker staker.L1ValidatorConfig `koanf:"staker" reload:"hot"`
SeqCoordinator SeqCoordinatorConfig `koanf:"seq-coordinator"`
DataAvailability das.DataAvailabilityConfig `koanf:"data-availability"`
SyncMonitor SyncMonitorConfig `koanf:"sync-monitor"`
Dangerous DangerousConfig `koanf:"dangerous"`
TransactionStreamer TransactionStreamerConfig `koanf:"transaction-streamer" reload:"hot"`
Maintenance MaintenanceConfig `koanf:"maintenance" reload:"hot"`
ResourceMgmt resourcemanager.Config `koanf:"resource-mgmt" reload:"hot"`
Sequencer bool `koanf:"sequencer"`
ParentChainReader headerreader.Config `koanf:"parent-chain-reader" reload:"hot"`
InboxReader InboxReaderConfig `koanf:"inbox-reader" reload:"hot"`
DelayedSequencer DelayedSequencerConfig `koanf:"delayed-sequencer" reload:"hot"`
BatchPoster BatchPosterConfig `koanf:"batch-poster" reload:"hot"`
MessagePruner MessagePrunerConfig `koanf:"message-pruner" reload:"hot"`
BlockValidator staker.BlockValidatorConfig `koanf:"block-validator" reload:"hot"`
Feed broadcastclient.FeedConfig `koanf:"feed" reload:"hot"`
Staker legacystaker.L1ValidatorConfig `koanf:"staker" reload:"hot"`
BOLD boldstaker.BoldConfig `koanf:"bold"`
SeqCoordinator SeqCoordinatorConfig `koanf:"seq-coordinator"`
DataAvailability das.DataAvailabilityConfig `koanf:"data-availability"`
SyncMonitor SyncMonitorConfig `koanf:"sync-monitor"`
Dangerous DangerousConfig `koanf:"dangerous"`
TransactionStreamer TransactionStreamerConfig `koanf:"transaction-streamer" reload:"hot"`
Maintenance MaintenanceConfig `koanf:"maintenance" reload:"hot"`
ResourceMgmt resourcemanager.Config `koanf:"resource-mgmt" reload:"hot"`
// SnapSyncConfig is only used for testing purposes, these should not be configured in production.
SnapSyncTest SnapSyncConfig
}
Expand Down Expand Up @@ -153,7 +157,8 @@ func ConfigAddOptions(prefix string, f *flag.FlagSet, feedInputEnable bool, feed
MessagePrunerConfigAddOptions(prefix+".message-pruner", f)
staker.BlockValidatorConfigAddOptions(prefix+".block-validator", f)
broadcastclient.FeedConfigAddOptions(prefix+".feed", f, feedInputEnable, feedOutputEnable)
staker.L1ValidatorConfigAddOptions(prefix+".staker", f)
legacystaker.L1ValidatorConfigAddOptions(prefix+".staker", f)
boldstaker.BoldConfigAddOptions(prefix+".bold", f)
SeqCoordinatorConfigAddOptions(prefix+".seq-coordinator", f)
das.DataAvailabilityConfigAddNodeOptions(prefix+".data-availability", f)
SyncMonitorConfigAddOptions(prefix+".sync-monitor", f)
Expand All @@ -171,7 +176,8 @@ var ConfigDefault = Config{
MessagePruner: DefaultMessagePrunerConfig,
BlockValidator: staker.DefaultBlockValidatorConfig,
Feed: broadcastclient.FeedConfigDefault,
Staker: staker.DefaultL1ValidatorConfig,
Staker: legacystaker.DefaultL1ValidatorConfig,
BOLD: boldstaker.DefaultBoldConfig,
SeqCoordinator: DefaultSeqCoordinatorConfig,
DataAvailability: das.DefaultDataAvailabilityConfig,
SyncMonitor: DefaultSyncMonitorConfig,
Expand Down Expand Up @@ -203,7 +209,7 @@ func ConfigDefaultL1NonSequencerTest() *Config {
config.SeqCoordinator.Enable = false
config.BlockValidator = staker.TestBlockValidatorConfig
config.SyncMonitor = TestSyncMonitorConfig
config.Staker = staker.TestL1ValidatorConfig
config.Staker = legacystaker.TestL1ValidatorConfig
config.Staker.Enable = false
config.BlockValidator.ValidationServerConfigs = []rpcclient.ClientConfig{{URL: ""}}

Expand All @@ -219,7 +225,7 @@ func ConfigDefaultL2Test() *Config {
config.Feed.Output.Signed = false
config.SeqCoordinator.Signer.ECDSA.AcceptSequencer = false
config.SeqCoordinator.Signer.ECDSA.Dangerous.AcceptMissing = true
config.Staker = staker.TestL1ValidatorConfig
config.Staker = legacystaker.TestL1ValidatorConfig
config.SyncMonitor = TestSyncMonitorConfig
config.Staker.Enable = false
config.BlockValidator.ValidationServerConfigs = []rpcclient.ClientConfig{{URL: ""}}
Expand Down Expand Up @@ -267,7 +273,7 @@ type Node struct {
MessagePruner *MessagePruner
BlockValidator *staker.BlockValidator
StatelessBlockValidator *staker.StatelessBlockValidator
Staker *staker.Staker
Staker *multiprotocolstaker.MultiProtocolStaker
BroadcastServer *broadcaster.Broadcaster
BroadcastClients *broadcastclients.BroadcastClients
SeqCoordinator *SeqCoordinator
Expand Down Expand Up @@ -633,7 +639,7 @@ func createNodeImpl(
}
}

var stakerObj *staker.Staker
var stakerObj *multiprotocolstaker.MultiProtocolStaker
var messagePruner *MessagePruner
var stakerAddr common.Address

Expand All @@ -653,7 +659,7 @@ func createNodeImpl(
getExtraGas := func() uint64 { return configFetcher.Get().Staker.ExtraGas }
// TODO: factor this out into separate helper, and split rest of node
// creation into multiple helpers.
var wallet staker.ValidatorWalletInterface = validatorwallet.NewNoOp(l1client, deployInfo.Rollup)
var wallet legacystaker.ValidatorWalletInterface = validatorwallet.NewNoOp(l1client, deployInfo.Rollup)
if !strings.EqualFold(config.Staker.Strategy, "watchtower") {
if config.Staker.UseSmartContractWallet || (txOptsValidator == nil && config.Staker.DataPoster.ExternalSigner.URL == "") {
var existingWalletAddress *common.Address
Expand Down Expand Up @@ -681,13 +687,13 @@ func createNodeImpl(
}
}

var confirmedNotifiers []staker.LatestConfirmedNotifier
var confirmedNotifiers []legacystaker.LatestConfirmedNotifier
if config.MessagePruner.Enable {
messagePruner = NewMessagePruner(txStreamer, inboxTracker, func() *MessagePrunerConfig { return &configFetcher.Get().MessagePruner })
confirmedNotifiers = append(confirmedNotifiers, messagePruner)
}

stakerObj, err = staker.NewStaker(l1Reader, wallet, bind.CallOpts{}, func() *staker.L1ValidatorConfig { return &configFetcher.Get().Staker }, blockValidator, statelessBlockValidator, nil, confirmedNotifiers, deployInfo.ValidatorUtils, fatalErrChan)
stakerObj, err = multiprotocolstaker.NewMultiProtocolStaker(l1Reader, wallet, bind.CallOpts{}, func() *legacystaker.L1ValidatorConfig { return &configFetcher.Get().Staker }, &configFetcher.Get().BOLD, blockValidator, statelessBlockValidator, nil, confirmedNotifiers, deployInfo.ValidatorUtils, deployInfo.Bridge, fatalErrChan)
if err != nil {
return nil, err
}
Expand All @@ -697,11 +703,7 @@ func createNodeImpl(
if dp != nil {
stakerAddr = dp.Sender()
}
whitelisted, err := stakerObj.IsWhitelisted(ctx)
if err != nil {
return nil, err
}
log.Info("running as validator", "txSender", stakerAddr, "actingAsWallet", wallet.Address(), "whitelisted", whitelisted, "strategy", config.Staker.Strategy)
log.Info("running as validator", "txSender", stakerAddr, "actingAsWallet", wallet.Address(), "strategy", config.Staker.Strategy)
}

var batchPoster *BatchPoster
Expand Down Expand Up @@ -905,7 +907,8 @@ func (n *Node) Start(ctx context.Context) error {
n.MessagePruner.Start(ctx)
}
if n.Staker != nil {
err = n.Staker.Initialize(ctx)
err = n.Staker.
Initialize(ctx)
if err != nil {
return fmt.Errorf("error initializing staker: %w", err)
}
Expand Down
1 change: 1 addition & 0 deletions bold
Submodule bold added at 9bc979
1 change: 1 addition & 0 deletions cmd/chaininfo/chain_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,6 @@ type RollupAddresses struct {
UpgradeExecutor common.Address `json:"upgrade-executor"`
ValidatorUtils common.Address `json:"validator-utils"`
ValidatorWalletCreator common.Address `json:"validator-wallet-creator"`
StakeToken common.Address `json:"stake-token"`
amsanghi marked this conversation as resolved.
Show resolved Hide resolved
DeployedAt uint64 `json:"deployed-at"`
}
1 change: 1 addition & 0 deletions cmd/nitro-val/nitro_val.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func mainImpl() int {
func() *valnode.Config { return &liveNodeConfig.Get().Validation },
stack,
fatalErrChan,
nil,
)
if err != nil {
log.Error("couldn't init validation node", "err", err)
Expand Down
7 changes: 4 additions & 3 deletions cmd/nitro/nitro.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import (
"github.com/offchainlabs/nitro/solgen/go/bridgegen"
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
"github.com/offchainlabs/nitro/solgen/go/rollupgen"
"github.com/offchainlabs/nitro/staker"
legacystaker "github.com/offchainlabs/nitro/staker/legacy"
"github.com/offchainlabs/nitro/staker/validatorwallet"
"github.com/offchainlabs/nitro/util/colors"
"github.com/offchainlabs/nitro/util/dbutil"
Expand Down Expand Up @@ -257,7 +257,7 @@ func mainImpl() int {
defaultL1WalletConfig.ResolveDirectoryNames(nodeConfig.Persistent.Chain)

nodeConfig.Node.Staker.ParentChainWallet.ResolveDirectoryNames(nodeConfig.Persistent.Chain)
defaultValidatorL1WalletConfig := staker.DefaultValidatorL1WalletConfig
defaultValidatorL1WalletConfig := legacystaker.DefaultValidatorL1WalletConfig
defaultValidatorL1WalletConfig.ResolveDirectoryNames(nodeConfig.Persistent.Chain)

nodeConfig.Node.BatchPoster.ParentChainWallet.ResolveDirectoryNames(nodeConfig.Persistent.Chain)
Expand Down Expand Up @@ -294,7 +294,7 @@ func mainImpl() int {
if err != nil {
log.Crit("couldn't parse staker strategy", "err", err)
}
if strategy != staker.WatchtowerStrategy && !nodeConfig.Node.Staker.Dangerous.WithoutBlockValidator {
if strategy != legacystaker.WatchtowerStrategy && !nodeConfig.Node.Staker.Dangerous.WithoutBlockValidator {
nodeConfig.Node.BlockValidator.Enable = true
}
}
Expand Down Expand Up @@ -518,6 +518,7 @@ func mainImpl() int {
func() *valnode.Config { return &liveNodeConfig.Get().Validation },
stack,
fatalErrChan,
nil,
)
if err != nil {
valNode = nil
Expand Down
Loading
Loading