From 768421fa049948edfafaf92ca4cef9dff17dfc2a Mon Sep 17 00:00:00 2001 From: Daejun Park Date: Wed, 16 Aug 2023 11:15:02 -0700 Subject: [PATCH] chore: update tests for the latest interface --- test/IdRegistry/IdRegistry.symbolic.t.sol | 12 ++++++------ test/KeyRegistry/KeyRegistry.symbolic.t.sol | 11 ++++------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/test/IdRegistry/IdRegistry.symbolic.t.sol b/test/IdRegistry/IdRegistry.symbolic.t.sol index 08f63945..c7866a1f 100644 --- a/test/IdRegistry/IdRegistry.symbolic.t.sol +++ b/test/IdRegistry/IdRegistry.symbolic.t.sol @@ -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"); @@ -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 @@ -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); @@ -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); diff --git a/test/KeyRegistry/KeyRegistry.symbolic.t.sol b/test/KeyRegistry/KeyRegistry.symbolic.t.sol index 8200b2f3..28338ab1 100644 --- a/test/KeyRegistry/KeyRegistry.symbolic.t.sol +++ b/test/KeyRegistry/KeyRegistry.symbolic.t.sol @@ -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 @@ -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);