Skip to content

fix(abi): update stale v12.19 ACCOUNTS_RESOLVE_MARKET + ACCOUNTS_CONVERT_RELEASED_PNL specs - #342

Open
Morenikeoa wants to merge 1 commit into
dcccrypto:mainfrom
Morenikeoa:fix/accounts-stale-v12-specs-upstream
Open

fix(abi): update stale v12.19 ACCOUNTS_RESOLVE_MARKET + ACCOUNTS_CONVERT_RELEASED_PNL specs#342
Morenikeoa wants to merge 1 commit into
dcccrypto:mainfrom
Morenikeoa:fix/accounts-stale-v12-specs-upstream

Conversation

@Morenikeoa

Copy link
Copy Markdown

Summary

Both account specs still documented their v12.19 4-account layouts even though their paired encoders were confirmed rewritten for v17:

  • ACCOUNTS_RESOLVE_MARKET still listed [admin(s+w), slab(w), clock, oracle] (src/percolator.rs:9748), but encodeResolveMarket's own doc says "v17 wire: tag(1) only... BREAKING vs v12.x ... the mode byte has been REMOVED" — the spec was never updated to match, unlike every other v17-rewritten spec in this file (each carries an explicit "v17 wire account layout" comment).

  • ACCOUNTS_CONVERT_RELEASED_PNL still listed [user(s+w), slab(w), clock, oracle] (src/percolator.rs:10636), but encodeConvertReleasedPnl's own doc says "BREAKING vs v12.x: userIdx(u16) removed... v17 portfolios are identified by account key alone" and points directly back to this constant ("Accounts: see ACCOUNTS_CONVERT_RELEASED_PNL") — but the spec was never updated to add the account-key-identified portfolio its own paired encoder's doc describes.

Fix (with confidence caveat)

Both fixes are evidence-based inferences, not confirmed v17 wrapper reads (no percolator-prog source is available in this repo to verify directly):

  • ResolveMarket: every one of the 13 other "v17 wire account layout" specs in this file drops clock/oracle as standalone accounts with no exception. The closest structural analog, ACCOUNTS_RESTART_ASSET_ORACLE — also admin-gated, market-level, no-token-movement — is exactly [authority(signer), market(w)]. Inferred as [admin(s+w), market(w)].

  • ConvertReleasedPnl: owner-initiated, moves no real tokens — the exact same category as ACCOUNTS_INIT_USER (InitPortfolio) and ACCOUNTS_CLOSE_ACCOUNT (ClosePortfolio), both confirmed v17-rewritten to the identical 3-account shape [owner(signer,w), market(w), portfolio(w)]. Inferred as the same shape.

Both inferences are flagged explicitly in their code comments and should be verified against an actual v17 handle_resolve_market / handle_convert_released_pnl decode (devnet dry-run or program source) before being relied on in production. Leaving the old, definitely-stale 4-account specs in place was not a safer default — both encoders no longer emit payloads that match what the v12.19 account counts were paired with, so the old specs were already known wrong, just wrong in a less-examined way.

Test plan

  • Added regression tests for both specs asserting no standalone clock/oracle accounts and the new shapes.
  • Confirmed both fail against the prior 4-account specs and pass against this fix.
  • Full suite green: 853 passed, 31 skipped (884 total, +2 new tests).

…ERT_RELEASED_PNL specs

Both account specs still documented their v12.19 4-account layouts
even though their paired encoders were confirmed rewritten for v17:

- ACCOUNTS_RESOLVE_MARKET still listed [admin(s+w), slab(w), clock,
  oracle] (src/percolator.rs:9748), but encodeResolveMarket's own doc
  says "v17 wire: tag(1) only... BREAKING vs v12.x ... the mode byte
  has been REMOVED" — the spec was never updated to match, unlike
  every other v17-rewritten spec in this file (each carries an
  explicit "v17 wire account layout" comment).

- ACCOUNTS_CONVERT_RELEASED_PNL still listed [user(s+w), slab(w),
  clock, oracle] (src/percolator.rs:10636), but
  encodeConvertReleasedPnl's own doc says "BREAKING vs v12.x:
  userIdx(u16) removed... v17 portfolios are identified by account
  key alone" and points directly back to this constant ("Accounts:
  see ACCOUNTS_CONVERT_RELEASED_PNL") — but the spec was never
  updated to add the account-key-identified portfolio its own paired
  encoder's doc describes.

Both fixes are evidence-based inferences, not confirmed v17 wrapper
reads (no percolator-prog source is available in this repo to verify
directly):

- ResolveMarket: every one of the 13 other "v17 wire account layout"
  specs in this file drops clock/oracle as standalone accounts with
  no exception. The closest structural analog,
  ACCOUNTS_RESTART_ASSET_ORACLE — also admin-gated, market-level,
  no-token-movement — is exactly [authority(signer), market(w)].
  Inferred as [admin(s+w), market(w)].

- ConvertReleasedPnl: owner-initiated, moves no real tokens — the
  exact same category as ACCOUNTS_INIT_USER (InitPortfolio) and
  ACCOUNTS_CLOSE_ACCOUNT (ClosePortfolio), both confirmed
  v17-rewritten to the identical 3-account shape [owner(signer,w),
  market(w), portfolio(w)]. Inferred as the same shape.

Both inferences are flagged explicitly in their code comments and
should be verified against an actual v17 handle_resolve_market /
handle_convert_released_pnl decode (devnet dry-run or program source)
before being relied on in production. Leaving the old, definitely-
stale 4-account specs in place was not a safer default — both
encoders no longer emit payloads that match what the v12.19 account
counts were paired with, so the old specs were already known wrong,
just wrong in a less-examined way.

Added regression tests for both asserting no standalone clock/oracle
accounts and the new shapes. Confirmed both fail against the prior
4-account specs and pass against this fix.

Full suite: 853 passed | 31 skipped (882 -> 884, +2 new tests).
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Morenikeoa, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 37 minutes and 41 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7d1f59da-3982-492f-b70a-5873ab380341

📥 Commits

Reviewing files that changed from the base of the PR and between 673bc47 and 8857727.

📒 Files selected for processing (2)
  • src/abi/accounts.ts
  • test/accounts.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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