Pre-mainnet hardening: repoint owner check, shared hold-check helper, pinned remappings #19
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/premainnet-hardening"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Base
main. #17 is merged (2404283), so this was retargeted. Pre-mainnet suggestions from Security's PR #17 re-review (v2) and its #19 re-review (2026-11-16): no High/Medium/Low; Info-D/E/F fixed atd790cbb. Info-G and Info-H are added in5b929efand77c2b5e, which are not reviewed yet. Do not merge until reviewed.Bytecode: only
5aa3adbis byte-identical to #17, metadata included.9b06cd1,d790cbb,5b929efand77c2b5echange BuilderBonus's executable code. All other contracts, TaskulerMarket included, are byte-identical to #17 at every commit. Sepolia runs8610085(#20), so a BuilderBonus redeploy will be needed after this merges for the changes to take effect on testnet.Changes
scheduleRepointandexecuteRepointnow revertOwnerMismatch()unless the target Market'sowner()equals BuilderBonus'sowner(). The check runs at both steps, so ownership drifting apart during the 48-hour delay blocks the repoint. A missing or malformedowner()answer counts as a mismatch. It guards against mistakes; a contract that reports a false owner is still bounded as described in KI-14.isHeldcall (theInsufficientGasguard plusstaticcall{gas: HOLD_CHECK_GAS}) is now one internal helper,_holdProbe, used by_firstHoldandignoreBrokenMarketHolds. The threshold is an internal constant,HOLD_CHECK_MIN_GAS(55,793), with the same value as before. No ABI change. This does change BuilderBonus's executable bytecode (code layout); the runtime stays 15,366 B. Security measured the gas edges ofignoreBrokenMarketHoldsandwithdrawand found them identical to7a41b38, to the gas unit.foundry.tomlnow lists all three remappings and setsauto_detect_remappings = false. At5aa3adb, a clean build gives exactly the same creation and runtime bytecode, metadata hash included, for every contract insrc/, compared with #17. Security also reproduced all 11 deployedb19f21dcontracts with the pinned config._requireSameOwnernow does the following:owner()with exactlyOWNER_CHECK_GAS(50,000), revertingInsufficientGasif less thanOWNER_CHECK_MIN_GASis left;OwnerMismatch, as do a revert, a gas burner and dirty high bits._requireSameOwner(market_), so the initial Market must report BuilderBonus's owner too, whatever the deploy script.ABI (BuilderBonus)
OwnerMismatch()0xa8c81623. No new functions or events. The constructor (Info-H) andscheduleRepoint/executeRepointcan also revertInsufficientGas()from the owner check (Info-G).Tests
test_ScheduleRepointRequiresSameOwner: a different owner, noowner(), and a two-wordowner()all revertOwnerMismatch; the same owner passes.test_ExecuteRepointRechecksOwner: the Market owner moves during the delay, so execute reverts; once BuilderBonus's owner moves too, it executes.test_ExecuteRepointBlockedAfterBonusOwnerMoves: BuilderBonus's owner moves alone, so execute reverts.test_OwnerCheckGasCappedAndSizeChecked(Info-G): a gas burner, a 30 KB return, dirty high bits, an empty return and a revert all giveOwnerMismatchfor under 120k gas; 60k forwarded givesInsufficientGas; a clean answer passes.test_ConstructorRequiresSameOwner(Info-H): a Market reporting another owner, or a governance that isn't the genuine Market's owner, makes the constructor revertOwnerMismatch; the matching owner deploys.setOwner(safe)) so the existing repoint scenarios still run.forge testwith the fork RPC set: 353 passed, 0 failed, 0 skipped.Size
BuilderBonus is 15,518 B (9,058 B margin). TaskulerMarket is unchanged at 24,146 B (430 B margin). Every other contract's bytecode is unchanged.
Docs