fix: remove console.log, forceProgression bug

This commit is contained in:
rymnc 2023-08-23 16:58:27 +05:30
parent 3402f957dd
commit 44224b1dca
No known key found for this signature in database
GPG Key ID: AAA088D5C68ECD34
3 changed files with 11 additions and 2 deletions

View File

@ -81,6 +81,7 @@ contract WakuRlnRegistry is Ownable {
}
function forceProgress() external onlyOwner onlyUsableStorage {
if (storages[usingStorageIndex + 1] == address(0)) revert NoStorageContractAvailable();
usingStorageIndex += 1;
}
}

View File

@ -37,7 +37,6 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
solcInput: extendedArtifact.solcInput,
devdoc: extendedArtifact.devdoc,
};
console.log(d);
deployments.save(`WakuRlnStorage_${indexOfStorageToBeDeployed}`, d);
};

View File

@ -52,9 +52,11 @@ contract WakuRlnRegistryTest is Test {
}
function test__forceProgression() public {
wakuRlnRegistry.newStorage();
wakuRlnRegistry.newStorage();
wakuRlnRegistry.forceProgress();
require(wakuRlnRegistry.usingStorageIndex() == 1);
assertEq(wakuRlnRegistry.usingStorageIndex(), 1);
assertEq(wakuRlnRegistry.nextStorageIndex(), 2);
}
function test__SingleRegistration(uint256 commitment) public {
@ -105,4 +107,11 @@ contract WakuRlnRegistryTest is Test {
vm.expectRevert(NoStorageContractAvailable.selector);
wakuRlnRegistry.register(commitments);
}
function test__forceProgression__NoStorageContract() public {
vm.expectRevert(NoStorageContractAvailable.selector);
wakuRlnRegistry.forceProgress();
assertEq(wakuRlnRegistry.usingStorageIndex(), 0);
assertEq(wakuRlnRegistry.nextStorageIndex(), 0);
}
}