Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
a689ac5
test: register invalid
romanzac Sep 26, 2025
acbfe76
test: multiple registers
romanzac Sep 26, 2025
b2e0421
fix: increase max rejects
romanzac Sep 26, 2025
754c92e
test: erasure with fullErase idCommitments
romanzac Sep 29, 2025
5ba0e5c
fix: reduce cyclomatic complexity
romanzac Sep 29, 2025
e72b0ac
fix: reduce complexity one step less
romanzac Sep 29, 2025
fb525a8
fix: run tests in parallel
romanzac Sep 29, 2025
835f1ab
fix: undo run tests in parallel - default already
romanzac Sep 29, 2025
4f1d5da
Merge branch 'main' into chore-add-fuzz-tests
romanzac Sep 29, 2025
4e7c466
test: invalid extension with extreme values
romanzac Sep 30, 2025
e41e356
fix: line length
romanzac Sep 30, 2025
cb4631c
test: set MaxTotalRateLimit
romanzac Sep 30, 2025
157de1d
test: set ActiveDuration
romanzac Sep 30, 2025
e6c9790
test: Merkle inserts
romanzac Oct 1, 2025
74dd614
test: Merkle erasures
romanzac Oct 1, 2025
b996ba2
test: GetRateCommitmentsRange
romanzac Oct 2, 2025
721a151
test: GetMerkleProof
romanzac Oct 2, 2025
73ae2ac
fix: optimized MerkleInsert MerkleErasures
romanzac Oct 2, 2025
1ae5ac6
fix: update gas snapshot
romanzac Oct 3, 2025
228239b
test: malicious upgrade drains funds
romanzac Oct 7, 2025
f7a328d
fix: formatting
romanzac Oct 7, 2025
597181d
test: show success when unauthorized upgrade after malicious
romanzac Oct 8, 2025
e3e3d31
test: offchain proof post lazy erase
romanzac Oct 9, 2025
842e0f1
fix: line length
romanzac Oct 9, 2025
3bce55a
fix: remove offchain lazy erase test - rate limit still applies
romanzac Oct 9, 2025
d869b68
Merge branch 'main' into chore-add-fuzz-tests
romanzac Oct 12, 2025
f7cc189
fix: remove fuzz tests from CI run
romanzac Oct 12, 2025
8869519
fix: formatting
romanzac Oct 12, 2025
43c16da
fix: formatting coverage
romanzac Oct 12, 2025
48ec274
test: timestamp manipulation
romanzac Oct 13, 2025
46fbccb
fix: rename tests
romanzac Oct 13, 2025
e629c8f
Merge branch 'main' into chore-adversarial-tests
romanzac Oct 13, 2025
b2d6cdb
test: front running for registration
romanzac Oct 15, 2025
434c740
fix: unused variables
romanzac Oct 15, 2025
704f017
test: register during spam conditions
romanzac Oct 15, 2025
192fe28
fix: delete failing tests
romanzac Oct 20, 2025
d746ef1
fix: delete MaliciousImplementation
romanzac Oct 20, 2025
499d900
fix: formatting with a new Foundry version
romanzac Oct 20, 2025
38f506c
test: testEraseAndReuse with Echidna
romanzac Oct 24, 2025
199ed30
fix: remove limit check
romanzac Oct 24, 2025
6db28fa
fix: remove test_MultiUserEraseReuseRace
romanzac Oct 27, 2025
0be6279
fix: skip Echidna contract during forge test
romanzac Oct 27, 2025
ab0aed0
test: Echidna contract with invariants
romanzac Oct 27, 2025
f735f68
fix: tune config file
romanzac Oct 27, 2025
d785610
fix: run and cleanup scripts for echidna
romanzac Oct 27, 2025
6541acc
test: Echidna test replay
romanzac Oct 28, 2025
2466d86
fix: Solidity version
romanzac Oct 28, 2025
5a2364a
fix: test_attemptExtensionRace_WakuRLN
romanzac Oct 28, 2025
c4d0e7f
fix: invalid commitment in test_attemptExtensionRace_WakuRLN
romanzac Oct 29, 2025
910f757
fix: invalid commitments in
romanzac Oct 29, 2025
1cd3c91
fix: line length
romanzac Oct 29, 2025
0238995
fix: skip all Echidna tests in CI
romanzac Oct 29, 2025
2d57fe3
test: register invalid
romanzac Sep 26, 2025
f41cb4c
test: multiple registers
romanzac Sep 26, 2025
37afea8
fix: increase max rejects
romanzac Sep 26, 2025
9e8ba35
test: erasure with fullErase idCommitments
romanzac Sep 29, 2025
c931f31
fix: reduce cyclomatic complexity
romanzac Sep 29, 2025
6b31364
fix: reduce complexity one step less
romanzac Sep 29, 2025
418e014
test: invalid extension with extreme values
romanzac Sep 30, 2025
7f1a7c4
fix: line length
romanzac Sep 30, 2025
b2d9c59
test: set MaxTotalRateLimit
romanzac Sep 30, 2025
95bff4b
test: set ActiveDuration
romanzac Sep 30, 2025
61d5adc
test: Merkle inserts
romanzac Oct 1, 2025
3f787f7
test: Merkle erasures
romanzac Oct 1, 2025
3e64d46
test: GetRateCommitmentsRange
romanzac Oct 2, 2025
b811398
test: GetMerkleProof
romanzac Oct 2, 2025
5a4e007
fix: optimized MerkleInsert MerkleErasures
romanzac Oct 2, 2025
55caf00
fix: update gas snapshot
romanzac Oct 3, 2025
0f22f3e
Merge remote-tracking branch 'origin/chore-add-fuzz-tests' into chore…
romanzac Oct 30, 2025
184914a
fix: formatting
romanzac Oct 30, 2025
c3eb411
fix: remove tests with high overlap
romanzac Oct 30, 2025
416f074
fix: remove all tests originally meant for fuzzing
romanzac Oct 30, 2025
b06eacd
fix: rename merged Echidna tests
romanzac Oct 30, 2025
272c200
fix: formatting
romanzac Oct 30, 2025
be5e1b9
test: fuzzing for essential invariants
romanzac Oct 30, 2025
1f9de37
test: EchidnaTest contract
romanzac Oct 30, 2025
60462ef
fix: remove unnecessary imports
romanzac Oct 31, 2025
34459e3
fix: remove unnecessary helpers
romanzac Oct 31, 2025
c705ca1
fix: remove bounds from invariants
romanzac Oct 31, 2025
2a75fa1
fix: change test mode to property
romanzac Oct 31, 2025
69404eb
fix: update run script
romanzac Oct 31, 2025
9bfa4d1
fix: max_test_rejects back to the original value
romanzac Oct 31, 2025
b2b127a
fix: remove unused local variables
romanzac Oct 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 50 additions & 39 deletions .gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,30 +1,41 @@
TestStableTokenTest:test__CannotAddAlreadyMinterRole() (gas: 46286)
TestStableTokenTest:test__CannotMintExceedingMaxSupply() (gas: 26202)
TestStableTokenTest:test__CannotMintWithETHExceedingMaxSupply() (gas: 31164)
TestStableTokenTest:test__CannotMintWithZeroETH() (gas: 18282)
TestStableTokenTest:test__CannotRemoveNonMinterRole() (gas: 22638)
TestStableTokenTest:test__CannotSetMaxSupplyBelowTotalSupply() (gas: 71114)
TestStableTokenTest:test__CheckMinterRoleMapping() (gas: 70651)
TestStableTokenTest:test__ContractDoesNotHoldETHAfterMint() (gas: 110700)
TestStableTokenTest:test__ERC20BasicFunctionality() (gas: 146240)
TestStableTokenTest:test__ETHBurnedEventEmitted() (gas: 112584)
TestStableTokenTest:test__ETHIsBurnedToZeroAddress() (gas: 110545)
TestStableTokenTest:test__MaxSupplyIsSetCorrectly() (gas: 15409)
TestStableTokenTest:test__MintRequiresETH() (gas: 18254)
TestStableTokenTest:test__MintWithDifferentETHAmounts() (gas: 209672)
TestStableTokenTest:test__MinterAddedEventEmitted() (gas: 44991)
TestStableTokenTest:test__MinterRemovedEventEmitted() (gas: 34697)
TestStableTokenTest:test__MinterRoleCanMint() (gas: 98026)
TestStableTokenTest:test__MultipleMinterRolesCanMint() (gas: 128734)
TestStableTokenTest:test__NonMinterNonOwnerAccountCannotMint() (gas: 22444)
TestStableTokenTest:test__NonOwnerCannotAddMinterRole() (gas: 18239)
TestStableTokenTest:test__NonOwnerCannotRemoveMinterRole() (gas: 45775)
TestStableTokenTest:test__NonOwnerCannotSetMaxSupply() (gas: 18070)
TestStableTokenTest:test__OwnerCanAddMinterRole() (gas: 47336)
TestStableTokenTest:test__OwnerCanMintWithoutMinterRole() (gas: 74316)
TestStableTokenTest:test__OwnerCanRemoveMinterRole() (gas: 36544)
TestStableTokenTest:test__OwnerCanSetMaxSupply() (gas: 30683)
TestStableTokenTest:test__RemovedMinterRoleCannotMint() (gas: 37086)
TestStableTokenTest:test__CannotAddAlreadyMinterRole() (gas: 46264)
TestStableTokenTest:test__CannotMintExceedingMaxSupply() (gas: 26180)
TestStableTokenTest:test__CannotMintWithETHExceedingMaxSupply() (gas: 31142)
TestStableTokenTest:test__CannotMintWithZeroETH() (gas: 18260)
TestStableTokenTest:test__CannotRemoveNonMinterRole() (gas: 22680)
TestStableTokenTest:test__CannotSetMaxSupplyBelowTotalSupply() (gas: 71137)
TestStableTokenTest:test__CheckMinterRoleMapping() (gas: 70674)
TestStableTokenTest:test__ContractDoesNotHoldETHAfterMint() (gas: 110678)
TestStableTokenTest:test__ERC20BasicFunctionality() (gas: 146284)
TestStableTokenTest:test__ETHBurnedEventEmitted() (gas: 112562)
TestStableTokenTest:test__ETHIsBurnedToZeroAddress() (gas: 110523)
TestStableTokenTest:test__InitializeZeroReverts() (gas: 2549161)
TestStableTokenTest:test__MaxSupplyIsSetCorrectly() (gas: 15387)
TestStableTokenTest:test__MintRequiresETH() (gas: 18298)
TestStableTokenTest:test__MintWithDifferentETHAmounts() (gas: 209650)
TestStableTokenTest:test__MinterAddedEventEmitted() (gas: 44969)
TestStableTokenTest:test__MinterRemovedEventEmitted() (gas: 34680)
TestStableTokenTest:test__MinterRoleCanMint() (gas: 98049)
TestStableTokenTest:test__MultipleMinterRolesCanMint() (gas: 128712)
TestStableTokenTest:test__NonMinterNonOwnerAccountCannotMint() (gas: 22487)
TestStableTokenTest:test__NonOwnerCannotAddMinterRole() (gas: 18283)
TestStableTokenTest:test__NonOwnerCannotRemoveMinterRole() (gas: 45753)
TestStableTokenTest:test__NonOwnerCannotSetMaxSupply() (gas: 18048)
TestStableTokenTest:test__OwnerCanAddMinterRole() (gas: 47314)
TestStableTokenTest:test__OwnerCanMintWithoutMinterRole() (gas: 74339)
TestStableTokenTest:test__OwnerCanRemoveMinterRole() (gas: 36526)
TestStableTokenTest:test__OwnerCanSetMaxSupply() (gas: 30706)
TestStableTokenTest:test__RemovedMinterRoleCannotMint() (gas: 37104)
WakuRlnV2Test:testFuzz_Erasure(bool,uint8) (runs: 1000, μ: 984656, ~: 982425)
WakuRlnV2Test:testFuzz_GetMerkleProof(uint32) (runs: 1002, μ: 4104507, ~: 3989323)
WakuRlnV2Test:testFuzz_GetRateCommitmentsRange(uint32,uint32) (runs: 1002, μ: 3669568, ~: 3667740)
WakuRlnV2Test:testFuzz_InvalidExtension(uint256,address,uint256) (runs: 1000, μ: 316358, ~: 316689)
WakuRlnV2Test:testFuzz_MerkleErasures(uint8,bool) (runs: 1001, μ: 3676081, ~: 2201167)
WakuRlnV2Test:testFuzz_MerkleInserts(uint8) (runs: 1001, μ: 3817908, ~: 2690272)
WakuRlnV2Test:testFuzz_MultipleRegisters(uint8) (runs: 1002, μ: 6076714, ~: 3291327)
WakuRlnV2Test:testFuzz_RegisterInvalid(uint256,uint32) (runs: 1000, μ: 60856, ~: 61711)
WakuRlnV2Test:testFuzz_SetActiveDuration(uint32,bool) (runs: 1000, μ: 299053, ~: 312991)
WakuRlnV2Test:testFuzz_SetMaxTotalRateLimit(uint32,bool) (runs: 1000, μ: 420447, ~: 313914)
WakuRlnV2Test:test__EmptyRangePagination() (gas: 307693)
WakuRlnV2Test:test__ErasingNonExistentMembership() (gas: 46131)
WakuRlnV2Test:test__FullCleanUpErasure() (gas: 1016790)
Expand All @@ -40,7 +51,7 @@ WakuRlnV2Test:test__InvalidRegistration__InvalidIdCommitment__Zero() (gas: 42830
WakuRlnV2Test:test__InvalidRegistration__InvalidMembershipRateLimit__MinMax() (gas: 55598)
WakuRlnV2Test:test__InvalidTokenAmount(uint256,uint32) (runs: 1000, μ: 191620, ~: 191620)
WakuRlnV2Test:test__LargePaginationQuery() (gas: 237941853)
WakuRlnV2Test:test__LinearPriceCalculation(uint32) (runs: 1000, μ: 26069, ~: 26069)
WakuRlnV2Test:test__LinearPriceCalculation(uint32) (runs: 1002, μ: 26069, ~: 26069)
WakuRlnV2Test:test__MassRegistrationAndErasure() (gas: 2714587)
WakuRlnV2Test:test__MaxTotalRateLimitEdgeCases() (gas: 21832122)
WakuRlnV2Test:test__MerkleTreeUpdateAfterErasureAndReuse() (gas: 2426716)
Expand All @@ -49,22 +60,22 @@ WakuRlnV2Test:test__OwnerConfigurationUpdates() (gas: 53177)
WakuRlnV2Test:test__PriceCalculatorReconfiguration() (gas: 669789)
WakuRlnV2Test:test__RegistrationWhenMaxRateLimitIsReached() (gas: 595140)
WakuRlnV2Test:test__ReinitializationProtection() (gas: 80197)
WakuRlnV2Test:test__RemoveAllExpiredMemberships(uint32) (runs: 1000, μ: 5020828, ~: 2445573)
WakuRlnV2Test:test__RemoveExpiredMemberships(uint32) (runs: 1000, μ: 1146896, ~: 1146896)
WakuRlnV2Test:test__TokenTransferFailures() (gas: 4114224)
WakuRlnV2Test:test__RemoveAllExpiredMemberships(uint32) (runs: 1001, μ: 5076387, ~: 2445573)
WakuRlnV2Test:test__RemoveExpiredMemberships(uint32) (runs: 1001, μ: 1146896, ~: 1146896)
WakuRlnV2Test:test__TokenTransferFailures() (gas: 4126462)
WakuRlnV2Test:test__UnauthorizedMerkleTreeModifications() (gas: 1113852)
WakuRlnV2Test:test__Upgrade() (gas: 6702671)
WakuRlnV2Test:test__UpgradeWithInvalidImplementation() (gas: 51496)
WakuRlnV2Test:test__ValidPaginationQuery(uint32) (runs: 1000, μ: 393970, ~: 134452)
WakuRlnV2Test:test__ValidPaginationQuery(uint32) (runs: 1001, μ: 386547, ~: 134452)
WakuRlnV2Test:test__ValidPaginationQuery__OneElement() (gas: 301276)
WakuRlnV2Test:test__ValidRegistration(uint32) (runs: 1000, μ: 307585, ~: 307585)
WakuRlnV2Test:test__ValidRegistrationExpiry(uint32) (runs: 1000, μ: 288640, ~: 288640)
WakuRlnV2Test:test__ValidRegistrationExtend(uint32) (runs: 1000, μ: 534996, ~: 534996)
WakuRlnV2Test:test__ValidRegistrationExtendSingleMembership(uint32) (runs: 1000, μ: 296279, ~: 296279)
WakuRlnV2Test:test__ValidRegistrationNoGracePeriod(uint32) (runs: 1000, μ: 292251, ~: 292251)
WakuRlnV2Test:test__ValidRegistration(uint32) (runs: 1001, μ: 307585, ~: 307585)
WakuRlnV2Test:test__ValidRegistrationExpiry(uint32) (runs: 1001, μ: 288640, ~: 288640)
WakuRlnV2Test:test__ValidRegistrationExtend(uint32) (runs: 1001, μ: 534996, ~: 534996)
WakuRlnV2Test:test__ValidRegistrationExtendSingleMembership(uint32) (runs: 1001, μ: 296279, ~: 296279)
WakuRlnV2Test:test__ValidRegistrationNoGracePeriod(uint32) (runs: 1001, μ: 292251, ~: 292251)
WakuRlnV2Test:test__ValidRegistrationWithEraseList() (gas: 1303567)
WakuRlnV2Test:test__ValidRegistration__kats() (gas: 277614)
WakuRlnV2Test:test__WithdrawToken(uint32) (runs: 1000, μ: 277708, ~: 277708)
WakuRlnV2Test:test__WithdrawToken(uint32) (runs: 1001, μ: 277708, ~: 277708)
WakuRlnV2Test:test__ZeroGracePeriodDuration() (gas: 8156320)
WakuRlnV2Test:test__ZeroPriceEdgeCase() (gas: 791578)
WakuRlnV2Test:test__indexReuse_eraseMemberships(uint32) (runs: 1000, μ: 4235383, ~: 1628509)
WakuRlnV2Test:test__indexReuse_eraseMemberships(uint32) (runs: 1001, μ: 4189422, ~: 1421226)
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
)" >> $GITHUB_ENV

- name: "Run the tests"
run: "forge test"
run: 'forge test --no-match-path "test/Echidna*.t.sol"'

- name: "Add test summary"
run: |
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
run: "pnpm install"

- name: "Generate the coverage report using the unit and the integration tests"
run: 'forge coverage --match-path "test/**/*.sol" --report lcov'
run: 'forge coverage --match-path "test/**/*.sol" --no-match-path "test/Echidna*.t.sol" --report lcov'

- name: "Upload coverage report to Codecov"
uses: "codecov/codecov-action@v3"
Expand Down
19 changes: 19 additions & 0 deletions echidna.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
solcArgs: "--via-ir --optimize --optimize-runs 1"
testMode: property
testLimit: 100000 # For ~1 hour on strong CPU; adjust
seqLen: 100 # Sequence length for stateful fuzzing
shrinkLimit: 5000
corpusDir: corpus
deployContracts:
- ["0x0000000000000000000000000000000000001000", "PoseidonT3"]
- ["0x0000000000000000000000000000000000001001", "LazyIMT"]
cryticArgs:
- "--compile-libraries=(PoseidonT3,0x0000000000000000000000000000000000001000),(LazyIMT,0x0000000000000000000000000000000000001001)"
propMaxGas: 25000000
testMaxGas: 25000000
maxTimeDelay: 20000000 # ~231 days in seconds; set high to cover active (180 days / 15552000s) and grace (30 days / 2592000s) periods for expiration races
sender: ["0x10000", "0x20000", "0x30000", "0x40000"] # Multiple senders to simulate different users; expand if needed
balanceAddr: 100000000000000000000
coverage: true
quiet: false
projectName: "WakuRlnV2"
5 changes: 5 additions & 0 deletions echidna_cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
rm -rf corpus
rm -f covered*.txt
rm -rf .crytic/
echo "Echidna artifacts cleaned up."
19 changes: 19 additions & 0 deletions echidna_races.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
solcArgs: "--via-ir --optimize --optimize-runs 1"
testMode: assertion
testLimit: 100000 # For ~1 hour on strong CPU; adjust
seqLen: 100 # Sequence length for stateful fuzzing
shrinkLimit: 5000
corpusDir: corpus
deployContracts:
- ["0x0000000000000000000000000000000000001000", "PoseidonT3"]
- ["0x0000000000000000000000000000000000001001", "LazyIMT"]
cryticArgs:
- "--compile-libraries=(PoseidonT3,0x0000000000000000000000000000000000001000),(LazyIMT,0x0000000000000000000000000000000000001001)"
propMaxGas: 25000000
testMaxGas: 25000000
maxTimeDelay: 20000000 # ~231 days in seconds; set high to cover active (180 days / 15552000s) and grace (30 days / 2592000s) periods for expiration races
sender: ["0x10000", "0x20000", "0x30000", "0x40000"] # Multiple senders to simulate different users; expand if needed
balanceAddr: 100000000000000000000
coverage: true
quiet: false
projectName: "WakuRlnV2"
3 changes: 3 additions & 0 deletions run_echidna_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
echidna test/EchidnaTest.t.sol --contract EchidnaTest --config echidna.config.yaml
echidna test/EchidnaTestRaces.t.sol --contract EchidnaTestRaces --config echidna_races.config.yaml
Loading
Loading