From 8182ab0b063d21e7666c994896a798096b09e1c3 Mon Sep 17 00:00:00 2001 From: MariusVanDerWijden Date: Thu, 5 Feb 2026 14:59:06 +0100 Subject: [PATCH] core: clean up parallal state processor --- core/parallel_state_processor.go | 6 ++++++ tests/block_test.go | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/core/parallel_state_processor.go b/core/parallel_state_processor.go index 15e81f09e4..8c840c0f8f 100644 --- a/core/parallel_state_processor.go +++ b/core/parallel_state_processor.go @@ -100,6 +100,12 @@ func (p *ParallelStateProcessor) prepareExecResult(block *types.Block, allStateR allLogs = append(allLogs, result.receipt.Logs...) allReceipts = append(allReceipts, result.receipt) } + // Block gas limit is enforced against usedGas (pre-refund after Amsterdam, post-refund before). + if usedGas > header.GasLimit { + return &ProcessResultWithMetrics{ + ProcessResult: &ProcessResult{Error: fmt.Errorf("gas limit exceeded")}, + } + } // Read requests if Prague is enabled. if p.chainConfig().IsPrague(block.Number(), block.Time()) { diff --git a/tests/block_test.go b/tests/block_test.go index f5953fdd27..8d3343273a 100644 --- a/tests/block_test.go +++ b/tests/block_test.go @@ -126,7 +126,7 @@ func TestBlockchain(t *testing.T) { bt.skipLoad(`.*\.meta/.*`) bt.walk(t, blockTestDir, func(t *testing.T, name string, test *BlockTest) { - execBlockTest(t, bt, test) + execBlockTest(t, bt, test, false) }) // There is also a LegacyTests folder, containing blockchain tests generated // prior to Istanbul. However, they are all derived from GeneralStateTests, @@ -144,7 +144,7 @@ func testExecutionSpecBlocktests(t *testing.T, testDir string) { bt.skipLoad(".*prague/eip7002_el_triggerable_withdrawals/test_system_contract_deployment.json") bt.walk(t, testDir, func(t *testing.T, name string, test *BlockTest) { - execBlockTest(t, bt, test) + execBlockTest(t, bt, test, true) }) } @@ -158,6 +158,8 @@ func TestExecutionSpecBlocktestsBAL(t *testing.T) { testExecutionSpecBlocktests(t, executionSpecBALBlockchainTestDir) } +var failures = 0 + func execBlockTest(t *testing.T, bt *testMatcher, test *BlockTest, buildAndVerifyBAL bool) { // Define all the different flag combinations we should run the tests with, // picking only one for short tests. @@ -175,6 +177,10 @@ func execBlockTest(t *testing.T, bt *testMatcher, test *BlockTest, buildAndVerif for _, snapshot := range snapshotConf { for _, dbscheme := range dbschemeConf { if err := bt.checkFailure(t, test.Run(snapshot, dbscheme, true, buildAndVerifyBAL, nil, nil)); err != nil { + failures++ + if failures > 10 { + panic("adsf") + } t.Errorf("test with config {snapshotter:%v, scheme:%v} failed: %v", snapshot, dbscheme, err) return }