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 justification to batches, progress on validation pipeline #13

Merged
merged 20 commits into from
Nov 27, 2023

Conversation

nomaxg
Copy link

@nomaxg nomaxg commented Nov 9, 2023

This PR introduces:

  • justification to Arbitrum batches which will be validated against the HotShot commitment corresponding to the batch
  • A series of host-io changes to the wasm validation pipeline that allows the wasm executable to read a hotshot commitment (currently, these default to [0; 32] in many places to ensure backwards compatibility)

Future work:

  • Tests
  • Add logic to fetch the HotShot commitment from a live contract (this is currently mocked)
  • Set Espresso flags correctly in the espresso variant of nitro-testnode

Depends on:
EspressoSystems/geth-arbitrum#2

To test (for backwards compatibility):

./test-node.bash --dev --init
./test-node.bash script send-l2 --to address_0x673C9b46952080D3bf1B8d689C7BBC590a8755Cb --ethamount 5 --l2url
# spin up validation nodes
docker compose up validation_node
docker compose up validator

arbos/block_processor.go Outdated Show resolved Hide resolved
cmd/replay/main.go Outdated Show resolved Hide resolved
cmd/replay/main.go Outdated Show resolved Hide resolved
cmd/replay/main.go Outdated Show resolved Hide resolved
cmd/replay/main.go Outdated Show resolved Hide resolved
@nomaxg nomaxg changed the title Batch validation Add justification to batches, progress on validation pipeline Nov 21, 2023
@nomaxg nomaxg marked this pull request as ready for review November 21, 2023 23:41
@sveitser sveitser self-requested a review November 27, 2023 11:27
Copy link

@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

@sveitser
Copy link

I'm getting this failure locally for make test-go

=== Failed
=== FAIL: broadcaster ExampleBroadcastMessage_broadcastfeedmessage (0.00s)
=== RUN   ExampleBroadcastMessage_broadcastfeedmessage
got:
{"version":1,"messages":[{"sequenceNumber":12345,"message":{"message":{"header":{"kind":0,"sender":"0x0000000000000000000000000000000000000000","blockNumber":0,"timestamp":0,"requestId":"0x0000000000000000000000000000000000000000000000000000000000000000","baseFeeL1":0,"justification":null},"l2Msg":"3q2+7w=="},"delayedMessagesRead":3333},"signature":null}]}
want:
{"version":1,"messages":[{"sequenceNumber":12345,"message":{"message":{"header":{"kind":0,"sender":"0x0000000000000000000000000000000000000000","blockNumber":0,"timestamp":0,"requestId":"0x0000000000000000000000000000000000000000000000000000000000000000","baseFeeL1":0},"l2Msg":"3q2+7w=="},"delayedMessagesRead":3333},"signature":null}]}

DONE 463 tests, 1 skipped, 1 failure in 117.090s
make: *** [Makefile:327: .make/test-go] Error 1

This makes the `ExampleBroadcastMessage_broadcastfeedmessage` test pass
without having to change the expected output.
let message = comm_map.get(&msg_num).unwrap_or(&[0; 32]);

if out_ptr + 32 > sp.memory_size() {
error!("memory bounds exceeded in {name}");
Copy link
Member

Choose a reason for hiding this comment

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

macro error! is used only for once, I think it is better to expand it here and remove the macro.

arbos/block_processor.go Show resolved Hide resolved
@@ -101,6 +109,38 @@ pub fn read_delayed_inbox_message(mut env: WasmEnvMut, sp: u32) -> MaybeEscape {
inbox_message_impl(&sp, inbox, "wavmio.readDelayedInboxMessage")
}

// Reads a hotshot commitment
fn read_hotshot_commitment_impl(
Copy link
Member

Choose a reason for hiding this comment

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

Could you please help me understand this a bit better?

Copy link
Author

@nomaxg nomaxg Nov 27, 2023

Choose a reason for hiding this comment

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

Yes, essentially what we are doing is validating that espresso batches (which currently map 1-to-1 to arbitrum batches) correspond to a valid hotshot commitment. This function implements a host-io function that reads a hotshot commitment, so that the wasm layer can pass a commitment to ProduceBlock

@nomaxg nomaxg merged commit 4c67886 into integration Nov 27, 2023
4 checks passed
nomaxg pushed a commit that referenced this pull request Jul 22, 2024
refactor: clean up logs and functions (#4)

fix: log error (#8)

fix: staker with self-validation (#9)

doc: clean comment (#13)

* refactor: clean doc

* doc: add todo for replay

* doc: add alt license header

* doc: change some comment for replay
zacshowa pushed a commit that referenced this pull request Nov 26, 2024
Add stylus programSize and programMemoryFootprint precompiles
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.

4 participants