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

EIP-1559/London/0x2 transactions do not work due to default inclusion of gasPrice #4211

Closed
haltman-at opened this issue Jul 29, 2021 · 6 comments · Fixed by #4217, #4219 or #4220
Closed

Comments

@haltman-at
Copy link
Contributor

Expected behavior

Including either of the maxFeePerGas or maxPriorityFeePerGas fields when sending a transaction should result in a transaction of type 0x2 with no gasPrice field.

Actual behavior

A gasPrice field is included by default, resulting in a nonsense transaction that's trying to be both EIP-1559 and pre-EIP-1559 at the same time, which Geth will reject.

Steps to reproduce the behavior

Start Geth in development mode with HTTP enabled, then make a transaction on it using web3.eth.sendTransaction, specifying either of the maxFeePerGas or maxPriorityFeePerGas fields (make sure they're hex strings per #4210) (and making sure you use the unlocked account for your from address).

Logs

Example with Truffle Console:

truffle(development)> web3.eth.sendTransaction({ to: it.address, from: accounts[0], data: '0xc0406226', maxFeePerGas: "0x1", maxPriorityFeePerGas: "0x1" })
Uncaught:
Error: Returned error: both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified
    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
Ethereum client: Geth 1.10.6-stable

@spacesailor24
Copy link
Contributor

This is going to be addressed via this, however it's strange this didn't come up during our testing. We have tests that pull down Geth from docker and execute our tests against it, so this needs further investigation (e.g. this test should be failing with the issue raised here)

Thank you for bringing to our attention

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>
@spacesailor24 spacesailor24 reopened this Jul 31, 2021
@spacesailor24 spacesailor24 mentioned this issue Jul 31, 2021
@spacesailor24
Copy link
Contributor

@haltman-at v1.5.1-rc.0 has just been released, could you try retesting?

@haltman-at
Copy link
Contributor Author

OK, tried it out, and oddly I'm still getting this error. (The hex string problem is fixed though, thanks!)

Truffle console log, FWIW:

truffle(development)> web3.eth.sendTransaction({ to: it.address, from: accounts[0], data: '0xc0406226', maxFeePerGas: 1, maxPriorityFeePerGas: 1 })
Uncaught:
Error: Returned error: both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified
    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
}

Moreover, just to be absolutely sure it was not Truffle causing the problem (not that that would make any sense, but I wanted to be certain), I performed a second test where I did not use Truffle, and got the same result:

> await web3.eth.sendTransaction({to: '0xf60619264E7aF020048046676685c02F71C27bFa', from: '0xeb31F90F4dEF7E6dccae81830cD2B6046B820F40', data: '0xc0406226', maxFeePerGas: 1, maxPriorityFeePerGas: 1 })
Uncaught:
Error: Returned error: both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified
    at Object.ErrorResponse (/home/sniffnoy/truffle/truffle/node_modules/web3-core-helpers/lib/errors.js:28:19)
    at /home/sniffnoy/truffle/truffle/node_modules/web3/node_modules/web3-core-requestmanager/lib/index.js:302:36
    at XMLHttpRequest.request.onreadystatechange (/home/sniffnoy/truffle/truffle/node_modules/web3/node_modules/web3-providers-http/lib/index.js:98:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/sniffnoy/truffle/truffle/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (/home/sniffnoy/truffle/truffle/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpResponseEnd (/home/sniffnoy/truffle/truffle/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14) {
  data: null
}

@haltman-at
Copy link
Contributor Author

(It's not possible that this is a Geth bug, is it...? It's not like I've tested making such transactions against Geth by any other means, or tried clients other than Geth... perhaps I can try that later if necessary...)

@spacesailor24
Copy link
Contributor

@haltman-at Thank you for getting back to us so quickly! I think I understand a bit of what's going on, and it seems to be a web3.js bug

I'll be working on getting out a patch asap

@spacesailor24
Copy link
Contributor

For reference, this section of code was never updated to account for EIP-1559

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants