Skip to content

Commit

Permalink
move espresso logic to arbos, handle nil justifications
Browse files Browse the repository at this point in the history
  • Loading branch information
nomaxg committed Nov 14, 2023
1 parent 00f9ecc commit ca02150
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion arbnode/inbox_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"github.com/ethereum/go-ethereum/log"
flag "github.com/spf13/pflag"

"github.com/offchainlabs/nitro/arbos/espresso"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/espresso"
"github.com/offchainlabs/nitro/util/arbmath"
"github.com/offchainlabs/nitro/util/headerreader"
"github.com/offchainlabs/nitro/util/stopwaiter"
Expand Down
2 changes: 1 addition & 1 deletion arbnode/inbox_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
"github.com/ethereum/go-ethereum/rlp"

"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbos/espresso"
"github.com/offchainlabs/nitro/arbstate"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/broadcaster"
"github.com/offchainlabs/nitro/espresso"
"github.com/offchainlabs/nitro/staker"
"github.com/offchainlabs/nitro/util/containers"
)
Expand Down
16 changes: 8 additions & 8 deletions arbos/arbostypes/incomingmessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/params"

"github.com/offchainlabs/nitro/arbos/espresso"
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/espresso"
"github.com/offchainlabs/nitro/util/arbmath"
)

Expand All @@ -41,13 +41,13 @@ type EspressoBlockJustification struct {
}

type L1IncomingMessageHeader struct {
Kind uint8 `json:"kind"`
Poster common.Address `json:"sender"`
BlockNumber uint64 `json:"blockNumber"`
Timestamp uint64 `json:"timestamp"`
RequestId *common.Hash `json:"requestId" rlp:"nilList"`
L1BaseFee *big.Int `json:"baseFeeL1"`
BlockJustification *EspressoBlockJustification
Kind uint8 `json:"kind"`
Poster common.Address `json:"sender"`
BlockNumber uint64 `json:"blockNumber"`
Timestamp uint64 `json:"timestamp"`
RequestId *common.Hash `json:"requestId" rlp:"nilList"`
L1BaseFee *big.Int `json:"baseFeeL1"`
BlockJustification *EspressoBlockJustification `json:"justification" rlp:"optional"`
}

func (h L1IncomingMessageHeader) SeqNum() (uint64, error) {
Expand Down
2 changes: 1 addition & 1 deletion arbos/block_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (

"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbos/espresso"
"github.com/offchainlabs/nitro/arbos/l2pricing"
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/espresso"
"github.com/offchainlabs/nitro/solgen/go/precompilesgen"
"github.com/offchainlabs/nitro/util/arbmath"

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion cmd/replay/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import (
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbos/burn"
"github.com/offchainlabs/nitro/arbos/espresso"
"github.com/offchainlabs/nitro/arbstate"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/cmd/chaininfo"
"github.com/offchainlabs/nitro/das/dastree"
"github.com/offchainlabs/nitro/espresso"
"github.com/offchainlabs/nitro/gethhook"
"github.com/offchainlabs/nitro/wavmio"
)
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 @@ -8,7 +8,7 @@ import (
"encoding/json"
"time"

"github.com/offchainlabs/nitro/espresso"
"github.com/offchainlabs/nitro/arbos/espresso"
"github.com/offchainlabs/nitro/util/stopwaiter"

"github.com/ethereum/go-ethereum/arbitrum_types"
Expand Down
15 changes: 13 additions & 2 deletions execution/gethexec/executionengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/offchainlabs/nitro/arbos"
"github.com/offchainlabs/nitro/arbos/arbosState"
"github.com/offchainlabs/nitro/arbos/arbostypes"
"github.com/offchainlabs/nitro/arbos/espresso"
"github.com/offchainlabs/nitro/arbos/l1pricing"
"github.com/offchainlabs/nitro/arbutil"
"github.com/offchainlabs/nitro/execution"
Expand Down Expand Up @@ -287,14 +288,19 @@ func (s *ExecutionEngine) sequenceTransactionsWithBlockMutex(header *arbostypes.
}

delayedMessagesRead := lastBlockHeader.Nonce.Uint64()
jst := header.BlockJustification
var hotShotHeader espresso.Header
if jst != nil {
hotShotHeader = jst.Header
}

startTime := time.Now()
block, receipts, err := arbos.ProduceBlockAdvanced(
header,
txes,
delayedMessagesRead,
lastBlockHeader,
&header.BlockJustification.Header,
&hotShotHeader,
statedb,
s.bc,
s.bc.Config(),
Expand Down Expand Up @@ -442,12 +448,17 @@ func (s *ExecutionEngine) createBlockFromNextMessage(msg *arbostypes.MessageWith
}
statedb.StartPrefetcher("TransactionStreamer")
defer statedb.StopPrefetcher()
jst := msg.Message.Header.BlockJustification
var hotShotHeader espresso.Header
if jst != nil {
hotShotHeader = jst.Header
}

block, receipts, err := arbos.ProduceBlock(
msg.Message,
msg.DelayedMessagesRead,
currentHeader,
&msg.Message.Header.BlockJustification.Header,
&hotShotHeader,
statedb,
s.bc,
s.bc.Config(),
Expand Down
2 changes: 1 addition & 1 deletion staker/stateless_block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"sync"
"testing"

"github.com/offchainlabs/nitro/espresso"
"github.com/offchainlabs/nitro/arbos/espresso"
"github.com/offchainlabs/nitro/execution"
"github.com/offchainlabs/nitro/util/rpcclient"
"github.com/offchainlabs/nitro/validator/server_api"
Expand Down

0 comments on commit ca02150

Please sign in to comment.