Repository navigation
Add refreshBasket(bool skipTradingDelay) - #1320
Conversation
Governance must now opt in to skipping the trading delay with refreshBasket(true). refreshBasket() calls refreshBasket(false), so an unrelated queued proposal that refreshes the basket no longer bypasses the delay after a default. Only governance can skip the delay. Tests and tasks call refreshBasket by full signature, which ethers requires for overloaded functions. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 45 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…resh-skip-delay # Conflicts: # docs/deployment-variables.md
…nd frozen Review feedback: - the changelog tells ethers clients to call refreshBasket by signature - the non-governance refresh test now covers a disabled basket while trading is paused or frozen - the docs say a refresh without skipTradingDelay waits the full delay Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
NatSpec, docs, and changelog now say governance basket changes should call refreshBasket(true). The sample governance proposal does so too. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The spell only sets the prime basket; the proposal has to refresh the basket afterwards. Also reword the sample proposal comment. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…prorata-rounding Stack on #1320. - CHANGELOG: keep both sides. - hardhat.config: drop the BackingManagerP1 compiler override. With the stack it is 24,333 bytes at the default 200 optimizer runs. RTokenP1 is unaffected and stays at 145 runs (24,572 bytes). - Tests: call the overloaded refreshBasket() by full signature. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…resh-skip-delay The only incoming change moves the tradingDelayBypassed switch guard and its test out of the earlier PRs. This branch keeps both, so its tree is unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…resh-skip-delay The incoming change restores the tradingDelayBypassed switch guard on the earlier branches. This branch already has it, so its tree is unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Summary
Adds
BasketHandler.refreshBasket(bool skipTradingDelay). Governance now has to opt in to skipping the trading delay.refreshBasket()callsrefreshBasket(false).Stacked on #1319.
Why
Trust audit finding "Unrelated queued governance proposal bypasses the trading delay" (Low).
At the audited commit, any
refreshBasket()by governance skipped the trading delay. A queued proposal that refreshes the basket for an unrelated reason, for example after swapping a collateral plugin, could execute right after a default and start rebalancing immediately. Anyone can execute a queued proposal once its timelock has elapsed.With this change the skip is explicit:
refreshBasket()refreshBasket()refreshBasket(false)refreshBasket()refreshBasket(true)refreshBasket(true)basket unrefreshablerefreshBasket()keeps its selector and behaves as it did before 4.3.0: it never skips the delay. "Kept" means the full delay runs again from the new basket's timestamp, as every successful refresh resets it.What changes for governance
Governance is expected to call
refreshBasket(true)for basket changes, notrefreshBasket(). A proposal built withrefreshBasket()still works, but rebalancing waits fortradingDelay. Tooling that builds basket-change proposals needs to switch torefreshBasket(true)when RTokens upgrade to 4.3.0.The NatSpec on
refreshBasket(),docs/deployment-variables.md, andCHANGELOG.mdsay this, and the sample governance proposal intasks/validation/test-proposal.tscallsrefreshBasket(true).docs/reweightable-rtokens.mdnow says a basket normalizer proposal must end withrefreshBasket(true); the recipe previously left the refresh out.Changes
contracts/p1/BasketHandler.sol,contracts/p0/BasketHandler.sol,contracts/interfaces/IBasketHandler.sol: the new overload.tradingDelayBypassedis set toskipTradingDelayon a successful switch. No storage layout change.tradingDelayandtradingDelayBypassed, the spell's doc comment,docs/deployment-variables.md, andCHANGELOG.mddescribe the new rule.test/Recollateralization.test.ts: tests for skipping, for keeping the delay through bothrefreshBasket()andrefreshBasket(false), and for a non-governance caller: passingtrue, and refreshing a disabled basket while trading is paused or frozen.test/andtasks/change from.refreshBasket(). All but three become['refreshBasket()'](), which is mechanical: ethers v5 only exposes an overloaded function by its full signature. Three become['refreshBasket(bool)'](true): two in the tests for skipping the delay, and the sample governance proposal.CHANGELOG.mdtells ethers clients that load the new ABI to do the same. Existing calldata is unaffected.BasketHandlerP1grows from 24,062 to 24,110 bytes (limit 24,576).Verification
test/*.test.ts: 685 passing on P1, 587 passing on P0, before the last two commits. Those add one revenue test (from Do not apply tradingDelay to forwardRevenue() #1319) and therefreshBasket(true)guidance; the trading-delay tests intest/Revenues.test.tsandtest/Recollateralization.test.tswere rerun on P0 and P1 after them.FORK_NETWORK=mainnet yarn hardhat 4.3.0at block 26508593 andFORK_NETWORK=base yarn hardhat 4.3.0at Base block 63086205: eUSD, ETH+, USD3 and bsdETH upgrade and pass the post-upgrade checks.refreshBasket(). CI runs them, except the gas-report suites (for exampletest/integration/CTokenVaultGas.test.ts), which only run withREPORT_GASset.🤖 Generated with Claude Code
Summary by CodeRabbit