Skip to content

Fix locked and vested account balances#34

Merged
YoshiyukiSakura merged 2 commits into
crossagentfrom
worktree/task_44bc2b57f9794114
May 25, 2026
Merged

Fix locked and vested account balances#34
YoshiyukiSakura merged 2 commits into
crossagentfrom
worktree/task_44bc2b57f9794114

Conversation

@crossagent-production-app
Copy link
Copy Markdown
Contributor

@crossagent-production-app crossagent-production-app Bot commented May 25, 2026

Addresses #32

Delivery Evidence Summary

Change:

  • Backend account refresh now keeps locked sourced from System.Account.data.frozen / max Balances.Locks amount.
  • Backend vested is now derived from Vesting.Vesting schedules at the indexed current block, instead of reusing the vesting balance lock amount.
  • Initial account backfill reads all Vesting.Vesting entries alongside Balances.Locks so refreshed and backfilled accounts use the same field semantics.
  • The account-page evidence fixture was updated from toy numbers to live-derived comparison values for the account in issue Locked and Vested Balance is not displayed #32.

Why the 3 vs 9.5 screenshot mismatch happened:

  • The previous PR evidence screenshot used mocked fixture values (locked: 3, vested: 2, reserved: 1) and was not a live-data reproduction.
  • Live Heima chain storage for 49VYuGkjdmZprGpb4jU313RdSffxSVHixojzmafdFYGpVYXb shows System.Account.data.frozen = 9505083444444445904195000 and Balances.Locks[vesting].amount = 9505083444444445904195000, which corresponds to the reference locked value around 9.5050.
  • The reference vested value around 18.7120 comes from Vesting.Vesting progress (locked, perBlock, startingBlock) and is a different field from balance-lock locked.

Objective Evidence:

  • Live RPC check against wss://rpc.heima-parachain.heima.network confirmed:
    • system.account(...).data.free = 12064779000000000000000000
    • system.account(...).data.frozen = 9505083444444445904195000
    • balances.locks(...)[0].id = vesting, amount = 9505083444444445904195000
    • vesting.vesting(...)[0].locked = 24102589000000000000000000, perBlock = 5555555555555555000, startingBlock = 6282695
  • go test ./plugins/balance/model ./plugins/balance/dao exited 0.
  • npm test -- --runTestsByPath src/__tests__/utils/text.test.ts --runInBand exited 0.
  • npm run lint -- --file 'src/pages/sub/account/[id].tsx' --file src/utils/api.ts exited 0 with no warnings.
  • E2E_SCREENSHOT=/tmp/account-balance-e2e-rework.png ./node_modules/.bin/playwright test tmp/evidence/account-balance-e2e.spec.js --reporter=line exited 0 and verified Total, Transferrable, Locked, Vested, Reserved, and tab rendering.
  • git diff --check exited 0.

Visual Evidence:

  • Updated account-page E2E screenshot using live-derived comparison values: account-balance-e2e-rework.png
  • Issue visual reference: issue-account-balance-reference

Reviewer:

  • @repo Intake Reviewer requested.

Risks / Not Covered:

  • The live Heima API will show the corrected vested field only after this branch is deployed and account data is refreshed/backfilled.
  • vested is block-height dependent; it will continue to increase according to the vesting schedule until capped by the schedule locked amount.
  • Full production build was not rerun in this rework; previous run hit existing app-wide NextRouter was not mounted prerender errors across unchanged routes. Focused backend tests, frontend lint/Jest, and Playwright E2E passed.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
subscan-essentials Ready Ready Preview, Comment May 25, 2026 5:10am
subscan-essentials-ui-react Ready Ready Preview, Comment May 25, 2026 5:10am

Request Review

@crossagent-production-app
Copy link
Copy Markdown
Contributor Author

crossagent-production-app Bot commented May 25, 2026

Superseded by corrected evidence for the 3 vs 9.5 locked-balance question: #34 (comment)

This earlier evidence comment used mock fixture values and should not be treated as final visual evidence.

@YoshiyukiSakura
Copy link
Copy Markdown
Contributor

image why are these numbers not matching? total balance are both 12 which is good,but to the same account,one locked number is 3,and the other is 9.5?

@YoshiyukiSakura
Copy link
Copy Markdown
Contributor

Operator follow-up instruction: please do not merge this PR until the balance mismatch question is resolved.

The open question is here: #34 (comment)

For the same account, total balance is 12 on both sides, but the locked value appears as 3 in one place and 9.5 in another. Please investigate the source of the mismatch and either:

  1. fix the implementation and publish updated validation evidence, or
  2. explain clearly in this PR why the two locked values are expected to differ, including which field each UI value represents.

Completion standard: PR #34 should not be treated as ready until the 3 vs 9.5 question is answered or fixed with evidence.

@crossagent-production-app
Copy link
Copy Markdown
Contributor Author

Reworked PR #34 for the 3 vs 9.5 balance question.

Resolution:

  • The 3 in the prior evidence screenshot was a mocked fixture value, not the live account's locked value.
  • Live Heima storage for 49VYuGkjdmZprGpb4jU313RdSffxSVHixojzmafdFYGpVYXb has System.Account.data.frozen and Balances.Locks[vesting].amount both at 9505083444444445904195000, which is the reference locked value around 9.5050.
  • The reference vested value around 18.7120 comes from Vesting.Vesting progress, so it is a different field from locked.

Fix pushed in 4a86e4a: locked remains the frozen/max-lock amount, and vested is now computed from vesting schedules at the indexed current block. Updated Playwright evidence is in the PR body.

@crossagent-production-app
Copy link
Copy Markdown
Contributor Author

crossagent-production-app Bot commented May 25, 2026

Delivery Evidence Summary

Change:

  • Backend account refresh keeps locked sourced from System.Account.data.frozen / max Balances.Locks amount.
  • Backend vested is derived from Vesting.Vesting schedules at the indexed current block.
  • Initial account backfill reads Vesting.Vesting entries alongside Balances.Locks, so refreshed and backfilled accounts use the same field semantics.
  • UI default API host is https://explorer-api.heima.network, replacing the old assethub-westend-lite default for this Heima account page.

Objective Evidence:

  • go test ./plugins/balance/model ./plugins/balance/dao exit code 0: balance model and DAO tests passed
  • npm test -- --runTestsByPath src/__tests__/utils/text.test.ts --runInBand exit code 0: frontend text utility test passed
  • npm run lint -- --file 'src/pages/sub/account/[id].tsx' --file src/utils/api.ts exit code 0: account page and API helper lint passed
  • E2E_SCREENSHOT=/tmp/account-balance-e2e-rework.png ./node_modules/.bin/playwright test tmp/evidence/account-balance-e2e.spec.js --reporter=line exit code 0: Playwright verified Total, Transferrable, Locked, Vested, Reserved, and tab rendering
  • npm test -- --runTestsByPath src/__tests__/utils/const.test.ts --runInBand exit code 0: DEFAULT_API_HOST resolves to https://explorer-api.heima.network
  • curl --max-time 20 -sS -X POST https://assethub-westend-lite.webapi.subscan.io/api/plugin/balance/account -H 'content-type: application/json' --data '{"address":"49VYuGkjdmZprGpb4jU313RdSffxSVHixojzmafdFYGpVYXb"}' | jq -c '{code, data}' exit code 0: old assethub-westend-lite endpoint returned code 0 with data null for the issue account
  • curl --max-time 20 -sS -X POST https://explorer-api.heima.network/api/plugin/balance/account -H 'content-type: application/json' --data '{"address":"49VYuGkjdmZprGpb4jU313RdSffxSVHixojzmafdFYGpVYXb"}' | jq -c '{code, data}' exit code 0: Heima endpoint returned code 0 with account balance payload for the issue account
  • git diff --check exit code 0: whitespace check passed on PR head

Visual Evidence:

  • PR 34 account balance E2E evidence
  • Corrected account-page E2E screenshot showing live-derived comparison values with Locked = 9.505083 and Vested = 18.712.

Reviewer:

  • Repo Intake Reviewer review requested.

Risks / Not Covered:

  • Production Heima API currently returns the issue account balance payload with locked and vested still at zero until this branch is deployed and account refresh/backfill runs.
  • Vested is block-height dependent and continues increasing according to the vesting schedule until capped by the schedule locked amount.
  • Focused backend tests, frontend lint/Jest, and Playwright E2E cover this issue path; full-app production build remains outside this evidence package.

Generated at: 2026-05-25T05:45:30.000Z

@YoshiyukiSakura YoshiyukiSakura merged commit 0001cb3 into crossagent May 25, 2026
4 of 5 checks passed
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.

2 participants