usecannon / cannon

Manage EVM protocol deployments. Inspired by Docker, Terraform, and npm.

Home Page:https://usecannon.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cannon obscures actual error when executing through `interact`

dbeal-eth opened this issue · comments

commented

when using cannon interact from the cli, when encounterign an unexpected revert, its impossible to figure out what the real error is because it is obfuscated. for example:

✔ Pick a FUNCTION: › delegateCollateral(uint128,uint128,address,uint256,uint256)
✔ Function is payable. ETH AMOUNT (in eth units): … 0
✔ accountId (uint128) … 170141183460469231731687303715884105727
  > processed inputs (1): 170141183460469231731687303715884105727
✔ poolId (uint128) … 1
  > processed inputs (1): 1
✔ collateralType (address) … 0x4200000000000000000000000000000000000006
✔ newCollateralAmountD18 (uint256) … 2.0
  > processed inputs (1): 2000000000000000000
✔ leverage (uint256) … 1.0
  > processed inputs (1): 1000000000000000000
❌ txn will most likely fail: [object Object]
✔ Send transaction? … yes
  ❌ Error
    Reason: execution reverted
{
  "reason": "execution reverted",
  "code": "UNPREDICTABLE_GAS_LIMIT",
  "method": "estimateGas",
  "transaction": {
    "from": "0x48914229deDd5A9922f44441ffCCfC2Cb7856Ee9",
    "to": "0xa53346A1684DAB73EFfd048fA40Fb1fA9327fDe9",
    "value": {
      "type": "BigNumber",
      "hex": "0x00"
    },
    "data": "0x7b0532a4000000000000000000000000000000007fffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000100000000000000000000000042000000000000000000000000000000000000060000000000000000000000000000000000000000000000001bc16d674ec800000000000000000000000000000000000000000000000000000de0b6b3a7640000",
    "accessList": null
  },
  "error": {
    "message": "execution reverted",
    "code": 3
  }
}
  ❌ Error
    Reason: txn is null

it should attempt to show the error reason, and decode it if the data is available to decode it.