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

the rpc method implementation is ok. but the actual implementation of rpcEstimateGas is incorrect #2773

Open
advaita-saha opened this issue Oct 23, 2024 · 4 comments
Labels
bug Something isn't working EL RPC JSON-RPC over HTTP/websocket

Comments

@advaita-saha
Copy link
Contributor

          the rpc method implementation is ok. but the actual implementation of rpcEstimateGas itself probably need more test. will merge for now

Originally posted by @jangko in #2701 (comment)

@advaita-saha advaita-saha changed the title the rpc method implementation is ok. but the actual implementation of rpcEstimateGas itself probably need more test. will merge for now the rpc method implementation is ok. but the actual implementation of rpcEstimateGas is incorrect Oct 23, 2024
@advaita-saha
Copy link
Contributor Author

Needs revisitation to https://eips.ethereum.org/EIPS/eip-1559
For transaction normalisation

@advaita-saha
Copy link
Contributor Author

From Kurtosis debug
DBG 2024-10-23 20:09:31.865+00:00 Error occurred within RPC methodName=eth_estimateGas err="rpcEstimateGas error: EvmInvalidParam"

@advaita-saha
Copy link
Contributor Author

WRN 2024-10-23 20:08:53.995+00:00 Gas estimation capped by limited funds original=9223372036854775807 balance=1000000000000000000000000000 sent=400000000000000000 maxFeePerGas=30000000000 fundable=33333333320000000

@jangko
Copy link
Contributor

jangko commented Oct 24, 2024

For transaction normalisation

either use maxPriorityFeePerGasNorm and maxFeePerGasNorm or eip1559TxNormalization(slow due to tx copy)

priorityFee = min(tx.maxPriorityFeePerGasNorm(), tx.maxFeePerGasNorm() - baseFee)

func eip1559TxNormalization*(tx: Transaction;
baseFeePerGas: GasInt): Transaction =
## This function adjusts a legacy transaction to EIP-1559 standard. This
## is needed particularly when using the `validateTransaction()` utility
## with legacy transactions.
result = tx
if tx.txType < TxEip1559:
result.maxPriorityFeePerGas = tx.gasPrice
result.maxFeePerGas = tx.gasPrice
else:
result.gasPrice = baseFeePerGas +
min(result.maxPriorityFeePerGas, result.maxFeePerGas - baseFeePerGas)
func maxPriorityFeePerGasNorm*(tx: Transaction): GasInt =
if tx.txType < TxEip1559:
tx.gasPrice
else:
tx.maxPriorityFeePerGas
func maxFeePerGasNorm*(tx: Transaction): GasInt =
if tx.txType < TxEip1559:
tx.gasPrice
else:
tx.maxFeePerGas

@jangko jangko added RPC JSON-RPC over HTTP/websocket EL bug Something isn't working labels Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working EL RPC JSON-RPC over HTTP/websocket
Projects
None yet
Development

No branches or pull requests

2 participants