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 requirement in 4.x #6215

Closed
t-vila opened this issue Jun 21, 2023 Discussed in #6188 · 1 comment · Fixed by #6265
Closed

maxFeePerGas requirement in 4.x #6215

t-vila opened this issue Jun 21, 2023 Discussed in #6188 · 1 comment · Fixed by #6265
Assignees
Labels
4.x 4.0 related Bug Addressing a bug

Comments

@t-vila
Copy link

t-vila commented Jun 21, 2023

Discussed in #6188

Originally posted by t-vila June 12, 2023
Hey all,

As far as I remember maxFeePerGas was optional in 1.x and calculated from the baseFee - in 4.x I get MissingGasError if I don't specify it. It looks like it's expected

export class MissingGasError extends InvalidValueError {

For instance this:

const tx = {
    from: signer.address,
    to: "...",
    value: web3.utils.toWei('0.0001', 'ether'),
    gas: limit,
    nonce: await web3.eth.getTransactionCount(signer.address),
    maxPriorityFeePerGas: web3.utils.toWei('3', 'gwei'),
    //maxFeePerGas: web3.utils.toWei('3', 'gwei'),
    chainId: 11155111,
    type: 0x2
  };

Will throw:

MissingGasError: Invalid value given "gas: 0x5208, gasPrice: undefined, maxPriorityFeePerGas: 0xb2d05e00, maxFeePerGas: undefined". Error: "gas" is missing.

@jdevcs jdevcs added the 4.x 4.0 related label Jun 21, 2023
@luu-alex
Copy link
Contributor

luu-alex commented Jun 23, 2023

Thank you for submitting this! 4.x is slightly different on validating transactions and the error message isn't clear, when we validate a transaction this is the conditional
Since you are using maxPriorityFeePerGas and specified a type 2 transaction its expected that you define maxFeePerGas as well.

If you wanted to submit a legacy transaction you would need to specify gas && gasPrice

I'll create a PR to make the error message more clear. thank you

For more clarity as well, what code/methods were u running

@luu-alex luu-alex self-assigned this Jun 29, 2023
@mconnelly8 mconnelly8 added Bug Addressing a bug Estimate labels Jun 29, 2023
@luu-alex luu-alex removed the Estimate label Jul 19, 2023
This was referenced Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x 4.0 related Bug Addressing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants