refactor: formalize strict feature flag (ex relaxed) - #902
Conversation
📝 WalkthroughWalkthroughThis PR renames the feature flag from Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
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)
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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/cardano/src/roll/accounts.rs (1)
90-107:⚠️ Potential issue | 🟡 MinorPre-existing:
ControlledAmountDec::undoignoresis_pointerflag.The undo path always adds back to
utxo_sum(Line 106), but the apply path (Lines 95-99) conditionally subtracts from eitherutxo_sum_at_pointer_addressesorutxo_sumdepending onself.is_pointer. If the original decrement targeted a pointer address, the undo will incorrectly creditutxo_suminstead ofutxo_sum_at_pointer_addresses.This is pre-existing (not introduced by this PR's macro change), but since the lines are in the changed surface, flagging for awareness.
Suggested fix
fn undo(&self, entity: &mut Option<AccountState>) { let entity = entity.as_mut().expect("existing account"); let stake = entity.stake.unwrap_live_mut(); - stake.utxo_sum = add!(stake.utxo_sum, self.amount); + if self.is_pointer { + stake.utxo_sum_at_pointer_addresses = add!(stake.utxo_sum_at_pointer_addresses, self.amount); + } else { + stake.utxo_sum = add!(stake.utxo_sum, self.amount); + } }
🧹 Nitpick comments (2)
crates/testing/Cargo.toml (1)
10-10: Unrelated additions bundled with the feature-flag rename.Adding
dolos-fjallanditertoolsdependencies appears unrelated to therelaxed→strictrefactor. Consider splitting these into a separate commit or PR for cleaner history if they serve a different purpose.Also applies to: 19-19
crates/cardano/src/pots.rs (1)
52-75: Consider applyingadd!/sub!to query methods for full strict-mode coverage.Methods like
stake_deposits(),obligations(),max_supply(), andcirculating()still use direct+/-/*operators. If the intent ofstrictmode is to surface any arithmetic anomaly (e.g., corrupted pot values causing overflow during reads), these would also benefit from the macros. Not urgent since these are read-only, but worth considering for completeness.
Summary by CodeRabbit
Release Notes
Refactor
Chores