-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
87 additions
and
26 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity >=0.8.27; | ||
|
||
import {IRegistry} from "./IRegistry.sol"; | ||
|
||
interface ISysstia { | ||
event RegistryUpdated(IRegistry indexed registry); | ||
|
||
function updateRegistry(IRegistry _registry) external; | ||
function claim(address _to) external returns (uint256); | ||
function canonicalRollup() external view returns (address); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity >=0.8.27; | ||
|
||
import {SysstiaBase} from "./Base.t.sol"; | ||
import {Ownable} from "@oz/access/Ownable.sol"; | ||
|
||
import {Registry} from "@aztec/governance/Registry.sol"; | ||
import {IRegistry} from "@aztec/governance/interfaces/IRegistry.sol"; | ||
import {ISysstia} from "@aztec/governance/interfaces/ISysstia.sol"; | ||
|
||
contract UpdateRegistryTest is SysstiaBase { | ||
address internal caller; | ||
|
||
function test_WhenCallerIsNotOwner(address _caller) external { | ||
// it reverts | ||
vm.assume(_caller != sysstia.owner()); | ||
|
||
vm.expectRevert(abi.encodeWithSelector(Ownable.OwnableUnauthorizedAccount.selector, _caller)); | ||
vm.prank(_caller); | ||
sysstia.updateRegistry(IRegistry(address(0xdead))); | ||
} | ||
|
||
function test_WhenCallerIsOwner() external { | ||
// it updates the registry | ||
// it emits a {RegistryUpdated} event | ||
|
||
Registry registry = new Registry(address(this)); | ||
registry.upgrade(address(0xbeef)); | ||
|
||
IRegistry oldRegistry = sysstia.registry(); | ||
address oldCanonical = sysstia.canonicalRollup(); | ||
|
||
vm.prank(sysstia.owner()); | ||
vm.expectEmit(true, true, false, true, address(sysstia)); | ||
emit ISysstia.RegistryUpdated(registry); | ||
sysstia.updateRegistry(registry); | ||
|
||
assertEq(address(sysstia.registry()), address(registry)); | ||
assertNotEq(address(oldRegistry), address(registry)); | ||
assertEq(sysstia.canonicalRollup(), address(0xbeef)); | ||
assertNotEq(oldCanonical, address(0xbeef)); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
UpdateRegistryTest | ||
├── when caller is not owner | ||
│ └── it reverts | ||
└── when caller is owner | ||
├── it updates the registry | ||
└── it emits a {RegistryUpdated} event |
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