Skip to content

fix(giga): fall back to v2 on execution errors#3768

Draft
philipsu522 wants to merge 2 commits into
mainfrom
cursor/giga-execution-error-fallback-56d1
Draft

fix(giga): fall back to v2 on execution errors#3768
philipsu522 wants to merge 2 commits into
mainfrom
cursor/giga-execution-error-fallback-56d1

Conversation

@philipsu522

@philipsu522 philipsu522 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Describe your changes and provide context

This fixes a live RPC-level divergence, not only a defensive edge case. On main, the parity test reaches matching consensus fields but fails receipt parity: Giga stamps TxType=2 and gasUsed=gasLimit, while V2 writes an EndBlock synthetic receipt with zero values. Mixed Giga/V2 fleets can therefore return different receipts for the same transaction.

State-transition errors now route through the existing V2 fallback instead of duplicating V2's fee, nonce, receipt, deferred-info, and ABCI result handling. This adds an execution_failed abort sentinel and fallback metric reason. Because the Giga StateDB has not been finalized when ExecuteTransactionFeeCharged returns an error, its transaction-local cache is discarded before V2 re-runs the transaction. Both sequential and OCC Giga paths use the existing fallback plumbing.

The EIP-7623 floor-data-gas parity test covers deterministic ABCI fields, LastResultsHash, nonce, receipt, sender balance, fee-collector balance, and per-transaction coinbase balance in sequential and OCC modes.

Operational tradeoff: this creates the first deterministic single-transaction trigger that passes CheckTx at roughly 27.5k gas but reverts an entire OCC batch to V2. Operators should alert on app_giga_fallback_to_v2{reason="execution_failed"}; per-transaction OCC fallback should be tracked as follow-up work.

Testing performed to validate your change

  • go test ./giga/tests -run '^TestGiga_FailedExecutionFallsBackToV2$' -count=1
  • go test ./giga/tests -count=1
  • go test ./app -run 'TestGiga|TestOCC|TestProcess' -count=1
  • gofmt -s and goimports on all changed Go files

Slack Thread

Open in Web Open in Cursor 

Co-authored-by: Philip Su <philip.su.522@gmail.com>
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJul 16, 2026, 3:15 PM

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.02%. Comparing base (703e48d) to head (6ab6c68).

Files with missing lines Patch % Lines
giga/executor/utils/errors.go 50.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3768      +/-   ##
==========================================
- Coverage   59.92%   59.02%   -0.91%     
==========================================
  Files        2288     2201      -87     
  Lines      190180   180310    -9870     
==========================================
- Hits       113971   106419    -7552     
+ Misses      66049    64534    -1515     
+ Partials    10160     9357     -803     
Flag Coverage Δ
sei-chain-pr 59.93% <71.42%> (?)
sei-db 70.41% <ø> (-0.22%) ⬇️
sei-db-state-db ?

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

Files with missing lines Coverage Δ
app/app.go 71.52% <100.00%> (+0.35%) ⬆️
giga/executor/utils/errors.go 50.00% <50.00%> (ø)

... and 88 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.

@bdchatham bdchatham left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a live bugfix, not just defense: the new test fails on main at receipt parity (giga stamps TxType=2, gasUsed=gasLimit; v2 writes the EndBlock synthetic receipt with zeros) while consensus fields match. State the red-proof in the description so the severity (RPC-level receipt divergence on mixed fleets) is on record.

Comment thread giga/tests/giga_test.go Outdated
Comment thread app/app.go Outdated
Comment thread app/app.go
Co-authored-by: FromTheRain <bdchatham@users.noreply.github.com>
@bdchatham

Copy link
Copy Markdown
Contributor

Live mixed-fleet validation on harbor

Validated this PR end-to-end on an ephemeral harbor chain: 4 validators + one v2 RPC node (giga_executor.enabled=false, occ_enabled=false) on nightly-20260715-65411b1 (= #3753 merge, pre-this-PR), plus one giga+OCC RPC node swapped between the pre-fix image and sei/sei-chain:pr3768-6ab6c68 (built from head 6ab6c68 via ecr.yml workflow_dispatch).

Probe: EIP-7623 floor-data-gas tx (1000 zero calldata bytes, gasLimit 27500 — clears the ante's intrinsic check, fails inside geth's Execute()), exercised via qa-testing's tests/chain_tests/floorDataGas.spec.ts (sei-protocol/qa-testing#143/#145).

Pre-fix giga node — divergence reproduced. Same tx hash, eth_getTransactionReceipt on both nodes:

field giga (pre-fix) v2
gasUsed 0x6b6c (gas limit) 0x0
cumulativeGasUsed 0x6b6c 0x0
effectiveGasPrice 0x165a0bc00 0x0
status / type 0x0 / 0x2 0x0 / 0x2

Consensus held throughout (nonce, sender balance, and fee charge matched v2 on both executors) — receipt-only divergence, invisible to the AppHash/LastResultsHash gate, per the RCA.

This PR's image — fixed. Giga node on pr3768-6ab6c68, peered against unfixed validators and the unfixed v2 node:

  • qa-testing floor-data-gas spec: 4/4 passing (was 3/4, failing on exactly gasUsed 27500 vs 0)
  • Fresh same-tx cross-node diff: receipts byte-identical{status: 0x0, gasUsed: 0x0, cumulativeGasUsed: 0x0, type: 0x2, effectiveGasPrice: 0x0}
  • Fallback observable on the node's metrics: sei_chain_app_giga_fallback_to_v2_total{reason="execution_failed", scope="batch"} 2 — one per probe tx, scope="batch" as expected under OCC
  • Node synced ~4,300 blocks produced under the old image and stayed in consensus with the unfixed fleet

The qa-testing spec now guards this class continuously: it locks the canonical v2 receipt shape at the RPC surface, so a regression on any executor fails it regardless of which node serves the query.

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