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

Fix DoEstimateGas doesn't return evm revert error #30

Merged

Conversation

dongwu-kim
Copy link

Inshallah. This PR is to fix the eth_estimateGas method work.
Previous code seems to apply the gas from the stateful precompile contract. But reverted transaction will get block.GasLimit() gas. So the last executable() doesn't work.

Is this a known issue?

Before( error by viem )

An error occurred while executing: tx gas limit 60000000 exceeds block max gas 50000000: invalid gas limit: invalid gas limit

Request Arguments:
  chain:  xxx (id: 2061)
  from:   0x20f33CE90A13a4b5E7697E3544c3083B8F8A51D4
  to:     0x18Df82C7E422A42D47345Ed86B0E935E9718eBda
  value:  0 xxx
  data:   0xb67e53a300000000000000000000000036b33d90ca929aa42470344dd3ac76f40454f943

Details: tx gas limit 60000000 exceeds block max gas 50000000: invalid gas limit: invalid gas limit
Docs: https://viem.sh/docs/contract/estimateContractGas.html
Version: [email protected]

After( error by viem )

The contract function "emitToken" reverted with the following reason:
User can't receive tokens yet

Contract Call:
  address:   0x18Df82C7E422A42D47345Ed86B0E935E9718eBda
  function:  emitToken(address _to)
  args:  (0x36b33D90CA929AA42470344Dd3ac76F40454F943)
  sender:  0x20f33CE90A13a4b5E7697E3544c3083B8F8A51D4

Docs: https://viem.sh/docs/contract/estimateContractGas.html
Version: [email protected]

@dongwu-kim dongwu-kim force-pushed the fix-do-estimate-gas branch from 2d4242d to d9d002a Compare August 24, 2023 14:19
@itsdevbear
Copy link

@dongwu-kim thanks for the PR :)

@itsdevbear itsdevbear merged commit 497f3de into berachain:stateful-v1.12.0 Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants