navi sui transactions - #94
Conversation
operate.md review —
|
| Move signature | PR call | |
|---|---|---|
collect_v3_rewards_with_one_swap_bluefin<T,S> (:271) |
self, version, clock, storage, asset: u8, incentive_v3, funds_pool: &mut RewardFund<S>, bluefin_pool: &mut BluefinPool<S,T>, config: &BluefinConfig |
T=SUI, S=NAVX; REWARDS_POOL.NAVX → pool(NAVX,SUI,bluefin) → GLOBAL_CONFIGS.BLUEFIN ✅ |
collect_v3_rewards_with_one_swap<T,S> (:194) |
…, funds_pool: &mut RewardFund<S>, cetus_pool: &mut CetusPool<S,T>, config: &GlobalConfig |
T=SUI, S=vSUI; REWARDS_POOL.vSUI → pool(vSUI,SUI,cetus) → GLOBAL_CONFIGS.CETUS ✅ |
Type-argument order ([asset.type, rewardCoinType] = <T,S>), the BluefinPool<S,T> / CetusPool<S,T> pair ordering, and the pool-before-config argument order all match. NAVI_CONFIG.ASSET_MAP.SUI = '0' and both REWARDS_POOL.NAVX / REWARDS_POOL.vSUI exist (src/utils/constants.ts:136,138,171). getPoolIdBySymbolsAndProtocol throws on an unregistered pair (src/models/strategyContext.ts:681-685), so a missing pool fails loudly rather than building a malformed PTB. Branch placement is correct — SUI cannot be shadowed by an earlier arm.
🔴 What this PR gets right that the code it was ported from gets wrong (out of scope, but worth acting on)
The same call exists in two places on main elsewhere, and both have config and bluefin_pool swapped relative to the Move signature:
alphafi-sdk-rust/src/tx/autocompound.rs:3591-3593—vec![investor, version, clock, storage, idx, incentive, rp, config, p1]alpha/sui-alpha-sdk/src/crons/autocompound.ts:3227-3238—BLUEFIN_GLOBAL_CONFIGthenbluefinPoolMap["NAVX-SUI"]
In each file the sibling cetus branch immediately below it has the order right (…, rp, p1, config), and the two collect_v3_rewards_with_two_swaps_bluefin call sites in the Rust SDK (:3686, :3738) are also right (rp, p1, p2, config) — so one_swap_bluefin is the lone outlier in both repos, the same mistake copied across. The Move function has had this signature since it was introduced (single commit 6e901ed2), so there is no older deployed ordering that would explain it.
Consequence: the NAVI-SUI pool's NAVX reward autocompound via Bluefin builds a PTB passing &BluefinConfig where &mut BluefinPool<S,T> is expected, which aborts at execution. Not introduced here — flagging because this PR is the correct version and the two live ones are not. Worth a separate fix in alphafi-sdk-rust (that is the path the crons actually run).
🟢 Non-blocking notes on scripts/testRun.ts
Dev-scratch churn, no production impact, but it is committed:
- The active call flips from
withdraw()todeposit()and thewithdraw()poolIdis changed to the same id asdeposit(), so the previous withdraw target is lost from the file. - The two new helpers disagree on environment:
withdrawApiposts to productionhttps://api.alphalend.xyz/slush/v1/withdrawwhiledepositApiposts tohttps://api-staging.alphalend.xyz/slush/v1/deposit. Both are dry-run-only today (executeTransactionBlockcommented out), but a scratch helper pointed at prod is an easy foot-gun to leave lying around. - They also disagree on decoding:
Transaction.fromKind(res.bytes)vsTransaction.from(res.bytes). Only one can be right for a given endpoint's response shape — worth making them consistent, or commenting why they differ.
No secrets in the diff (the hardcoded values are public object ids and a sender address).
Approving — the production change is correct and CI is green; everything above is either advisory or out of scope. Approvals: 1/2 after this one — needs one more before merge.
jangid
left a comment
There was a problem hiding this comment.
operate.md: clean — CI green (test/lint/build). Verified both new moveCalls against alphafi_navi_investor.move: type args <T=SUI, S=reward>, BluefinPool<S,T>/CetusPool<S,T> pairing, and pool-before-config argument order all match the signatures. Note in the summary comment: the same call on alphafi-sdk-rust main (src/tx/autocompound.rs:3591) and in alpha's legacy cron has config and pool swapped — this PR is the correct version, those two are not. Approvals: 1/2 — needs one more before merge.
No description provided.