Skip to content

Comments

perf: suppress dead Cosmos events in giga executor path#2904

Open
pdrobnjak wants to merge 1 commit intopd/giga-block-cache-v2from
pd/perf-suppress-cosmos-events
Open

perf: suppress dead Cosmos events in giga executor path#2904
pdrobnjak wants to merge 1 commit intopd/giga-block-cache-v2from
pd/perf-suppress-cosmos-events

Conversation

@pdrobnjak
Copy link
Contributor

Summary

  • Adds GIGA_SUPPRESS_COSMOS_EVENTS=true env var flag to skip Cosmos-level event emission (coin_spent, coin_received, etc.) during giga executor tx execution
  • Cosmos events in this path are constructed but never consumed: ExecTxResult.Events is never populated, events are not consensus-critical, and deterministicExecTxResult strips them
  • EVM logs (Solidity events) flow through a separate path (tempState.logs → receipts) and are unaffected

Implementation

  1. EventManager.suppressed field — EmitEvent/EmitEvents return immediately (no mutex, no append, no bech32 encoding)
  2. NewSuppressedEventManager() constructor for the suppressed variant
  3. DBImpl.cosmosEventsSuppressedSnapshot() creates suppressed EventManagers
  4. Finalize() skips flushEvents() loop entirely when suppressed

Profile impact (benchmark-compare.sh, 120s)

Mutex contention eliminated: -48.35s (7.6% of total)

  • EventManager.EmitEvents: -48.21s
  • sync.(*Mutex).Unlock: -48.35s

Allocations eliminated: ~1.65 GB

  • Events.AppendEvents: -1,068 MB
  • Events.AppendEvent: -729 MB

TPS was flat in isolation because the bottleneck shifts to Snapshot()CacheMultiStore allocation. The contention and allocation savings will compound once that path is optimized.

Test plan

  • giga/deps/xevm/state tests pass
  • sei-cosmos/types tests pass
  • Verify EVM logs still appear in receipts with flag enabled
  • Run benchmark with GIGA_SUPPRESS_COSMOS_EVENTS=true

🤖 Generated with Claude Code

Cosmos-level events (coin_spent, coin_received, transfer, etc.) emitted
during giga executor tx execution are never consumed: the ExecTxResult
is built without populating the Events field, and events are not
consensus-critical (stripped from deterministicExecTxResult).

EVM logs (Solidity events) flow through a completely separate path
(tempState.logs -> receipts + MsgEVMTransactionResponse) and are
unaffected.

When GIGA_SUPPRESS_COSMOS_EVENTS=true:
- EventManager.EmitEvent/EmitEvents return immediately (no mutex, no
  append, no bech32 encoding in event attributes)
- Snapshot() creates suppressed EventManagers
- Finalize() skips the flushEvents() consolidation loop

This eliminates ~55s of mutex contention per 30s profile window:
- AccAddress.String() bech32 cache mutex: ~27s
- EventManager.EmitEvents RWMutex: ~28s

Also updates benchmark/analysis/ with findings from the AccAddress.String
sync.Map optimization (PR #2902) and this event suppression discovery.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@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, 2:25 PM

@codecov
Copy link

codecov bot commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.38%. Comparing base (fce7d6a) to head (2660165).

❗ There is a different number of reports uploaded between BASE (fce7d6a) and HEAD (2660165). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (fce7d6a) HEAD (2660165)
sei-chain 1 0
Additional details and impacted files

Impacted file tree graph

@@                     Coverage Diff                     @@
##           pd/giga-block-cache-v2    #2904       +/-   ##
===========================================================
- Coverage                   57.22%   48.38%    -8.85%     
===========================================================
  Files                        2093      671     -1422     
  Lines                      171750    50621   -121129     
===========================================================
- Hits                        98285    24491    -73794     
+ Misses                      64687    23984    -40703     
+ Partials                     8778     2146     -6632     
Flag Coverage Δ
sei-chain ?
sei-cosmos 48.19% <ø> (+<0.01%) ⬆️
sei-db 68.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1545 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.

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