Skip to content

Commit

Permalink
bump framework; remove generic result type
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 committed Jan 22, 2025
1 parent e7033b5 commit ee936a7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 42 deletions.
19 changes: 7 additions & 12 deletions core/chains/evm/client/chain_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package client

import (
"context"
"errors"
"math/big"
"sync"
"time"
Expand Down Expand Up @@ -101,7 +100,7 @@ type chainClient struct {
*big.Int,
*RPCClient,
]
txSender *multinode.TransactionSender[*types.Transaction, *SendTxResult, *big.Int, *RPCClient]
txSender *multinode.TransactionSender[*types.Transaction, *big.Int, *RPCClient]

Check failure on line 103 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_ccip_deployment_tests)

not enough type arguments for type TransactionSender: have 3, want 4

Check failure on line 103 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

not enough type arguments for type TransactionSender: have 3, want 4

Check failure on line 103 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Tests (core)

not enough type arguments for type TransactionSender: have 3, want 4

Check failure on line 103 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Tests (ccip-deployment)

not enough type arguments for type TransactionSender: have 3, want 4

Check failure on line 103 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Flakeguard Root Project / Run Tests (github.com/smartcontractkit/chainlink/v2/core/chains/evm/client, ubuntu-latest)

not enough type arguments for type TransactionSender: have 3, want 4

Check failure on line 103 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests_integration)

not enough type arguments for type TransactionSender: have 3, want 4

Check failure on line 103 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / GolangCI Lint (.)

not enough type arguments for type TransactionSender: have 3, want 4

Check failure on line 103 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

not enough type arguments for type TransactionSender: have 3, want 4
logger logger.SugaredLogger
chainType chaintype.ChainType
clientErrors evmconfig.ClientErrors
Expand Down Expand Up @@ -130,12 +129,12 @@ func NewChainClient(
deathDeclarationDelay,
)

txSender := multinode.NewTransactionSender[*types.Transaction, *SendTxResult, *big.Int, *RPCClient](
txSender := multinode.NewTransactionSender[*types.Transaction, *big.Int, *RPCClient](
lggr,
chainID,
chainFamily,
multiNode,

Check failure on line 136 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_ccip_deployment_tests)

in call to multinode.NewTransactionSender[*types.Transaction, *big.Int, *RPCClient], type *multinode.MultiNode[*"math/big".Int, *RPCClient] of multiNode does not match *multinode.MultiNode[*RPCClient, RPC]

Check failure on line 136 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

in call to multinode.NewTransactionSender[*types.Transaction, *big.Int, *RPCClient], type *multinode.MultiNode[*"math/big".Int, *RPCClient] of multiNode does not match *multinode.MultiNode[*RPCClient, RPC]

Check failure on line 136 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Tests (core)

in call to multinode.NewTransactionSender[*types.Transaction, *big.Int, *RPCClient], type *multinode.MultiNode[*"math/big".Int, *RPCClient] of multiNode does not match *multinode.MultiNode[*RPCClient, RPC]

Check failure on line 136 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Tests (ccip-deployment)

in call to multinode.NewTransactionSender[*types.Transaction, *big.Int, *RPCClient], type *multinode.MultiNode[*"math/big".Int, *RPCClient] of multiNode does not match *multinode.MultiNode[*RPCClient, RPC]

Check failure on line 136 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Flakeguard Root Project / Run Tests (github.com/smartcontractkit/chainlink/v2/core/chains/evm/client, ubuntu-latest)

in call to multinode.NewTransactionSender[*types.Transaction, *big.Int, *RPCClient], type *multinode.MultiNode[*"math/big".Int, *RPCClient] of multiNode does not match *multinode.MultiNode[*RPCClient, RPC]

Check failure on line 136 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests_integration)

in call to multinode.NewTransactionSender[*types.Transaction, *big.Int, *RPCClient], type *multinode.MultiNode[*"math/big".Int, *RPCClient] of multiNode does not match *multinode.MultiNode[*RPCClient, RPC]

Check failure on line 136 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / GolangCI Lint (.)

in call to multinode.NewTransactionSender[*types.Transaction, *big.Int, *RPCClient], type *multinode.MultiNode[*"math/big".Int, *RPCClient] of multiNode does not match *multinode.MultiNode[*RPCClient, RPC]

Check failure on line 136 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

in call to multinode.NewTransactionSender[*types.Transaction, *big.Int, *RPCClient], type *multinode.MultiNode[*"math/big".Int, *RPCClient] of multiNode does not match *multinode.MultiNode[*RPCClient, RPC]
NewSendTxResult,
func(err error) multinode.SendTxReturnCode { return 0 },
0, // use the default value provided by the implementation
)

Expand Down Expand Up @@ -373,20 +372,16 @@ func (c *chainClient) PendingNonceAt(ctx context.Context, account common.Address
}

func (c *chainClient) SendTransaction(ctx context.Context, tx *types.Transaction) error {
var result *SendTxResult
if c.chainType == chaintype.ChainHedera {
activeRPC, err := c.multiNode.SelectRPC()
if err != nil {
return err
}
result = activeRPC.SendTransaction(ctx, tx)
} else {
result = c.txSender.SendTransaction(ctx, tx)
}
if result == nil {
return errors.New("SendTransaction failed: result is nil")
_, err = activeRPC.SendTransaction(ctx, tx)
return err
}
return result.Error()
_, err := c.txSender.SendTransaction(ctx, tx)

Check failure on line 383 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_ccip_deployment_tests)

assignment mismatch: 2 variables but c.txSender.SendTransaction returns 1 value

Check failure on line 383 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_ccip_deployment_tests)

cannot use tx (variable of type *"github.com/ethereum/go-ethereum/core/types".Transaction) as TX value in argument to c.txSender.SendTransaction

Check failure on line 383 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

assignment mismatch: 2 variables but c.txSender.SendTransaction returns 1 value

Check failure on line 383 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

cannot use tx (variable of type *"github.com/ethereum/go-ethereum/core/types".Transaction) as TX value in argument to c.txSender.SendTransaction

Check failure on line 383 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Tests (core)

assignment mismatch: 2 variables but c.txSender.SendTransaction returns 1 value

Check failure on line 383 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Tests (core)

cannot use tx (variable of type *"github.com/ethereum/go-ethereum/core/types".Transaction) as TX value in argument to c.txSender.SendTransaction

Check failure on line 383 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Tests (ccip-deployment)

assignment mismatch: 2 variables but c.txSender.SendTransaction returns 1 value

Check failure on line 383 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Tests (ccip-deployment)

cannot use tx (variable of type *"github.com/ethereum/go-ethereum/core/types".Transaction) as TX value in argument to c.txSender.SendTransaction

Check failure on line 383 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Flakeguard Root Project / Run Tests (github.com/smartcontractkit/chainlink/v2/core/chains/evm/client, ubuntu-latest)

assignment mismatch: 2 variables but c.txSender.SendTransaction returns 1 value

Check failure on line 383 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Flakeguard Root Project / Run Tests (github.com/smartcontractkit/chainlink/v2/core/chains/evm/client, ubuntu-latest)

cannot use tx (variable of type *"github.com/ethereum/go-ethereum/core/types".Transaction) as TX value in argument to c.txSender.SendTransaction

Check failure on line 383 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests_integration)

assignment mismatch: 2 variables but c.txSender.SendTransaction returns 1 value

Check failure on line 383 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests_integration)

cannot use tx (variable of type *"github.com/ethereum/go-ethereum/core/types".Transaction) as TX value in argument to c.txSender.SendTransaction

Check failure on line 383 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / GolangCI Lint (.)

assignment mismatch: 2 variables but c.txSender.SendTransaction returns 1 value

Check failure on line 383 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / GolangCI Lint (.)

cannot use tx (variable of type *"github.com/ethereum/go-ethereum/core/types".Transaction) as TX value in argument to c.txSender.SendTransaction) (typecheck)

Check failure on line 383 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

assignment mismatch: 2 variables but c.txSender.SendTransaction returns 1 value

Check failure on line 383 in core/chains/evm/client/chain_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

cannot use tx (variable of type *"github.com/ethereum/go-ethereum/core/types".Transaction) as TX value in argument to c.txSender.SendTransaction
return err
}

func (c *chainClient) SendTransactionReturnCode(ctx context.Context, tx *types.Transaction, fromAddress common.Address) (multinode.SendTxReturnCode, error) {
Expand Down
31 changes: 3 additions & 28 deletions core/chains/evm/client/rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ type RPCClient struct {
}

var _ multinode.RPCClient[*big.Int, *evmtypes.Head] = (*RPCClient)(nil)
var _ multinode.SendTxRPCClient[*types.Transaction, *SendTxResult] = (*RPCClient)(nil)
var _ multinode.SendTxRPCClient[*types.Transaction] = (*RPCClient)(nil)

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_ccip_deployment_tests)

not enough type arguments for type SendTxRPCClient: have 1, want 2

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_ccip_deployment_tests)

cannot use (*RPCClient)(nil) (value of type *RPCClient) as multinode.SendTxRPCClient[*"github.com/ethereum/go-ethereum/core/types".Transaction] value in variable declaration

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

not enough type arguments for type SendTxRPCClient: have 1, want 2

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

cannot use (*RPCClient)(nil) (value of type *RPCClient) as multinode.SendTxRPCClient[*"github.com/ethereum/go-ethereum/core/types".Transaction] value in variable declaration

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / Tests (core)

not enough type arguments for type SendTxRPCClient: have 1, want 2

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / Tests (core)

cannot use (*RPCClient)(nil) (value of type *RPCClient) as multinode.SendTxRPCClient[*"github.com/ethereum/go-ethereum/core/types".Transaction] value in variable declaration

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / Tests (ccip-deployment)

not enough type arguments for type SendTxRPCClient: have 1, want 2

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / Tests (ccip-deployment)

cannot use (*RPCClient)(nil) (value of type *RPCClient) as multinode.SendTxRPCClient[*"github.com/ethereum/go-ethereum/core/types".Transaction] value in variable declaration

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / Flakeguard Root Project / Run Tests (github.com/smartcontractkit/chainlink/v2/core/chains/evm/client, ubuntu-latest)

not enough type arguments for type SendTxRPCClient: have 1, want 2

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / Flakeguard Root Project / Run Tests (github.com/smartcontractkit/chainlink/v2/core/chains/evm/client, ubuntu-latest)

cannot use (*RPCClient)(nil) (value of type *RPCClient) as multinode.SendTxRPCClient[*"github.com/ethereum/go-ethereum/core/types".Transaction] value in variable declaration

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests_integration)

not enough type arguments for type SendTxRPCClient: have 1, want 2

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests_integration)

cannot use (*RPCClient)(nil) (value of type *RPCClient) as multinode.SendTxRPCClient[*"github.com/ethereum/go-ethereum/core/types".Transaction] value in variable declaration

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / GolangCI Lint (.)

not enough type arguments for type SendTxRPCClient: have 1, want 2

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / GolangCI Lint (.)

cannot use (*RPCClient)(nil) (value of type *RPCClient) as multinode.SendTxRPCClient[*"github.com/ethereum/go-ethereum/core/types".Transaction] value in variable declaration

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / GolangCI Lint (.)

not enough type arguments for type SendTxRPCClient: have 1, want 2

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / GolangCI Lint (.)

cannot use (*RPCClient)(nil) (value of type *RPCClient) as multinode.SendTxRPCClient[*"github.com/ethereum/go-ethereum/core/types".Transaction] value in variable declaration

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

not enough type arguments for type SendTxRPCClient: have 1, want 2

Check failure on line 126 in core/chains/evm/client/rpc_client.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_tests)

cannot use (*RPCClient)(nil) (value of type *RPCClient) as multinode.SendTxRPCClient[*"github.com/ethereum/go-ethereum/core/types".Transaction] value in variable declaration

func NewRPCClient(
cfg config.NodePool,
Expand Down Expand Up @@ -808,29 +808,7 @@ func (r *RPCClient) BlockByNumberGeth(ctx context.Context, number *big.Int) (blo
return
}

type SendTxResult struct {
err error
code multinode.SendTxReturnCode
}

var _ multinode.SendTxResult = (*SendTxResult)(nil)

func NewSendTxResult(err error) *SendTxResult {
result := &SendTxResult{
err: err,
}
return result
}

func (r *SendTxResult) Error() error {
return r.err
}

func (r *SendTxResult) Code() multinode.SendTxReturnCode {
return r.code
}

func (r *RPCClient) SendTransaction(ctx context.Context, tx *types.Transaction) *SendTxResult {
func (r *RPCClient) SendTransaction(ctx context.Context, tx *types.Transaction) (multinode.SendTxReturnCode, error) {
ctx, cancel, ws, http := r.makeLiveQueryCtxAndSafeGetClients(ctx, r.largePayloadRPCTimeout)
defer cancel()
lggr := r.newRqLggr().With("tx", tx)
Expand All @@ -847,10 +825,7 @@ func (r *RPCClient) SendTransaction(ctx context.Context, tx *types.Transaction)

r.logResult(lggr, err, duration, r.getRPCDomain(), "SendTransaction")

return &SendTxResult{
err: err,
code: ClassifySendError(err, r.clientErrors, logger.Sugared(logger.Nop()), tx, common.Address{}, r.chainType.IsL2()),
}
return ClassifySendError(err, r.clientErrors, logger.Sugared(logger.Nop()), tx, common.Address{}, r.chainType.IsL2()), err
}

func (r *RPCClient) SimulateTransaction(ctx context.Context, tx *types.Transaction) error {
Expand Down
4 changes: 2 additions & 2 deletions core/chains/evm/client/rpc_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,8 @@ func TestRpcClientLargePayloadTimeout(t *testing.T) {
{
Name: "SendTransaction",
Fn: func(ctx context.Context, rpc *client.RPCClient) error {
result := rpc.SendTransaction(ctx, types.NewTx(&types.LegacyTx{}))
return result.Error()
_, err := rpc.SendTransaction(ctx, types.NewTx(&types.LegacyTx{}))
return err
},
},
{
Expand Down

0 comments on commit ee936a7

Please sign in to comment.