Repository navigation
fix(nft): verify builds for the upgraded MomoSwap NFT program (#108, #110–#114) - #14
Merged
Merged
Conversation
… slippage to its cap
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.
Why
develop-momo/anchor-launchpad-momoswap #108 and #110–#114 are merged to anchor
mainbut not deployed. develop-momo/momoswap-backend#333 makes the API build for both the livemomoDc2L…binary and the upgraded one. Without this PR, cookie-mcp's pre-sign check (verify.ts, exact account count and every PDA re-derived from the vendored IDL) refuses:create_collection's accounts (#110);What changed
IDL.
src/idl/momo_nft_launchpad.jsonis re-vendored from anchormain79973de(upstream sha2564d2561e0…c134, the same file backend #333 pins), Prettier-formatted, and the content hash inverify.test.tsis re-pinned. Instruction changes:create_collection(thecollection_token_accountseed) and the newset_live_graduation_target(no kind signs it). Also theCollectiontype (#107created_slot, which cookie-mcp doesn't decode) and errors 6055–6059.verify.ts, create. This mirrors momoswap-frontend#449.create_collectionmay pass one extra account after its IDL accounts, only when its decodedCollectionParamsname a non-defaultroyalty_partnerwithpartner_share_bps > 0. The extra account must be that partner, and it can't be a signer or writable. Two extra accounts fail the count check. A partner create with no extra account still passes, because that's how the live binary is built.collection_token_accountmay be the collection authority's ATA (the IDL's new seed, the default derivation) or, for one release, the creator's ATA (LEGACY_SEED_PATHS, marked TEMPORARY). Any other address is refused. The legacy seed is thecreatorslot, which must already be our wallet, so this doesn't let in a stranger's ATA.royalty_partnerandpartner_share_bpsmust be the onescreate_nft_dropasked for. Without this, the extra-account rule would only hold the build to its own params.CollectionParamsis Borsh-decoded by its IDL field list. Data cut short, bytes left over, or a field type the decoder doesn't know are refused.max_cost(#112). No functional change was needed.verify.tsalready heldmax_costto the user's approved all-in spend (maxSpend, which is also themaxSpendRawsent to the API) onbuy_nft,buy_returnedandrequest_mint, and it never adds the fee on top. So it accepts the backend's all-in builds (max_cost == maxSpendRaw) as well as today's cost-leg builds. Like frontend #450, a build whose data has nomax_costis now refused instead of being read as 0. Comments now say "all-in", and the build types documentmaxCostAllInRaw.mintBudgetandrequestBudgetare unchanged: #333 changes only the instruction arg, and the wrap and escrow are still the sameworstCase ≤ maxSpendRaw.create_nft_drop. It now refuses, before anything is uploaded, a mint window longer than/v1/nft/statusmaxSaleWindowSeconds(default 30 days, the program'sMAX_SALE_WINDOW_SECS, #113). A share without a partner was already refused, and the partner field's description now says "plain wallet".CODE_HINTS. Added hints for 6055 to 6059 (GraduationTargetAlreadyMet,…AlreadySet,…WindowClosed,InvalidRoyaltyPartner,SaleWindowTooLong). The 6001Pausedhint now says refunds still work, and settling does too once #108 is deployed.Settle (#108).
nft_drop_settlenever treatedpausedas a reason not to settle, so only the hint changed.List/cancel (#114). Nothing in cookie-mcp builds or signs
list_on_marketplaceorcancel_listingfor pool inventory.verify.tsrefuses both under every kind.cancel_listinginsrc/core/nftis the holder's own Baked Bazaar Auction House listing, which is a different program.Tests
yarn test(lint, format:check, typecheck, unit, smoke): 56 files / 887 tests, smoke 76 tools.yarn buildpasses.max_costtests onbuy_nft(the real API build),buy_returnedandrequest_mint. All-in == spend passes, the cost-leg value passes, spend + 1 is refused, and a missingmax_costis refused.planNftDrop: exactly 720 h passes, a window over the API-stated maximum is refused.nftSimError: hints for 6055–6059 and the new 6001 wording.max_costguard,>→>=, the fee added on top, the window check.Rollout
momoDc2L…andGET /v1/nft/statusreportscollectionNftHolder: "program", delete thecreate_collectionentry inLEGACY_SEED_PATHS(and its "or the creator's" test). The partner-account allowance stays, because the upgraded program requires it.Not in scope: frontend #449 also holds every
CollectionParamsfield (name, URIs, curve, schedule, allowlist root…) to what the creator sent. Here only the partner and share are pinned. The rest is still bounded only by the seal and the simulation, which is worth a follow-up.