Skip to content

Commit

Permalink
Remove espresso sequencer (#214)
Browse files Browse the repository at this point in the history
* Remove espresso sequencer

* lint

* remove enable espresso

* commit go-ethereum

* fix solgen/gen.go

* fix build

* revert .gitmodules

* revert go.mod

* add enable espresso to validation check

* re-add enable espresso to tests

---------

Co-authored-by: Mathis <[email protected]>
  • Loading branch information
Sneh1999 and sveitser committed Sep 5, 2024
1 parent 715491f commit 8df6661
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 662 deletions.
44 changes: 3 additions & 41 deletions arbos/block_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package arbos

import (
"bytes"
"encoding/binary"
"errors"
"fmt"
Expand All @@ -17,7 +16,6 @@ import (
"github.com/offchainlabs/nitro/arbos/util"
"github.com/offchainlabs/nitro/util/arbmath"

espressoTypes "github.com/EspressoSystems/espresso-sequencer-go/types"
"github.com/ethereum/go-ethereum/arbitrum_types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
Expand Down Expand Up @@ -72,7 +70,7 @@ func (info *L1Info) L1BlockNumber() uint64 {
return info.l1BlockNumber
}

func createNewHeader(prevHeader *types.Header, l1info *L1Info, state *arbosState.ArbosState, chainConfig *params.ChainConfig, espressoHeader *espressoTypes.Header) *types.Header {
func createNewHeader(prevHeader *types.Header, l1info *L1Info, state *arbosState.ArbosState, chainConfig *params.ChainConfig) *types.Header {
l2Pricing := state.L2PricingState()
baseFee, err := l2Pricing.BaseFeeWei()
state.Restrict(err)
Expand All @@ -95,13 +93,6 @@ func createNewHeader(prevHeader *types.Header, l1info *L1Info, state *arbosState
}
copy(extra, prevHeader.Extra)
mixDigest = prevHeader.MixDigest

if chainConfig.ArbitrumChainParams.EnableEspresso {
if espressoHeader != nil {
// Store the hotshot height temporarily
binary.BigEndian.PutUint64(mixDigest[24:32], espressoHeader.Height)
}
}
}
header := &types.Header{
ParentHash: lastBlockHash,
Expand Down Expand Up @@ -180,22 +171,10 @@ func ProduceBlock(
txes = types.Transactions{}
}

var espressoHeader *espressoTypes.Header
if chainConfig.ArbitrumChainParams.EnableEspresso {
if IsEspressoMsg(message) && !IsEspressoSovereignMsg(message) {
// creating a block with espresso message
_, jst, err := ParseEspressoMsg(message)
if err != nil {
return nil, nil, err
}
espressoHeader = jst.Header
}
}

hooks := NoopSequencingHooks()

return ProduceBlockAdvanced(
message.Header, txes, delayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, hooks, espressoHeader, isMsgForPrefetch,
message.Header, txes, delayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, hooks, isMsgForPrefetch,
)
}

Expand All @@ -209,7 +188,6 @@ func ProduceBlockAdvanced(
chainContext core.ChainContext,
chainConfig *params.ChainConfig,
sequencingHooks *SequencingHooks,
espressoHeader *espressoTypes.Header,
isMsgForPrefetch bool,
) (*types.Block, types.Receipts, error) {

Expand All @@ -230,7 +208,7 @@ func ProduceBlockAdvanced(
l1Timestamp: l1Header.Timestamp,
}

header := createNewHeader(lastBlockHeader, l1Info, state, chainConfig, espressoHeader)
header := createNewHeader(lastBlockHeader, l1Info, state, chainConfig)
signer := types.MakeSigner(chainConfig, header.Number, header.Time)
// Note: blockGasLeft will diverge from the actual gas left during execution in the event of invalid txs,
// but it's only used as block-local representation limiting the amount of work done in a block.
Expand Down Expand Up @@ -313,22 +291,6 @@ func ProduceBlockAdvanced(
return nil, nil, err
}

if chainConfig.ArbitrumChainParams.EnableEspresso {
calldata := tx.Data()
calldataLen := len(calldata)
if calldataLen >= 52 {
extraData := calldata[calldataLen-52:]
var magicBytes [32]byte
copy(magicBytes[:], extraData[:32])
if magicBytes == espressoTypes.GetMagicBytes() {
builderAddr := espressoHeader.FeeInfo.Account.Bytes()
if !bytes.Equal(builderAddr, extraData[32:]) {
return nil, nil, fmt.Errorf(NOT_EXPECTED_BUILDER_ERROR)
}
}
}
}

if basefee.Sign() > 0 {
dataGas = math.MaxUint64
brotliCompressionLevel, err := state.BrotliCompressionLevel()
Expand Down
46 changes: 0 additions & 46 deletions cmd/replay/espresso_validation.go

This file was deleted.

8 changes: 2 additions & 6 deletions cmd/replay/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ func main() {
return wavmio.ReadInboxMessage(batchNum), nil
}

// Handle the various pre-conditions and panics that can happen before we should enter the espresso logic in the validators STF
validatingAgainstEspresso, panicHandler := handleEspressoPreConditions(message, chainConfig.ArbitrumChainParams.EnableEspresso)
// Handle the various pre-conditions if the message is an Espresso message
validatingAgainstEspresso := chainConfig.ArbitrumChainParams.EnableEspresso && arbos.IsEspressoMsg(message.Message)
if validatingAgainstEspresso {
txs, jst, err := arbos.ParseEspressoMsg(message.Message)
if err != nil {
Expand Down Expand Up @@ -323,11 +323,7 @@ func main() {
espressocrypto.VerifyNamespace(chainConfig.ChainID.Uint64(), *jst.Proof, *jst.Header.PayloadCommitment, *jst.Header.NsTable, txs, *jst.VidCommon)
}

} else if panicHandler != nil {
// Call the error case closure returned by handleEspressoPreconditions() if it isn't nil
panicHandler()
}

newBlock, _, err = arbos.ProduceBlock(message.Message, message.DelayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, batchFetcher, false)
if err != nil {
panic(err)
Expand Down
151 changes: 0 additions & 151 deletions execution/gethexec/espresso_sequencer.go

This file was deleted.

Loading

0 comments on commit 8df6661

Please sign in to comment.