Skip to content

Commit

Permalink
chore: update tests for the latest interface
Browse files Browse the repository at this point in the history
  • Loading branch information
daejunpark committed Aug 16, 2023
1 parent 1d9c2a4 commit 768421f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
12 changes: 6 additions & 6 deletions test/IdRegistry/IdRegistry.symbolic.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ contract IdRegistrySymTest is SymTest, Test {
assert(idRegistry.idOf(address(0x1001)) == 1);
assert(idRegistry.idOf(address(0x1002)) == 2);

assert(idRegistry.getRecoveryOf(1) == address(0x2001));
assert(idRegistry.getRecoveryOf(2) == address(0x2002));
assert(idRegistry.recoveryOf(1) == address(0x2001));
assert(idRegistry.recoveryOf(2) == address(0x2002));

// Create symbolic addresses
x = svm.createAddress("x");
Expand All @@ -43,7 +43,7 @@ contract IdRegistrySymTest is SymTest, Test {
// Record pre-state
uint256 oldIdX = idRegistry.idOf(x);
uint256 oldIdY = idRegistry.idOf(y);
uint256 oldIdCounter = idRegistry.getIdCounter();
uint256 oldIdCounter = idRegistry.idCounter();
bool oldPaused = idRegistry.paused();

// Execute an arbitrary tx to IdRegistry
Expand All @@ -54,10 +54,10 @@ contract IdRegistrySymTest is SymTest, Test {
// Record post-state
uint256 newIdX = idRegistry.idOf(x);
uint256 newIdY = idRegistry.idOf(y);
uint256 newIdCounter = idRegistry.getIdCounter();
uint256 newIdCounter = idRegistry.idCounter();

// Ensure that there is no recovery address associated with fid 0.
assert(idRegistry.getRecoveryOf(0) == address(0));
assert(idRegistry.recoveryOf(0) == address(0));

// Ensure that idCounter never decreases.
assert(newIdCounter >= oldIdCounter);
Expand Down Expand Up @@ -112,7 +112,7 @@ contract IdRegistrySymTest is SymTest, Test {
uint256 oldIdFrom = idRegistry.idOf(from);
uint256 oldIdTo = idRegistry.idOf(to);
uint256 oldIdOther = idRegistry.idOf(other);
address oldRecoveryFrom = idRegistry.getRecoveryOf(oldIdFrom);
address oldRecoveryFrom = idRegistry.recoveryOf(oldIdFrom);

// Execute recover with symbolic arguments
vm.prank(caller);
Expand Down
11 changes: 4 additions & 7 deletions test/KeyRegistry/KeyRegistry.symbolic.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,16 @@ contract KeyRegistrySymTest is SymTest, Test {
assert(idRegistry.idOf(address(0x1002)) == 2);
assert(idRegistry.idOf(address(0x1003)) == 3);

assert(idRegistry.getRecoveryOf(1) == address(0x2001));
assert(idRegistry.getRecoveryOf(2) == address(0x2002));
assert(idRegistry.getRecoveryOf(3) == address(0x2003));
assert(idRegistry.recoveryOf(1) == address(0x2001));
assert(idRegistry.recoveryOf(2) == address(0x2002));
assert(idRegistry.recoveryOf(3) == address(0x2003));

// Setup KeyRegistry
gracePeriod = svm.createUint(24, "gracePeriod");
keyRegistry = new KeyRegistry(
address(idRegistry),
uint24(gracePeriod),
address(this)
);
keyRegistry.setTrustedCaller(trustedCaller);
assert(keyRegistry.gracePeriod() == gracePeriod);

// Set initial states:
// - fid 1: removed
Expand Down Expand Up @@ -92,7 +89,7 @@ contract KeyRegistrySymTest is SymTest, Test {
uint256 oldCallerId = idRegistry.idOf(caller);

bool isNotMigratedOrGracePeriod =
!keyRegistry.isMigrated() || block.timestamp <= keyRegistry.keysMigratedAt() + gracePeriod;
!keyRegistry.isMigrated() || block.timestamp <= keyRegistry.keysMigratedAt() + keyRegistry.gracePeriod();

// Execute an arbitrary tx to KeyRegistry
vm.prank(caller);
Expand Down

0 comments on commit 768421f

Please sign in to comment.