Repository navigation
perf: pack the reward-rate baseline, seed Veda engines and trim vault and spend reads - #131
Conversation
👁️ Cyclops Security Review✅ Reviewed 8585a23 (latest) · Coverage: partial ·
|
| // A vault whose asset is not `s.token` cannot credit the destination, so the credit check refuses it, | ||
| // naming it then (_revertNotCredited) instead of reading the vault's asset on every spend. | ||
| if (s.fromVault != 0 && !PROVIDER.isAllowedVault(s.vault)) revert VaultNotAllowed(s.vault); |
There was a problem hiding this comment.
Low (exposure and trigger unconfirmed): Direct CardSpender spends can settle when vault asset differs from token
_check no longer requires a direct Earn spend's vault asset to equal CardSpend.token; the asset is read only after a failed credit check. A balance delta from another source satisfies that check: the vault's own fee mint lets a spend in its EarnShare to its EarnFees settle. Other mismatches still revert, sometimes under a different error.
Valid? React with 👍 / 👎.
What changed
EarnVault
earnFees(auint96, with a marker that sends a wider value to its own slot), so initialization writes no slot of its own for it.rewardRateBaseline()keeps its selector anduint256return. Storage layout changes; this applies to new vaults only.EarnFees
accrueFeesand_accrueFeesno longer allocate aFeePreviewand a remainder array that the call then replaces.CardSpender
asset()is read only when the destination was not credited (_revertNotCredited), where it still revertsIncorrectAssetForVaultfor a vault whose asset is not the spend's token.Deployment
vedaengines are now seeded with 1 base unit by theseed-engineactivation step, likeerc4626andpropammengines. Held deposits and solved payouts no longer take the engine's base-asset balance from zero and back on every call.deployment.mddescribes why the unit is inert.Gas
Tempo TIP-20 (
snapshots/):EarnFactory.deploy writes one slot fewer (about 250,000 gas less on Tempo). A seeded Veda engine saves about 250,000 gas on each deposit, solve-and-forward and exact withdraw on Tempo, which these snapshots do not cover.
Checks
pnpm verifypasses. The solar-verify specs for EarnVault, EarnFees and CardSpender verify as onmain.Deploy
Needs a vault factory release (new EarnVault and EarnFees implementations) and new card spenders for the CardSpender change. Existing Veda engines can be seeded by running the
seed-enginestep. No router or engine release.