Skip to content

core: implement parallel block execution with BAL - #35264

Merged
MariusVanDerWijden merged 1 commit into
ethereum:masterfrom
rjl493456442:parallel-execution
Jul 28, 2026
Merged

MariusVanDerWijden merged 1 commit into
ethereum:masterfrom
rjl493456442:parallel-execution

Conversation

@rjl493456442

@rjl493456442 rjl493456442 commented Jun 30, 2026 •

Copy link
Copy Markdown
Member

This PR implements the parallel block executor, with the execution pre-state
derived from the block-level access list.

Comment thread core/state_processor_parallel.go Resolved
@rjl493456442
rjl493456442 force-pushed the parallel-execution branch 3 times, most recently from bca6fc5 to b67888a Compare July 6, 2026 01:39
@rjl493456442
rjl493456442 force-pushed the parallel-execution branch 4 times, most recently from 014cd9d to a2f3f6c Compare July 21, 2026 04:16
Comment thread core/gaspool.go
Comment on lines +112 to +124
// CumulativeRegular returns the cumulative regular-dimension gas consumed
// (EIP-8037). It is used to derive the block gas used when transactions are
// charged against independent pools during parallel execution.
func (gp *GasPool) CumulativeRegular() uint64 {
return gp.cumulativeRegular
}

// CumulativeState returns the cumulative state-dimension gas consumed
// (EIP-8037). See CumulativeRegular for the rationale.
func (gp *GasPool) CumulativeState() uint64 {
return gp.cumulativeState
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move this together?

cRegular, cState := gp.Cumulative()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have CumulativeUsed. Unifying the regular and state as Cumulative is a bit vague and let's improve the naming of GasPool in a following PR.

Comment thread core/parallel_equiv_test.go Resolved
Comment thread core/state_processor.go Resolved

@MariusVanDerWijden MariusVanDerWijden left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I let some fuzzer run to try to find a diff, but they passed perfectly. Some small nitpicks

@MariusVanDerWijden
MariusVanDerWijden merged commit 454ca78 into ethereum:master Jul 28, 2026
9 checks passed
@MariusVanDerWijden MariusVanDerWijden added this to the 1.17.6 milestone Jul 28, 2026
jimmyc256 pushed a commit to Lambda256/go-ethereum-ralim that referenced this pull request Sep 23, 2026
This PR implements the parallel block executor, with the execution
pre-state
derived from the block-level access list.
simonlechner added a commit to 0xsoniclabs/go-ethereum that referenced this pull request Nov 2, 2026
A hook can be lost in an upstream rebase while the tree still compiles: a
nil-interceptor early return disappears in a conflict resolution, a config
guard is dropped when upstream restructures the surrounding function, a new
return path bypasses a code-size check. Upstream's own test suite cannot catch
any of it, because it runs with a zero-valued vm.Config where every Sonic hook
is inert by design.

Each test in the suite flips one hook and asserts that observable behavior
changes, so an inert hook fails a test. On top of the behavioral tests,
sonic_hook_registry_test.go pins the vm.Config and vm.EVM field sets, asserts
the number of reference sites per hook, and checks that every hook still has a
pinning test and that the make target still selects it.

SONIC_HOOKS.md documents the inventory, the upstream behavior Sonic depends
on, the known limitations, and the rule: after any upstream rebase,
`make test-sonic-hooks` must pass before the branch is mergeable.

Ported to v1.17.5. Four registry entries changed, justified here as the
registry requires:

- vm.EVM gained the upstream field arena (*stackArena), now listed in
  upstreamEvmFields.
- EVM.CheckCodeSize is expected 3 times rather than once, because upstream
  splits the max-code-size check across the EIP-4762, Amsterdam and default
  branches of initNewContract.
- The two StateDB.EmitLogsForBurnAccounts census entries and the tests
  pinning them are dropped. That hook was upstream v1.17.2 behavior Sonic
  depended on rather than a Sonic modification, and upstream removed EIP-7708
  burn logs entirely in EIP-8246 (ethereum#35219), so there is no call site left to
  pin.
- expectedCallInterceptorDispatches carries EVM.create, dispatching to both
  Create and Create2, in place of the EVM.Create and EVM.Create2 rows, because
  the guard now sits in the shared creation frame. The CREATE/CREATE2 opcodes
  reach the interceptor through that frame alone, which
  TestCallInterceptor_CreateOpcodesDispatchToTheInterceptor pins by running
  the two opcode handlers.

Rebased onto v1.17.8. Two more upstream fields are registered:

- vm.Config gained DisableParallelExecution (bool) with parallel block
  execution (ethereum#35264), now listed in upstreamConfigFields.
- vm.EVM gained precompileCache (*PrecompileCache) with precompile result
  caching (ethereum#35388), now listed in upstreamEvmFields.

Rebased onto v1.17.10. Registry changes:

- vm.EVM gained forceTableLoop (bool), the test-only switch upstream's
  differential test uses to run the table loop against the generated
  interpreter (ethereum#35638), now listed in upstreamEvmFields.
- EVM.CheckInitCodeSize is expected 5 times rather than 3, because
  gasCreateEip8037 and gasCreate2Eip8037 now call it as well. The v1.17.5 port
  had left them calling upstream's CheckMaxInitCodeSize, which the census
  could not see.
- Two new census entries allow exactly one call each to upstream's
  CheckMaxCodeSize and CheckMaxInitCodeSize in core and core/vm: the fallback
  in the Sonic wrapper. Since their upstream signatures were restored, a call
  upstream adds compiles and silently checks the protocol limit; these entries
  fail on it instead.
- Config.MaxInitCodeSize is pinned by
  TestCustomCodeSize_CreateGasAllowsCustomMaxInitCodeSize, which replaces the
  EIP-3860-only test and also covers Amsterdam.
- Config.MaxTxGas is expected 3 times rather than 2. Under Amsterdam,
  preCheck applies a configured cap to the whole gas limit as well, and
  reads the field directly to tell a configured cap from the protocol
  default.

TestCallInterceptor_CreateOpcodesDispatchToTheInterceptor takes its stack from
the test EVM, since NewStack became EVM.NewStack.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
simonlechner added a commit to 0xsoniclabs/go-ethereum that referenced this pull request Nov 4, 2026
A hook can be lost in an upstream rebase while the tree still compiles: a
nil-interceptor early return disappears in a conflict resolution, a config
guard is dropped when upstream restructures the surrounding function, a new
return path bypasses a code-size check. Upstream's own test suite cannot catch
any of it, because it runs with a zero-valued vm.Config where every Sonic hook
is inert by design.

Each test in the suite flips one hook and asserts that observable behavior
changes, so an inert hook fails a test. On top of the behavioral tests,
sonic_hook_registry_test.go pins the vm.Config and vm.EVM field sets, asserts
the number of reference sites per hook, and checks that every hook still has a
pinning test and that the make target still selects it.

SONIC_HOOKS.md documents the inventory, the upstream behavior Sonic depends
on, the known limitations, and the rule: after any upstream rebase,
`make test-sonic-hooks` must pass before the branch is mergeable.

Ported to v1.17.5. Four registry entries changed, justified here as the
registry requires:

- vm.EVM gained the upstream field arena (*stackArena), now listed in
  upstreamEvmFields.
- EVM.CheckCodeSize is expected 3 times rather than once, because upstream
  splits the max-code-size check across the EIP-4762, Amsterdam and default
  branches of initNewContract.
- The two StateDB.EmitLogsForBurnAccounts census entries and the tests
  pinning them are dropped. That hook was upstream v1.17.2 behavior Sonic
  depended on rather than a Sonic modification, and upstream removed EIP-7708
  burn logs entirely in EIP-8246 (ethereum#35219), so there is no call site left to
  pin.
- expectedCallInterceptorDispatches carries EVM.create, dispatching to both
  Create and Create2, in place of the EVM.Create and EVM.Create2 rows, because
  the guard now sits in the shared creation frame. The CREATE/CREATE2 opcodes
  reach the interceptor through that frame alone, which
  TestCallInterceptor_CreateOpcodesDispatchToTheInterceptor pins by running
  the two opcode handlers.

Rebased onto v1.17.8. Two more upstream fields are registered:

- vm.Config gained DisableParallelExecution (bool) with parallel block
  execution (ethereum#35264), now listed in upstreamConfigFields.
- vm.EVM gained precompileCache (*PrecompileCache) with precompile result
  caching (ethereum#35388), now listed in upstreamEvmFields.

Rebased onto v1.17.10. Registry changes:

- vm.EVM gained forceTableLoop (bool), the test-only switch upstream's
  differential test uses to run the table loop against the generated
  interpreter (ethereum#35638), now listed in upstreamEvmFields.
- EVM.CheckInitCodeSize is expected 5 times rather than 3, because
  gasCreateEip8037 and gasCreate2Eip8037 now call it as well. The v1.17.5 port
  had left them calling upstream's CheckMaxInitCodeSize, which the census
  could not see.
- Two new census entries allow exactly one call each to upstream's
  CheckMaxCodeSize and CheckMaxInitCodeSize in core and core/vm: the fallback
  in the Sonic wrapper. Since their upstream signatures were restored, a call
  upstream adds compiles and silently checks the protocol limit; these entries
  fail on it instead.
- Config.MaxInitCodeSize is pinned by
  TestCustomCodeSize_CreateGasAllowsCustomMaxInitCodeSize, which replaces the
  EIP-3860-only test and also covers Amsterdam.

TestCallInterceptor_CreateOpcodesDispatchToTheInterceptor takes its stack from
the test EVM, since NewStack became EVM.NewStack.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants