oasislabs / oasis.js

🕸A web client for the Oasis platform
Apache License 2.0
33 stars 11 forks source link

Transaction Reversion- Logging #306

Closed rebekahkim closed 4 years ago

rebekahkim commented 4 years ago

Description of the bug When deploying a contract, the transaction is reverted because (according to the chain logs) it ran out of gas. However, I have set my gasLimit to maximum possible.

Also, (this is a feature request) having more logs to diagnose the problem would be very helpful.

Steps to reproduce

  1. Deploy app on local chain
  2. ts file
service = await oasis.workspace.OToken.deploy("something", {
      header: {confidential: false},
      gasLimit:'0xf42400',
    });

Local chain logs:

2019-09-24 14:07:40,098 INFO  [state] call_type: TransactionExecuted, sender: 0xb8b3666d8fea887d97ab54f571b8e5020c5c8b58, transaction_hash: 0x1da2396cdb9803f24c16f8552e454a1904c58495eada0aca623f83c4ae7dbf21, success: false, error: Some(OutOfGas)
2019-09-24 14:07:40,098 INFO  [oasis_chain::blockchain] Mined block number 1 containing transaction 0x1da2396cdb9803f24c16f8552e454a1904c58495eada0aca623f83c4ae7dbf21. Gas used: 0x53263b

Error on oasis test on app:

 FAIL  test/service.spec.ts (6.39s)
  OToken
    ✕ deployed (4ms)

  ● OToken › deployed

    transaction reverted: {
      "blockHash": "0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6",
      "blockNumber": "0x1",
      "contractAddress": "0xf8b476862dd4bcaaabb988aa5a459d95e319ac0e",
      "cumulativeGasUsed": "0x53263b",
      "gasUsed": "0x53263b",
      "logs": [],
      "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      "root": null,
      "status": "0x0",
      "transactionHash": "0x1da2396cdb9803f24c16f8552e454a1904c58495eada0aca623f83c4ae7dbf21",
      "transactionIndex": "0x0"
    }

      at new TransactionReverted (node_modules/@oasislabs/web3/src/error.ts:4:3)
      at Web3Gateway.<anonymous> (node_modules/@oasislabs/web3/src/gateway.ts:109:13)
      at step (node_modules/node_modules/tslib/tslib.es6.js:99:23)
      at Object.next (node_modules/node_modules/tslib/tslib.es6.js:80:53)
      at fulfilled (node_modules/node_modules/tslib/tslib.es6.js:70:58)

Expected behavior Transaction executes with enough gas or at least have some helpful logs for reason behind failure.

Environment

rebekahkim commented 4 years ago

See tx-reversion branch here

armaniferrante commented 4 years ago

@rebekahkim is this still a problem after the recent oasis-chain updates (https://github.com/oasislabs/oasis-chain/pull/55)?

rebekahkim commented 4 years ago

Nope but more logging would be nice :) @armaniferrante feel free to close

armaniferrante commented 4 years ago

Thanks closing. We should indeed add more logging into oasis-chain. For now, you can bump the verbosity by using the -v flag.