Skip to content

perf: cache block-level constants in executeEVMTxWithGigaExecutor#2899

Open
pdrobnjak wants to merge 1 commit intomainfrom
pd/giga-block-cache-v2
Open

perf: cache block-level constants in executeEVMTxWithGigaExecutor#2899
pdrobnjak wants to merge 1 commit intomainfrom
pd/giga-block-cache-v2

Conversation

@pdrobnjak
Copy link
Contributor

@pdrobnjak pdrobnjak commented Feb 17, 2026

Summary

  • Cache block-constant EVM values (ChainID, BlockContext, ChainConfig, BaseFee) once per block, eliminating redundant store reads, Keccak256 hashing, and big.Int allocations per transaction
  • These values are identical for every tx in a block but were recomputed on every call to executeEVMTxWithGigaExecutor
  • Cache is populated in both giga execution paths:
    • ProcessTxsSynchronousGiga — sequential path (non-OCC)
    • ProcessTXsWithOCCGiga — parallel OCC path

Allocation reduction (heap diff, alloc_space)

Function Reduction
GetVMBlockContext -6.17 GB
VersionIndexedStore.UpdateReadSet -2.56 GB
VersionIndexedStore.Get -2.88 GB
Dec.UnmarshalJSON (params) -3.08 GB
json.Unmarshal (params) -2.13 GB
gaskv.NewStore -1.50 GB
Total ~11.3 GB fewer allocs

TPS is roughly flat — the win is in reduced GC pressure from eliminating ~11 GB of redundant allocations per 300s run.

Test plan

  • go build ./app/... compiles cleanly
  • gofmt -s -l app/app.go produces no output
  • Benchmark comparison: both baseline and candidate complete 300s runs
  • Profile diff confirms allocation reductions in target functions
  • CI passes

🤖 Generated with Claude Code

@github-actions
Copy link

github-actions bot commented Feb 17, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedFeb 17, 2026, 1:18 PM

@pdrobnjak pdrobnjak self-assigned this Feb 17, 2026
@pdrobnjak pdrobnjak force-pushed the pd/giga-block-cache-v2 branch 5 times, most recently from 8a8da09 to 2c835ac Compare February 17, 2026 12:59
@pdrobnjak pdrobnjak changed the title perf: cache block-level constants in executeEVMTxWithGigaExecutor perf: cache block-level constants in executeEVMTxWithGigaExecutor Feb 17, 2026
@codecov
Copy link

codecov bot commented Feb 17, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.22%. Comparing base (8fc1d5b) to head (fce7d6a).

Files with missing lines Patch % Lines
app/app.go 66.66% 14 Missing and 6 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2899   +/-   ##
=======================================
  Coverage   57.21%   57.22%           
=======================================
  Files        2093     2093           
  Lines      171755   171750    -5     
=======================================
+ Hits        98276    98285    +9     
+ Misses      64709    64687   -22     
- Partials     8770     8778    +8     
Flag Coverage Δ
sei-chain 52.69% <66.66%> (-0.01%) ⬇️
sei-cosmos 48.18% <ø> (+0.03%) ⬆️
sei-db 68.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
app/app.go 72.97% <66.66%> (+0.22%) ⬆️

... and 29 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Cache ChainID, BlockContext, ChainConfig, and BaseFee once per block
instead of recomputing them for every transaction. These values are
identical for all txs in a block but were previously causing redundant
store reads, Keccak256 hashing, and big.Int allocations on every call.

The cache is constructed as a local variable and passed as a parameter
to executeEVMTxWithGigaExecutor, avoiding any mutable state on App.
Both giga execution paths (synchronous and OCC) are covered.

Co-Authored-By: Claude Opus 4.6 <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

Comments