Repository navigation
4.3.0 spell: set tradingDelay at upgrade - #1311
Conversation
4.3.0 changes what tradingDelay delays: governance basket refreshes now skip it, so it only delays trading after a basket change governance did not make, such as a refresh after a default. castSpell takes a newTradingDelay so each community sets the value for its new meaning in the upgrade proposal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A zero delay starts automatic trading as soon as a defaulted basket is replaced, which is most likely a misconfiguration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Adds a
newTradingDelayparameter to the 4.3.0 upgrade spell:castSpell(IRToken rToken, uint48 newTradingDelay). The spell sets it on the BackingManager after the upgrade, so each community picks itstradingDelayin the same proposal that changes whattradingDelaymeans.Why
4.3.0 (#1297) changes what
tradingDelaydelays:tradingDelayafter every basket change.OWNER) setstradingDelayBypassedand skips the delay. Only emergency basket changes still wait: the permissionless refresh after a collateral default.So
tradingDelayis now a window for governance to step in with a better basket before automatic recollateralization starts, without slowing down governance's own basket changes. All four RTokens runtradingDelay = 0today, a value chosen for the old meaning. Putting the setting in the spell means communities choose a value explicitly when they upgrade. The spell requiresnewTradingDelayto be at least the currenttradingDelay(Err(14), checked before any upgrade): the delay should only increase.Changes
contracts/spells/4_3_0.sol:castSpelltakesnewTradingDelay, requires it to be>=the currenttradingDelay, and callsbackingManager.setTradingDelay(newTradingDelay)after the component upgrades, while the spell still holdsOWNER.setTradingDelayenforcesMAX_TRADING_DELAY(1 year). The doc comment explains the change in meaning.tasks/validation/proposals/4_3_0.ts:proposal_4_3_0takesnewTradingDelayand passes it tocastSpell.tasks/validation/spells/4.3.0.ts: the fork task casts with a test value of 1 day and checks the BackingManager reports it after the upgrade. The validator already advances time pasttradingDelaybefore its trading checks.docs/deployment-variables.md: thetradingDelayentry now describes the 4.3.0 meaning.CHANGELOG.md: notes the new spell parameter.The spell is not deployed yet, so changing the
castSpellsignature breaks nothing on chain.Verification
yarn compile. Solhint shows 0 errors; the one warning is the existing contract-name rule for4_3_0. ESLint and Prettier pass on the changed files.FORK_NETWORK=mainnet yarn hardhat 4.3.0at block 26430568: eUSD, ETH+, and USD3 pass, including the newtradingDelaycheck.FORK_NETWORK=base yarn hardhat 4.3.0at Base block 58389092: bsdETH passes.BASE_SUBGRAPH_URLpointed atdtf-yield-base/prod, as in 4.3.0: Upgrade spell #1308.These runs include the
>=check, plus a nonzero check that was removed afterwards; I recompiled and linted after removing it. The fork task casts with 1 day against a current delay of 0, so it exercises only the passing path; no test covers theErr(14)revert.The pre-push Husky hook can't run from a nested linked worktree, so I ran the equivalent checks by hand.
🤖 Generated with Claude Code