From 883b5fde24ac886ce0ca5a7e17a11b6b7f2a796c Mon Sep 17 00:00:00 2001 From: nomaxg Date: Mon, 27 Nov 2023 12:24:13 -0500 Subject: [PATCH 1/2] add block validation logic to produceblock --- arbos/block_processor.go | 50 +++++++++++++-------------- execution/gethexec/executionengine.go | 6 ---- 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/arbos/block_processor.go b/arbos/block_processor.go index ff3baf0f2f..5d0c70f3f1 100644 --- a/arbos/block_processor.go +++ b/arbos/block_processor.go @@ -159,8 +159,32 @@ func ProduceBlock( } hooks := NoopSequencingHooks() + + // Espresso-specific validation + // TODO test: https://github.com/EspressoSystems/espresso-sequencer/issues/772 + if chainConfig.Espresso { + jst := message.Header.BlockJustification + if jst == nil { + return nil, nil, errors.New("batch missing espresso justification") + + } + hotshotHeader := jst.Header + if *lastHotShotCommitment != hotshotHeader.Commit() { + return nil, nil, errors.New("invalid hotshot header") + } + var roots = []*espresso.NmtRoot{&hotshotHeader.TransactionsRoot} + var proofs = []*espresso.NmtProof{&message.Header.BlockJustification.Proof} + // If the validation function below were not mocked, we would need to serialize the transactions + // in the batch here. To avoid the unnecessary overhead, we provide an empty array instead. + var txs []espresso.Bytes + err := espresso.ValidateBatchTransactions(chainConfig.ChainID.Uint64(), roots, proofs, txs) + if err != nil { + return nil, nil, errors.New("failed to validate namespace proof)") + } + } + return ProduceBlockAdvanced( - message.Header, txes, delayedMessagesRead, lastBlockHeader, lastHotShotCommitment, statedb, chainContext, chainConfig, hooks, + message.Header, txes, delayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, hooks, ) } @@ -170,7 +194,6 @@ func ProduceBlockAdvanced( txes types.Transactions, delayedMessagesRead uint64, lastBlockHeader *types.Header, - lastHotShotCommitment *espresso.Commitment, statedb *state.StateDB, chainContext core.ChainContext, chainConfig *params.ChainConfig, @@ -194,29 +217,6 @@ func ProduceBlockAdvanced( l1Timestamp: l1Header.Timestamp, } - // Espresso-specific validation - // TODO test: https://github.com/EspressoSystems/espresso-sequencer/issues/772 - if chainConfig.Espresso { - jst := l1Header.BlockJustification - if jst == nil { - return nil, nil, errors.New("batch missing espresso justification") - - } - hotshotHeader := jst.Header - if *lastHotShotCommitment != hotshotHeader.Commit() { - return nil, nil, errors.New("invalid hotshot header") - } - var roots = []*espresso.NmtRoot{&hotshotHeader.TransactionsRoot} - var proofs = []*espresso.NmtProof{&l1Header.BlockJustification.Proof} - // If the validation function below were not mocked, we would need to serialize the transactions - // in the batch here. To avoid the unnecessary overhead, we provide an empty array instead. - var txs []espresso.Bytes - err := espresso.ValidateBatchTransactions(chainConfig.ChainID.Uint64(), roots, proofs, txs) - if err != nil { - return nil, nil, errors.New("failed to validate namespace proof)") - } - } - 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, diff --git a/execution/gethexec/executionengine.go b/execution/gethexec/executionengine.go index 2794615df4..8a364debb7 100644 --- a/execution/gethexec/executionengine.go +++ b/execution/gethexec/executionengine.go @@ -288,11 +288,6 @@ func (s *ExecutionEngine) sequenceTransactionsWithBlockMutex(header *arbostypes. } delayedMessagesRead := lastBlockHeader.Nonce.Uint64() - jst := header.BlockJustification - var hotShotHeader espresso.Commitment - if jst != nil { - hotShotHeader = jst.Header.Commit() - } startTime := time.Now() block, receipts, err := arbos.ProduceBlockAdvanced( @@ -300,7 +295,6 @@ func (s *ExecutionEngine) sequenceTransactionsWithBlockMutex(header *arbostypes. txes, delayedMessagesRead, lastBlockHeader, - &hotShotHeader, statedb, s.bc, s.bc.Config(), From 1a0a306bb6219eacfdc7c1e18f15837c2401f5c7 Mon Sep 17 00:00:00 2001 From: Mathis Date: Wed, 29 Nov 2023 16:39:09 +0100 Subject: [PATCH 2/2] Run CI on integration branch (#17) * Run CI on integration branch * CI: separate build and test-go-deps steps * CI: set timeout to 20min for challeng tests They often take more than 10 minutes (which is the default). --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f406c6a209..b3718926f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ on: branches: - master - develop + - integration jobs: test: @@ -126,7 +127,10 @@ jobs: run: ./scripts/build-brotli.sh -w -d - name: Build - run: make build test-go-deps -j + run: make build -j + + - name: test-go-deps + run: make --debug test-go-deps - name: Build all lint dependencies run: make -j build-node-deps @@ -169,7 +173,7 @@ jobs: if: matrix.test-mode == 'challenge' run: | packages=`go list ./...` - gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 -- ./... -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,./go-ethereum/... -tags=challengetest -run=TestChallenge + gotestsum --format short-verbose --packages="$packages" --rerun-fails=1 -- -timeout 20m ./... -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,./go-ethereum/... -tags=challengetest -run=TestChallenge - name: Upload coverage to Codecov uses: codecov/codecov-action@v2