Skip to content

Commit

Permalink
chore: ignore version 0 (the dead)
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Jul 28, 2023
1 parent 8358a48 commit be56a7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions l1-contracts/src/core/messagebridge/Registry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ contract Registry is IRegistry {

function _getVersionFor(address _rollup) internal view returns (uint256 version, bool exists) {
version = rollupToVersion[_rollup];
exists = version > 0 || snapshots[0].rollup == _rollup;
return (version, exists);
return (version, version > 0);
}
}
5 changes: 3 additions & 2 deletions l1-contracts/test/Registry.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ contract RegistryTest is Test {
assertEq(address(registry.getInbox()), DEAD);
assertEq(address(registry.getOutbox()), DEAD);

uint256 version = registry.getVersionFor(DEAD);
assertEq(version, 0, "should have version 0 for dead rollup");
vm.expectRevert(abi.encodeWithSelector(Errors.Registry__RollupNotRegistered.selector, DEAD));
registry.getVersionFor(DEAD);
}

function testUpgrade() public {
Expand All @@ -55,6 +55,7 @@ contract RegistryTest is Test {
}

function testRevertUpgradeToSame() public {
registry.upgrade(DEAD, DEAD, DEAD);
vm.expectRevert(abi.encodeWithSelector(Errors.Registry__RollupAlreadyRegistered.selector, DEAD));
registry.upgrade(DEAD, DEAD, DEAD);
}
Expand Down

0 comments on commit be56a7e

Please sign in to comment.