-
Notifications
You must be signed in to change notification settings - Fork 9
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
Intro Host resource to enhance contract account security & add test suite #7
Conversation
Welcome to Codecov 🎉Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment. Thanks for integrating Codecov - We've got you covered ☂️ |
contracts/ContractUpdater.cdc
Outdated
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.
Note this was renamed to StagedContractUpdates.cdc
, but I think the GitHub UI is confused and is reflecting as a delete + new file. There are likely a number of other instances where renaming + changes cause this mixup in the UI - sorry for any confusion!
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.
It would be good to make sure each transaction has a comment at the top describing what it does
access(self) let failedDeployments: {Int: [String]} | ||
|
||
init( | ||
blockUpdateBoundary: UInt64, |
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.
Do we need to validate the blockUpdateBoundary?
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.
I guess we don't know when cadence 1.0 will be released yet, so we can't really choose a block yet
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.
Yeah, that's my thought. I figured we would pass that value on deployment once the boundary is known. The coordinator can also update the value as long as the updated value is advanced.
Thanks for approving @joshuahannan, I'll update transactions missing comments shortly. |
It was realized when reviewing a similar pattern that publishing unrestricted AuthAccount Capabilities introduces enough risk to be considered an anti-pattern.
This PR introduces changes to the (formerly named
ContractUpdater
)StagedContractUpdates
contract that allow contract-hosting accounts to wrap their AuthAccount Capabilities in aHost
resource before publishing to the account that will store theUpdater
resource defining their full update deployment. This restricts the access on the underlying account to the contract update API and nothing else from the time of transfer onward and is significantly safer than passing a full AuthAccount Capability.Also introduced in this PR is a Cadence test suite as well as a testing workflow action on pull request and merge to main.