fix: workaround assumePayable

This commit is contained in:
rymnc 2023-03-29 17:51:48 +05:30
parent 7c081c1ad8
commit cae34e64d8
No known key found for this signature in database
GPG Key ID: C740033EE3F41EBD
3 changed files with 10 additions and 1 deletions

View File

@ -45,7 +45,7 @@ jobs:
run: yarn lint
- id: test
run: yarn test
run: yarn test:verbose
- id: coverage
run: yarn coverage

View File

@ -5,6 +5,7 @@
"start": "hardhat node --export-all deployments/allDeployments.json",
"compile": "hardhat compile",
"test": "yarn test:foundry && yarn test:hardhat",
"test:verbose": "yarn test:foundry -vvv && yarn test:hardhat --verbose",
"test:hardhat": "hardhat test",
"test:hardhat:localhost": "yarn test:hardhat --network localhost",
"test:hardhat:sepolia": "yarn test:hardhat --network sepolia",

View File

@ -16,6 +16,9 @@ contract ArrayUnique {
seen[arr[i]] = true;
}
}
// contract in construction goes around the assumePayable() check
receive() external payable {}
}
function repeatElementIntoArray(
@ -160,7 +163,9 @@ contract RLNTest is Test {
address payable to
) public {
// avoid precompiles, etc
// TODO: wrap both of these in a single function
assumePayable(to);
assumeNoPrecompiles(to);
vm.assume(to != address(0));
uint256 idCommitment = poseidon.hash(idSecretHash);
@ -206,6 +211,7 @@ contract RLNTest is Test {
) public {
// avoid precompiles, etc
assumePayable(to);
assumeNoPrecompiles(to);
vm.assume(to != address(0));
uint256 idCommitment = poseidon.hash(idSecretHash);
@ -234,6 +240,7 @@ contract RLNTest is Test {
) public {
// avoid precompiles, etc
assumePayable(to);
assumeNoPrecompiles(to);
vm.assume(isUniqueArray(idSecretHashes) && idSecretHashes.length > 0);
vm.assume(to != address(0));
uint256 idCommitmentlen = idSecretHashes.length;
@ -276,6 +283,7 @@ contract RLNTest is Test {
address payable to
) public {
assumePayable(to);
assumeNoPrecompiles(to);
vm.assume(isUniqueArray(idSecretHashes) && idSecretHashes.length > 0);
vm.assume(to != address(0));