Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxFeePerGas and maxPriorityFeePerGas have to be given as hex strings #4210

Closed
haltman-at opened this issue Jul 29, 2021 · 0 comments · Fixed by #4217 · 4 remaining pull requests
Closed

maxFeePerGas and maxPriorityFeePerGas have to be given as hex strings #4210

haltman-at opened this issue Jul 29, 2021 · 0 comments · Fixed by #4217 · 4 remaining pull requests
Labels
1.x 1.0 related issues

Comments

@haltman-at
Copy link
Contributor

haltman-at commented Jul 29, 2021

Expected behavior

It should be possible to give these fields in the same formats that web3 accepts for other numeric fields (numbers, decimal or hexadecimal numeric strings, BNs, BigNumbers).

Actual behavior

You get an error unless they're given as hex strings. See example in logs below.

Steps to reproduce the behavior

Make any transaction with web3.eth.sendTransaction with either maxFeePerGas or maxPriorityFeePerGas in any format other than a hex string! (E.g. number, decimal numeric string, BN, or BigNumber.)

Logs

Example with Truffle console:

truffle(development)> web3.eth.sendTransaction({ to: it.address, from: accounts[0], data: '0xc0406226', maxFeePerGas: "1" })
Uncaught:
Error: Returned error: invalid argument 0: json: cannot unmarshal hex string without 0x prefix into Go struct field TransactionArgs.maxFeePerGas of type *hexutil.Big
    at XMLHttpRequest._onHttpResponseEnd (/home/sniffnoy/truffle/truffle/node_modules/xhr2-cookies/xml-http-request.ts:345:8)
    at XMLHttpRequest._setReadyState (/home/sniffnoy/truffle/truffle/node_modules/xhr2-cookies/xml-http-request.ts:219:8)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/sniffnoy/truffle/truffle/node_modules/xhr2-cookies/xml-http-request-event-target.ts:44:13)
    at XMLHttpRequest.request.onreadystatechange (/home/sniffnoy/truffle/truffle/node_modules/web3/node_modules/web3-providers-http/lib/index.js:98:13)
    at /home/sniffnoy/truffle/truffle/packages/provider/wrapper.js:107:9
    at /home/sniffnoy/truffle/truffle/node_modules/web3/node_modules/web3-core-requestmanager/lib/index.js:302:36
    at Object.ErrorResponse (/home/sniffnoy/truffle/truffle/node_modules/web3-core-helpers/lib/errors.js:28:19) {
  data: null
}

Environment

NPM: 6.14.11
Node: 12.21.0
web3.js: 1.5.0

@philknows philknows added the 1.x 1.0 related issues label Jul 31, 2021
spacesailor24 added a commit that referenced this issue Jul 31, 2021
* Closes #4210 - allow non-hex values for eip1559 gas params

* Add tests for 4210

* Closes #4211

* Add tests for 4210 (#4218)

* Update CHANGELOG

Co-authored-by: Greg Markou <gregmarkou@Gregs-MacBook-Pro.local>
Co-authored-by: Wyatt Barnes <me@wyatt.email>
Co-authored-by: Wyatt Barnes <wyatt@writerof.software>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment