Skip to content

Commit

Permalink
fix block parameter on eth_estimateGas via proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
spilin committed Nov 1, 2023
1 parent a7fc161 commit ea3a922
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions standaloneproxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,20 @@ func (l *StandaloneProxy) Pre(ctx context.Context, name string, _ *endpoint.Endp

case "eth_estimateGas":
if len(args) != 2 {
return ctx, false, errors.New("invalid params")
return ctx, true, errors.New("invalid params")
}
tx, ok := args[0].(engine.TransactionForCall)
if !ok {
return ctx, false, errors.New("invalid params")
return ctx, true, errors.New("invalid params")
}
number, ok := args[1].(*common.BN64)
blockNumberOrHash, ok := args[1].(*common.BlockNumberOrHash)
if !ok {
return ctx, false, errors.New("invalid params")
return ctx, true, errors.New("invalid params")
}
if blockNumberOrHash == nil {
return ctx, true, errors.New("string 'latest', 'earliest' or integer block number is required")
}
res, err := l.client.EstimateGas(tx, number)
res, err := l.client.EstimateGas(tx, blockNumberOrHash.BlockNumber)
if err != nil {
return ctx, true, err
}
Expand Down

0 comments on commit ea3a922

Please sign in to comment.