acceptProposalUpgrade
Function Type: external
Access Control: isSuperUser
Function Signature: acceptProposalUpgrade()
Accepts a pending upgrade proposal and executes the contract upgrade after the mandatory 7-day waiting period has elapsed.
Description
This function completes the final step of the time-delayed governance process for contract upgrades. It validates the time delay, executes the upgrade to the new implementation, and cleans up the proposal state.
Access Control
Modifier: isSuperUser
Only the current superUser can execute pending upgrade proposals, maintaining governance authority over system changes.
Requirements
Time Delay Validation
- Current timestamp must be greater than or equal to
upgradeProposal.timeToAccept - The full 7-day waiting period must have elapsed
Proposal State Validation
- A valid proposal must exist (proposal address cannot be zero)
- Proposal must not have been rejected or expired
Security Features
Time Delay Enforcement
- Mandatory 7-day waiting period cannot be bypassed
- Provides community oversight and intervention opportunity
- Allows for thorough security review
Atomic Execution
- Upgrade and state cleanup happen in single transaction
- Prevents partial state issues
- Ensures clean governance transition
UUPS Pattern Compliance
- Uses OpenZeppelin's
upgradeToAndCallfor secure upgrades - Maintains proxy pattern integrity
- Preserves storage layout and state
Workflow
- Access Control: Validates that the caller is the current superUser using the
isSuperUsermodifier. Reverts withInvalidUserif not authorized. - Time Validation: Checks that the 7-day acceptance period has elapsed using the
timeElapsedmodifier. Reverts withTimeNotElapsedif called too early. - Upgrade Execution: Calls the internal
_authorizeUpgradefunction to perform the contract upgrade. - State Cleanup: Clears the proposal data after successful upgrade execution.
Related Functions
Upgrade Lifecycle
proposeUpgrade()- Initiate upgrade proposalsrejectProposalUpgrade()- Cancel proposals
State Queries
getUpgradeProposalData()- Monitor proposal statusgetVersion()- Verify upgrade success
The acceptProposalUpgrade function represents the culmination of the upgrade governance process, executing irreversible system changes with appropriate safeguards and validation.