Skip to content

Instantly share code, notes, and snippets.

@jwasinger
Last active January 24, 2018 14:33
Show Gist options
  • Save jwasinger/50be4eaf540e46fdb7c64d91e6368110 to your computer and use it in GitHub Desktop.
Save jwasinger/50be4eaf540e46fdb7c64d91e6368110 to your computer and use it in GitHub Desktop.

EWASM Test Cases:

{interface method}

  • {test name} - {test description

getAddress

  • getAddress - Transaction to account with code which calls getAddress and stores the result to storage

getBlockHash (should this be a Blockchain test?)

  • getBlockHash - Transaction to account with code which calls getBlockHash with a value of 0 and stores the result to storage

getCaller

  • getCaller - Transaction to account with code which calls getBlockHash with a value of 0 and stores the result to storage. Expect the result to be Genesis block hash

getCodeSize

  • getCodeSize - Transaction to account with code which calls getCodeSize and stores the result to storage. Expect the result to be the length of the account's code

getBlockDifficulty

  • getBlockDifficulty - Transaction to account with code which calls getBlockDifficulty and stores the result to storage. Expect the result to be predefined difficulty

getGasLeft

  • getGasLeft - Transaction to account with code which calls useGas(1000000), then getGasLeft and stores the result to storage. Expect resulting_gas = gasLimit - 1000000 - base_tx_cost

getBlockNumber (should this be a Blockchain test?)

  • getBlockNumber - Transaction to account with code which calls getBlockNumber, and stores the result to storage. Expect predefined block number 1 to be stored in storage.

selfDestruct

  • selfDestruct - Transaction to account which selfDestructs to the transaction originator. Expect that the transaction originator receives the funds from the self-destructed account and the self-destructed account doesn't exist after the transaction is complete.

callDelegate

callStatic

useGas

  • useGas - Transaction to account which calls useGas(1000). Expect that the account which received the transaction has balance=balance-(1000+metered_code_cost)

getCallDataSize

  • getCallDataSize - Transaction (containing large amount of data) to an account with code that calls getCallDataSize and stores the result to storage. Expect that the value stored is equal to the size of the call data passed with the transaction.

getBalance:

  • getBalanceExt - Transaction to an account with code which calls getBalance on an account other than itself
  • getBalance - Transaction to an account with code which calls getBalance on itself

call

  • call - Transaction to an account which calls another account which stores a value to storage

storageLoad

  • storageLoad - Transaction to an account with code that loads a value already stored in storage and stores it in another storage location.

codeCopy

  • codeCopy - Transaction to an account with code which copies 10 bytes from the account's code and stores them in storage.

externalCodeCopy

  • extCodeCopy - Transaction to an account with code which copies 10 bytes from the code of another account and stores them in storage.

getBlockGasLimit

  • getBlockGasLimit - Transaction to an account with code which calls getBlockGasLimit and stores the result to storage.

getTxGasPrice (should this be a Blockchain test?)

  • getTxGasPrice - Transaction to an account with code which calls getTxGasPrice and stores the result to storage.

getTxOrigin (should this be a Blockchain test?)

  • getTxOrigin - Transaction to an account with code which calls getTxOrigin and stores the result to storage.

getBlockTimestamp (should this be a Blockchain test?)

  • getBlockTimestamp - Transaction to an account with code which calls getTxOrigin and stores the result to storage.

return

create

callDataCopy

  • callDataCopy - Transaction with data to an account with code which calls callDataCopy and stores the result to storage.

callCode

  • callCode - Transaction with data to an account with code which calls callCode with the code of another account. The code stores a value to storage. The contract which invoked the callCode also stores the return value from callCode in storage to ensure the call is successful.

storageStore

getCallValue

  • getCallValue - Transaction with value to an account which calls getCallValue and stores the value passed to storage.

getBlockCoinbase

  • getBlockCoinbase - Transaction with value to an account which calls getBlockCoinbase and stores the value passed to storage.

getExternalCodeSize

  • getBlockCoinbase - Transaction to account which calls getExternalCodeSize with its own address, stores the result to storage, then calls getExternalCodeSize with another account's address and stores the result to another storage location.

revert

getReturnDataSize

returnDataCopy

createFromTransaction

log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment