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:
parent
91e18caf84
commit
6565544d35
|
@ -20,8 +20,6 @@ additional_services:
|
|||
- tx_spammer
|
||||
- assertoor
|
||||
- beacon_metrics_gazer
|
||||
tx_spammer_params:
|
||||
tx_spammer_extra_args: ["--accounts=1", "--txcount=1"]
|
||||
mev_type: null
|
||||
assertoor_params:
|
||||
image: "ethpandaops/assertoor:master"
|
||||
|
|
|
@ -304,3 +304,18 @@ proc setupServerAPI*(api: ServerAPIRef, server: RpcServer) =
|
|||
return populateReceipt(receipt, gasUsed, blkdesc.blk.transactions[txid], txid, blkdesc.blk.header)
|
||||
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue