etherspot / skandha

A modular typescript implementation of ERC4337 (Account Abstraction) bundler client.
https://etherspot.io
MIT License
561 stars 56 forks source link

[ERROR] Invalid Bignumber value - eth_estimateUserOperationGas #167

Closed saqlain1020 closed 5 months ago

saqlain1020 commented 6 months ago

Describe the bug

I am getting invalid bignumber value undefined error when doing estimateUserOperationGas call, i am using blockpi node rpc. Haven't tried debugging it yet, cause i am running docker image. I have attached the error below.

Expected behavior

It should not throw any error and return gas limits for userOp

Steps to reproduce

No response

Additional context

Running master branch commit 60bb0684245afdce02eb8ccb9022c3c6439c2a03 Created Docker image using provided command, on windows 11.

Error log (Docker Desktop)

2024-03-26 22:49:33 [17:49:33.087] INFO (1): REQUEST ::
2024-03-26 22:49:33     reqId: "req-3"
2024-03-26 22:49:33     method: "POST"
2024-03-26 22:49:33     url: "/80001"
2024-03-26 22:49:33     body: {
2024-03-26 22:49:33       "jsonrpc": "2.0",
2024-03-26 22:49:33       "id": 2,
2024-03-26 22:49:33       "method": "eth_estimateUserOperationGas",
2024-03-26 22:49:33       "params": [
2024-03-26 22:49:33         {
2024-03-26 22:49:33           "sender": "0xB64A8C01486E5E126954961a99E4518b22187C4b",
2024-03-26 22:49:33           "nonce": "0x1b",
2024-03-26 22:49:33           "initCode": "0x",
2024-03-26 22:49:33           "callData": "0x0000189a0000000000000000000000003870419ba2bbf0127060bcb37f69a1b1c090992b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004440c10f19000000000000000000000000b64a8c01486e5e126954961a99e4518b22187c4b00000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000",
2024-03-26 22:49:33           "maxFeePerGas": "0x69275dabb",
2024-03-26 22:49:33           "maxPriorityFeePerGas": "0x69275daa8",
2024-03-26 22:49:33           "paymasterAndData": "0x",
2024-03-26 22:49:33           "signature": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000001c5b32F37F5beA87BDD5374eB2aC54eA8e000000000000000000000000000000000000000000000000000000000000004181d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b00000000000000000000000000000000000000000000000000000000000000"
2024-03-26 22:49:33         },
2024-03-26 22:49:33         "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
2024-03-26 22:49:33       ]
2024-03-26 22:49:33     }
2024-03-26 22:49:33 [17:49:33.507] ERROR (1): invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0)
2024-03-26 22:49:33     err: {
2024-03-26 22:49:33       "type": "Error",
2024-03-26 22:49:33       "message": "invalid BigNumber value (argument=\"value\", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0)",
2024-03-26 22:49:33       "stack":
2024-03-26 22:49:33           Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0)
2024-03-26 22:49:33               at Logger.makeError (/usr/app/node_modules/@ethersproject/logger/lib/index.js:238:21)
2024-03-26 22:49:33               at Logger.throwError (/usr/app/node_modules/@ethersproject/logger/lib/index.js:247:20)
2024-03-26 22:49:33               at Logger.throwArgumentError (/usr/app/node_modules/@ethersproject/logger/lib/index.js:250:21)
2024-03-26 22:49:33               at BigNumber.from (/usr/app/node_modules/@ethersproject/bignumber/lib/bignumber.js:239:23)
2024-03-26 22:49:33               at NumberCoder.encode (/usr/app/node_modules/@ethersproject/abi/lib/coders/number.js:36:39)
2024-03-26 22:49:33               at /usr/app/node_modules/@ethersproject/abi/lib/coders/array.js:74:19
2024-03-26 22:49:33               at Array.forEach (<anonymous>)
2024-03-26 22:49:33               at pack (/usr/app/node_modules/@ethersproject/abi/lib/coders/array.js:60:12)
2024-03-26 22:49:33               at TupleCoder.encode (/usr/app/node_modules/@ethersproject/abi/lib/coders/tuple.js:71:33)
2024-03-26 22:49:33               at AbiCoder.encode (/usr/app/node_modules/@ethersproject/abi/lib/abi-coder.js:91:15)
2024-03-26 22:49:33       "reason": "invalid BigNumber value",
2024-03-26 22:49:33       "code": "INVALID_ARGUMENT",
2024-03-26 22:49:33       "argument": "value"
2024-03-26 22:49:33     }
2024-03-26 22:49:33 [17:49:33.507] INFO (1): RESPONSE ::
2024-03-26 22:49:33     reqId: "req-3"
2024-03-26 22:49:33     body: {
2024-03-26 22:49:33       "error": "Unexpected behaviour"
2024-03-26 22:49:33     }

Operating system

Windows

Skandha version or commit hash

60bb0684245afdce02eb8ccb9022c3c6439c2a03

ch4r10t33r commented 6 months ago

Describe the bug

I am getting invalid bignumber value undefined error when doing estimateUserOperationGas call, i am using blockpi node rpc. Haven't tried debugging it yet, cause i am running docker image. I have attached the error below.

Expected behavior

It should not throw any error and return gas limits for userOp

Steps to reproduce

No response

Additional context

Running master branch commit 60bb0684245afdce02eb8ccb9022c3c6439c2a03 Created Docker image using provided command, on windows 11.

Error log (Docker Desktop)

2024-03-26 22:49:33 [17:49:33.087] INFO (1): REQUEST ::
2024-03-26 22:49:33     reqId: "req-3"
2024-03-26 22:49:33     method: "POST"
2024-03-26 22:49:33     url: "/80001"
2024-03-26 22:49:33     body: {
2024-03-26 22:49:33       "jsonrpc": "2.0",
2024-03-26 22:49:33       "id": 2,
2024-03-26 22:49:33       "method": "eth_estimateUserOperationGas",
2024-03-26 22:49:33       "params": [
2024-03-26 22:49:33         {
2024-03-26 22:49:33           "sender": "0xB64A8C01486E5E126954961a99E4518b22187C4b",
2024-03-26 22:49:33           "nonce": "0x1b",
2024-03-26 22:49:33           "initCode": "0x",
2024-03-26 22:49:33           "callData": "0x0000189a0000000000000000000000003870419ba2bbf0127060bcb37f69a1b1c090992b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004440c10f19000000000000000000000000b64a8c01486e5e126954961a99e4518b22187c4b00000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000",
2024-03-26 22:49:33           "maxFeePerGas": "0x69275dabb",
2024-03-26 22:49:33           "maxPriorityFeePerGas": "0x69275daa8",
2024-03-26 22:49:33           "paymasterAndData": "0x",
2024-03-26 22:49:33           "signature": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000001c5b32F37F5beA87BDD5374eB2aC54eA8e000000000000000000000000000000000000000000000000000000000000004181d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b00000000000000000000000000000000000000000000000000000000000000"
2024-03-26 22:49:33         },
2024-03-26 22:49:33         "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
2024-03-26 22:49:33       ]
2024-03-26 22:49:33     }
2024-03-26 22:49:33 [17:49:33.507] ERROR (1): invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0)
2024-03-26 22:49:33     err: {
2024-03-26 22:49:33       "type": "Error",
2024-03-26 22:49:33       "message": "invalid BigNumber value (argument=\"value\", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0)",
2024-03-26 22:49:33       "stack":
2024-03-26 22:49:33           Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0)
2024-03-26 22:49:33               at Logger.makeError (/usr/app/node_modules/@ethersproject/logger/lib/index.js:238:21)
2024-03-26 22:49:33               at Logger.throwError (/usr/app/node_modules/@ethersproject/logger/lib/index.js:247:20)
2024-03-26 22:49:33               at Logger.throwArgumentError (/usr/app/node_modules/@ethersproject/logger/lib/index.js:250:21)
2024-03-26 22:49:33               at BigNumber.from (/usr/app/node_modules/@ethersproject/bignumber/lib/bignumber.js:239:23)
2024-03-26 22:49:33               at NumberCoder.encode (/usr/app/node_modules/@ethersproject/abi/lib/coders/number.js:36:39)
2024-03-26 22:49:33               at /usr/app/node_modules/@ethersproject/abi/lib/coders/array.js:74:19
2024-03-26 22:49:33               at Array.forEach (<anonymous>)
2024-03-26 22:49:33               at pack (/usr/app/node_modules/@ethersproject/abi/lib/coders/array.js:60:12)
2024-03-26 22:49:33               at TupleCoder.encode (/usr/app/node_modules/@ethersproject/abi/lib/coders/tuple.js:71:33)
2024-03-26 22:49:33               at AbiCoder.encode (/usr/app/node_modules/@ethersproject/abi/lib/abi-coder.js:91:15)
2024-03-26 22:49:33       "reason": "invalid BigNumber value",
2024-03-26 22:49:33       "code": "INVALID_ARGUMENT",
2024-03-26 22:49:33       "argument": "value"
2024-03-26 22:49:33     }
2024-03-26 22:49:33 [17:49:33.507] INFO (1): RESPONSE ::
2024-03-26 22:49:33     reqId: "req-3"
2024-03-26 22:49:33     body: {
2024-03-26 22:49:33       "error": "Unexpected behaviour"
2024-03-26 22:49:33     }

Operating system

Windows

Skandha version or commit hash

60bb068

Thanks for reporting this issue. Can you please let me know how are you generating the UserOp? Are you using an SDK, if so which one? Did you attempt to estimate the userop without passing maxFeePerGas and maxPriorityFeePerGas?

The response of eth_estimateUserOperationGas will provide you with appropriate value for these fields along with PVG, CGL and VGL.

saqlain1020 commented 6 months ago

Describe the bug

I am getting invalid bignumber value undefined error when doing estimateUserOperationGas call, i am using blockpi node rpc. Haven't tried debugging it yet, cause i am running docker image. I have attached the error below.

Expected behavior

It should not throw any error and return gas limits for userOp

Steps to reproduce

No response

Additional context

Running master branch commit 60bb0684245afdce02eb8ccb9022c3c6439c2a03 Created Docker image using provided command, on windows 11.

Error log (Docker Desktop)

2024-03-26 22:49:33 [17:49:33.087] INFO (1): REQUEST ::
2024-03-26 22:49:33     reqId: "req-3"
2024-03-26 22:49:33     method: "POST"
2024-03-26 22:49:33     url: "/80001"
2024-03-26 22:49:33     body: {
2024-03-26 22:49:33       "jsonrpc": "2.0",
2024-03-26 22:49:33       "id": 2,
2024-03-26 22:49:33       "method": "eth_estimateUserOperationGas",
2024-03-26 22:49:33       "params": [
2024-03-26 22:49:33         {
2024-03-26 22:49:33           "sender": "0xB64A8C01486E5E126954961a99E4518b22187C4b",
2024-03-26 22:49:33           "nonce": "0x1b",
2024-03-26 22:49:33           "initCode": "0x",
2024-03-26 22:49:33           "callData": "0x0000189a0000000000000000000000003870419ba2bbf0127060bcb37f69a1b1c090992b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004440c10f19000000000000000000000000b64a8c01486e5e126954961a99e4518b22187c4b00000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000",
2024-03-26 22:49:33           "maxFeePerGas": "0x69275dabb",
2024-03-26 22:49:33           "maxPriorityFeePerGas": "0x69275daa8",
2024-03-26 22:49:33           "paymasterAndData": "0x",
2024-03-26 22:49:33           "signature": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000001c5b32F37F5beA87BDD5374eB2aC54eA8e000000000000000000000000000000000000000000000000000000000000004181d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b00000000000000000000000000000000000000000000000000000000000000"
2024-03-26 22:49:33         },
2024-03-26 22:49:33         "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
2024-03-26 22:49:33       ]
2024-03-26 22:49:33     }
2024-03-26 22:49:33 [17:49:33.507] ERROR (1): invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0)
2024-03-26 22:49:33     err: {
2024-03-26 22:49:33       "type": "Error",
2024-03-26 22:49:33       "message": "invalid BigNumber value (argument=\"value\", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0)",
2024-03-26 22:49:33       "stack":
2024-03-26 22:49:33           Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0)
2024-03-26 22:49:33               at Logger.makeError (/usr/app/node_modules/@ethersproject/logger/lib/index.js:238:21)
2024-03-26 22:49:33               at Logger.throwError (/usr/app/node_modules/@ethersproject/logger/lib/index.js:247:20)
2024-03-26 22:49:33               at Logger.throwArgumentError (/usr/app/node_modules/@ethersproject/logger/lib/index.js:250:21)
2024-03-26 22:49:33               at BigNumber.from (/usr/app/node_modules/@ethersproject/bignumber/lib/bignumber.js:239:23)
2024-03-26 22:49:33               at NumberCoder.encode (/usr/app/node_modules/@ethersproject/abi/lib/coders/number.js:36:39)
2024-03-26 22:49:33               at /usr/app/node_modules/@ethersproject/abi/lib/coders/array.js:74:19
2024-03-26 22:49:33               at Array.forEach (<anonymous>)
2024-03-26 22:49:33               at pack (/usr/app/node_modules/@ethersproject/abi/lib/coders/array.js:60:12)
2024-03-26 22:49:33               at TupleCoder.encode (/usr/app/node_modules/@ethersproject/abi/lib/coders/tuple.js:71:33)
2024-03-26 22:49:33               at AbiCoder.encode (/usr/app/node_modules/@ethersproject/abi/lib/abi-coder.js:91:15)
2024-03-26 22:49:33       "reason": "invalid BigNumber value",
2024-03-26 22:49:33       "code": "INVALID_ARGUMENT",
2024-03-26 22:49:33       "argument": "value"
2024-03-26 22:49:33     }
2024-03-26 22:49:33 [17:49:33.507] INFO (1): RESPONSE ::
2024-03-26 22:49:33     reqId: "req-3"
2024-03-26 22:49:33     body: {
2024-03-26 22:49:33       "error": "Unexpected behaviour"
2024-03-26 22:49:33     }

Operating system

Windows

Skandha version or commit hash

60bb068

Thanks for reporting this issue. Can you please let me know how are you generating the UserOp? Are you using an SDK, if so which one? Did you attempt to estimate the userop without passing maxFeePerGas and maxPriorityFeePerGas?

The response of eth_estimateUserOperationGas will provide you with appropriate value for these fields along with PVG, CGL and VGL.

I am using pimlico to create userOp, it does everything under the hood, if i use pimico bundler than it works fine, but with skandha it gives me error, if i use pimlico bundler to estimate and then use skandha to send the userOp, then it works fine, it is giving this issue only when estimating. And yes i tried removing maxFeePerGas and priority fees, same error.

saqlain1020 commented 6 months ago

@ch4r10t33r Got it working. ✅

I just added callGasLimit,verificationGasLimit,preVerificationGas and set their values to "0", i was doing estimate call seperately using a bundler method and providing it with the userOp data, i was not providing CG, VG, PVG. It was working without them when using pimlico bundler, but with etherspot adding those values as 0 fixed the issue Thanks for the help

ch4r10t33r commented 6 months ago

@ch4r10t33r Got it working. ✅

I just added callGasLimit,verificationGasLimit,preVerificationGas and set their values to "0", i was doing estimate call seperately using a bundler method and providing it with the userOp data, i was not providing CG, VG, PVG. It was working without them when using pimlico bundler, but with etherspot adding those values as 0 fixed the issue Thanks for the help

Glad that it worked. Thanks for reporting the issue. We'll see how we can handle these kind of errors in future.

saqlain1020 commented 6 months ago

@ch4r10t33r I have created a pull request for this issue.