Skip to content

Commit

Permalink
core/chains/evm/types: move to evm/types
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 committed Jan 24, 2025
1 parent de9e993 commit 0329299
Show file tree
Hide file tree
Showing 268 changed files with 911 additions and 866 deletions.
2 changes: 1 addition & 1 deletion core/capabilities/ccip/ccipevm/msghasher.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

cciptypes "github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3"
"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink/v2/evm/types"

"github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/message_hasher"
"github.com/smartcontractkit/chainlink/v2/evm/utils"
)
Expand Down
2 changes: 1 addition & 1 deletion core/capabilities/ccip/configs/evm/chain_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/ethereum/go-ethereum/common"

"github.com/smartcontractkit/chainlink-ccip/pkg/consts"
evmtypes "github.com/smartcontractkit/chainlink/v2/evm/types"

evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/offramp"
evmrelaytypes "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/types"
)
Expand Down
2 changes: 1 addition & 1 deletion core/capabilities/ccip/configs/evm/contract_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/codec"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/rmn_home"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/rmn_proxy_contract"
evmtypes "github.com/smartcontractkit/chainlink/v2/evm/types"

"github.com/smartcontractkit/chainlink-ccip/pkg/consts"

evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/ccip_home"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/nonce_manager"
Expand Down
2 changes: 1 addition & 1 deletion core/capabilities/ccip/configs/evm/usdc.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package evm

import (
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
evmtypes "github.com/smartcontractkit/chainlink/v2/evm/types"
)

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/smartcontractkit/chainlink-common/pkg/utils/mailbox"
"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"
evmtypes "github.com/smartcontractkit/chainlink/v2/evm/types"

"github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ocrimpls"
cctypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types"
Expand All @@ -32,7 +33,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/keystore"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/config"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/multi_ocr3_helper"
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest"
Expand Down
2 changes: 1 addition & 1 deletion core/capabilities/integration_tests/framework/don.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/services/servicetest"
coretypes "github.com/smartcontractkit/chainlink-common/pkg/types/core"
"github.com/smartcontractkit/chainlink-common/pkg/values"
"github.com/smartcontractkit/chainlink/v2/evm/types"

"github.com/smartcontractkit/chainlink/v2/core/capabilities"
remotetypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/types"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0"
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils"
Expand Down
2 changes: 1 addition & 1 deletion core/capabilities/integration_tests/framework/ethereum.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
gethlog "github.com/ethereum/go-ethereum/log"

"github.com/smartcontractkit/chainlink-common/pkg/services"
evmtypes "github.com/smartcontractkit/chainlink/v2/evm/types"

evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils"
"github.com/smartcontractkit/chainlink/v2/evm/assets"
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/client/chain_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
commonassets "github.com/smartcontractkit/chainlink-common/pkg/assets"
"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-framework/multinode"
evmtypes "github.com/smartcontractkit/chainlink/v2/evm/types"

evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/evm/config/chaintype"
)

Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/client/chain_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import (

"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"
"github.com/smartcontractkit/chainlink-framework/multinode"
evmtypes "github.com/smartcontractkit/chainlink/v2/evm/types"

"github.com/smartcontractkit/chainlink/v2/core/chains/evm/client"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/testutils"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/evm/utils"
)

Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/client/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import (

"github.com/smartcontractkit/chainlink-common/pkg/logger"
client "github.com/smartcontractkit/chainlink-framework/multinode"
evmtypes "github.com/smartcontractkit/chainlink/v2/evm/types"

"github.com/smartcontractkit/chainlink-framework/multinode"
"github.com/smartcontractkit/chainlink-framework/multinode/mocks"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/config"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
)

type TestClientErrors struct {
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/client/mocks/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions core/chains/evm/client/null_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/assets"
"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-framework/multinode"

evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
evmtypes "github.com/smartcontractkit/chainlink/v2/evm/types"
)

// NullClient satisfies the Client but has no side effects
Expand Down
42 changes: 21 additions & 21 deletions core/chains/evm/client/rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/services"
"github.com/smartcontractkit/chainlink-framework/multinode"
types2 "github.com/smartcontractkit/chainlink/v2/evm/types"

"github.com/smartcontractkit/chainlink/v2/core/chains/evm/config"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/evm/assets"
"github.com/smartcontractkit/chainlink/v2/evm/config/chaintype"
"github.com/smartcontractkit/chainlink/v2/evm/utils"
Expand Down Expand Up @@ -122,7 +122,7 @@ type RPCClient struct {
latestChainInfo multinode.ChainInfo
}

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

func NewRPCClient(
Expand Down Expand Up @@ -451,7 +451,7 @@ func isRequestingFinalizedBlock(el rpc.BatchElem) bool {
}
}

func (r *RPCClient) SubscribeToHeads(ctx context.Context) (ch <-chan *evmtypes.Head, sub multinode.Subscription, err error) {
func (r *RPCClient) SubscribeToHeads(ctx context.Context) (ch <-chan *types2.Head, sub multinode.Subscription, err error) {
ctx, cancel, chStopInFlight, ws, _ := r.acquireQueryCtx(ctx, r.rpcTimeout)
defer cancel()
args := []interface{}{rpcSubscriptionMethodNewHeads}
Expand All @@ -463,7 +463,7 @@ func (r *RPCClient) SubscribeToHeads(ctx context.Context) (ch <-chan *evmtypes.H
interval := r.newHeadsPollInterval
timeout := interval
isHealthCheckRequest := multinode.CtxIsHeathCheckRequest(ctx)
poller, channel := multinode.NewPoller[*evmtypes.Head](interval, func(ctx context.Context) (*evmtypes.Head, error) {
poller, channel := multinode.NewPoller[*types2.Head](interval, func(ctx context.Context) (*types2.Head, error) {
if isHealthCheckRequest {
ctx = multinode.CtxAddHealthCheckFlag(ctx)
}
Expand Down Expand Up @@ -493,8 +493,8 @@ func (r *RPCClient) SubscribeToHeads(ctx context.Context) (ch <-chan *evmtypes.H
err = r.wrapWS(err)
}()

channel := make(chan *evmtypes.Head)
forwarder := newSubForwarder(channel, func(head *evmtypes.Head) (*evmtypes.Head, error) {
channel := make(chan *types2.Head)
forwarder := newSubForwarder(channel, func(head *types2.Head) (*types2.Head, error) {
head.EVMChainID = ubig.New(r.chainID)
r.onNewHead(ctx, chStopInFlight, head)
return head, nil
Expand All @@ -513,7 +513,7 @@ func (r *RPCClient) SubscribeToHeads(ctx context.Context) (ch <-chan *evmtypes.H
return channel, forwarder, err
}

func (r *RPCClient) SubscribeToFinalizedHeads(ctx context.Context) (<-chan *evmtypes.Head, multinode.Subscription, error) {
func (r *RPCClient) SubscribeToFinalizedHeads(ctx context.Context) (<-chan *types2.Head, multinode.Subscription, error) {
ctx, cancel, chStopInFlight, _, _ := r.acquireQueryCtx(ctx, r.rpcTimeout)
defer cancel()

Expand All @@ -523,7 +523,7 @@ func (r *RPCClient) SubscribeToFinalizedHeads(ctx context.Context) (<-chan *evmt
}
timeout := interval
isHealthCheckRequest := multinode.CtxIsHeathCheckRequest(ctx)
poller, channel := multinode.NewPoller[*evmtypes.Head](interval, func(ctx context.Context) (*evmtypes.Head, error) {
poller, channel := multinode.NewPoller[*types2.Head](interval, func(ctx context.Context) (*types2.Head, error) {
if isHealthCheckRequest {
ctx = multinode.CtxAddHealthCheckFlag(ctx)
}
Expand All @@ -543,7 +543,7 @@ func (r *RPCClient) SubscribeToFinalizedHeads(ctx context.Context) (<-chan *evmt

// GethClient wrappers

func (r *RPCClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (receipt *evmtypes.Receipt, err error) {
func (r *RPCClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (receipt *types2.Receipt, err error) {
err = r.CallContext(ctx, &receipt, "eth_getTransactionReceipt", txHash, false)
if err != nil {
return nil, err
Expand Down Expand Up @@ -646,7 +646,7 @@ func (r *RPCClient) HeaderByHash(ctx context.Context, hash common.Hash) (header
return
}

func (r *RPCClient) LatestFinalizedBlock(ctx context.Context) (head *evmtypes.Head, err error) {
func (r *RPCClient) LatestFinalizedBlock(ctx context.Context) (head *types2.Head, err error) {
// capture chStopInFlight to ensure we are not updating chainInfo with observations related to previous life cycle
ctx, cancel, chStopInFlight, _, _ := r.acquireQueryCtx(ctx, r.rpcTimeout)
defer cancel()
Expand All @@ -672,7 +672,7 @@ func (r *RPCClient) LatestFinalizedBlock(ctx context.Context) (head *evmtypes.He
return
}

func (r *RPCClient) latestBlock(ctx context.Context) (head *evmtypes.Head, err error) {
func (r *RPCClient) latestBlock(ctx context.Context) (head *types2.Head, err error) {
return r.BlockByNumber(ctx, nil)
}

Expand Down Expand Up @@ -703,7 +703,7 @@ func (r *RPCClient) astarLatestFinalizedBlock(ctx context.Context, result interf
return nil
}

func (r *RPCClient) BlockByNumber(ctx context.Context, number *big.Int) (head *evmtypes.Head, err error) {
func (r *RPCClient) BlockByNumber(ctx context.Context, number *big.Int) (head *types2.Head, err error) {
ctx, cancel, chStopInFlight, _, _ := r.acquireQueryCtx(ctx, r.rpcTimeout)
defer cancel()
hexNumber := ToBlockNumArg(number)
Expand Down Expand Up @@ -749,7 +749,7 @@ func (r *RPCClient) ethGetBlockByNumber(ctx context.Context, number string, resu
return err
}

func (r *RPCClient) BlockByHash(ctx context.Context, hash common.Hash) (head *evmtypes.Head, err error) {
func (r *RPCClient) BlockByHash(ctx context.Context, hash common.Hash) (head *types2.Head, err error) {
err = r.CallContext(ctx, &head, "eth_getBlockByHash", hash.Hex(), false)
if err != nil {
return nil, err
Expand Down Expand Up @@ -860,8 +860,8 @@ func (r *RPCClient) SimulateTransaction(ctx context.Context, tx *types.Transacti

func (r *RPCClient) SendEmptyTransaction(
ctx context.Context,
newTxAttempt func(nonce evmtypes.Nonce, feeLimit uint32, fee *assets.Wei, fromAddress common.Address) (attempt any, err error),
nonce evmtypes.Nonce,
newTxAttempt func(nonce types2.Nonce, feeLimit uint32, fee *assets.Wei, fromAddress common.Address) (attempt any, err error),
nonce types2.Nonce,
gasLimit uint32,
fee *assets.Wei,
fromAddress common.Address,
Expand All @@ -871,7 +871,7 @@ func (r *RPCClient) SendEmptyTransaction(
}

// PendingSequenceAt returns one higher than the highest nonce from both mempool and mined transactions
func (r *RPCClient) PendingSequenceAt(ctx context.Context, account common.Address) (nonce evmtypes.Nonce, err error) {
func (r *RPCClient) PendingSequenceAt(ctx context.Context, account common.Address) (nonce types2.Nonce, err error) {
ctx, cancel, ws, http := r.makeLiveQueryCtxAndSafeGetClients(ctx, r.rpcTimeout)
defer cancel()
lggr := r.newRqLggr().With("account", account)
Expand All @@ -881,11 +881,11 @@ func (r *RPCClient) PendingSequenceAt(ctx context.Context, account common.Addres
var n uint64
if http != nil {
n, err = http.geth.PendingNonceAt(ctx, account)
nonce = evmtypes.Nonce(int64(n))
nonce = types2.Nonce(int64(n))
err = r.wrapHTTP(err)
} else {
n, err = ws.geth.PendingNonceAt(ctx, account)
nonce = evmtypes.Nonce(int64(n))
nonce = types2.Nonce(int64(n))
err = r.wrapWS(err)
}
duration := time.Since(start)
Expand Down Expand Up @@ -1160,7 +1160,7 @@ type CallArgs struct {
func (r *RPCClient) TokenBalance(ctx context.Context, address common.Address, contractAddress common.Address) (*big.Int, error) {
result := ""
numLinkBigInt := new(big.Int)
functionSelector := evmtypes.HexToFunctionSelector(BALANCE_OF_ADDRESS_FUNCTION_SELECTOR) // balanceOf(address)
functionSelector := types2.HexToFunctionSelector(BALANCE_OF_ADDRESS_FUNCTION_SELECTOR) // balanceOf(address)
data := utils.ConcatBytes(functionSelector.Bytes(), common.LeftPadBytes(address.Bytes(), utils.EVMWordByteLen))
args := CallArgs{
To: contractAddress,
Expand Down Expand Up @@ -1410,7 +1410,7 @@ func (r *RPCClient) Name() string {
return r.name
}

func (r *RPCClient) onNewHead(ctx context.Context, requestCh <-chan struct{}, head *evmtypes.Head) {
func (r *RPCClient) onNewHead(ctx context.Context, requestCh <-chan struct{}, head *types2.Head) {
if head == nil {
return
}
Expand All @@ -1430,7 +1430,7 @@ func (r *RPCClient) onNewHead(ctx context.Context, requestCh <-chan struct{}, he
}
}

func (r *RPCClient) onNewFinalizedHead(ctx context.Context, requestCh <-chan struct{}, head *evmtypes.Head) {
func (r *RPCClient) onNewFinalizedHead(ctx context.Context, requestCh <-chan struct{}, head *types2.Head) {
if head == nil {
return
}
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/client/rpc_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"
"github.com/smartcontractkit/chainlink-framework/multinode"
evmtypes "github.com/smartcontractkit/chainlink/v2/evm/types"

"github.com/smartcontractkit/chainlink/v2/core/chains/evm/client"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/testutils"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/evm/config/chaintype"
)

Expand Down
Loading

0 comments on commit 0329299

Please sign in to comment.