-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #515 from ava-labs/set-min-version
L-02 No Ability to Specify the Initial _minTeleporterVersion
- Loading branch information
Showing
14 changed files
with
149 additions
and
78 deletions.
There are no files selected for viewing
8 changes: 4 additions & 4 deletions
8
abi-bindings/go/teleporter/tests/TestMessenger/TestMessenger.go
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,13 +17,18 @@ import {Ownable} from "@openzeppelin/[email protected]/access/Ownable.sol"; | |
abstract contract TeleporterRegistryOwnableApp is TeleporterRegistryApp, Ownable { | ||
constructor( | ||
address teleporterRegistryAddress, | ||
address initialOwner | ||
) TeleporterRegistryApp(teleporterRegistryAddress) Ownable(initialOwner) {} | ||
address initialOwner, | ||
uint256 minTeleporterVersion | ||
) | ||
TeleporterRegistryApp(teleporterRegistryAddress, minTeleporterVersion) | ||
Ownable(initialOwner) | ||
{} | ||
|
||
/** | ||
* @dev See {TeleporterRegistryApp-_checkTeleporterRegistryAppAccess} | ||
* | ||
* Checks that the caller is the owner of the contract for upgrade access. | ||
* Checks that the caller is the owner of the contract for updating {minTeleporterVersion}, | ||
* and pausing/unpausing specific Teleporter version interactions. | ||
*/ | ||
function _checkTeleporterRegistryAppAccess() internal view virtual override { | ||
_checkOwner(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,13 +16,18 @@ import {Ownable} from "@openzeppelin/[email protected]/access/Ownable.sol"; | |
contract TeleporterRegistryOwnableAppTest is BaseTeleporterRegistryOwnableAppTest { | ||
function setUp() public virtual override { | ||
BaseTeleporterRegistryOwnableAppTest.setUp(); | ||
ownerApp = new ExampleRegistryOwnableApp(address(teleporterRegistry), DEFAULT_OWNER_ADDRESS); | ||
ownerApp = new ExampleRegistryOwnableApp( | ||
address(teleporterRegistry), DEFAULT_OWNER_ADDRESS, teleporterRegistry.latestVersion() | ||
); | ||
app = ExampleRegistryApp(address(ownerApp)); | ||
} | ||
|
||
function testZeroInitialOwner() public virtual { | ||
uint256 minTeleporterVersion = teleporterRegistry.latestVersion(); | ||
vm.expectRevert(abi.encodeWithSelector(Ownable.OwnableInvalidOwner.selector, address(0))); | ||
ownerApp = new ExampleRegistryOwnableApp(address(teleporterRegistry), address(0)); | ||
ownerApp = new ExampleRegistryOwnableApp( | ||
address(teleporterRegistry), address(0), minTeleporterVersion | ||
); | ||
} | ||
} | ||
|
||
|
@@ -31,15 +36,18 @@ contract TeleporterRegistryOwnableAppUpgradeableTest is BaseTeleporterRegistryOw | |
BaseTeleporterRegistryOwnableAppTest.setUp(); | ||
ExampleRegistryOwnableAppUpgradeable upgradeableApp = | ||
new ExampleRegistryOwnableAppUpgradeable(); | ||
upgradeableApp.initialize(address(teleporterRegistry), DEFAULT_OWNER_ADDRESS); | ||
upgradeableApp.initialize( | ||
address(teleporterRegistry), DEFAULT_OWNER_ADDRESS, teleporterRegistry.latestVersion() | ||
); | ||
ownerApp = ExampleRegistryOwnableApp(address(upgradeableApp)); | ||
app = ExampleRegistryApp(address(ownerApp)); | ||
} | ||
|
||
function testZeroInitialOwner() public { | ||
ExampleRegistryOwnableAppUpgradeable upgradeableApp = | ||
new ExampleRegistryOwnableAppUpgradeable(); | ||
uint256 minTeleporterVersion = teleporterRegistry.latestVersion(); | ||
vm.expectRevert(abi.encodeWithSelector(Ownable.OwnableInvalidOwner.selector, address(0))); | ||
upgradeableApp.initialize(address(teleporterRegistry), address(0)); | ||
upgradeableApp.initialize(address(teleporterRegistry), address(0), minTeleporterVersion); | ||
} | ||
} |
Oops, something went wrong.