-
Notifications
You must be signed in to change notification settings - Fork 23
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
Non upgradeable TeleporterRegistryApps #458
Conversation
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.
To aid with review, what commit are the non-upgradeable variants sourced from?
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.
https://github.com/ava-labs/teleporter/blob/c6c6117c99ef0a426595c8ae2c536dc89eeea735/contracts/src/teleporter/registry/TeleporterUpgradeable.sol main
before the upgradability PR was merged
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.
Thanks!
* | ||
* @custom:security-contact https://github.com/ava-labs/teleporter/blob/main/SECURITY.md | ||
*/ | ||
abstract contract TeleporterRegistryApp is Context, ITeleporterReceiver, ReentrancyGuard { |
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.
Would it make sense to add a ITeleporterRegistryApp
interface that both the upgradeable and non-upgradeable versions implement?
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.
To aid in review, I'd suggest we defer this to a separate PR.
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.
This may require more changes. Right now most of the functions are public
, and for interfaces the visibility would need to be made external
. The functions were made public
so that inherited contracts can still call these functions internally without doing this.func
. To still provide the ability to call internally, we could go through the external calling internal logic pattern.
function _erc7201StorageSlot(bytes memory storageName) private pure returns (bytes32) { | ||
return keccak256( | ||
abi.encode( | ||
uint256(keccak256(abi.encodePacked("avalanche-ictt.storage.", storageName))) - 1 |
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.
Should this be "teleporter.storage"?
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.
nice catch, wasn't sure if this should be icm but will stick with teleporter for now
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.
nvm in the contract already uses teleporter used the wrong name for test
Co-authored-by: Michael Kaplan <[email protected]> Signed-off-by: minghinmatthewlam <[email protected]>
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.
One suggestion to rename a function as well, and it looks like the ABI bindings need to be regenerated. Otherwise, LGTM
* | ||
* Checks that the caller is the owner of the contract for upgrade access. | ||
*/ | ||
function _checkTeleporterUpgradeAccess() internal view virtual override { |
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.
Should we rename this function to something like _checkTeleporterRegistryAccess
? Don't want to overload the term "upgrade" in a non-upgradeable contract.
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.
changed to _changeTeleporterRegistryAppAccess
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.
LGTM!
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.
👍
Why this should be merged
Fixes #416 and #421
How this works
How this was tested
Restructured unit tests so that there are base tests to cover both non-upgradeable and upgradeable versions of the TeleporterRegistryApp contracts.
How is this documented
update README to include upgradeable contracts