Skip to content

Commit

Permalink
Added negative tests
Browse files Browse the repository at this point in the history
  • Loading branch information
traiansf committed Dec 20, 2024
1 parent 3b0a7fa commit 23b6a0c
Show file tree
Hide file tree
Showing 3 changed files with 479 additions and 3 deletions.
5 changes: 4 additions & 1 deletion pykwasm/src/pykwasm/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from eth_account import Account
from requests.exceptions import ConnectionError
from web3 import Web3
from web3.exceptions import BadFunctionCallOutput, Web3RPCError
from web3.exceptions import BadFunctionCallOutput, ContractLogicError, Web3RPCError
from web3.middleware import SignAndSendRawMiddlewareBuilder

ABI_MAP = {
Expand Down Expand Up @@ -107,6 +107,9 @@ def run_method(w3, contract, sender, eth, method, params):
msg = f'Node RPC encountered an error: {e.message}'
print(msg, file=sys.stderr)
sys.exit(1)
except ContractLogicError as e:
print(f'Contract logic error: {e.message}', file=sys.stderr)
sys.exit(1)

return (view_like, result_or_receipt)

Expand Down
4 changes: 2 additions & 2 deletions pykwasm/src/pykwasm/kdist/wasm-semantics/ulm-wasm.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ These rules define various integration points between the ULM and our Wasm inter
</ulmWasm>
...
</generatedTop>
) => #if OutVal ==K NO_OUTPUT #then EVMC_INTERNAL_ERROR #else Status #fi
) => #if Status ==Int EVMC_SUCCESS andBool OutVal ==K NO_OUTPUT #then EVMC_INTERNAL_ERROR #else Status #fi
```

Hooks implementation
Expand Down Expand Up @@ -629,7 +629,7 @@ Handle the actual hook calls.
rule
<instrs>
#fail(ulmBytes(BYTES:Bytes)) => #throwException(EVMC_FAILURE, Bytes2String(BYTES))
#fail(ulmBytes(BYTES:Bytes)) => #throwException(EVMC_REVERT, Bytes2String(BYTES))
...
</instrs>
Expand Down
Loading

0 comments on commit 23b6a0c

Please sign in to comment.