diff --git a/.gas-snapshot b/.gas-snapshot index 420ecbf..629e9b9 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,17 +1,18 @@ RlnTest:test__Constants() (gas: 8619) -RlnTest:test__InvalidRegistration__DuplicateCommitment(uint256) (runs: 1000, μ: 144113, ~: 144113) -RlnTest:test__InvalidRegistration__FullSet() (gas: 1433224) -RlnTest:test__InvalidRegistration__InsufficientDeposit(uint256) (runs: 1000, μ: 17440, ~: 17440) -RlnTest:test__InvalidRegistration__InvalidIdCommitment(uint256) (runs: 1000, μ: 17053, ~: 17058) -RlnTest:test__InvalidRegistration__InvalidUserMessageLimit() (gas: 17055) -RlnTest:test__InvalidRegistration__MaxUserMessageLimit() (gas: 17203) -RlnTest:test__InvalidSlash__InvalidProof() (gas: 1081919) -RlnTest:test__InvalidSlash__MemberNotRegistered(uint256) (runs: 1000, μ: 32521, ~: 32521) -RlnTest:test__InvalidSlash__NoStake(uint256,address) (runs: 1000, μ: 319630, ~: 319682) -RlnTest:test__InvalidSlash__ToRlnAddress() (gas: 151034) -RlnTest:test__InvalidSlash__ToZeroAddress() (gas: 150939) -RlnTest:test__InvalidWithdraw__InsufficientContractBalance() (gas: 145224) +RlnTest:test__InvalidRegistration__DuplicateCommitment(uint256) (runs: 1000, μ: 144283, ~: 144283) +RlnTest:test__InvalidRegistration__FullSet() (gas: 1576547) +RlnTest:test__InvalidRegistration__InsufficientDeposit(uint256) (runs: 1000, μ: 17525, ~: 17525) +RlnTest:test__InvalidRegistration__InvalidIdCommitment(uint256) (runs: 1000, μ: 17098, ~: 17103) +RlnTest:test__InvalidRegistration__InvalidUserMessageLimit() (gas: 17100) +RlnTest:test__InvalidRegistration__MaxUserMessageLimit() (gas: 17248) +RlnTest:test__InvalidSlash__InvalidProof() (gas: 1224746) +RlnTest:test__InvalidSlash__MemberNotRegistered(uint256) (runs: 1000, μ: 30343, ~: 30343) +RlnTest:test__InvalidSlash__NoStake(uint256,address) (runs: 1000, μ: 319489, ~: 319497) +RlnTest:test__InvalidSlash__ToRlnAddress() (gas: 151119) +RlnTest:test__InvalidSlash__ToZeroAddress() (gas: 151024) +RlnTest:test__InvalidWithdraw__InsufficientContractBalance() (gas: 145148) RlnTest:test__InvalidWithdraw__InsufficientWithdrawalBalance() (gas: 10538) -RlnTest:test__ValidRegistration(uint256) (runs: 1000, μ: 135760, ~: 135760) -RlnTest:test__ValidSlash(uint256,address) (runs: 1000, μ: 203402, ~: 203412) -RlnTest:test__ValidWithdraw(address) (runs: 1000, μ: 202120, ~: 202108) \ No newline at end of file +RlnTest:test__ValidRegistration(uint256) (runs: 1000, μ: 135845, ~: 135845) +RlnTest:test__ValidSlash(uint256,address) (runs: 1000, μ: 203288, ~: 203297) +RlnTest:test__ValidWithdraw(address) (runs: 1000, μ: 202042, ~: 202032) +RlnTest:test__root() (gas: 8178268) \ No newline at end of file diff --git a/src/BinaryIMTMemory.sol b/src/BinaryIMTMemory.sol index a340724..98eeca8 100644 --- a/src/BinaryIMTMemory.sol +++ b/src/BinaryIMTMemory.sol @@ -1,9 +1,10 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.4; +pragma solidity ^0.8.19; import { PoseidonT3 } from "poseidon-solidity/PoseidonT3.sol"; // stripped down version of +// solhint-disable-next-line max-line-length // https://github.com/privacy-scaling-explorations/zk-kit/blob/718a5c2fa0f6cd577cee3fd08373609ac985d3bb/packages/imt.sol/contracts/internal/InternalBinaryIMT.sol // that allows getting the root of the rln tree without expensive storage reads/writes struct BinaryIMTMemoryData { @@ -61,6 +62,7 @@ library BinaryIMTMemory { uint256 public constant Z_20 = 15_019_797_232_609_675_441_998_260_052_101_280_400_536_945_603_062_888_308_240_081_994_073_687_793_470; + // solhint-disable-next-line code-complexity function defaultZero(uint256 index) public pure returns (uint256) { if (index == 0) return Z_0; if (index == 1) return Z_1;