From 845009f684a99901d176c4e6467eed24bccce316 Mon Sep 17 00:00:00 2001 From: milan-cb Date: Thu, 29 Jan 2026 12:41:18 -0800 Subject: [PATCH] ethclient: fix timeout param for eth_sendRawTransactionSync (#33693) Fix timeout parameter in eth_sendRawTransactionSync to be an integer instead of hex. The spec has now been clarified on this point. --- ethclient/ethclient.go | 6 ++++-- internal/ethapi/api.go | 2 +- internal/ethapi/api_test.go | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index 6f2fb5ebc8..bc4eaad6fa 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -729,9 +729,11 @@ func (ec *Client) SendRawTransactionSync( rawTx []byte, timeout *time.Duration, ) (*types.Receipt, error) { - var ms *hexutil.Uint64 + var ms *uint64 if timeout != nil { - if d := hexutil.Uint64(timeout.Milliseconds()); d > 0 { + msInt := timeout.Milliseconds() + if msInt > 0 { + d := uint64(msInt) ms = &d } } diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index b0a79295f5..e0baccbfe7 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1661,7 +1661,7 @@ func (api *TransactionAPI) SendRawTransaction(ctx context.Context, input hexutil // SendRawTransactionSync will add the signed transaction to the transaction pool // and wait until the transaction has been included in a block and return the receipt, or the timeout. -func (api *TransactionAPI) SendRawTransactionSync(ctx context.Context, input hexutil.Bytes, timeoutMs *hexutil.Uint64) (map[string]interface{}, error) { +func (api *TransactionAPI) SendRawTransactionSync(ctx context.Context, input hexutil.Bytes, timeoutMs *uint64) (map[string]interface{}, error) { tx := new(types.Transaction) if err := tx.UnmarshalBinary(input); err != nil { return nil, err diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index aaa002b5ec..3668bd0e14 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -4026,7 +4026,7 @@ func TestSendRawTransactionSync_Timeout(t *testing.T) { raw, _ := makeSelfSignedRaw(t, api, b.acc.Address) - timeout := hexutil.Uint64(200) // 200ms + timeout := uint64(200) // 200ms receipt, err := api.SendRawTransactionSync(context.Background(), raw, &timeout) if receipt != nil {