-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
revoke deployer key from timelock admin #15710
Changes from all commits
02d721d
6e43f5d
2d9ad87
5d41fdf
ed2bab7
f36a558
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -211,3 +211,34 @@ func TransferToDeployer(e deployment.Environment, cfg TransferToDeployerConfig) | |||
e.Logger.Infof("deployer key accepted ownership tx %s", tx.Hash().Hex()) | ||||
return deployment.ChangesetOutput{}, nil | ||||
} | ||||
|
||||
var _ deployment.ChangeSet[RenounceTimelockDeployerConfig] = RenounceTimelockDeployer | ||||
|
||||
type RenounceTimelockDeployerConfig struct { | ||||
ChainSel uint64 | ||||
} | ||||
|
||||
// RenounceTimelockDeployer revokes the deployer key from administering the contract. | ||||
func RenounceTimelockDeployer(e deployment.Environment, cfg RenounceTimelockDeployerConfig) (deployment.ChangesetOutput, error) { | ||||
contracts, err := MaybeLoadMCMSWithTimelockState(e, []uint64{cfg.ChainSel}) | ||||
if err != nil { | ||||
return deployment.ChangesetOutput{}, err | ||||
} | ||||
tl := contracts[cfg.ChainSel].Timelock | ||||
if tl == nil { | ||||
return deployment.ChangesetOutput{}, fmt.Errorf("timelock not found on chain %d", cfg.ChainSel) | ||||
} | ||||
admin, err := tl.ADMINROLE(&bind.CallOpts{}) | ||||
if err != nil { | ||||
return deployment.ChangesetOutput{}, fmt.Errorf("failed to get admin role: %w", err) | ||||
} | ||||
tx, err := tl.RenounceRole(e.Chains[cfg.ChainSel].DeployerKey, admin, e.Chains[cfg.ChainSel].DeployerKey.From) | ||||
if err != nil { | ||||
return deployment.ChangesetOutput{}, fmt.Errorf("failed to revoke deployer key: %w", err) | ||||
} | ||||
if _, err := deployment.ConfirmIfNoError(e.Chains[cfg.ChainSel], tx, err); err != nil { | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to allow this to happen also via an mcms proposal? if so maybe we'll need to add conditional logic depending on the config similar to this one:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not an MCMS proposal, this is done from an EOA since the deployer key has admin role and it renounces its own role |
||||
return deployment.ChangesetOutput{}, err | ||||
} | ||||
e.Logger.Infof("revoked deployer key from owning contract %s", tl.Address().Hex()) | ||||
return deployment.ChangesetOutput{}, nil | ||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth changing to the
tl, ok := contracts[cfg.ChainSel]
otherwise ifnil
it can throw a nil pointer panic