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

Persistent storage for sovereign builder #180

Merged
merged 12 commits into from
Aug 7, 2024
3 changes: 1 addition & 2 deletions arbnode/batch_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,7 @@ func (b *BatchPoster) addEspressoBlockMerkleProof(
return err
}

if jst.Header.Height == 0 {
// This means the header in the jst is still the dummy header.
if jst.Header == nil {
Copy link

Choose a reason for hiding this comment

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

@ImJeremyHe what are the implications / reasons for making the header optional?

Copy link
Member

Choose a reason for hiding this comment

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

Just want to get rid of using the dummy header. In the previous version, we fetch transactions from hotshot blocks, so hotshot header is always there. So this is not optional.

In sovereign sequencer, the sequencer builds a dummy jst as a placeholder for easily decoding later.

(The reason for the dummy jst is largely because we can reuse the code here, facilitating the tx streamer to tell the reason of different message bytes. Are we really reorging, or just updating the jst.)

if arbos.IsEspressoMsg(dbMessageParsed.Message) &&
arbos.IsEspressoMsg(msg) &&
!bytes.Equal(msg.L2msg, dbMessageParsed.Message.L2msg) {

We currently are using a dummy header to build the dummy jst.
The data of the dummy header is a noise actually and it takes time to decode and encode it, though it is not a big issue.

return fmt.Errorf("this msg has not been included in hotshot %v", jst.Header.Height)
}

Expand Down
2 changes: 1 addition & 1 deletion arbnode/transaction_streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ func (s *TransactionStreamer) PollSubmittedTransactionForFinality(ctx context.Co
}

// Filling in the block justification with the header
jst.Header = espressoHeader
jst.Header = &espressoHeader
jst.Proof = &resp.Proof
jst.VidCommon = &resp.VidCommon

Expand Down
2 changes: 1 addition & 1 deletion arbos/arbostypes/incomingmessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type BlockMerkleJustification struct {
}

type EspressoBlockJustification struct {
Header espressoTypes.Header
Header *espressoTypes.Header
Proof *espressoTypes.NamespaceProof
VidCommon *espressoTypes.VidCommon
BlockMerkleJustification *BlockMerkleJustification
Expand Down
2 changes: 1 addition & 1 deletion arbos/block_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func ProduceBlock(
if err != nil {
return nil, nil, err
}
espressoHeader = &jst.Header
espressoHeader = jst.Header
}
}

Expand Down
2 changes: 1 addition & 1 deletion arbos/parse_l2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestEspressoParsing(t *testing.T) {
root, err := tagged_base64.New("root", []byte{4, 5, 6})
Require(t, err)
expectJst := &arbostypes.EspressoBlockJustification{
Header: espressoTypes.Header{
Header: &espressoTypes.Header{
L1Head: 1,
ChainConfig: mockChainConfig,
Timestamp: 2,
Expand Down
2 changes: 1 addition & 1 deletion execution/gethexec/espresso_sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (s *EspressoSequencer) createBlock(ctx context.Context) (returnValue bool)
}

jst := &arbostypes.EspressoBlockJustification{
Header: header,
Header: &header,
VidCommon: &arbTxns.VidCommon,
Proof: &arbTxns.Proof,
}
Expand Down
6 changes: 2 additions & 4 deletions execution/gethexec/executionengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,7 @@ func MessageFromTxes(header *arbostypes.L1IncomingMessageHeader, txes types.Tran
l2Message = append(l2Message, arbos.L2MessageKind_EspressoSovereignTx)
// Set a block justification placeholder here. That would help us easily parse
// our messages from `ParseEspressoMessage`.
jstBytes, err := arbos.GetEspressoJstBytes(&arbostypes.EspressoBlockJustification{
Header: espressoTypes.GetDummyHeader(),
})
jstBytes, err := arbos.GetEspressoJstBytes(&arbostypes.EspressoBlockJustification{})
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -473,7 +471,7 @@ func (s *ExecutionEngine) SequenceTransactionsEspresso(
s.bc,
s.bc.Config(),
hooks,
&jst.Header,
jst.Header,
false,
)
if err != nil {
Expand Down
Loading