-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move registry into governance + btt
- Loading branch information
Showing
31 changed files
with
363 additions
and
137 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
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
7 changes: 4 additions & 3 deletions
7
...re/interfaces/messagebridge/IRegistry.sol → ...s/src/governance/interfaces/IRegistry.sol
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,22 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2023 Aztec Labs. | ||
pragma solidity >=0.8.18; | ||
|
||
/** | ||
* @title Data Structures Library | ||
* @author Aztec Labs | ||
* @notice Library that contains data structures used throughout the Aztec protocol | ||
*/ | ||
library DataStructures { | ||
// docs:start:registry_snapshot | ||
/** | ||
* @notice Struct for storing address of cross communication components and the block number when it was updated | ||
* @param rollup - The address of the rollup contract | ||
* @param blockNumber - The block number of the snapshot | ||
*/ | ||
struct RegistrySnapshot { | ||
address rollup; | ||
uint256 blockNumber; | ||
} | ||
// docs:end:registry_snapshot | ||
} |
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,16 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2023 Aztec Labs. | ||
pragma solidity >=0.8.18; | ||
|
||
/** | ||
* @title Errors Library | ||
* @author Aztec Labs | ||
* @notice Library that contains errors used throughout the Aztec governance | ||
* Errors are prefixed with the contract name to make it easy to identify where the error originated | ||
* when there are multiple contracts that could have thrown the error. | ||
*/ | ||
library Errors { | ||
// Registry | ||
error Registry__RollupNotRegistered(address rollup); // 0xa1fee4cf | ||
error Registry__RollupAlreadyRegistered(address rollup); // 0x3c34eabf | ||
} |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity >=0.8.27; | ||
|
||
import {Test} from "forge-std/Test.sol"; | ||
|
||
import {Registry} from "@aztec/governance/Registry.sol"; | ||
|
||
contract RegistryBase is Test { | ||
Registry internal registry; | ||
|
||
function setUp() public { | ||
registry = new Registry(address(this)); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
l1-contracts/test/governance/registry/getCurentSnapshotTest.t.sol
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,27 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity >=0.8.27; | ||
|
||
import {RegistryBase} from "./Base.t.sol"; | ||
|
||
import {DataStructures} from "@aztec/governance/libraries/DataStructures.sol"; | ||
|
||
contract GetCurrentSnapshotTest is RegistryBase { | ||
function test_GivenOneListedRollup() external { | ||
// it should return the newest | ||
DataStructures.RegistrySnapshot memory snapshot = registry.getCurrentSnapshot(); | ||
assertEq(snapshot.blockNumber, block.number); | ||
assertEq(snapshot.rollup, address(0xdead)); | ||
assertEq(registry.numberOfVersions(), 1); | ||
} | ||
|
||
function test_GivenMultipleListedRollups() external { | ||
// it should return the newest | ||
address rollup = address(uint160(uint256(bytes32("new instance")))); | ||
registry.upgrade(rollup); | ||
|
||
DataStructures.RegistrySnapshot memory snapshot = registry.getCurrentSnapshot(); | ||
assertEq(snapshot.blockNumber, block.number); | ||
assertGt(snapshot.blockNumber, 0); | ||
assertEq(snapshot.rollup, rollup); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
l1-contracts/test/governance/registry/getCurentSnapshotTest.tree
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,5 @@ | ||
GetCurrentSnapshotTest | ||
├── given one listed rollup | ||
│ └── it should return the newest | ||
└── given multiple listed rollups | ||
└── it should return the newest |
Oops, something went wrong.