feat(#375): sdk_parity_fixtures for the wrapper — 12 live tags the spec never had - #460
Merged
Conversation
… check the wrapper
The Parity Gate's `percolator-prog` target has failed with `cargo run failed` on
every run since at least 2026-08-23, for two reasons stacked: this binary did not
exist, and the job never checked out the `percolator` engine that this crate
compiles through `path = "../percolator"`. ABI drift in the wrapper had no
automated detection at all. (The workflow half of that is in percolator-sdk.)
WHAT THE GATE FINDS THE MOMENT IT CAN RUN
`percolator-sdk/specs/wrapper-tags.json` is missing twelve live instructions —
tags 81 through 92:
CancelRedemption(81) UnwrapEscrowedPortfolio(82)
InitMatcherCtx(83) WithdrawProtocolFee(84)
SetProtocolFeeAuthority(85) UpdateFeeSplit(86)
WithdrawInsuranceReserveToStake(87) UpdateMaintenanceFeePerSlot(88)
ExpireBackingBucket(89) WithdrawCreatorFee(90)
RebalanceLpVaultBacking(91) UpdateInsuranceWithdrawPolicy(92)
Seven of those move money. `IX_TAG` already carried 83-92, so the SDK could encode
them; CancelRedemption(81) and UnwrapEscrowedPortfolio(82) were genuinely absent
from the SDK, and tags 81/82 were annotated there as "Not in v17" — false.
Everything else already agreed: the gaps list comes back identical, and there are
no name mismatches and no phantom tags.
WHY THIS PROBES `decode` INSTEAD OF READING THE SOURCE
The obvious implementation parses the `match tag` arms. Do not. Writing this, a
regex over `N => Self::Variant` reported 69 tags and concluded BatchTradeNoCpi(66),
BatchTradeCpi(67) and InitMatcherCtx(83) did not exist — that the SDK had invented
two of them. All three exist; they are dispatched in block form (`66 => { ... }`),
which the pattern silently skipped. A parser that is wrong about the dispatcher
produces a spec that is confidently wrong, which is worse than no gate.
Probing `Instruction::decode` cannot make that mistake — the answer comes from the
code path the runtime uses. A first draft then capped the probe at 200 bytes and
reported tag 0 as unallocated, because InitMarket's body is 218; there is now a
canary asserting tag 0 decodes, so that failure cannot ship quietly either.
FOUR NAMES ARE DELIBERATELY THE SDK'S
tags 3/4/5/8 emit DepositCollateral, WithdrawCollateral, KeeperCrank and
CloseAccount. Those are not drift: they have never appeared in this crate at any
commit, they are declared aliases in the SDK, and `test/parity-fixtures.test.ts`
keys on them. Renaming four entries of the SDK's public surface would fix nothing —
this gate exists to catch a tag being renumbered or an instruction
appearing/disappearing, and the tag binding is discovered by probing.
VERIFIED: the deployed artifact is untouched. `cargo build-sbf --features devnet`
produces a byte-identical percolator_prog.so with and without this file
(9a310e28...42fb both ways, checked with the file genuinely absent).
Upstream aeyakovenko/percolator-prog has no src/bin at all — nothing to coordinate.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NgoNgagkvw7i5SSRC3FJ8D
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 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. Comment |
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NgoNgagkvw7i5SSRC3FJ8D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 2 of 3 for #375. The
percolator-progtarget of the Parity Gate has failed withcargo run failedon every run since at least 2026-08-23, for two stacked reasons: this binary did not exist, and the job never checked out thepercolatorengine that this crate compiles throughpath = "../percolator". The workflow half is in the percolator-sdk PR.What the gate finds the moment it can run
percolator-sdk/specs/wrapper-tags.jsonis missing twelve live instructions, tags 81–92:CancelRedemptionWithdrawInsuranceReserveToStakeUnwrapEscrowedPortfolioUpdateMaintenanceFeePerSlotInitMatcherCtxExpireBackingBucketWithdrawProtocolFeeWithdrawCreatorFeeSetProtocolFeeAuthorityRebalanceLpVaultBackingUpdateFeeSplitUpdateInsuranceWithdrawPolicySeven of those move money.
IX_TAGalready carried 83–92 so the SDK could encode them;CancelRedemption(81) andUnwrapEscrowedPortfolio(82) were genuinely absent from the SDK, and tags 81/82 were annotated there as "Not in v17" — false.Everything else already agreed: the gaps list comes back identical, with no name mismatches and no phantom tags.
Why this probes
decodeinstead of reading the sourceThe obvious implementation parses the
match tagarms. Do not.Writing this, a regex over
N => Self::Variantreported 69 tags and concluded thatBatchTradeNoCpi(66),BatchTradeCpi(67) andInitMatcherCtx(83) did not exist — that the SDK had invented two of them. All three exist. They are dispatched in block form (66 => { ... }), which the pattern silently skipped. A parser that is wrong about the dispatcher produces a spec that is confidently wrong, which is worse than no gate at all.Probing
Instruction::decodecannot make that mistake — the answer comes from the code path the runtime uses.A first draft then capped the probe at 200 bytes and reported tag 0 as unallocated, because
InitMarket's body is 218. There is now a canary asserting tag 0 decodes, so that failure cannot ship quietly either.Four names are deliberately the SDK's
Tags 3/4/5/8 emit
DepositCollateral,WithdrawCollateral,KeeperCrank,CloseAccount. Not drift: none has appeared in this crate at any commit, they are declared aliases in the SDK (@alias DepositCollateral @since v12.x alias), andtest/parity-fixtures.test.tskeys on them. Renaming four entries of the SDK's public surface would fix nothing — this gate catches a tag being renumbered or an instruction appearing/disappearing, and the tag binding is discovered by probing either way. Renaming a variant in the program still breaks the build at the match arm.The deployed artifact is untouched
cargo build-sbf --features devnetproduces a byte-identicalpercolator_prog.sowith and without this file:Checked with the file genuinely moved out of the tree, not stashed.
Upstream
aeyakovenko/percolator-proghas nosrc/binat all — nothing to coordinate.🤖 Generated with Claude Code
https://claude.ai/code/session_01NgoNgagkvw7i5SSRC3FJ8D