Skip to content

Commit

Permalink
Remove the espresso L2 message kind
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJeremyHe committed Nov 19, 2024
1 parent 353ddee commit c9270e4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 28 deletions.
8 changes: 7 additions & 1 deletion arbnode/batch_poster.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,13 @@ func (b *BatchPoster) checkEspressoValidation(
msg *arbostypes.MessageWithMetadata,
) error {

if !arbos.IsEspressoMsg(msg.Message) {
// We only submit the user transactions to hotshot. Only those messages created by
// sequencer should wait for the finality
if msg.Message.Header.Kind != arbostypes.L1MessageType_L2Message {
return nil
}
kind := msg.Message.L2msg[0]
if kind != arbos.L2MessageKind_Batch && kind != arbos.L2MessageKind_SignedTx {
return nil
}

Expand Down
17 changes: 0 additions & 17 deletions arbos/parse_l2.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ const (
L2MessageKind_Heartbeat = 6 // deprecated
L2MessageKind_SignedCompressedTx = 7
// 8 is reserved for BLS signed batch
L2MessageKind_EspressoSovereignTx = 11
)

// Warning: this does not validate the day of the week or if DST is being observed
Expand Down Expand Up @@ -174,12 +173,6 @@ func parseL2Message(rd io.Reader, poster common.Address, timestamp uint64, reque
return nil, types.ErrTxTypeNotSupported
}
return types.Transactions{newTx}, nil
case L2MessageKind_EspressoSovereignTx:
result, err := parseL2Message(rd, poster, timestamp, requestId, chainId, depth)
if err != nil {
return nil, err
}
return result, nil
case L2MessageKind_Heartbeat:
if timestamp >= HeartbeatsDisabledAt {
return nil, errors.New("heartbeat messages have been disabled")
Expand Down Expand Up @@ -405,16 +398,6 @@ func parseBatchPostingReportMessage(rd io.Reader, chainId *big.Int, msgBatchGasC
}), nil
}

func IsEspressoMsg(msg *arbostypes.L1IncomingMessage) bool {
return msg.Header.Kind == arbostypes.L1MessageType_L2Message &&
msg.L2msg[0] == L2MessageKind_EspressoSovereignTx
}

func IsEspressoSovereignMsg(msg *arbostypes.L1IncomingMessage) bool {
return msg.Header.Kind == arbostypes.L1MessageType_L2Message &&
msg.L2msg[0] == L2MessageKind_EspressoSovereignTx
}

func BuildHotShotPayload(msgs *[]arbostypes.L1IncomingMessage) (espressoTypes.Bytes, int) {
payload := []byte{}
msgCnt := 0
Expand Down
14 changes: 5 additions & 9 deletions execution/gethexec/executionengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,8 @@ func (s *ExecutionEngine) NextDelayedMessageNumber() (uint64, error) {
return currentHeader.Nonce.Uint64(), nil
}

func MessageFromTxes(header *arbostypes.L1IncomingMessageHeader, txes types.Transactions, txErrors []error, espressoSovereignSequencer bool) (*arbostypes.L1IncomingMessage, error) {
func MessageFromTxes(header *arbostypes.L1IncomingMessageHeader, txes types.Transactions, txErrors []error) (*arbostypes.L1IncomingMessage, error) {
var l2Message []byte
if espressoSovereignSequencer {
// Add a specific l2 message kind in front of the bytes.
l2Message = append(l2Message, arbos.L2MessageKind_EspressoSovereignTx)
}

if len(txes) == 1 && txErrors[0] == nil {
txBytes, err := txes[0].MarshalBinary()
Expand Down Expand Up @@ -466,7 +462,7 @@ func (s *ExecutionEngine) resequenceReorgedMessages(messages []*arbostypes.Messa
}
hooks := arbos.NoopSequencingHooks()
hooks.DiscardInvalidTxsEarly = true
_, err = s.sequenceTransactionsWithBlockMutex(msg.Message.Header, txes, hooks, arbos.IsEspressoSovereignMsg(msg.Message))
_, err = s.sequenceTransactionsWithBlockMutex(msg.Message.Header, txes, hooks)
if err != nil {
log.Error("failed to re-sequence old user message removed by reorg", "err", err)
return
Expand Down Expand Up @@ -507,7 +503,7 @@ func (s *ExecutionEngine) sequencerWrapper(sequencerFunc func() (*types.Block, e
func (s *ExecutionEngine) SequenceTransactions(header *arbostypes.L1IncomingMessageHeader, txes types.Transactions, hooks *arbos.SequencingHooks, espressoSovereign bool) (*types.Block, error) {
return s.sequencerWrapper(func() (*types.Block, error) {
hooks.TxErrors = nil
return s.sequenceTransactionsWithBlockMutex(header, txes, hooks, espressoSovereign)
return s.sequenceTransactionsWithBlockMutex(header, txes, hooks)
})
}

Expand Down Expand Up @@ -549,7 +545,7 @@ func writeAndLog(pprof, trace *bytes.Buffer) {
log.Info("Transactions sequencing took longer than 2 seconds, created pprof and trace files", "pprof", pprofFile, "traceFile", traceFile)
}

func (s *ExecutionEngine) sequenceTransactionsWithBlockMutex(header *arbostypes.L1IncomingMessageHeader, txes types.Transactions, hooks *arbos.SequencingHooks, espressoSovereign bool) (*types.Block, error) {
func (s *ExecutionEngine) sequenceTransactionsWithBlockMutex(header *arbostypes.L1IncomingMessageHeader, txes types.Transactions, hooks *arbos.SequencingHooks) (*types.Block, error) {
lastBlockHeader, err := s.getCurrentHeader()
if err != nil {
return nil, err
Expand Down Expand Up @@ -597,7 +593,7 @@ func (s *ExecutionEngine) sequenceTransactionsWithBlockMutex(header *arbostypes.
return nil, nil
}

msg, err := MessageFromTxes(header, txes, hooks.TxErrors, espressoSovereign)
msg, err := MessageFromTxes(header, txes, hooks.TxErrors)
if err != nil {
return nil, err
}
Expand Down
1 change: 0 additions & 1 deletion system_tests/seqfeed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ func testBlockHashComparison(t *testing.T, blockHash *common.Hash, mustMismatch
&l1IncomingMsgHeader,
types.Transactions{tx},
[]error{nil},
false,
)
Require(t, err)

Expand Down

0 comments on commit c9270e4

Please sign in to comment.