Skip to content

perf: cache block-level constants in executeEVMTxWithGigaExecutor#2899

Merged
pdrobnjak merged 3 commits intomainfrom
pd/giga-block-cache-v2
Feb 27, 2026
Merged

perf: cache block-level constants in executeEVMTxWithGigaExecutor#2899
pdrobnjak merged 3 commits 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 27, 2026, 3:41 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 65.00000% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.71%. Comparing base (7cfe94a) to head (25d74fc).
⚠️ Report is 1 commits behind head on main.

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

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2899      +/-   ##
==========================================
- Coverage   58.12%   52.71%   -5.41%     
==========================================
  Files        2111     2049      -62     
  Lines      173544   163882    -9662     
==========================================
- Hits       100879    86397   -14482     
- Misses      63706    69286    +5580     
+ Partials     8959     8199     -760     
Flag Coverage Δ
sei-chain-pr 49.40% <0.00%> (?)
sei-db 69.50% <ø> (ø)

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

Files with missing lines Coverage Δ
app/app.go 69.91% <65.00%> (-1.54%) ⬇️

... and 606 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>
pdrobnjak and others added 2 commits February 27, 2026 15:25
Resolve conflicts in app/app.go: incorporate main's gas pre-charge
logic and ExecuteTransactionFeeCharged API while preserving branch's
cache.baseFee usage for the execution call.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pdrobnjak pdrobnjak enabled auto-merge (squash) February 27, 2026 15:55
@pdrobnjak pdrobnjak merged commit ad9312c into main Feb 27, 2026
39 checks passed
@pdrobnjak pdrobnjak deleted the pd/giga-block-cache-v2 branch February 27, 2026 15:57
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.

3 participants