diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 47c3013398fe..d198d152cd40 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -56,10 +56,31 @@ jobs: path: e2e - run: cd e2e && yarn install - - run: | + - name: Run single node e2e + run: | cd e2e GETH=`pwd`/../build/bin/geth ./run.sh & sleep 15 yarn run demo-simple + yarn run e2e-reverting-bundles yarn run demo-contract + pkill -9 geth || true + - name: Run private tx with two nodes + run: | + cd e2e + GETH=`pwd`/../build/bin/geth ./run.sh & + # Second node, not mining + P2P_PORT=30302 DATADIR=datadir2 HTTP_PORT=8546 MINER_ARGS='--nodiscover' GETH=`pwd`/../build/bin/geth ./run.sh & + sleep 15 + DATADIR1=datadir DATADIR2=datadir2 GETH=`pwd`/../build/bin/geth ./peer_nodes.sh + sleep 15 yarn run demo-private-tx + pkill -9 geth || true + - name: Run megabundle-only node checking for reverts + run: | + cd e2e + # Disable bundle workers + MINER_ARGS='--miner.etherbase=0xd912aecb07e9f4e1ea8e6b4779e7fb6aa1c3e4d8 --miner.trustedrelays=0xfb11e78C4DaFec86237c2862441817701fdf197F --mine --miner.threads=2 --miner.maxmergedbundles=0' GETH=`pwd`/../build/bin/geth ./run.sh & + sleep 15 + yarn run e2e-reverting-megabundle + pkill -9 geth || true diff --git a/miner/worker.go b/miner/worker.go index e4b4ba407ab3..6db4470904c2 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -945,8 +945,7 @@ func (w *worker) commitBundle(env *environment, txs types.Transactions, interrup // (1) new head block event arrival, the interrupt signal is 1 // (2) worker start or restart, the interrupt signal is 1 // (3) worker recreate the sealing block with any newly arrived transactions, the interrupt signal is 2. - // For the first two cases, the semi-finished work will be discarded. - // For the third case, the semi-finished work will be submitted to the consensus engine. + // Discard the interrupted work, since it is incomplete and contains partial bundles if interrupt != nil && atomic.LoadInt32(interrupt) != commitInterruptNone { // Notify resubmit loop to increase resubmitting interval due to too frequent commits. if atomic.LoadInt32(interrupt) == commitInterruptResubmit { @@ -961,10 +960,11 @@ func (w *worker) commitBundle(env *environment, txs types.Transactions, interrup } return errBundleInterrupted } - // If we don't have enough gas for any further transactions then we're done + // If we don't have enough gas for any further transactions discard the block + // since not all bundles of the were applied if env.gasPool.Gas() < params.TxGas { log.Trace("Not enough gas for further transactions", "have", env.gasPool, "want", params.TxGas) - break + return errCouldNotApplyTransaction } // Error may be ignored here. The error has already been checked @@ -1545,11 +1545,11 @@ func (w *worker) simulateBundles(env *environment, bundles []types.MevBundle, pe simulatedBundles := []simulatedBundle{} for _, bundle := range bundles { - state := env.state.Copy() - gasPool := new(core.GasPool).AddGas(env.header.GasLimit) if len(bundle.Txs) == 0 { continue } + state := env.state.Copy() + gasPool := new(core.GasPool).AddGas(env.header.GasLimit) simmed, err := w.computeBundleGas(env, bundle, state, gasPool, pendingTxs, 0) if err != nil {