Repository navigation
Closed
Copy link
Labels
kind:featureNew capability or a change to current behaviorkind:securitySecurity impact; report a vulnerability to [email protected], not here
Description
Summary
Only contracts/script/TestnetFaucet.s.sol exists. The faucet's own header (L12) notes: "production deploy script MUST be named differently". There is no script that deploys the full v3 protocol surface in ADR 016 §2 dependency order and atomically transfers GOVERNANCE_ROLE (and related setter roles) from the deployer to TimelockController.
Without this, every deploy is a manual sequence of forge create calls plus separate grantRole / renounceRole transactions — which is both error-prone and leaves a window where the deployer EOA holds god-mode on production contracts.
Why prod-blocking
- Any Sepolia or mainnet deploy needs a reproducible, scripted, audit-reviewable deployment artifact.
- The role-handoff atomicity is a security property: if a deploy script revert leaves
DEFAULT_ADMIN_ROLEon the deployer EOA, post-mortem custody becomes a per-deploy ad-hoc operation rather than a known-good pattern. - Issue Governance lifecycle test suite: propose → vote → queue → execute for every governable parameter #693 (governance lifecycle tests) assumes Timelock holds
GOVERNANCE_ROLEon every target; this script is the production realization of that assumption.
Scope
New contracts/script/DeployProtocol.s.sol that:
- Deploys in ADR 016 §2 order:
Token→CapacityBond→FeeRouter(withsafetyReserve/buybackBurnerinitiallyaddress(0), set in step 2 per ADR 016's §Tunable Economics note) →SafetyReserve→BuybackBurner→ContentBlacklist→PublisherRegistry→TimelockController(48h delay, proposers/executors set in step 3) →DecdnGovernor. - Wires post-deploy dependencies:
FeeRouter.setSafetyReserve,FeeRouter.setBuybackBurner,SafetyReservegrants toCapacityBond'sAPPEAL_REVERSAL_ROLE, etc. - Configures Timelock: grants
PROPOSER_ROLEandCANCELLER_ROLEtoDecdnGovernor, grantsEXECUTOR_ROLEtoaddress(0)(open execution), revokes Timelock's own admin role from the deployer. - Atomic role handoff on every target contract:
grantRole(GOVERNANCE_ROLE, address(timelock))onFeeRouter,CapacityBond,ContentBlacklist,SafetyReserve,PublisherRegistry.grantRole(EMERGENCY_MULTISIG_ROLE, <multisig from env>)onSafetyReserveand other emergency surfaces.renounceRole(DEFAULT_ADMIN_ROLE, deployer)on every contract — last step, after all other grants confirmed.
Env-var contract:
USDC_ADDRESS— settlement token (Arbitrum Sepolia USDC for testnet)EMERGENCY_MULTISIG— 3-of-5 multisig forEMERGENCY_MULTISIG_ROLETREASURY_ADDRESS— initial treasury destination (often the Timelock itself per ADR 016)TIMELOCK_DELAY— defaults to 48h per ADR 009
Acceptance
forge script script/DeployProtocol.s.sol --rpc-url <fork>runs against an Arbitrum Sepolia fork and succeeds end-to-end.- Post-deploy assertions in the script verify, for every contract:
hasRole(DEFAULT_ADMIN_ROLE, deployer) == falseandhasRole(GOVERNANCE_ROLE, timelock) == true. - A companion
DeployProtocol.t.solruns the script in-process viavm.startStateDiffRecording(or equivalent) and asserts the final role topology matches ADR 016 §Role Matrix. - Deployed addresses are written to a deterministic JSON manifest (
deployments/<chainid>.json) for downstream tooling.
Out of scope
- Mainnet deployment of TOKEN's initial supply distribution (Genesis Bond Credits etc. per ADR 026) — that's a separate one-shot script.
- Verification on Arbiscan — should be a separate CI step driven from the manifest.
- Frontend address-injection — separate website-repo work.
Related
- ADR 016 §2 (deployment order), §Role Matrix
- ADR 009 (48h Timelock delay, 12-month emergency sunset)
- ADR 026 §5, ADR 033 (SafetyReserve wiring)
- Production governance contracts: Governor + TimelockController + ERC20Votes #340 (parent — closed)
- Governance lifecycle test suite: propose → vote → queue → execute for every governable parameter #693 (governance lifecycle tests — consumes this script's role topology)
Reacted by github-actions
Metadata
Metadata
Assignees
Labels
kind:featureNew capability or a change to current behaviorkind:securitySecurity impact; report a vulnerability to [email protected], not here
Type
Fields
Priority
None yet
Activity
github-actions commentedon May 28, 2026
🎯 Triage report
This issue requests a new
contracts/script/DeployProtocol.s.solthat orchestrates the full v3 contract surface deployment in ADR 016 §2 dependency order, then atomically hands off all privileged roles from the deployer EOA toTimelockController. The security motivation is clear: without this, any partial-revert during a manual deploy leavesDEFAULT_ADMIN_ROLEon the deployer indefinitely. It directly unblocks #693 (governance lifecycle tests) and is explicitly markedprod-blocking.📊 Assessment
securityadded (existing:enhancement,technical,architecture,prod-blocking)🔗 Similar issues
DecdnGovernor+TimelockControllercontracts; this issue is the deploy-script follow-on💡 Notes and suggestions
Implementation checklist
contracts/script/DeployProtocol.s.sol—Scriptsubcontract, usesvm.startBroadcast(deployer)Token→CapacityBond→FeeRouter(with zero addresses for SR/BB) →SafetyReserve→BuybackBurner→ContentBlacklist→PublisherRegistry→TimelockController→DecdnGovernorFeeRouter.setSafetyReserve,FeeRouter.setBuybackBurner,SafetyReserve→CapacityBondAPPEAL_REVERSAL_ROLEgrantPROPOSER_ROLE+CANCELLER_ROLE→ Governor;EXECUTOR_ROLE→address(0); revoke deployer's Timelock admingrantRole(GOVERNANCE_ROLE, timelock),grantRole(EMERGENCY_MULTISIG_ROLE, multisig),renounceRole(DEFAULT_ADMIN_ROLE, deployer)— renounce last!hasRole(DEFAULT_ADMIN_ROLE, deployer)andhasRole(GOVERNANCE_ROLE, timelock)deployments/<chainid>.jsonwith all contract addresses + deploy blockcontracts/test/DeployProtocol.t.sol: runs script in-process viavm.startStateDiffRecording, asserts ADR 016 §Role Matrix topologySolidity CI gotchas to watch:
renounceRoleonDEFAULT_ADMIN_ROLEis the last call — if any earlier grant reverts, the admin role stays with the deployer; consider arequire-after-renounce guardFOUNDRY_PROFILE=ci forge build --sizes --deny warningswill catch any unreachable-code warnings introduced by always-reverting stubs; avoid addingnonReentranton any always-reverting function (W5740 trap per CLAUDE.md)forge fmtmust pass before CI; runpre-commit run --all-filesbefore pushEnv-var validation: add explicit
require(usdcAddress != address(0), "USDC_ADDRESS not set")guards at script top; a silent zero-address for USDC would deploy a broken-but-non-reverting protocolAdd this agentic workflows to your repo
To install this agentic workflow, run
test(contracts): add governance lifecycle suite (closes #693) (#695)
feat(contracts): production DeployProtocol script (closes #694) (#700)