Roman Zajic 65f9e58df9
chore: adversarial tests (#42)
* test: malicious upgrade drains funds

* fix: formatting

* test: show success when unauthorized upgrade after malicious

* test: offchain proof post lazy erase
- multi-user erase reuse race

* fix: line length

* fix: remove offchain lazy erase test - rate limit still applies

* test: timestamp manipulation

* fix: rename tests

* test: front running for registration

* fix: unused variables

* test: register during spam conditions

* fix: delete failing tests
- test_MaliciousUpgradeDrainsFunds
- testFrontrunning_RegistrationRevertsForVictim
- testFrontrunning_SetFillingSpam

* fix: delete MaliciousImplementation

* fix: formatting with a new Foundry version

* test: testEraseAndReuse with Echidna

* fix: remove limit check

* fix: remove test_MultiUserEraseReuseRace
- test_TimestampManipulationRaces

* fix: skip Echidna contract during forge test

* test: Echidna contract with invariants
- registerMembership
- attemptExtensionRace
- attemptErasureRace

* fix: tune config file

* fix: run and cleanup scripts for echidna

* test: Echidna test replay

* fix: Solidity version

* fix: test_attemptExtensionRace_WakuRLN

* fix: invalid commitment in test_attemptExtensionRace_WakuRLN

* fix: invalid commitments in
test_attemptErasureRace_WakuRLN

* fix: line length

* fix: skip all Echidna tests in CI

* chore: fuzz test expansion (#40)

* test: register invalid

* test: multiple registers

* fix: increase max rejects

* test: erasure with fullErase idCommitments

* fix: reduce cyclomatic complexity

* fix: reduce complexity one step less

* fix: run tests in parallel

* fix: undo run tests in parallel - default already

* test: invalid extension with extreme values

* fix: line length

* test: set MaxTotalRateLimit

* test: set ActiveDuration

* test: Merkle inserts

* test: Merkle erasures

* test: GetRateCommitmentsRange

* test: GetMerkleProof

* fix: optimized MerkleInsert MerkleErasures

* fix: update gas snapshot

* test: malicious upgrade drains funds

* fix: formatting

* test: show success when unauthorized upgrade after malicious

* test: offchain proof post lazy erase
- multi-user erase reuse race

* fix: line length

* fix: remove offchain lazy erase test - rate limit still applies

* fix: remove fuzz tests from CI run

* fix: formatting

* fix: formatting coverage

* test: timestamp manipulation

* fix: rename tests

* test: front running for registration

* fix: unused variables

* test: register during spam conditions

* fix: delete failing tests
- test_MaliciousUpgradeDrainsFunds
- testFrontrunning_RegistrationRevertsForVictim
- testFrontrunning_SetFillingSpam

* fix: delete MaliciousImplementation

* fix: formatting with a new Foundry version

* test: testEraseAndReuse with Echidna

* fix: remove limit check

* fix: remove test_MultiUserEraseReuseRace
- test_TimestampManipulationRaces

* fix: skip Echidna contract during forge test

* test: Echidna contract with invariants
- registerMembership
- attemptExtensionRace
- attemptErasureRace

* fix: tune config file

* fix: run and cleanup scripts for echidna

* test: Echidna test replay

* fix: Solidity version

* fix: test_attemptExtensionRace_WakuRLN

* fix: invalid commitment in test_attemptExtensionRace_WakuRLN

* fix: invalid commitments in
test_attemptErasureRace_WakuRLN

* fix: line length

* fix: skip all Echidna tests in CI

* test: register invalid

* test: multiple registers

* fix: increase max rejects

* test: erasure with fullErase idCommitments

* fix: reduce cyclomatic complexity

* fix: reduce complexity one step less

* test: invalid extension with extreme values

* fix: line length

* test: set MaxTotalRateLimit

* test: set ActiveDuration

* test: Merkle inserts

* test: Merkle erasures

* test: GetRateCommitmentsRange

* test: GetMerkleProof

* fix: optimized MerkleInsert MerkleErasures

* fix: update gas snapshot

* fix: formatting

* fix: remove tests with high overlap

* fix: remove all tests originally meant for fuzzing

* fix: rename merged Echidna tests

* fix: formatting

* test: fuzzing for essential invariants

* test: EchidnaTest contract

* fix: remove unnecessary imports

* fix: remove unnecessary helpers

* fix: remove bounds from invariants

* fix: change test mode to property

* fix: update run script

* fix: max_test_rejects back to the original value

* fix: remove unused local variables

* test: malicious upgrade drains funds

* fix: formatting

* test: show success when unauthorized upgrade after malicious

* test: offchain proof post lazy erase
- multi-user erase reuse race

* fix: line length

* fix: remove offchain lazy erase test - rate limit still applies

* test: timestamp manipulation

* fix: rename tests

* test: front running for registration

* fix: unused variables

* test: register during spam conditions

* fix: delete failing tests
- test_MaliciousUpgradeDrainsFunds
- testFrontrunning_RegistrationRevertsForVictim
- testFrontrunning_SetFillingSpam

* fix: delete MaliciousImplementation

* fix: remove test_MultiUserEraseReuseRace
- test_TimestampManipulationRaces

* test: Echidna test replay

* fix: Solidity version

* fix: test_attemptExtensionRace_WakuRLN

* fix: invalid commitment in test_attemptExtensionRace_WakuRLN

* fix: invalid commitments in
test_attemptErasureRace_WakuRLN

* fix: line length

* fix: cleanup after rebase

* fix: remove redundant file

* fix: formatting

* fix: formatting

* fix: adorno + archive EchidnaReplayRaces.t.sol

* test: focus on erasures with timestamps

* fix: remove isolated test

* test: Echidna tests for races
- add dynamic assertions before operation
- untrack erased IDs

* fix: remove unused replay test
2025-11-14 19:16:11 +08:00

73 lines
5.1 KiB
Plaintext

TestStableTokenTest:test__CannotAddAlreadyMinterRole() (gas: 46248)
TestStableTokenTest:test__CannotMintExceedingMaxSupply() (gas: 26253)
TestStableTokenTest:test__CannotMintWithETHExceedingMaxSupply() (gas: 31196)
TestStableTokenTest:test__CannotMintWithZeroETH() (gas: 18269)
TestStableTokenTest:test__CannotRemoveNonMinterRole() (gas: 22686)
TestStableTokenTest:test__CannotSetMaxSupplyBelowTotalSupply() (gas: 71121)
TestStableTokenTest:test__CheckMinterRoleMapping() (gas: 70476)
TestStableTokenTest:test__ContractDoesNotHoldETHAfterMint() (gas: 110659)
TestStableTokenTest:test__ERC20BasicFunctionality() (gas: 146438)
TestStableTokenTest:test__ETHBurnedEventEmitted() (gas: 112577)
TestStableTokenTest:test__ETHIsBurnedToZeroAddress() (gas: 110526)
TestStableTokenTest:test__InitializeZeroReverts() (gas: 2558591)
TestStableTokenTest:test__MaxSupplyIsSetCorrectly() (gas: 15454)
TestStableTokenTest:test__MintRequiresETH() (gas: 18285)
TestStableTokenTest:test__MintWithDifferentETHAmounts() (gas: 209788)
TestStableTokenTest:test__MintWithETH_RevertsBelowOneETH() (gas: 25455)
TestStableTokenTest:test__MintWithETH_SucceedsAtOneETH() (gas: 110063)
TestStableTokenTest:test__MinterAddedEventEmitted() (gas: 44947)
TestStableTokenTest:test__MinterRemovedEventEmitted() (gas: 34662)
TestStableTokenTest:test__MinterRoleCanMint() (gas: 98092)
TestStableTokenTest:test__MultipleMinterRolesCanMint() (gas: 128755)
TestStableTokenTest:test__NonMinterNonOwnerAccountCannotMint() (gas: 22493)
TestStableTokenTest:test__NonOwnerCannotAddMinterRole() (gas: 18223)
TestStableTokenTest:test__NonOwnerCannotRemoveMinterRole() (gas: 45737)
TestStableTokenTest:test__NonOwnerCannotSetMaxSupply() (gas: 18054)
TestStableTokenTest:test__OwnerCanAddMinterRole() (gas: 47248)
TestStableTokenTest:test__OwnerCanMintWithoutMinterRole() (gas: 74382)
TestStableTokenTest:test__OwnerCanRemoveMinterRole() (gas: 36473)
TestStableTokenTest:test__OwnerCanSetMaxSupply() (gas: 30795)
TestStableTokenTest:test__RemovedMinterRoleCannotMint() (gas: 37073)
WakuRlnV2Test:test__EmptyRangePagination() (gas: 307693)
WakuRlnV2Test:test__ErasingNonExistentMembership() (gas: 46131)
WakuRlnV2Test:test__FullCleanUpErasure() (gas: 1016790)
WakuRlnV2Test:test__GracePeriodExtensionEdgeCases() (gas: 328094)
WakuRlnV2Test:test__IdCommitmentToMetadata__DoesntExist() (gas: 25425)
WakuRlnV2Test:test__ImpactOfDurationChangesOnExistingMemberships() (gas: 540089)
WakuRlnV2Test:test__InvalidPaginationQuery__EndIndexGTNextFreeIndex() (gas: 18353)
WakuRlnV2Test:test__InvalidPaginationQuery__StartIndexGTEndIndex() (gas: 16223)
WakuRlnV2Test:test__InvalidRegistration__DuplicateIdCommitment() (gas: 306169)
WakuRlnV2Test:test__InvalidRegistration__FullTree() (gas: 56506)
WakuRlnV2Test:test__InvalidRegistration__InvalidIdCommitment__LargerThanField() (gas: 44077)
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__MassRegistrationAndErasure() (gas: 2714587)
WakuRlnV2Test:test__MaxTotalRateLimitEdgeCases() (gas: 21832122)
WakuRlnV2Test:test__MerkleTreeUpdateAfterErasureAndReuse() (gas: 2426716)
WakuRlnV2Test:test__NonMinterCanMintWithETHAndRegister() (gas: 373332)
WakuRlnV2Test:test__OwnerConfigurationUpdates() (gas: 53177)
WakuRlnV2Test:test__PriceCalculatorReconfiguration() (gas: 669854)
WakuRlnV2Test:test__RegistrationWhenMaxRateLimitIsReached() (gas: 595140)
WakuRlnV2Test:test__ReinitializationProtection() (gas: 80197)
WakuRlnV2Test:test__RemoveAllExpiredMemberships(uint32) (runs: 1000, μ: 4516570, ~: 2259520)
WakuRlnV2Test:test__RemoveExpiredMemberships(uint32) (runs: 1000, μ: 1055797, ~: 1055798)
WakuRlnV2Test:test__TokenTransferFailures() (gas: 4139092)
WakuRlnV2Test:test__UnauthorizedMerkleTreeModifications() (gas: 1113852)
WakuRlnV2Test:test__Upgrade() (gas: 6702671)
WakuRlnV2Test:test__UpgradeWithInvalidImplementation() (gas: 51496)
WakuRlnV2Test:test__ValidPaginationQuery(uint32) (runs: 1000, μ: 378536, ~: 134452)
WakuRlnV2Test:test__ValidPaginationQuery__OneElement() (gas: 301276)
WakuRlnV2Test:test__ValidRegistration(uint32) (runs: 1000, μ: 307650, ~: 307650)
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__ValidRegistrationWithEraseList() (gas: 1337020)
WakuRlnV2Test:test__ValidRegistration__kats() (gas: 277614)
WakuRlnV2Test:test__WithdrawToken(uint32) (runs: 1000, μ: 283285, ~: 283286)
WakuRlnV2Test:test__ZeroGracePeriodDuration() (gas: 8156320)
WakuRlnV2Test:test__ZeroPriceEdgeCase() (gas: 791643)
WakuRlnV2Test:test__indexReuse_eraseMemberships(uint32) (runs: 1000, μ: 4269053, ~: 1835792)