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

[DO NOT MERGE] Visualize diff to upstream v3.1.0 #200

Closed
wants to merge 472 commits into from

Conversation

sveitser
Copy link
Collaborator

This PR is there to visualize the diff between our integration branch and the last-upstream-sync branch. Currently last-upstream-sync is at tag v3.1.0.

ImJeremyHe and others added 30 commits February 23, 2024 19:19
Fixes compilation on OSX. Not sure why.
* Fix the delayed transactions

* Update system_tests/espresso_e2e_test.go

Co-authored-by: Mathis <[email protected]>

---------

Co-authored-by: Mathis <[email protected]>
* Update espresso-sequencer-go

* Support builder-guaranteed tx

* Update the error message
sveitser and others added 8 commits August 8, 2024 17:11
* Save digest artifacts into own directory per run

Currently it seems that we have too many digests in the folder and I
think this breaks the assembly of the multiarch docker image.

With this change only digests for the same run are saved in the same
directory.

* Fail docker image merge on wrong number of digests
* Clean digests dir
Clean the log with the log helper
* Add missing dependency
* Use renamed variable, fix typo
* Fix pebble panic

* lint
@sveitser sveitser changed the title [DO NOT MERGE] Visualize diff to upstream [DO NOT MERGE] Visualize diff to upstream v3.1.0 Aug 19, 2024
@@ -185,7 +185,20 @@ func CreateExecutionNode(
if err != nil {
return nil, err
}
txPublisher = sequencer
if config.Sequencer.Espresso {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Create EspressoSequencer in espresso mode.

if err != nil {
return nil, err
}
switchSequencer, err := NewSwitchSequencer(sequencer, espressoSequencer, parentChainReader.Client(), seqConfigFetcher)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Enable the automated escape hatch to restore liveness during HotShot liveness failures.


// Espresso specific flags
Espresso bool `koanf:"espresso"`
EnableEspressoSovereign bool `koanf:"enable-espresso-sovereign"`
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Enable the sovereign sequencer mode, where nitro remains the block builder.

@codecov-commenter
Copy link

codecov-commenter commented Aug 19, 2024

Codecov Report

Attention: Patch coverage is 12.09741% with 1119 lines in your changes missing coverage. Please review.

Please upload report for BASE (last-upstream-sync@7d1d84c). Learn more about missing BASE report.

Additional details and impacted files
@@                  Coverage Diff                  @@
##             last-upstream-sync     #200   +/-   ##
=====================================================
  Coverage                      ?   24.44%           
=====================================================
  Files                         ?      266           
  Lines                         ?    38773           
  Branches                      ?        0           
=====================================================
  Hits                          ?     9479           
  Misses                        ?    27666           
  Partials                      ?     1628           

if err != nil {
return 0, false, nil, err
}
if oldJst.BlockMerkleJustification == nil && newJst.BlockMerkleJustification != nil {
Copy link
Collaborator Author

@sveitser sveitser Aug 19, 2024

Choose a reason for hiding this comment

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

@ImJeremyHe @nomaxg why do we need to have this extra logic to check for duplicates? We should probably add more explicit comments to the code.

Copy link
Member

@ImJeremyHe ImJeremyHe Aug 20, 2024

Choose a reason for hiding this comment

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

Agree that there should be more comments.

That is because that batch poster should wait for the justifications from hotshot and fill the messages with them before posting them to L1. This means that actually the batch poster are modifying the existing messages.

For some validators, they receive the l2 messages without any jst first and maintain the l2 blocks. And they also fetch the messages from L1. No matter where the messages are from, they are eventually stored in the transaction streamer. So, the transaction streamer will check if the these messages from different sources are the same. If not, it will consider a reorg happening.

That's why we have to add these code here to get around the misunderstanding of reorg

@@ -1136,7 +1202,310 @@ func (s *TransactionStreamer) executeMessages(ctx context.Context, ignored struc
return s.config().ExecuteMessageLoopDelay
}

func (s *TransactionStreamer) PollSubmittedTransactionForFinality(ctx context.Context) time.Duration {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Remaining changes in this file are for the sovereign sequencer mode. They handle the submission of L2 blocks to the Espresso Sequencer for notarization.

BlockMerkleComm *espressoTypes.TaggedBase64
}

type EspressoBlockJustification struct {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The Justification is used to justify that the L2 blocks are created from the transactions sequenced by the Espresso sequencer, or in other words went through the HotShot consensus.

@@ -288,6 +313,22 @@ func ProduceBlockAdvanced(
return nil, nil, err
}

if chainConfig.ArbitrumChainParams.EnableEspresso {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is for a feature we called "builder guaranteed transactions". It allows wallets to "tag" their transactions with an Ethereum address of a builder to only allow that builder to include the transaction in a block.

@@ -95,6 +107,8 @@ const (
L2MessageKind_Heartbeat = 6 // deprecated
L2MessageKind_SignedCompressedTx = 7
// 8 is reserved for BLS signed batch
L2MessageKind_EspressoSequencedTx = 10
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Using the espresso sequencer as sequencer for the L2 (this is deprecated, in favor of the sovereign sequencer).

@@ -95,6 +107,8 @@ const (
L2MessageKind_Heartbeat = 6 // deprecated
L2MessageKind_SignedCompressedTx = 7
// 8 is reserved for BLS signed batch
L2MessageKind_EspressoSequencedTx = 10
L2MessageKind_EspressoSovereignTx = 11
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Using the Espresso sequencer as notarization layer.

commitment,
)
if jst.Proof != nil {
espressocrypto.VerifyNamespace(chainConfig.ChainID.Uint64(), *jst.Proof, *jst.Header.PayloadCommitment, *jst.Header.NsTable, txs, *jst.VidCommon)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This call dispatches to the espresso crypto helper to verify the integrity of the Espresso namespace. Currently this checks that the L2 transactions are exactly the ones that were finalized by Espresso consensus.

@@ -0,0 +1,148 @@
package gethexec
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This module allows the nitro sequencer running on Espresso to automatically bypass the Espresso sequencer in case of a liveness failure to avoid stalling Nitro.

SendRoot common.Hash
Batch uint64
PosInBatch uint64
HotShotHeight uint64
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The block height of hotshot is used to enforce a continuous mapping between Espresso and nitro blocks (barring the Escape hatch being turned on).

@@ -22,4 +23,9 @@ type ValidationInput struct {
DelayedMsg []byte
StartState GoGlobalState
DebugChain bool

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Extra validation input for validation of Espresso integration functionality.

  • The height is used for continuity check of blocks.
  • The hotshot commitment is used to verify the integrity of transactions.
  • The hotshot liveness is used to validate correct use of the escape hatch.

@@ -286,6 +292,15 @@ impl Hostio {
opcode!(LocalGet, 1);
opcode!(ReadPreImage, PreimageType::Sha2_256);
}
WavmReadHotShotCommitment => {
opcode!(LocalGet, 0);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nomaxg do you know what these opcode do, and why it's 0, 1 for the commitment and just 0 for the liveness?

Copy link
Member

@ImJeremyHe ImJeremyHe Aug 20, 2024

Choose a reason for hiding this comment

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

Here defines how the WavmReadHotShotCommitment should be converted into OpCodes. LocalGet means getting something from somewhere and putting them to the value_stack.
Since the ReadHotShotCommitment opcode requires 2 arguments, so we have to LocalGet two times. (One pointer for the place where the commitment will be stored, and the other for the hotshot height)
As for the Liveness, we don't need to store the bool value into the module memory. (I don't quite understand why, but readInboxMessage stores the messages into the memory and the hotshot commitment seems something similar to the InboxMessage)

@@ -247,6 +279,56 @@ pub unsafe extern "C" fn arbitrator_step_until_host_io(
ptr::null_mut()
}

#[no_mangle]
#[cfg(feature = "native")]
pub unsafe extern "C" fn arbitrator_step_until_is_hotshot_live(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nomaxg @ImJeremyHe this function and the one below are exactly the same. Is that intentional?

Copy link
Member

@ImJeremyHe ImJeremyHe Aug 20, 2024

Choose a reason for hiding this comment

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

Sorry. I believe this is a bug. But this function is only used in the espresso_osp_test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok. We should investigate why the test passes despite this bug.

if mach.is_halted() {
return ptr::null_mut();
}
if mach.next_instruction_is_read_hotshot() {
Copy link
Collaborator Author

@sveitser sveitser Aug 19, 2024

Choose a reason for hiding this comment

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

@ImJeremyHe @nomaxg feels like this should be next_instruction_is_hotshot_live

sveitser and others added 2 commits August 20, 2024 09:09
* Improve help texts for flags
* Update e2e tests to use Sovereign sequencer


Co-authored-by: ImJeremyHe <[email protected]>
@sveitser
Copy link
Collaborator Author

I'm closing this PR to prevent it from triggering the already troubled CI.

@sveitser sveitser closed this Aug 28, 2024
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.

6 participants