Skip to content

Commit

Permalink
feat: implement eth_estimateGas in polycli loadtest --mode rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
leovct committed Nov 23, 2023
1 parent a3adf1f commit 910e9f8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/loadtest/loadtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,12 @@ func loadTestRPC(ctx context.Context, c *ethclient.Client, nonce uint64, ia *Ind
_, err = c.SuggestGasPrice(ctx)
} else if funcNum < 21 {
log.Trace().Msg("eth_estimateGas")
var tx *ethtypes.Transaction
tx, _, err = c.TransactionByHash(ctx, ethcommon.HexToHash(ia.TransactionIDs[randSrc.Intn(len(ia.TransactionIDs))]))
if err != nil {
log.Error().Err(err).Msg("Unable to get the transaction hash")
}
_, err = c.EstimateGas(ctx, txToCallMsg(tx))
} else if funcNum < 33 {
log.Trace().Msg("eth_getTransactionCount")
_, err = c.NonceAt(ctx, ethcommon.HexToAddress(ia.Addresses[randSrc.Intn(len(ia.Addresses))]), nil)
Expand Down

0 comments on commit 910e9f8

Please sign in to comment.