In-depth lesson · Business logic
Typical fixes
Every point the Business logic reports back under this heading, best-backed first, each with the reports it is seen in.
-
Key the limiter on the real connection address and normalise identifiers before counting.
Seen in 4 reports
-
Override the transfer hooks to keep the per-user stake ledger in sync with share movements.
Seen in 4 reports
-
Persist the full recapitalization target and bootstrap the Senior high-water mark from it rather than from the live decremented pending bucket.
Seen in 4 reports
-
Re-evaluate the latch automatically and net the offsetting open leg before latching.
Seen in 4 reports
-
Record carry collected at commit in the commitment and count it against both charge bounds.
Seen in 4 reports
-
Reduce the pending recapitalisation when cash is paid out and do not re-reserve value already credited to Senior.
Seen in 4 reports
-
Require the owner, or add a delay or owner priority, before the retry can move the protection out of Latched.
Seen in 4 reports
-
Reserve the free settlement an order needs at commit time and validate that the order's own margin can meet its bounds.
Seen in 4 reports
-
Update the vault balance before minting shares and use time-weighting or lock-ups for rewards.
Seen in 4 reports
-
Validate the CAPTCHA token server-side on every request and reject when it is missing or falsy.
Seen in 4 reports
-
Allow debtors to clear their full debt regardless of donation-inflated conversion rates, and exclude donated balances from total assets.
Seen in 3 reports
-
Apply the adverse confidence shift before capping the basket, consistently on order execution and liquidation.
Seen in 3 reports
-
Bind a nonce, expiry, amount and caller address into the signed payload.
Seen in 3 reports
-
Bind the latched state to the owner's amendment so a permissionless retry cannot consume it first.
Seen in 3 reports
-
Burn the matching shares on payout and guard the zero-NAV state.
Seen in 3 reports
-
Call the transfer recorder on every fee credit so a zk-tree leaf is inserted for the miner and aggregator balances.
Seen in 3 reports
-
Check the return codes from Compound-style mint and redeem calls.
Seen in 3 reports
-
Condition the fee transfer on the seized amount rather than the remaining collateral, and use greater-than-or-equal comparisons.
Seen in 3 reports
-
Convert the remaining asset headroom with the same rounding that deposit and mint use.
Seen in 3 reports
-
Decode with the correct ABI type and compute selectors from the current settler ABI.
Seen in 3 reports
-
Enforce a real minimum LP amount and price the exercise from a time-weighted average.
Seen in 3 reports
-
Handle a single-block earmark range explicitly and do not advance the last-processed block when the query returns zero.
Seen in 3 reports
-
Implement the reward claim function and add a rescue path for stranded tokens.
Seen in 3 reports
-
Re-check the collateralisation ratio after deducting the repayment fee and guard against zero-amount fee withdrawals.
Seen in 3 reports
-
Reduce the high-water mark by the fraction of shares burned, not the fraction of principal paid out.
Seen in 3 reports
-
Require the caller to be the controller or an approved operator, and check the queue head can pay out before trusting it.
Seen in 3 reports
-
Require the controller's consent when creating a request on its behalf.
Seen in 3 reports
-
Return the computed assets variable from mint and repay functions.
Seen in 3 reports
-
Revert in allocate when the kill switch is on, or have the vault verify the adapter actually took the assets.
Seen in 3 reports
-
Scale the total locked collateral by the same debt-proportion factor and advance the transmuter balance pointer only by the cover actually applied.
Seen in 3 reports
-
Set a non-zero minimum-shares-out and enforce the computed cap before forwarding the allocation.
Seen in 3 reports
-
Set the senior high-water mark to the maximum of the existing mark and the new principal in the zero-principal branch.
Seen in 3 reports
-
Store the cap factor per epoch so historical entitlements are not changed by later owner updates.
Seen in 3 reports
-
Use one canonicalisation regime for display, ownership checks and transaction arguments.
Seen in 3 reports
-
Add per-account and per-IP throttling and a captcha to the reset endpoint.
Seen in 2 reports
-
Apply the confidence shift to the raw basket before clamping to the cap, on both live and frozen paths.
Seen in 2 reports
-
Low -
Medium
-
-
Apply the frozen-close spread and execution fee on the liquidation path, and do not pay the keeper share to the position owner.
Seen in 2 reports
-
Medium -
Medium
-
-
Apply the projected-wipe guard to every deposit-pricing view, not just the forward estimate.
-
Apply the same ordering checks in every setter and in the initialiser.
-
Apply the standard normalisation before resolving any pasted name and do not fall back to the node owner when no address record exists.
-
Apply the wiped-tranche check to every quote function and to the unassigned-assets assignment path, not just the deposit estimate.
Seen in 2 reports
-
Critical -
Critical
-
-
Apply the zero-assets-with-surviving-shares guard to the bootstrap deposit quote as well as ordinary deposits.
-
Apply the zero-principal and surviving-supply guard to the executed bootstrap quote as well as the estimate.
Seen in 2 reports
-
Critical -
Critical
-
-
Bind the authorised amount to the exact total the user confirmed and do not proceed on a failed budget quote.
Seen in 2 reports
-
Bind the pending action, including name, resolver, access result and transaction branch, when the confirmation is shown.
-
Bound the supply-to-principal ratio and defer activation at near-zero principal, not only at exactly zero.
-
Call record_transfer for the miner fee credit so a leaf is inserted.
-
Canonicalise email addresses before comparing them for duplicate or self-invitation checks.
-
Cap the fresh close VPI relative to notional or margin and treat near-zero depth as exempt, not only exactly zero.
-
Check that the computed collateral factor is not zero before allowing collateral withdrawal.