add rpc `eth_estimateGas` - dependency for blob spammer (#2701)

* add eth_estimateGas, dependency for blob spammer

* remove restriction

* fix indentation
This commit is contained in:
Advaita Saha 2024-10-06 08:09:47 +05:30 committed by GitHub
parent 91e18caf84
commit 6565544d35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 2 deletions

View File

@ -20,8 +20,6 @@ additional_services:
- tx_spammer - tx_spammer
- assertoor - assertoor
- beacon_metrics_gazer - beacon_metrics_gazer
tx_spammer_params:
tx_spammer_extra_args: ["--accounts=1", "--txcount=1"]
mev_type: null mev_type: null
assertoor_params: assertoor_params:
image: "ethpandaops/assertoor:master" image: "ethpandaops/assertoor:master"

View File

@ -304,3 +304,18 @@ proc setupServerAPI*(api: ServerAPIRef, server: RpcServer) =
return populateReceipt(receipt, gasUsed, blkdesc.blk.transactions[txid], txid, blkdesc.blk.header) return populateReceipt(receipt, gasUsed, blkdesc.blk.transactions[txid], txid, blkdesc.blk.header)
idx.inc idx.inc
server.rpc("eth_estimateGas") do(args: TransactionArgs) -> Web3Quantity:
## Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.
## The transaction will not be added to the blockchain. Note that the estimate may be significantly more than
## the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.
##
## args: the transaction call object.
## quantityTag: integer block number, or the string "latest", "earliest" or "pending", see the default block parameter.
## Returns the amount of gas used.
let
header = api.headerFromTag(blockId("latest")).valueOr:
raise newException(ValueError, "Block not found")
gasUsed = rpcEstimateGas(args, header, api.chain.com, DEFAULT_RPC_GAS_CAP).valueOr:
raise newException(ValueError, "rpcEstimateGas error: " & $error.code)
w3Qty(gasUsed)