fix: correctly identify truly cold mint accounts#2275
fix: correctly identify truly cold mint accounts#2275sergeytimoshin wants to merge 5 commits intomainfrom
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis change reorganizes the hot/cold account conversion logic in the RPC client by deferring hot-path account construction to the None branch, and adds comprehensive unit tests for AccountInterface and TokenAccountInterface covering various state transitions and edge cases. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
No actionable comments were generated in the recent review. 🎉 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 |
a9aeb68 to
6d42d5d
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
sdk-libs/client/src/rpc/client.rs (1)
1173-1235: 🧹 Nitpick | 🔵 TrivialEdge case to consider:
is_cold() && lamports > 0now hits the Hot deserialization path.When the indexer says cold but lamports are non-zero, we fall into the
elsebranch and attemptMint::try_from_slice(&ai.account.data). If the on-chain account at that address isn't actually a validMint(e.g., someone arbitrarily sent SOL to the address, creating a zero-data system-owned account), this will produce a somewhat opaque deserialization error.This isn't a blocker — the error will surface — but you might want to tighten the error message for this transitional state so operators can distinguish "stale cold flag with live account" from "genuinely corrupt hot mint data":
Mint::try_from_slice(&ai.account.data).map_err(|e| { RpcError::CustomError(format!( - "Failed to deserialize hot mint account: {e}" + "Failed to deserialize mint account as hot (is_cold={}, lamports={}): {e}", + ai.is_cold(), ai.account.lamports )) })?;This gives much better diagnostics when debugging the cold→hot transition edge cases.
🤖 Fix all issues with AI agents
In `@sdk-libs/client/src/rpc/client.rs`:
- Around line 1175-1176: Add a brief inline comment above the is_truly_cold
assignment explaining why we also check ai.account.lamports == 0 (e.g., the
indexer can report ai.is_cold() after decompression, so lamports == 0 confirms
on-chain compression), and keep the existing logic using ai.is_cold(),
ai.account.lamports, and the is_truly_cold variable intact.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@sdk-libs/client/src/indexer/types/interface.rs`:
- Around line 117-132: Add a doc comment to AccountInterface::is_cold()
explaining that its simpler cold.is_some() check intentionally differs from
IndexerAccountInterface::is_cold() (which inspects
DECOMPRESSED_PDA_DISCRIMINATOR) because AccountInterface is produced from
already-filtered client-side data where decompressed placeholders have been
removed; mention that decompressed accounts will have cold: None in the
AccountInterface representation so the simple presence check is correct and
expected.
Summary by CodeRabbit
Tests
Documentation
Refactor