fix: harden proxy view fee previews#446
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a128113c1c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let fee_growth_rate = match config.fees.max_total_assets_growth_rate { | ||
| Some(rate) => to_i128(u128::from(rate))?, | ||
| None => 0, | ||
| }; |
There was a problem hiding this comment.
Preserve growth-cap absence in proxy_view
When the fee config has no max_total_assets_growth_rate (the default uncapped mode), this maps it to 0, which is indistinguishable from a configured Some(Wad::zero()). Those two states are materially different because total_assets_for_fee_accrual treats None as uncapped growth but Some(0) as no growth beyond the anchor, and governance currently accepts Some(0). Downstream consumers of the new fee snapshot cannot reconstruct the actual fee policy and may simulate fee accrual incorrectly; return a presence flag/optional encoding or another unambiguous sentinel instead of collapsing None to zero.
Useful? React with 👍 / 👎.
a128113 to
8e550d7
Compare
d31bf3c to
ba08a36
Compare
6c6e6c8 to
35b3685
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
35b3685 to
e17ca85
Compare
8b940a2 to
3c4abaf
Compare
e17ca85 to
3118c26
Compare
Summary
Stacked follow-up to PR #428 for the fee-anchor lifecycle cluster. This patch handles the latest proxy-view / fee-preview truthfulness rows with one Halborn-detectable commit per finding:
86ddc60c-b4d9-4e2e-a9ad-705890b3fc89/#FIND-085/ commit863a2b62: include configuredmax_total_assets_growth_ratein theproxy_viewfee snapshot tuple.082f9cb2-f33c-4006-8528-ef7a7b2918cc/#FIND-077/ commit5842847b: replace uncheckedu128 as i128fee snapshot casts withto_i128(...)so overlarge stored fee-anchor/config values fail closed.ae756926-e93c-4d54-a4a6-3a706ed20867/#FIND-028/ commit335a946b: computeproxy_viewmax_deposit/max_mintagainst the opposite-side conversion headroom, not only same-side total/idle/supply headroom.4460259b-12db-44b2-9396-262b531275c7/#FIND-080/ commit35b3685e: make fee-aware preview simulation returnConversionOverflowwhen management/performance fee minting would exceedu128::MAXinstead of saturating supply.Key files
contract/vault/soroban/src/contract/entrypoints.rscontract/vault/soroban/src/fungible_vault.rscontract/vault/soroban/tests/integration_tests.rsVerification
cargo fmt --all -- --checkgit diff --checkcargo test -p templar-soroban-runtime --test integration_tests soroban_contract_proxy_view -- --nocapture(4 passed)cargo test -p templar-soroban-runtime --test integration_tests soroban_contract_fee_aware_preview_fails_on_supply_overflow -- --nocapture(1 passed)cargo test -p templar-soroban-runtime --test integration_tests -- --nocapture(60 passed)just -f contract/vault/soroban/justfile size-budget-check(runtime deploy WASM96709bytes <=131072bytes)96709bytesStack
Base:
audit/fee-anchor-lifecycle-spec/ PR #428.This change is