fix: existing tests

This commit is contained in:
Richard Ramos 2024-04-22 14:34:28 -04:00
parent 3d668ddbea
commit 13b73d349e
No known key found for this signature in database
GPG Key ID: 1CE87DB518195760
3 changed files with 13 additions and 7 deletions

View File

@ -16,9 +16,14 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
log: true,
});
let initializeAbi = ["function initialize(address _poseidonHasher)"];
let initializeAbi = [
"function initialize(address _poseidonHasher, uint40 _ttl)",
];
let iface = new hre.ethers.utils.Interface(initializeAbi);
const data = iface.encodeFunctionData("initialize", [poseidonHasherAddress]);
const data = iface.encodeFunctionData("initialize", [
poseidonHasherAddress,
0,
]);
await deploy("WakuRlnRegistry_Proxy", {
contract: "ERC1967Proxy",

View File

@ -16,13 +16,14 @@ contract WakuRlnTest is Test {
uint256 public constant MEMBERSHIP_DEPOSIT = 1000000000000000;
uint256 public constant DEPTH = 20;
uint256 public constant SET_SIZE = 1048576;
uint40 public constant TTL = 100;
uint256[8] public zeroedProof = [0, 0, 0, 0, 0, 0, 0, 0];
/// @dev Setup the testing environment.
function setUp() public {
poseidon = new PoseidonHasher();
wakuRln = new WakuRln(address(poseidon), 0);
wakuRln = new WakuRln(address(poseidon), 0, TTL);
}
/// @dev Ensure that you can hash a value.

View File

@ -19,7 +19,7 @@ contract WakuRlnRegistryTest is Test {
function setUp() public {
poseidonHasher = new PoseidonHasher();
address implementation = address(new WakuRlnRegistry());
bytes memory data = abi.encodeCall(WakuRlnRegistry.initialize, address(poseidonHasher));
bytes memory data = abi.encodeCall(WakuRlnRegistry.initialize, (address(poseidonHasher), 0));
address proxy = address(new ERC1967Proxy(implementation, data));
wakuRlnRegistry = WakuRlnRegistry(proxy);
}
@ -29,14 +29,14 @@ contract WakuRlnRegistryTest is Test {
}
function test__RegisterStorage_BadIndex() public {
wakuRlnRegistry.registerStorage(address(new WakuRln(address(poseidonHasher), 0)));
address newStorage = address(new WakuRln(address(poseidonHasher), 0));
wakuRlnRegistry.registerStorage(address(new WakuRln(address(poseidonHasher), 0, 0)));
address newStorage = address(new WakuRln(address(poseidonHasher), 0, 0));
vm.expectRevert(IncompatibleStorageIndex.selector);
wakuRlnRegistry.registerStorage(newStorage);
}
function test__RegisterStorage_BadImpl() public {
address newStorage = address(new WakuRln(address(new PoseidonHasher()), 0));
address newStorage = address(new WakuRln(address(new PoseidonHasher()), 0, 0));
vm.expectRevert(IncompatibleStorage.selector);
wakuRlnRegistry.registerStorage(newStorage);
}