feat: migrate shield-swap-sdk to the new shield_swap.aleo stack - #62
Open
iamalwaysuncomfortable wants to merge 22 commits into
Open
feat: migrate shield-swap-sdk to the new shield_swap.aleo stack#62iamalwaysuncomfortable wants to merge 22 commits into
iamalwaysuncomfortable wants to merge 22 commits into
Conversation
- /auth/verify: send challenge_id from the challenge payload - sessions are httpOnly cookies + X-CSRF-Token (legacy body-JWT kept) - is_authenticated covers both credential kinds - salted retry on DPS consumer-username collisions - lifecycle live test: invite codes are pasted, never generated; shed SHIELD_SWAP_PRIVATE_KEY so the fresh-profile premise holds
…nt under cookie auth - _headers: prefer the live session (csrf + cookies) over Authorization; ss_ tokens don't cover the /access tier and the server reads the header first - 401 while both credentials are loaded drops the expired session and retries as bearer (15-min sessions) - _auth_done recognizes cookie sessions; CSRF never persisted as jwt; from_profile prefers the durable ss_ token over stale session creds
Slot-derived insert hints only validate for a pool's FIRST position — finalize asserts the true linked-list predecessors, so every later mint was rejected on populated pools. find_tick_predecessor walks the ticks mapping from the MIN sentinel (fresh pools anchor at the sentinel; initialized ticks return themselves since validation is skipped).
… 0.3.0 shield-swap-sdk now floors aleo-sdk at 0.3 (Array codegen runtime). Docs updated: staging auth/session + referral-vs-access invites, live- verified LP behaviors (tick-list hints, wrapped-side exact amounts, slippage headroom), sdk-abi example re-pointed at the new stack.
iamalwaysuncomfortable
deployed
to
pypi-shield-swap
July 28, 2026 21:47 — with
GitHub Actions
Active
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.
Migrates
shield-swap-sdkfrom the retiredshield_swap_v3.aleoto the freshly deployedshield_swap.aleostack, per the migration guide (amm-v3#62 target). Hard cutover — no state carries over.Contract cutover
PROGRAM_ID = shield_swap.aleo;U256 {hi, lo}prices,MerkleProofstruct,PositionNFT.withdrawal, reshapedPoolState/Slot/Tick/Position/SwapOutput, new compliance records;claim_multi_hop_outputandset_token_decimalsgone._MAGIC_X128tick table +MIN/MAX_SQRT_RATIO_X128pinned from the contract and verified against the reference implementation (f(±400000)matches exactly);u256_to_int/int_to_u256_plaintexthelpers.SlotView.pricere-derived;collect_allrequests exactly the chain-reported owed amounts.mint/claim_swap_output/collectcarry[MerkleProof; 2]arrays — empty-tree defaults while the lists are empty,wrapper_proofs=override for later.mint(withdrawal=…)(defaults to recipient) is stored on the NFT;collectalways pays it — therecipientkwarg is removed.CLAIM_OR_SWAP_DOMAINunchanged in the new bytecode; onlyDEFAULT_PROGRAMflips (v3 vectors kept as algorithm tests, new-program vectors pinned).Automatic router dispatch
Every verb detects each token's wrapped/plain shape (
from_wrapper_token_idchain probe, cached; transport errors propagate rather than misclassifying) and dispatches per the guide's §6 matrix:shield_swap_router.swap_from_wrappedwhen the input is wrapped (funded with underlying records; deposit + burn happen in-transaction;amount_out_min > 0enforced at prepare time)SwapOutputshapes (covers the plain-start/wrapped-claim asymmetry)Record selection understands
credits.aleo(microcredits) and skips recipient-bound wrapper records. Mirrored inAsyncShieldSwap.Supporting changes
fmt_array, toposort/ref-check recursion into array elements).DEFAULT_API_URLand regen default nowhttps://amm-api-staging.dev.provable.com(SHIELD_SWAP_API_URLoverride); models regenerated (wrapper_program→amm_token_program, newunderlying_program/underlying_token_iddrive record-program resolution); redeem no longer rotates the session credential.allow_tokenwith idempotent bootstrap.Verification
shield-swap-sdkunit suite: 171 passed