ERC1155 fuzzing properties for Trail of Bit's Echidna and Medusa
Note: Currently the compliant tests might revert (especially test_ERC1155_external_burnBatchRevertOnTransferFromPreviousOwner() ) when the id[] and amounts[] are empty array. It can be patched by requiring non empty arrays in that test function, but currently it remains unfixed assuming if in case any ERC1155 implementation has any specific case with empty arrays or the developer expects specific results when empty array is passed.
properties
balanceOf()should revert on address zerobalanceOfBatchWorks as expectedsafeTransferFrom()should revert while transferring unapproved tokensafeTransferFrom()correctly update balancessafeTransferFrom()should revert iffromis the zero addresssafeTransferFrom()should revert iftois the zero addresssafeTransferFrom()to self should not break accountingsafeBatchTransferFrom()to self should not break accountingsafeBatchTransferFrom()correctly update balancessafeTransferFrom()should revert if receiver is a contract that does not implement onERC1155Received()safeBatchTransferFrom()should revert if receiver is a contract that does not implement onERC1155Received()
burn()destroys token(s)burn()destroys token(s) from approved addressburnBatch()destroys token(s)burnBatch()destroys token(s) from approved address- cannot transfer a burned token
- burned token(s) should not be transferrable when burned with burnBatch
- Should mint tokens and should increase balance
- Should mint tokens in batch and should increase balance
$ forge buildExternal
echidna src/ERC1155/external/test/standard/ERC1155BasicTests.sol --contract ERC1155BasicExternalHarness --config src/ERC1155/external/test/echidna.config.yaml
echidna src/ERC1155/external/test/standard/ERC1155BurnableTests.sol --contract ERC1155BurnableExternalHarness --config src/ERC1155/external/test/echidna.config.yaml
echidna src/ERC1155/external/test/standard/ERC1155CompliantTests.sol --contract ERC1155CompliantExternalHarness --config src/ERC1155/external/test/echidna.config.yaml
echidna src/ERC1155/external/test/standard/ERC1155MintableTests.sol --contract ERC1155MintableExternalHarness --config src/ERC1155/external/test/echidna.config.yaml
Internal
echidna src/ERC1155/internal/test/standard/ERC1155BasicTests.sol --contract ERC1155BasicTestsInternal --config src/ERC1155/internal/test/echidna.config.yaml
echidna src/ERC1155/internal/test/standard/ERC1155Compliant.sol --contract ERC1155Compliant --config src/ERC1155/internal/test/echidna.config.yaml
echidna src/ERC1155/internal/test/standard/ERC1155MintableTests.sol --contract ERC1155MintableTestsInternal --config src/ERC1155/internal/test/echidna.config.yaml
echidna src/ERC1155/internal/test/standard/ERC1155BurnableTests.sol --contract ERC1155BurnableTestsInternal --config src/ERC1155/internal/test/echidna.config.yaml