Skip to content

Assert usei supply as deltas in mint and gov integration tests - #4134

Merged
masih merged 4 commits into
mainfrom
masih/plt-1223-delta-supply-assertions
Sep 10, 2026
Merged

Assert usei supply as deltas in mint and gov integration tests#4134
masih merged 4 commits into
mainfrom
masih/plt-1223-delta-supply-assertions

Conversation

@masih

@masih masih commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

mint_test.yaml and gov_proposal_test.yaml asserted the absolute usei total supply (5000000000333333333333, genesis plus exactly one scheduled mint), and the mint suite also pinned single-mint minter state (REMAINING == 666666666666, START_DATE == LAST_MINT_DATE, LAST_MINT_HEIGHT == 0). The localnet genesis carries a 3-day release schedule and x/mint mints again on the first block after a UTC date change, so any cluster that lives across midnight failed both suites, and packing suites into shared rows (#4133) widens that window since the assertions can now run several minutes after boot.

The mint suite now derives MINTS_SO_FAR = (total - remaining) / last_mint and checks the minter state and total supply against that (1..3 mints, each 333333333333, remaining and supply consistent with the count, last mint date inside the schedule), so it holds on any day of the schedule. The gov burn case checks before - after == 20000000 (the two 10M deposits) instead of two absolute values, and the unused NEW_PARAM query in that case is dropped. Both sets of expressions were checked against the yaml runner's left-to-right big-int arithmetic for the one-mint and two-mint cases.

Spun out of the review on #4133.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedSep 10, 2026, 11:33 AM

@masih
masih marked this pull request as ready for review September 10, 2026 11:08
@cursor

cursor Bot commented Sep 10, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
YAML-only integration test assertion changes; no production chain, mint, or gov logic is modified.

Overview
Integration tests no longer pin absolute usei total supply or single-day minter snapshots that break when the localnet crosses UTC midnight or runs late in CI.

Mint suite (mint_test.yaml): Drops fixed REMAINING, LAST_MINT_HEIGHT, and exact supply checks. It now computes MINTS_SO_FAR from minter fields, bounds mint count to the 3-day schedule (1..3), verifies remaining amount against that count, and asserts total supply in a range that accounts for a daily mint landing between bank and minter reads (REMAINING_AFTER_SUPPLY).

Gov burn case (gov_proposal_test.yaml): Records MINTED_BEFORE / MINTED_AFTER from the minter and asserts supply dropped by 20M usei (two 10M deposits) via a delta expression that nets intervening schedule mints. Removes the stray expedited-quorum query and absolute before/after supply equalities.

Reviewed by Cursor Bugbot for commit 602c49f. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.25%. Comparing base (07eb0a0) to head (602c49f).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4134      +/-   ##
==========================================
- Coverage   61.25%   60.25%   -1.00%     
==========================================
  Files        2195     2078     -117     
  Lines      192497   179013   -13484     
==========================================
- Hits       117908   107867   -10041     
+ Misses      63098    60811    -2287     
+ Partials    11491    10335    -1156     
Flag Coverage Δ
sei-db 70.02% <ø> (+0.21%) ⬆️
sei-db-state-db ?

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

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Both assertions are correctly rewritten as deltas and evaluate as intended in the Go yaml runner's left-to-right big.Int arithmetic (cmpExpr/evalArith in integration_test/runner/runner.go), and the 20000000 gov figure matches the two 10000000usei deposits (proposal JSON + explicit deposit tx). The change is a strict improvement; the only notes are a residual (much smaller) timing window and the mint suite's unchanged sibling assertions, which still break the stated midnight goal.

Findings: 0 blocking | 3 non-blocking | 0 posted inline

Blockers

  • None at the file/PR level.

Non-blocking

  • [suggestion] Both new expressions still assume no mint lands between the two queries they compare. In mint_test.yaml the minter is read (lines 12-15) before TOTAL_SUPPLY (line 23), and in gov_proposal_test.yaml the burn delta spans the whole proposal case; a mint at the UTC date change inside that window makes TOTAL_SUPPLY exceed genesis + total - remaining, or the burn delta read as 20000000 - minted. The window shrinks from unbounded to seconds/minutes, so this is far better than before — worth a follow-up (e.g. re-read the minter after the supply query and tolerate the difference) rather than a change here.
  • 2 non-blocking pre-existing issue(s) listed below under pre-existing issues.

Pre-existing issues

  • [suggestion] integration_test/mint_module/mint_test.yaml:30-39 (unchanged by this PR) still pins single-mint state: START_DATE == LAST_MINT_DATE, REMAINING_MINT_AMOUNT == 666666666666, LAST_MINT_AMOUNT == 333333333333, LAST_MINT_HEIGHT == 0. After a second daily mint RecordSuccessfulMint sets remaining to 333333333333 and LAST_MINT_DATE past START_DATE, so the suite still fails on a cluster that lives across midnight even though the new supply formula holds — the PR's stated midnight goal is only partially reached for this file.
  • [suggestion] integration_test/gov_module/gov_proposal_test.yaml:139-140 captures NEW_PARAM (expedited_quorum after the rejected proposal) but no verifier in that case consumes it; the query is dead weight.

@masih

masih commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator Author

@seidroid review

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Both suites are correctly converted from absolute supply figures to schedule-derived/delta assertions: the new expressions parse and evaluate as intended under the Go runner's tokenize-substitute-then-left-to-right big.Int arithmetic, the 20000000 gov delta matches the two 10000000usei deposits, and the mint math checks out against getReleaseAmountToday (999999999999 over a 3-day schedule releases exactly 333333333333 on each of days 0-2). Two residual timing/assumption windows remain, both strictly narrower than the behaviour they replace.

Findings: 0 blocking | 2 non-blocking | 2 posted inline

Blockers

  • None at the file/PR level.

Non-blocking

  • None at the file/PR level.
  • 2 suggestion(s)/nit(s) flagged inline on specific lines.

Comment thread integration_test/gov_module/gov_proposal_test.yaml Outdated
Comment thread integration_test/mint_module/mint_test.yaml
@masih

masih commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator Author

@seidroid review

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Both suites are correctly converted from absolute supply figures to schedule-derived and delta assertions; the expressions parse and evaluate as intended under the Go runner's big.Int arithmetic, the 3-day schedule math checks out against getReleaseAmountToday, and the 20000000 gov delta matches the two deposits. One residual single-query mint window remains in the gov assertion, where the mint suite got an airtight bracket.

Findings: 0 blocking | 1 non-blocking | 1 posted inline

Blockers

  • None at the file/PR level.

Non-blocking

  • None at the file/PR level.
  • 1 suggestion(s)/nit(s) flagged inline on specific lines.

# Get the current tally params
- cmd: seid q bank total --denom usei --output json | jq -r .amount
env: TOTAL_SUPPLY_BEFORE_BURN
- cmd: seid q mint minter --output json | jq -r '(.total_mint_amount|tonumber) - (.remaining_mint_amount|tonumber)'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[suggestion] Each minter read happens after its paired supply read, so the two snapshots can straddle a mint. If a mint lands between line 122 and this line, MINTED_BEFORE includes it but TOTAL_SUPPLY_BEFORE_BURN doesn't, and MINTED_AFTER - MINTED_BEFORE undercounts the window's minting by 333333333333 — the expression evaluates to burn - 333333333333. A mint between lines 140 and 142 skews it the other way, to burn + 333333333333.

This is far narrower than the whole-lifecycle window the previous revision had (it's now the gap between two adjacent docker exec queries), so it's a note rather than a blocker. Two ways to close it:

  • Pin both reads of each snapshot to the same height (--height $H on seid q bank total and seid q mint minter, with H from a preceding seid status), which makes the equality exact by construction; or
  • Mirror what mint_test.yaml now does and bracket it: read MINTED_BEFORE before the before-supply query and keep MINTED_AFTER after the after-supply query, which makes the expression provably >= 20000000, then add a second pair for the upper bound.

The first is cheaper and keeps the single exact assertion.

@masih
masih requested a review from kollegian September 10, 2026 11:40
@masih
masih enabled auto-merge September 10, 2026 11:47
@masih
masih added this pull request to the merge queue Sep 10, 2026
Merged via the queue into main with commit 308be4d Sep 10, 2026
80 checks passed
@masih
masih deleted the masih/plt-1223-delta-supply-assertions branch September 10, 2026 12:25
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