Skip to content

Use DBImpl for giga mock balance validation#3750

Draft
codchen wants to merge 1 commit into
mainfrom
codex/giga-mock-balances-dbimpl
Draft

Use DBImpl for giga mock balance validation#3750
codchen wants to merge 1 commit into
mainfrom
codex/giga-mock-balances-dbimpl

Conversation

@codchen

@codchen codchen commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Routes giga executor balance validation through the giga EVM DBImpl so mock_balances builds can top off accounts through the existing ensureSufficientBalance hook before validation rejects the tx.

Root Cause

validateGigaEVMTx was checking balances with GigaEvmKeeper.GetBalance, bypassing DBImpl. The actual debit path already used DBImpl, so mock balance support worked for execution but not for manual validation prechecks.

Changes

  • Create the giga DBImpl before validation and pass it into validateGigaEVMTx.
  • Add a DBImpl.EnsureSufficientBalance wrapper for validation-time affordability checks.
  • Use DB-backed GetBalance during validation, including the unassociated-address balance case.
  • Add a mock_balances regression test covering a large unfunded giga transfer.

Validation

  • go test ./giga/deps/xevm/state -run TestSubBalance -count=1
  • go test ./giga/tests -run TestGigaValidation_InsufficientBalance -count=1
  • go test -tags mock_balances ./giga/tests -run TestGigaMockBalancesValidationUsesDBImpl -count=1

@github-actions

Copy link
Copy Markdown

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJul 13, 2026, 4:02 PM

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.00%. Comparing base (79b12b9) to head (d11034c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
giga/deps/xevm/state/balance.go 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3750      +/-   ##
==========================================
- Coverage   59.91%   59.00%   -0.92%     
==========================================
  Files        2288     2201      -87     
  Lines      189782   179957    -9825     
==========================================
- Hits       113706   106176    -7530     
+ Misses      65942    64448    -1494     
+ Partials    10134     9333     -801     
Flag Coverage Δ
sei-chain-pr 61.29% <85.71%> (?)
sei-db 70.41% <ø> (ø)
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.20% <100.00%> (+0.03%) ⬆️
giga/deps/xevm/state/balance.go 60.21% <50.00%> (-0.46%) ⬇️

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant