Skip to content

the-caliber/ERC1155-fuzzing-properties

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ERC1155 fuzzing properties

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

Basic properties

  • balanceOf() should revert on address zero
  • balanceOfBatch Works as expected
  • safeTransferFrom() should revert while transferring unapproved token
  • safeTransferFrom() correctly update balances
  • safeTransferFrom() should revert if from is the zero address
  • safeTransferFrom() should revert if to is the zero address
  • safeTransferFrom() to self should not break accounting
  • safeBatchTransferFrom() to self should not break accounting
  • safeBatchTransferFrom() correctly update balances
  • safeTransferFrom() 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()

Burnable properties

  • burn() destroys token(s)
  • burn() destroys token(s) from approved address
  • burnBatch() 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

Mintable properties

  • Should mint tokens and should increase balance
  • Should mint tokens in batch and should increase balance

Usage

Build

$ forge build

Test

External

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published