From 4cb56fd97aa993e1df479336d6641f0a2fdd81fe Mon Sep 17 00:00:00 2001 From: Dimitris Grigoriou Date: Fri, 15 Mar 2024 17:59:42 +0200 Subject: [PATCH] Extract core keystore from evm (#12380) * Extract core keystore from evm * Migrate keystore mocks * Fixes * Remove pg package from keystore --- .../capabilities/targets/write_target_test.go | 9 +- .../evm/config/chain_scoped_chain_writer.go | 6 +- core/chains/evm/config/config.go | 6 +- core/chains/evm/config/config_test.go | 18 +-- core/chains/evm/config/toml/config.go | 13 +- core/chains/evm/keystore/eth.go | 19 +++ core/chains/evm/keystore/mocks/eth.go | 143 ++++++++++++++++++ core/chains/evm/monitor/balance.go | 2 +- core/chains/evm/txmgr/attempts_test.go | 2 +- core/chains/evm/txmgr/broadcaster_test.go | 4 +- core/chains/evm/txmgr/builder.go | 2 +- core/chains/evm/txmgr/confirmer_test.go | 4 +- core/chains/evm/txmgr/models.go | 2 +- core/chains/evm/txmgr/tracker_test.go | 15 +- core/chains/evm/txmgr/txmgr_test.go | 4 +- .../ethkey => chains/evm/types}/address.go | 2 +- .../evm/types}/address_test.go | 30 ++-- core/chains/legacyevm/chain.go | 2 +- core/config/docs/docs_test.go | 4 +- core/config/ocr_config.go | 4 +- core/config/toml/types.go | 4 +- core/internal/cltest/factories.go | 12 +- core/internal/cltest/job_factories.go | 4 +- core/internal/features/features_test.go | 5 +- core/services/blockhashstore/batch_bhs.go | 4 +- core/services/blockhashstore/bhs.go | 6 +- core/services/blockhashstore/bhs_test.go | 4 +- core/services/blockhashstore/common.go | 4 +- core/services/blockhashstore/delegate.go | 4 +- core/services/blockhashstore/validate_test.go | 10 +- .../blockheaderfeeder/block_header_feeder.go | 6 +- .../block_header_feeder_test.go | 6 +- .../blockheaderfeeder/validate_test.go | 14 +- core/services/chainlink/config_ocr.go | 4 +- core/services/chainlink/config_test.go | 10 +- core/services/directrequest/validate.go | 4 +- core/services/feeds/service.go | 4 +- core/services/feeds/service_test.go | 4 +- .../fluxmonitorv2/integrations_test.go | 5 +- core/services/job/job_orm_test.go | 5 +- core/services/job/mocks/orm.go | 12 +- core/services/job/models.go | 116 +++++++------- core/services/job/orm.go | 16 +- core/services/job/runner_integration_test.go | 4 +- core/services/keeper/integration_test.go | 24 +-- core/services/keeper/models.go | 8 +- core/services/keeper/orm.go | 10 +- core/services/keeper/orm_test.go | 8 +- core/services/keeper/registry_interface.go | 5 +- .../registry_synchronizer_process_logs.go | 6 +- .../keeper/registry_synchronizer_sync.go | 10 +- .../keeper/registry_synchronizer_sync_test.go | 4 +- .../keeper/upkeep_executer_unit_test.go | 6 +- core/services/keystore/keys/ethkey/export.go | 3 +- core/services/keystore/keys/ethkey/key.go | 3 +- core/services/keystore/keys/ethkey/key_v2.go | 8 +- .../keystore/keys/ethkey/key_v2_test.go | 4 +- core/services/keystore/keys/ethkey/models.go | 3 +- core/services/ocr/config_overrider.go | 6 +- core/services/ocr/config_overrider_test.go | 10 +- core/services/ocr/delegate.go | 4 +- core/services/ocr/validate.go | 4 +- core/services/ocr2/database_test.go | 4 +- core/services/ocr2/plugins/ocr2keeper/util.go | 8 +- .../ocr2vrf/coordinator/coordinator.go | 9 +- core/services/ocrcommon/telemetry_test.go | 6 +- core/services/relay/evm/evm.go | 6 +- core/services/relay/evm/ocr2keeper.go | 4 +- core/services/vrf/v2/bhs_feeder_test.go | 6 +- .../vrf/v2/integration_helpers_test.go | 5 +- core/web/evm_chains_controller_test.go | 4 +- core/web/jobs_controller_test.go | 18 +-- core/web/presenters/eth_key_test.go | 3 +- core/web/presenters/job.go | 140 ++++++++--------- core/web/presenters/job_test.go | 24 +-- core/web/resolver/eth_key.go | 3 +- core/web/resolver/eth_key_test.go | 17 ++- core/web/resolver/spec_test.go | 58 +++---- integration-tests/types/config/node/core.go | 4 +- 79 files changed, 584 insertions(+), 419 deletions(-) create mode 100644 core/chains/evm/keystore/eth.go create mode 100644 core/chains/evm/keystore/mocks/eth.go rename core/{services/keystore/keys/ethkey => chains/evm/types}/address.go (99%) rename core/{services/keystore/keys/ethkey => chains/evm/types}/address_test.go (76%) diff --git a/core/capabilities/targets/write_target_test.go b/core/capabilities/targets/write_target_test.go index c99e84beb75..c71c84e172e 100644 --- a/core/capabilities/targets/write_target_test.go +++ b/core/capabilities/targets/write_target_test.go @@ -9,7 +9,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/capabilities/targets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" txmmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr/mocks" - evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" evmmocks "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm/mocks" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" @@ -17,13 +17,12 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" ) -var forwardABI = evmtypes.MustGetABI(forwarder.KeystoneForwarderMetaData.ABI) +var forwardABI = types.MustGetABI(forwarder.KeystoneForwarderMetaData.ABI) func TestEvmWrite(t *testing.T) { chain := evmmocks.NewChain(t) @@ -34,12 +33,12 @@ func TestEvmWrite(t *testing.T) { cfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { a := testutils.NewAddress() - addr, err := ethkey.NewEIP55Address(a.Hex()) + addr, err := types.NewEIP55Address(a.Hex()) require.NoError(t, err) c.EVM[0].ChainWriter.FromAddress = &addr forwarderA := testutils.NewAddress() - forwarderAddr, err := ethkey.NewEIP55Address(forwarderA.Hex()) + forwarderAddr, err := types.NewEIP55Address(forwarderA.Hex()) require.NoError(t, err) c.EVM[0].ChainWriter.ForwarderAddress = &forwarderAddr }) diff --git a/core/chains/evm/config/chain_scoped_chain_writer.go b/core/chains/evm/config/chain_scoped_chain_writer.go index b84731314e1..1f1cdcecfa7 100644 --- a/core/chains/evm/config/chain_scoped_chain_writer.go +++ b/core/chains/evm/config/chain_scoped_chain_writer.go @@ -2,17 +2,17 @@ package config import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ) type chainWriterConfig struct { c toml.ChainWriter } -func (b *chainWriterConfig) FromAddress() *ethkey.EIP55Address { +func (b *chainWriterConfig) FromAddress() *types.EIP55Address { return b.c.FromAddress } -func (b *chainWriterConfig) ForwarderAddress() *ethkey.EIP55Address { +func (b *chainWriterConfig) ForwarderAddress() *types.EIP55Address { return b.c.ForwarderAddress } diff --git a/core/chains/evm/config/config.go b/core/chains/evm/config/config.go index c9c3273f086..3c504f63ae7 100644 --- a/core/chains/evm/config/config.go +++ b/core/chains/evm/config/config.go @@ -10,8 +10,8 @@ import ( commonconfig "github.com/smartcontractkit/chainlink/v2/common/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/config" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ) type EVM interface { @@ -130,8 +130,8 @@ type BlockHistory interface { } type ChainWriter interface { - FromAddress() *ethkey.EIP55Address - ForwarderAddress() *ethkey.EIP55Address + FromAddress() *types.EIP55Address + ForwarderAddress() *types.EIP55Address } type NodePool interface { diff --git a/core/chains/evm/config/config_test.go b/core/chains/evm/config/config_test.go index 0f3e0a9a9f8..c0457fbe850 100644 --- a/core/chains/evm/config/config_test.go +++ b/core/chains/evm/config/config_test.go @@ -16,13 +16,13 @@ import ( commonconfig "github.com/smartcontractkit/chainlink/v2/common/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ) func TestChainScopedConfig(t *testing.T) { @@ -89,7 +89,7 @@ func TestChainScopedConfig(t *testing.T) { gcfg2 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { overrides(c, s) c.EVM[0].KeySpecific = toml.KeySpecificConfig{ - {Key: ptr(ethkey.EIP55AddressFromAddress(randomOtherAddr)), + {Key: ptr(types.EIP55AddressFromAddress(randomOtherAddr)), GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: assets.GWei(850), }, @@ -124,7 +124,7 @@ func TestChainScopedConfig(t *testing.T) { t.Run(tt.name, func(t *testing.T) { gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { c.EVM[0].KeySpecific = toml.KeySpecificConfig{ - {Key: ptr(ethkey.EIP55AddressFromAddress(addr)), + {Key: ptr(types.EIP55AddressFromAddress(addr)), GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: tt.val, }, @@ -143,7 +143,7 @@ func TestChainScopedConfig(t *testing.T) { gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { c.EVM[0].GasEstimator.PriceMax = chainSpecificPrice c.EVM[0].KeySpecific = toml.KeySpecificConfig{ - {Key: ptr(ethkey.EIP55AddressFromAddress(addr)), + {Key: ptr(types.EIP55AddressFromAddress(addr)), GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: keySpecificPrice, }, @@ -160,7 +160,7 @@ func TestChainScopedConfig(t *testing.T) { gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { c.EVM[0].GasEstimator.PriceMax = chainSpecificPrice c.EVM[0].KeySpecific = toml.KeySpecificConfig{ - {Key: ptr(ethkey.EIP55AddressFromAddress(addr)), + {Key: ptr(types.EIP55AddressFromAddress(addr)), GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: keySpecificPrice, }, @@ -175,7 +175,7 @@ func TestChainScopedConfig(t *testing.T) { keySpecificPrice := assets.GWei(900) gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { c.EVM[0].KeySpecific = toml.KeySpecificConfig{ - {Key: ptr(ethkey.EIP55AddressFromAddress(addr)), + {Key: ptr(types.EIP55AddressFromAddress(addr)), GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: keySpecificPrice, }, @@ -192,7 +192,7 @@ func TestChainScopedConfig(t *testing.T) { gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { c.EVM[0].GasEstimator.PriceMax = chainSpecificPrice c.EVM[0].KeySpecific = toml.KeySpecificConfig{ - {Key: ptr(ethkey.EIP55AddressFromAddress(addr)), + {Key: ptr(types.EIP55AddressFromAddress(addr)), GasEstimator: toml.KeySpecificGasEstimator{ PriceMax: keySpecificPrice, }, @@ -224,7 +224,7 @@ func TestChainScopedConfig(t *testing.T) { val := testutils.NewAddress() gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].LinkContractAddress = ptr(ethkey.EIP55AddressFromAddress(val)) + c.EVM[0].LinkContractAddress = ptr(types.EIP55AddressFromAddress(val)) }) cfg3 := evmtest.NewChainScopedConfig(t, gcfg3) @@ -241,7 +241,7 @@ func TestChainScopedConfig(t *testing.T) { val := testutils.NewAddress() gcfg3 := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].OperatorFactoryAddress = ptr(ethkey.EIP55AddressFromAddress(val)) + c.EVM[0].OperatorFactoryAddress = ptr(types.EIP55AddressFromAddress(val)) }) cfg3 := evmtest.NewChainScopedConfig(t, gcfg3) diff --git a/core/chains/evm/config/toml/config.go b/core/chains/evm/config/toml/config.go index b84993b28a6..cb95ed54d56 100644 --- a/core/chains/evm/config/toml/config.go +++ b/core/chains/evm/config/toml/config.go @@ -21,7 +21,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ) type HasEVMConfigs interface { @@ -347,8 +346,8 @@ type Chain struct { ChainType *string FinalityDepth *uint32 FinalityTagEnabled *bool - FlagsContractAddress *ethkey.EIP55Address - LinkContractAddress *ethkey.EIP55Address + FlagsContractAddress *types.EIP55Address + LinkContractAddress *types.EIP55Address LogBackfillBatchSize *uint32 LogPollInterval *commonconfig.Duration LogKeepBlocksDepth *uint32 @@ -358,7 +357,7 @@ type Chain struct { MinContractPayment *commonassets.Link NonceAutoSync *bool NoNewHeadsThreshold *commonconfig.Duration - OperatorFactoryAddress *ethkey.EIP55Address + OperatorFactoryAddress *types.EIP55Address RPCDefaultBatchSize *uint32 RPCBlockQueryDelay *uint16 @@ -451,8 +450,8 @@ func (a *Automation) setFrom(f *Automation) { } type ChainWriter struct { - FromAddress *ethkey.EIP55Address `toml:",omitempty"` - ForwarderAddress *ethkey.EIP55Address `toml:",omitempty"` + FromAddress *types.EIP55Address `toml:",omitempty"` + ForwarderAddress *types.EIP55Address `toml:",omitempty"` } func (m *ChainWriter) setFrom(f *ChainWriter) { @@ -668,7 +667,7 @@ func (ks KeySpecificConfig) ValidateConfig() (err error) { } type KeySpecific struct { - Key *ethkey.EIP55Address + Key *types.EIP55Address GasEstimator KeySpecificGasEstimator `toml:",omitempty"` } diff --git a/core/chains/evm/keystore/eth.go b/core/chains/evm/keystore/eth.go new file mode 100644 index 00000000000..1e2b0c439bc --- /dev/null +++ b/core/chains/evm/keystore/eth.go @@ -0,0 +1,19 @@ +package keystore + +import ( + "context" + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" +) + +// Eth is the external interface for EthKeyStore +// +//go:generate mockery --quiet --name Eth --output mocks/ --case=underscore +type Eth interface { + CheckEnabled(ctx context.Context, address common.Address, chainID *big.Int) error + EnabledAddressesForChain(ctx context.Context, chainID *big.Int) (addresses []common.Address, err error) + SignTx(ctx context.Context, fromAddress common.Address, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) + SubscribeToKeyChanges(ctx context.Context) (ch chan struct{}, unsub func()) +} diff --git a/core/chains/evm/keystore/mocks/eth.go b/core/chains/evm/keystore/mocks/eth.go new file mode 100644 index 00000000000..48bd738fdbe --- /dev/null +++ b/core/chains/evm/keystore/mocks/eth.go @@ -0,0 +1,143 @@ +// Code generated by mockery v2.38.0. DO NOT EDIT. + +package mocks + +import ( + context "context" + big "math/big" + + common "github.com/ethereum/go-ethereum/common" + + mock "github.com/stretchr/testify/mock" + + types "github.com/ethereum/go-ethereum/core/types" +) + +// Eth is an autogenerated mock type for the Eth type +type Eth struct { + mock.Mock +} + +// CheckEnabled provides a mock function with given fields: ctx, address, chainID +func (_m *Eth) CheckEnabled(ctx context.Context, address common.Address, chainID *big.Int) error { + ret := _m.Called(ctx, address, chainID) + + if len(ret) == 0 { + panic("no return value specified for CheckEnabled") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, common.Address, *big.Int) error); ok { + r0 = rf(ctx, address, chainID) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// EnabledAddressesForChain provides a mock function with given fields: ctx, chainID +func (_m *Eth) EnabledAddressesForChain(ctx context.Context, chainID *big.Int) ([]common.Address, error) { + ret := _m.Called(ctx, chainID) + + if len(ret) == 0 { + panic("no return value specified for EnabledAddressesForChain") + } + + var r0 []common.Address + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *big.Int) ([]common.Address, error)); ok { + return rf(ctx, chainID) + } + if rf, ok := ret.Get(0).(func(context.Context, *big.Int) []common.Address); ok { + r0 = rf(ctx, chainID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]common.Address) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *big.Int) error); ok { + r1 = rf(ctx, chainID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SignTx provides a mock function with given fields: ctx, fromAddress, tx, chainID +func (_m *Eth) SignTx(ctx context.Context, fromAddress common.Address, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) { + ret := _m.Called(ctx, fromAddress, tx, chainID) + + if len(ret) == 0 { + panic("no return value specified for SignTx") + } + + var r0 *types.Transaction + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, common.Address, *types.Transaction, *big.Int) (*types.Transaction, error)); ok { + return rf(ctx, fromAddress, tx, chainID) + } + if rf, ok := ret.Get(0).(func(context.Context, common.Address, *types.Transaction, *big.Int) *types.Transaction); ok { + r0 = rf(ctx, fromAddress, tx, chainID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Transaction) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, common.Address, *types.Transaction, *big.Int) error); ok { + r1 = rf(ctx, fromAddress, tx, chainID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SubscribeToKeyChanges provides a mock function with given fields: ctx +func (_m *Eth) SubscribeToKeyChanges(ctx context.Context) (chan struct{}, func()) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for SubscribeToKeyChanges") + } + + var r0 chan struct{} + var r1 func() + if rf, ok := ret.Get(0).(func(context.Context) (chan struct{}, func())); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) chan struct{}); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(chan struct{}) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) func()); ok { + r1 = rf(ctx) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(func()) + } + } + + return r0, r1 +} + +// NewEth creates a new instance of Eth. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewEth(t interface { + mock.TestingT + Cleanup(func()) +}) *Eth { + mock := &Eth{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/core/chains/evm/monitor/balance.go b/core/chains/evm/monitor/balance.go index 16e2fd527bf..28bcdd9abdf 100644 --- a/core/chains/evm/monitor/balance.go +++ b/core/chains/evm/monitor/balance.go @@ -20,8 +20,8 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" httypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker/types" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/keystore" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" ) //go:generate mockery --quiet --name BalanceMonitor --output ../mocks/ --case=underscore diff --git a/core/chains/evm/txmgr/attempts_test.go b/core/chains/evm/txmgr/attempts_test.go index ab8a5831b20..d5c8f577ce1 100644 --- a/core/chains/evm/txmgr/attempts_test.go +++ b/core/chains/evm/txmgr/attempts_test.go @@ -18,13 +18,13 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" gasmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/mocks" + ksmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/keystore/mocks" "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/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - ksmocks "github.com/smartcontractkit/chainlink/v2/core/services/keystore/mocks" ) func NewEvmAddress() gethcommon.Address { diff --git a/core/chains/evm/txmgr/broadcaster_test.go b/core/chains/evm/txmgr/broadcaster_test.go index 0b76f7fc6d1..8c51c557fb5 100644 --- a/core/chains/evm/txmgr/broadcaster_test.go +++ b/core/chains/evm/txmgr/broadcaster_test.go @@ -35,6 +35,8 @@ import ( evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" gasmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/mocks" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/keystore" + ksmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/keystore/mocks" "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/chains/evm/utils" @@ -46,8 +48,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - ksmocks "github.com/smartcontractkit/chainlink/v2/core/services/keystore/mocks" ) // NewEthBroadcaster creates a new txmgr.EthBroadcaster for use in testing. diff --git a/core/chains/evm/txmgr/builder.go b/core/chains/evm/txmgr/builder.go index 58e37d633d9..cd8f5af884a 100644 --- a/core/chains/evm/txmgr/builder.go +++ b/core/chains/evm/txmgr/builder.go @@ -14,9 +14,9 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/forwarders" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/keystore" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" ) // NewTxm constructs the necessary dependencies for the EvmTxm (broadcaster, confirmer, etc) and returns a new EvmTxManager diff --git a/core/chains/evm/txmgr/confirmer_test.go b/core/chains/evm/txmgr/confirmer_test.go index ec09085bc44..7307f5c35bb 100644 --- a/core/chains/evm/txmgr/confirmer_test.go +++ b/core/chains/evm/txmgr/confirmer_test.go @@ -31,6 +31,8 @@ import ( evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" gasmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/mocks" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/keystore" + ksmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/keystore/mocks" "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/chains/evm/utils" @@ -40,8 +42,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - ksmocks "github.com/smartcontractkit/chainlink/v2/core/services/keystore/mocks" ) func newTestChainScopedConfig(t *testing.T) evmconfig.ChainScopedConfig { diff --git a/core/chains/evm/txmgr/models.go b/core/chains/evm/txmgr/models.go index 4c622ec945a..6633841f40b 100644 --- a/core/chains/evm/txmgr/models.go +++ b/core/chains/evm/txmgr/models.go @@ -11,8 +11,8 @@ import ( "github.com/smartcontractkit/chainlink/v2/common/txmgr" txmgrtypes "github.com/smartcontractkit/chainlink/v2/common/txmgr/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/keystore" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" ) // Type aliases for EVM diff --git a/core/chains/evm/txmgr/tracker_test.go b/core/chains/evm/txmgr/tracker_test.go index d3083372789..ce249f9ea1f 100644 --- a/core/chains/evm/txmgr/tracker_test.go +++ b/core/chains/evm/txmgr/tracker_test.go @@ -6,13 +6,13 @@ import ( "testing" "time" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/keystore" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest" "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" @@ -26,17 +26,12 @@ func newTestEvmTrackerSetup(t *testing.T) (*txmgr.Tracker, txmgr.TestEvmTxStore, txStore := cltest.NewTestTxStore(t, db, cfg.Database()) ethKeyStore := cltest.NewKeyStore(t, db, cfg.Database()).Eth() chainID := big.NewInt(0) - enabledAddresses := generateEnabledAddresses(t, ethKeyStore, chainID) - lggr := logger.TestLogger(t) - return txmgr.NewEvmTracker(txStore, ethKeyStore, chainID, lggr), txStore, ethKeyStore, enabledAddresses -} - -func generateEnabledAddresses(t *testing.T, keyStore keystore.Eth, chainID *big.Int) []common.Address { var enabledAddresses []common.Address - _, addr1 := cltest.MustInsertRandomKey(t, keyStore, *ubig.NewI(chainID.Int64())) - _, addr2 := cltest.MustInsertRandomKey(t, keyStore, *ubig.NewI(chainID.Int64())) + _, addr1 := cltest.MustInsertRandomKey(t, ethKeyStore, *ubig.NewI(chainID.Int64())) + _, addr2 := cltest.MustInsertRandomKey(t, ethKeyStore, *ubig.NewI(chainID.Int64())) enabledAddresses = append(enabledAddresses, addr1, addr2) - return enabledAddresses + lggr := logger.TestLogger(t) + return txmgr.NewEvmTracker(txStore, ethKeyStore, chainID, lggr), txStore, ethKeyStore, enabledAddresses } func containsID(txes []*txmgr.Tx, id int64) bool { diff --git a/core/chains/evm/txmgr/txmgr_test.go b/core/chains/evm/txmgr/txmgr_test.go index 332031bc776..7120a77728e 100644 --- a/core/chains/evm/txmgr/txmgr_test.go +++ b/core/chains/evm/txmgr/txmgr_test.go @@ -32,6 +32,8 @@ import ( evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/forwarders" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/keystore" + ksmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/keystore/mocks" "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" @@ -42,8 +44,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - ksmocks "github.com/smartcontractkit/chainlink/v2/core/services/keystore/mocks" "github.com/smartcontractkit/chainlink/v2/core/services/pg" ) diff --git a/core/services/keystore/keys/ethkey/address.go b/core/chains/evm/types/address.go similarity index 99% rename from core/services/keystore/keys/ethkey/address.go rename to core/chains/evm/types/address.go index 0d93a4cdb29..4a77ce5f8db 100644 --- a/core/services/keystore/keys/ethkey/address.go +++ b/core/chains/evm/types/address.go @@ -1,4 +1,4 @@ -package ethkey +package types import ( "database/sql/driver" diff --git a/core/services/keystore/keys/ethkey/address_test.go b/core/chains/evm/types/address_test.go similarity index 76% rename from core/services/keystore/keys/ethkey/address_test.go rename to core/chains/evm/types/address_test.go index 15b502d1785..e6e6a4f37c9 100644 --- a/core/services/keystore/keys/ethkey/address_test.go +++ b/core/chains/evm/types/address_test.go @@ -1,4 +1,4 @@ -package ethkey_test +package types_test import ( "encoding/json" @@ -8,13 +8,13 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/assert" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ) func TestEIP55Address(t *testing.T) { t.Parallel() - address := ethkey.EIP55Address("0xa0788FC17B1dEe36f057c42B6F373A34B014687e") + address := types.EIP55Address("0xa0788FC17B1dEe36f057c42B6F373A34B014687e") assert.Equal(t, []byte{ 0xa0, 0x78, 0x8f, 0xc1, 0x7b, 0x1d, 0xee, 0x36, @@ -35,12 +35,12 @@ func TestEIP55Address(t *testing.T) { assert.Equal(t, "0xa0788FC17B1dEe36f057c42B6F373A34B014687e", address.String()) - zeroAddress := ethkey.EIP55Address("") + zeroAddress := types.EIP55Address("") err := json.Unmarshal([]byte(`"0xa0788FC17B1dEe36f057c42B6F373A34B014687e"`), &zeroAddress) assert.NoError(t, err) assert.Equal(t, "0xa0788FC17B1dEe36f057c42B6F373A34B014687e", zeroAddress.String()) - zeroAddress = ethkey.EIP55Address("") + zeroAddress = types.EIP55Address("") err = zeroAddress.UnmarshalText([]byte("0xa0788FC17B1dEe36f057c42B6F373A34B014687e")) assert.NoError(t, err) assert.Equal(t, "0xa0788FC17B1dEe36f057c42B6F373A34B014687e", zeroAddress.String()) @@ -64,7 +64,7 @@ func TestValidateEIP55Address(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - _, err := ethkey.NewEIP55Address(test.input) + _, err := types.NewEIP55Address(test.input) valid := err == nil assert.Equal(t, test.valid, valid) }) @@ -75,20 +75,20 @@ func TestEIP55AddressFromAddress(t *testing.T) { t.Parallel() addr := common.HexToAddress("0xa0788FC17B1dEe36f057c42B6F373A34B014687e") - eip55 := ethkey.EIP55AddressFromAddress(addr) + eip55 := types.EIP55AddressFromAddress(addr) assert.Equal(t, addr, eip55.Address()) } func TestEIP55Address_Scan_Value(t *testing.T) { t.Parallel() - eip55, err := ethkey.NewEIP55Address("0xa0788FC17B1dEe36f057c42B6F373A34B014687e") + eip55, err := types.NewEIP55Address("0xa0788FC17B1dEe36f057c42B6F373A34B014687e") assert.NoError(t, err) val, err := eip55.Value() assert.NoError(t, err) - var eip55New ethkey.EIP55Address + var eip55New types.EIP55Address err = eip55New.Scan(val) assert.NoError(t, err) @@ -98,15 +98,15 @@ func TestEIP55Address_Scan_Value(t *testing.T) { func TestEIP55AddressCollection_Scan_Value(t *testing.T) { t.Parallel() - collection := ethkey.EIP55AddressCollection{ - ethkey.EIP55Address("0xa0788FC17B1dEe36f057c42B6F373A34B0146111"), - ethkey.EIP55Address("0xa0788FC17B1dEe36f057c42B6F373A34B0146222"), + collection := types.EIP55AddressCollection{ + types.EIP55Address("0xa0788FC17B1dEe36f057c42B6F373A34B0146111"), + types.EIP55Address("0xa0788FC17B1dEe36f057c42B6F373A34B0146222"), } val, err := collection.Value() assert.NoError(t, err) - var collectionNew ethkey.EIP55AddressCollection + var collectionNew types.EIP55AddressCollection err = collectionNew.Scan(val) assert.NoError(t, err) @@ -116,9 +116,9 @@ func TestEIP55AddressCollection_Scan_Value(t *testing.T) { func TestEIP55Address_IsZero(t *testing.T) { t.Parallel() - eip55 := ethkey.EIP55AddressFromAddress(common.HexToAddress("0x0")) + eip55 := types.EIP55AddressFromAddress(common.HexToAddress("0x0")) assert.True(t, eip55.IsZero()) - eip55 = ethkey.EIP55AddressFromAddress(common.HexToAddress("0x1")) + eip55 = types.EIP55AddressFromAddress(common.HexToAddress("0x1")) assert.False(t, eip55.IsZero()) } diff --git a/core/chains/legacyevm/chain.go b/core/chains/legacyevm/chain.go index f00f4b64b36..e7aac4701c3 100644 --- a/core/chains/legacyevm/chain.go +++ b/core/chains/legacyevm/chain.go @@ -24,6 +24,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker" httypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker/types" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/keystore" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/log" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/monitor" @@ -32,7 +33,6 @@ import ( ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore" ) //go:generate mockery --quiet --name Chain --output ./mocks/ --case=underscore diff --git a/core/config/docs/docs_test.go b/core/config/docs/docs_test.go index 919113e1d93..35a78762e64 100644 --- a/core/config/docs/docs_test.go +++ b/core/config/docs/docs_test.go @@ -17,10 +17,10 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/config/docs" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink/cfgtest" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ) func TestDoc(t *testing.T) { @@ -51,7 +51,7 @@ func TestDoc(t *testing.T) { // clean up KeySpecific as a special case require.Equal(t, 1, len(docDefaults.KeySpecific)) - ks := evmcfg.KeySpecific{Key: new(ethkey.EIP55Address), + ks := evmcfg.KeySpecific{Key: new(types.EIP55Address), GasEstimator: evmcfg.KeySpecificGasEstimator{PriceMax: new(assets.Wei)}} require.Equal(t, ks, docDefaults.KeySpecific[0]) docDefaults.KeySpecific = nil diff --git a/core/config/ocr_config.go b/core/config/ocr_config.go index 9f891511dd3..bde2142c846 100644 --- a/core/config/ocr_config.go +++ b/core/config/ocr_config.go @@ -3,7 +3,7 @@ package config import ( "time" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ) // OCR is a subset of global config relevant to OCR v1. @@ -16,7 +16,7 @@ type OCR interface { KeyBundleID() (string, error) ObservationTimeout() time.Duration SimulateTransactions() bool - TransmitterAddress() (ethkey.EIP55Address, error) // OCR2 can support non-evm changes + TransmitterAddress() (types.EIP55Address, error) // OCR2 can support non-evm changes // OCR1 config, cannot override in jobs TraceLogging() bool DefaultTransactionQueueDepth() uint32 diff --git a/core/config/toml/types.go b/core/config/toml/types.go index 68445f5b860..f56ab1e8c89 100644 --- a/core/config/toml/types.go +++ b/core/config/toml/types.go @@ -16,9 +16,9 @@ import ( commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" "github.com/smartcontractkit/chainlink/v2/core/build" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/config/parse" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/p2pkey" "github.com/smartcontractkit/chainlink/v2/core/sessions" "github.com/smartcontractkit/chainlink/v2/core/store/dialects" @@ -976,7 +976,7 @@ type OCR struct { // Optional KeyBundleID *models.Sha256Hash SimulateTransactions *bool - TransmitterAddress *ethkey.EIP55Address + TransmitterAddress *types.EIP55Address CaptureEATelemetry *bool TraceLogging *bool } diff --git a/core/internal/cltest/factories.go b/core/internal/cltest/factories.go index 02f56e756d9..1d715d349ac 100644 --- a/core/internal/cltest/factories.go +++ b/core/internal/cltest/factories.go @@ -49,9 +49,9 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/utils" ) -func NewEIP55Address() ethkey.EIP55Address { +func NewEIP55Address() evmtypes.EIP55Address { a := testutils.NewAddress() - e, err := ethkey.NewEIP55Address(a.Hex()) + e, err := evmtypes.NewEIP55Address(a.Hex()) if err != nil { panic(err) } @@ -327,7 +327,7 @@ func MustInsertHead(t *testing.T, db sqlutil.DataSource, number int64) evmtypes. func MustInsertV2JobSpec(t *testing.T, db *sqlx.DB, transmitterAddress common.Address) job.Job { t.Helper() - addr, err := ethkey.NewEIP55Address(transmitterAddress.Hex()) + addr, err := evmtypes.NewEIP55Address(transmitterAddress.Hex()) require.NoError(t, err) pipelineSpec := pipeline.Spec{} @@ -351,7 +351,7 @@ func MustInsertV2JobSpec(t *testing.T, db *sqlx.DB, transmitterAddress common.Ad return jb } -func MustInsertOffchainreportingOracleSpec(t *testing.T, db *sqlx.DB, transmitterAddress ethkey.EIP55Address) job.OCROracleSpec { +func MustInsertOffchainreportingOracleSpec(t *testing.T, db *sqlx.DB, transmitterAddress evmtypes.EIP55Address) job.OCROracleSpec { t.Helper() ocrKeyID := models.MustSha256HashFromHex(DefaultOCRKeyBundleID) @@ -376,7 +376,7 @@ func MakeDirectRequestJobSpec(t *testing.T) *job.Job { return spec } -func MustInsertKeeperJob(t *testing.T, db *sqlx.DB, korm keeper.ORM, from ethkey.EIP55Address, contract ethkey.EIP55Address) job.Job { +func MustInsertKeeperJob(t *testing.T, db *sqlx.DB, korm keeper.ORM, from evmtypes.EIP55Address, contract evmtypes.EIP55Address) job.Job { t.Helper() var keeperSpec job.KeeperSpec @@ -421,7 +421,7 @@ func MustInsertKeeperRegistry(t *testing.T, db *sqlx.DB, korm keeper.ORM, ethKey JobID: job.ID, KeeperIndex: keeperIndex, NumKeepers: numKeepers, - KeeperIndexMap: map[ethkey.EIP55Address]int32{ + KeeperIndexMap: map[evmtypes.EIP55Address]int32{ from: keeperIndex, }, } diff --git a/core/internal/cltest/job_factories.go b/core/internal/cltest/job_factories.go index 399e71ff216..4b2ea66f22d 100644 --- a/core/internal/cltest/job_factories.go +++ b/core/internal/cltest/job_factories.go @@ -10,10 +10,10 @@ import ( "github.com/jmoiron/sqlx" "github.com/smartcontractkit/chainlink/v2/core/bridges" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/p2pkey" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" ) @@ -38,7 +38,7 @@ const ( ` ) -func MinimalOCRNonBootstrapSpec(contractAddress, transmitterAddress ethkey.EIP55Address, peerID p2pkey.PeerID, keyBundleID string) string { +func MinimalOCRNonBootstrapSpec(contractAddress, transmitterAddress types.EIP55Address, peerID p2pkey.PeerID, keyBundleID string) string { return fmt.Sprintf(minimalOCRNonBootstrapTemplate, contractAddress, peerID, transmitterAddress.Hex(), keyBundleID) } diff --git a/core/internal/features/features_test.go b/core/internal/features/features_test.go index 9c6d9cb8b62..cd231450650 100644 --- a/core/internal/features/features_test.go +++ b/core/internal/features/features_test.go @@ -64,7 +64,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/keystest" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocrkey" "github.com/smartcontractkit/chainlink/v2/core/services/ocr" @@ -815,7 +814,7 @@ func TestIntegration_OCR(t *testing.T) { ports := freeport.GetN(t, numOracles) for i := 0; i < numOracles; i++ { app, peerID, transmitter, key := setupNode(t, owner, ports[i], b, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].FlagsContractAddress = ptr(ethkey.EIP55AddressFromAddress(flagsContractAddress)) + c.EVM[0].FlagsContractAddress = ptr(evmtypes.EIP55AddressFromAddress(flagsContractAddress)) c.EVM[0].GasEstimator.EIP1559DynamicFees = ptr(test.eip1559) c.P2P.V2.DefaultBootstrappers = &[]ocrcommontypes.BootstrapperLocator{ @@ -1036,7 +1035,7 @@ func TestIntegration_OCR_ForwarderFlow(t *testing.T) { for i := 0; i < numOracles; i++ { app, peerID, transmitter, forwarder, key := setupForwarderEnabledNode(t, owner, ports[i], b, func(c *chainlink.Config, s *chainlink.Secrets) { c.Feature.LogPoller = ptr(true) - c.EVM[0].FlagsContractAddress = ptr(ethkey.EIP55AddressFromAddress(flagsContractAddress)) + c.EVM[0].FlagsContractAddress = ptr(evmtypes.EIP55AddressFromAddress(flagsContractAddress)) c.EVM[0].GasEstimator.EIP1559DynamicFees = ptr(true) c.P2P.V2.DefaultBootstrappers = &[]ocrcommontypes.BootstrapperLocator{ {PeerID: bootstrapPeerID, Addrs: []string{fmt.Sprintf("127.0.0.1:%d", bootstrapNodePortV2)}}, diff --git a/core/services/blockhashstore/batch_bhs.go b/core/services/blockhashstore/batch_bhs.go index ffaa22b2463..58b4467f50c 100644 --- a/core/services/blockhashstore/batch_bhs.go +++ b/core/services/blockhashstore/batch_bhs.go @@ -11,10 +11,10 @@ import ( txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/batch_blockhash_store" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ) type batchBHSConfig interface { @@ -31,7 +31,7 @@ type BatchBlockhashStore struct { func NewBatchBHS( config batchBHSConfig, - fromAddresses []ethkey.EIP55Address, + fromAddresses []types.EIP55Address, txm txmgr.TxManager, batchbhs batch_blockhash_store.BatchBlockhashStoreInterface, chainID *big.Int, diff --git a/core/services/blockhashstore/bhs.go b/core/services/blockhashstore/bhs.go index 877e7b3dc25..d4dd52c5661 100644 --- a/core/services/blockhashstore/bhs.go +++ b/core/services/blockhashstore/bhs.go @@ -16,10 +16,10 @@ import ( txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/blockhash_store" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/trusted_blockhash_store" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ) var _ BHS = &BulletproofBHS{} @@ -38,7 +38,7 @@ type BulletproofBHS struct { config bpBHSConfig dbConfig bpBHSDatabaseConfig jobID uuid.UUID - fromAddresses []ethkey.EIP55Address + fromAddresses []types.EIP55Address txm txmgr.TxManager abi *abi.ABI trustedAbi *abi.ABI @@ -52,7 +52,7 @@ type BulletproofBHS struct { func NewBulletproofBHS( config bpBHSConfig, dbConfig bpBHSDatabaseConfig, - fromAddresses []ethkey.EIP55Address, + fromAddresses []types.EIP55Address, txm txmgr.TxManager, bhs blockhash_store.BlockhashStoreInterface, trustedBHS *trusted_blockhash_store.TrustedBlockhashStore, diff --git a/core/services/blockhashstore/bhs_test.go b/core/services/blockhashstore/bhs_test.go index f8d33b51a34..75424ee8059 100644 --- a/core/services/blockhashstore/bhs_test.go +++ b/core/services/blockhashstore/bhs_test.go @@ -9,6 +9,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" txmmocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr/mocks" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/blockhash_store" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" @@ -18,7 +19,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/blockhashstore" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" "github.com/smartcontractkit/chainlink/v2/core/utils" ) @@ -41,7 +41,7 @@ func TestStoreRotatesFromAddresses(t *testing.T) { require.NoError(t, err) k2, err := ks.Eth().Create(ctx, &cltest.FixtureChainID) require.NoError(t, err) - fromAddresses := []ethkey.EIP55Address{k1.EIP55Address, k2.EIP55Address} + fromAddresses := []types.EIP55Address{k1.EIP55Address, k2.EIP55Address} txm := new(txmmocks.MockEvmTxManager) bhsAddress := common.HexToAddress("0x31Ca8bf590360B3198749f852D5c516c642846F6") diff --git a/core/services/blockhashstore/common.go b/core/services/blockhashstore/common.go index a19a3b868f7..30208296a4f 100644 --- a/core/services/blockhashstore/common.go +++ b/core/services/blockhashstore/common.go @@ -8,8 +8,8 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/pkg/errors" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ) // Coordinator defines an interface for fetching request and fulfillment metadata from a VRF @@ -133,7 +133,7 @@ func GetSearchWindow(latestBlock, waitBlocks, lookbackBlocks int) (uint64, uint6 } // SendingKeys returns a list of sending keys (common.Address) given EIP55 addresses -func SendingKeys(fromAddresses []ethkey.EIP55Address) []common.Address { +func SendingKeys(fromAddresses []types.EIP55Address) []common.Address { var keys []common.Address for _, a := range fromAddresses { keys = append(keys, a.Address()) diff --git a/core/services/blockhashstore/delegate.go b/core/services/blockhashstore/delegate.go index c8954ad1c2b..9a11c057c32 100644 --- a/core/services/blockhashstore/delegate.go +++ b/core/services/blockhashstore/delegate.go @@ -9,6 +9,7 @@ import ( "github.com/pkg/errors" "github.com/smartcontractkit/chainlink-common/pkg/services" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/blockhash_store" v1 "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/solidity_vrf_coordinator_interface" @@ -18,7 +19,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/pg" "github.com/smartcontractkit/chainlink/v2/core/utils" ) @@ -74,7 +74,7 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, jb job.Job) ([]job.Servi if len(keys) == 0 { return nil, fmt.Errorf("missing sending keys for chain ID: %v", chain.ID()) } - fromAddresses := []ethkey.EIP55Address{keys[0].EIP55Address} + fromAddresses := []types.EIP55Address{keys[0].EIP55Address} if jb.BlockhashStoreSpec.FromAddresses != nil { fromAddresses = jb.BlockhashStoreSpec.FromAddresses } diff --git a/core/services/blockhashstore/validate_test.go b/core/services/blockhashstore/validate_test.go index 48487bb5489..099e5db02ca 100644 --- a/core/services/blockhashstore/validate_test.go +++ b/core/services/blockhashstore/validate_test.go @@ -6,15 +6,15 @@ import ( "github.com/stretchr/testify/require" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ) func TestValidate(t *testing.T) { - v1Coordinator := ethkey.EIP55Address("0x1F72B4A5DCf7CC6d2E38423bF2f4BFA7db97d139") - v2Coordinator := ethkey.EIP55Address("0x2be990eE17832b59E0086534c5ea2459Aa75E38F") - fromAddresses := []ethkey.EIP55Address{("0x469aA2CD13e037DC5236320783dCfd0e641c0559")} + v1Coordinator := types.EIP55Address("0x1F72B4A5DCf7CC6d2E38423bF2f4BFA7db97d139") + v2Coordinator := types.EIP55Address("0x2be990eE17832b59E0086534c5ea2459Aa75E38F") + fromAddresses := []types.EIP55Address{("0x469aA2CD13e037DC5236320783dCfd0e641c0559")} var tests = []struct { name string @@ -45,7 +45,7 @@ fromAddresses = ["0x469aA2CD13e037DC5236320783dCfd0e641c0559"]`, os.BlockhashStoreSpec.CoordinatorV2Address) require.Equal(t, int32(59), os.BlockhashStoreSpec.WaitBlocks) require.Equal(t, int32(159), os.BlockhashStoreSpec.LookbackBlocks) - require.Equal(t, ethkey.EIP55Address("0x3e20Cef636EdA7ba135bCbA4fe6177Bd3cE0aB17"), + require.Equal(t, types.EIP55Address("0x3e20Cef636EdA7ba135bCbA4fe6177Bd3cE0aB17"), os.BlockhashStoreSpec.BlockhashStoreAddress) require.Equal(t, 23*time.Second, os.BlockhashStoreSpec.PollPeriod) require.Equal(t, 7*time.Second, os.BlockhashStoreSpec.RunTimeout) diff --git a/core/services/blockheaderfeeder/block_header_feeder.go b/core/services/blockheaderfeeder/block_header_feeder.go index d1bcab4297a..b1e8ba7f2f3 100644 --- a/core/services/blockheaderfeeder/block_header_feeder.go +++ b/core/services/blockheaderfeeder/block_header_feeder.go @@ -12,10 +12,10 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/pkg/errors" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/blockhashstore" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ) var ( @@ -48,7 +48,7 @@ func NewBlockHeaderFeeder( gethks keystore.Eth, getBlockhashesBatchSize uint16, storeBlockhashesBatchSize uint16, - fromAddresses []ethkey.EIP55Address, + fromAddresses []types.EIP55Address, chainID *big.Int, ) *BlockHeaderFeeder { return &BlockHeaderFeeder{ @@ -86,7 +86,7 @@ type BlockHeaderFeeder struct { getBlockhashesBatchSize uint16 storeBlockhashesBatchSize uint16 gethks keystore.Eth - fromAddresses []ethkey.EIP55Address + fromAddresses []types.EIP55Address chainID *big.Int } diff --git a/core/services/blockheaderfeeder/block_header_feeder_test.go b/core/services/blockheaderfeeder/block_header_feeder_test.go index 1b855caf9d2..afd7525c9e2 100644 --- a/core/services/blockheaderfeeder/block_header_feeder_test.go +++ b/core/services/blockheaderfeeder/block_header_feeder_test.go @@ -9,10 +9,10 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/blockhashstore" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" keystoremocks "github.com/smartcontractkit/chainlink/v2/core/services/keystore/mocks" ) @@ -200,7 +200,7 @@ func (test testCase) testFeeder(t *testing.T) { blockHeaderProvider := &blockhashstore.TestBlockHeaderProvider{} fromAddress := "0x469aA2CD13e037DC5236320783dCfd0e641c0559" - fromAddresses := []ethkey.EIP55Address{ethkey.EIP55Address(fromAddress)} + fromAddresses := []types.EIP55Address{types.EIP55Address(fromAddress)} ks := keystoremocks.NewEth(t) ks.On("GetRoundRobinAddress", mock.Anything, testutils.FixtureChainID, mock.Anything).Maybe().Return(common.HexToAddress(fromAddress), nil) @@ -244,7 +244,7 @@ func TestFeeder_CachesStoredBlocks(t *testing.T) { batchBHS := &blockhashstore.TestBatchBHS{Stored: []uint64{75}} blockHeaderProvider := &blockhashstore.TestBlockHeaderProvider{} fromAddress := "0x469aA2CD13e037DC5236320783dCfd0e641c0559" - fromAddresses := []ethkey.EIP55Address{ethkey.EIP55Address(fromAddress)} + fromAddresses := []types.EIP55Address{types.EIP55Address(fromAddress)} ks := keystoremocks.NewEth(t) ks.On("GetRoundRobinAddress", mock.Anything, testutils.FixtureChainID, mock.Anything).Maybe().Return(common.HexToAddress(fromAddress), nil) diff --git a/core/services/blockheaderfeeder/validate_test.go b/core/services/blockheaderfeeder/validate_test.go index cdab0322a40..66413a615bd 100644 --- a/core/services/blockheaderfeeder/validate_test.go +++ b/core/services/blockheaderfeeder/validate_test.go @@ -6,16 +6,16 @@ import ( "github.com/stretchr/testify/require" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ) func TestValidate(t *testing.T) { - v1Coordinator := ethkey.EIP55Address("0x1F72B4A5DCf7CC6d2E38423bF2f4BFA7db97d139") - v2Coordinator := ethkey.EIP55Address("0x2be990eE17832b59E0086534c5ea2459Aa75E38F") - v2PlusCoordinator := ethkey.EIP55Address("0x92B5e28Ac583812874e4271380c7d070C5FB6E6b") - fromAddresses := []ethkey.EIP55Address{("0x469aA2CD13e037DC5236320783dCfd0e641c0559")} + v1Coordinator := types.EIP55Address("0x1F72B4A5DCf7CC6d2E38423bF2f4BFA7db97d139") + v2Coordinator := types.EIP55Address("0x2be990eE17832b59E0086534c5ea2459Aa75E38F") + v2PlusCoordinator := types.EIP55Address("0x92B5e28Ac583812874e4271380c7d070C5FB6E6b") + fromAddresses := []types.EIP55Address{("0x469aA2CD13e037DC5236320783dCfd0e641c0559")} var tests = []struct { name string @@ -53,9 +53,9 @@ storeBlockhashesBatchSize = 10 os.BlockHeaderFeederSpec.CoordinatorV2PlusAddress) require.Equal(t, int32(2000), os.BlockHeaderFeederSpec.LookbackBlocks) require.Equal(t, int32(500), os.BlockHeaderFeederSpec.WaitBlocks) - require.Equal(t, ethkey.EIP55Address("0x3e20Cef636EdA7ba135bCbA4fe6177Bd3cE0aB17"), + require.Equal(t, types.EIP55Address("0x3e20Cef636EdA7ba135bCbA4fe6177Bd3cE0aB17"), os.BlockHeaderFeederSpec.BlockhashStoreAddress) - require.Equal(t, ethkey.EIP55Address("0xD04E5b2ea4e55AEbe6f7522bc2A69Ec6639bfc63"), + require.Equal(t, types.EIP55Address("0xD04E5b2ea4e55AEbe6f7522bc2A69Ec6639bfc63"), os.BlockHeaderFeederSpec.BatchBlockhashStoreAddress) require.Equal(t, 23*time.Second, os.BlockHeaderFeederSpec.PollPeriod) require.Equal(t, 7*time.Second, os.BlockHeaderFeederSpec.RunTimeout) diff --git a/core/services/chainlink/config_ocr.go b/core/services/chainlink/config_ocr.go index 072c724871a..cf6127e713a 100644 --- a/core/services/chainlink/config_ocr.go +++ b/core/services/chainlink/config_ocr.go @@ -5,9 +5,9 @@ import ( "github.com/pkg/errors" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/config/toml" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ) var _ config.OCR = (*ocrConfig)(nil) @@ -48,7 +48,7 @@ func (o *ocrConfig) SimulateTransactions() bool { return *o.c.SimulateTransactions } -func (o *ocrConfig) TransmitterAddress() (ethkey.EIP55Address, error) { +func (o *ocrConfig) TransmitterAddress() (types.EIP55Address, error) { a := *o.c.TransmitterAddress if a.IsZero() { return a, errors.Wrap(config.ErrEnvUnset, "OCR.TransmitterAddress is not set") diff --git a/core/services/chainlink/config_test.go b/core/services/chainlink/config_test.go index 6cf9537f065..63ff68fa966 100644 --- a/core/services/chainlink/config_test.go +++ b/core/services/chainlink/config_test.go @@ -30,12 +30,12 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" legacy "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/config/toml" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink/cfgtest" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/p2pkey" "github.com/smartcontractkit/chainlink/v2/core/store/models" "github.com/smartcontractkit/chainlink/v2/core/utils" @@ -209,8 +209,8 @@ func TestConfig_Marshal(t *testing.T) { require.NoError(t, err) return &d } - mustAddress := func(s string) *ethkey.EIP55Address { - a, err := ethkey.NewEIP55Address(s) + mustAddress := func(s string) *types.EIP55Address { + a, err := types.NewEIP55Address(s) require.NoError(t, err) return &a } @@ -403,7 +403,7 @@ func TestConfig_Marshal(t *testing.T) { DefaultTransactionQueueDepth: ptr[uint32](12), KeyBundleID: ptr(models.MustSha256HashFromHex("acdd42797a8b921b2910497badc50006")), SimulateTransactions: ptr(true), - TransmitterAddress: ptr(ethkey.MustEIP55Address("0xa0788FC17B1dEe36f057c42B6F373A34B014687e")), + TransmitterAddress: ptr(types.MustEIP55Address("0xa0788FC17B1dEe36f057c42B6F373A34B014687e")), CaptureEATelemetry: ptr(false), TraceLogging: ptr(false), } @@ -1149,7 +1149,7 @@ func TestConfig_full(t *testing.T) { require.NoError(t, config.DecodeTOML(strings.NewReader(fullTOML), &got)) // Except for some EVM node fields. for c := range got.EVM { - addr, err := ethkey.NewEIP55Address("0x2a3e23c6f242F5345320814aC8a1b4E58707D292") + addr, err := types.NewEIP55Address("0x2a3e23c6f242F5345320814aC8a1b4E58707D292") require.NoError(t, err) if got.EVM[c].ChainWriter.FromAddress == nil { got.EVM[c].ChainWriter.FromAddress = &addr diff --git a/core/services/directrequest/validate.go b/core/services/directrequest/validate.go index 271e720660f..8cb9899d3f9 100644 --- a/core/services/directrequest/validate.go +++ b/core/services/directrequest/validate.go @@ -5,15 +5,15 @@ import ( "github.com/pkg/errors" "github.com/smartcontractkit/chainlink-common/pkg/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/null" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/store/models" ) type DirectRequestToml struct { - ContractAddress ethkey.EIP55Address `toml:"contractAddress"` + ContractAddress types.EIP55Address `toml:"contractAddress"` Requesters models.AddressCollection `toml:"requesters"` MinContractPayment *assets.Link `toml:"minContractPaymentLinkJuels"` EVMChainID *big.Big `toml:"evmChainID"` diff --git a/core/services/feeds/service.go b/core/services/feeds/service.go index fa5ad51a65a..abb85f39fe4 100644 --- a/core/services/feeds/service.go +++ b/core/services/feeds/service.go @@ -19,6 +19,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/services" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" "github.com/smartcontractkit/chainlink/v2/core/logger" @@ -26,7 +27,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/fluxmonitorv2" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocrkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/p2pkey" "github.com/smartcontractkit/chainlink/v2/core/services/ocr" @@ -1101,7 +1101,7 @@ func (s *service) findExistingJobForOCR2(j *job.Job, qopts pg.QOpt) (int32, erro // findExistingJobForOCRFlux looks for existing job for OCR or flux func (s *service) findExistingJobForOCRFlux(j *job.Job, qopts pg.QOpt) (int32, error) { - var address ethkey.EIP55Address + var address types.EIP55Address var evmChainID *big.Big switch j.Type { diff --git a/core/services/feeds/service_test.go b/core/services/feeds/service_test.go index 0e590fa9038..afefc5b2df8 100644 --- a/core/services/feeds/service_test.go +++ b/core/services/feeds/service_test.go @@ -20,6 +20,7 @@ import ( commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" "github.com/smartcontractkit/chainlink-common/pkg/services/servicetest" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" @@ -35,7 +36,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/job" jobmocks "github.com/smartcontractkit/chainlink/v2/core/services/job/mocks" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/csakey" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/keystest" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ocrkey" ksmocks "github.com/smartcontractkit/chainlink/v2/core/services/keystore/mocks" @@ -1547,7 +1547,7 @@ func Test_Service_ListSpecsByJobProposalIDs(t *testing.T) { func Test_Service_ApproveSpec(t *testing.T) { var evmChainID *big.Big - address := ethkey.EIP55AddressFromAddress(common.Address{}) + address := types.EIP55AddressFromAddress(common.Address{}) externalJobID := uuid.New() var ( diff --git a/core/services/fluxmonitorv2/integrations_test.go b/core/services/fluxmonitorv2/integrations_test.go index 7f45e6eb19c..3fbbdd8925f 100644 --- a/core/services/fluxmonitorv2/integrations_test.go +++ b/core/services/fluxmonitorv2/integrations_test.go @@ -30,6 +30,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/log" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" evmutils "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/flags_wrapper" faw "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/flux_aggregator_wrapper" @@ -623,7 +624,7 @@ func TestFluxMonitor_NewRound(t *testing.T) { app := startApplication(t, fa, func(c *chainlink.Config, s *chainlink.Secrets) { c.JobPipeline.HTTPRequest.DefaultTimeout = commonconfig.MustNewDuration(100 * time.Millisecond) c.Database.Listener.FallbackPollInterval = commonconfig.MustNewDuration(1 * time.Second) - flags := ethkey.EIP55AddressFromAddress(fa.flagsContractAddress) + flags := types.EIP55AddressFromAddress(fa.flagsContractAddress) c.EVM[0].FlagsContractAddress = &flags }) @@ -734,7 +735,7 @@ func TestFluxMonitor_HibernationMode(t *testing.T) { app := startApplication(t, fa, func(c *chainlink.Config, s *chainlink.Secrets) { c.JobPipeline.HTTPRequest.DefaultTimeout = commonconfig.MustNewDuration(100 * time.Millisecond) c.Database.Listener.FallbackPollInterval = commonconfig.MustNewDuration(1 * time.Second) - flags := ethkey.EIP55AddressFromAddress(fa.flagsContractAddress) + flags := types.EIP55AddressFromAddress(fa.flagsContractAddress) c.EVM[0].FlagsContractAddress = &flags }) diff --git a/core/services/job/job_orm_test.go b/core/services/job/job_orm_test.go index 9716231868c..a8931796fd0 100644 --- a/core/services/job/job_orm_test.go +++ b/core/services/job/job_orm_test.go @@ -19,6 +19,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest/heavyweight" @@ -483,7 +484,7 @@ func TestORM_CreateJob_VRFV2(t *testing.T) { actual = append(actual, common.BytesToAddress(b).String()) } require.ElementsMatch(t, fromAddresses, actual) - var vrfOwnerAddress ethkey.EIP55Address + var vrfOwnerAddress evmtypes.EIP55Address require.NoError(t, db.Get(&vrfOwnerAddress, `SELECT vrf_owner_address FROM vrf_specs LIMIT 1`)) require.Equal(t, "0x32891BD79647DC9136Fc0a59AAB48c7825eb624c", vrfOwnerAddress.Address().String()) require.NoError(t, jobORM.DeleteJob(jb.ID)) @@ -567,7 +568,7 @@ func TestORM_CreateJob_VRFV2Plus(t *testing.T) { actual = append(actual, common.BytesToAddress(b).String()) } require.ElementsMatch(t, fromAddresses, actual) - var vrfOwnerAddress ethkey.EIP55Address + var vrfOwnerAddress evmtypes.EIP55Address require.Error(t, db.Get(&vrfOwnerAddress, `SELECT vrf_owner_address FROM vrf_specs LIMIT 1`)) require.NoError(t, jobORM.DeleteJob(jb.ID)) cltest.AssertCount(t, db, "vrf_specs", 0) diff --git a/core/services/job/mocks/orm.go b/core/services/job/mocks/orm.go index 062c6e936bc..1068f511cdc 100644 --- a/core/services/job/mocks/orm.go +++ b/core/services/job/mocks/orm.go @@ -8,8 +8,6 @@ import ( context "context" - ethkey "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" - job "github.com/smartcontractkit/chainlink/v2/core/services/job" mock "github.com/stretchr/testify/mock" @@ -18,6 +16,8 @@ import ( pipeline "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" + types "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" + uuid "github.com/google/uuid" ) @@ -222,7 +222,7 @@ func (_m *ORM) FindJobByExternalJobID(_a0 uuid.UUID, qopts ...pg.QOpt) (job.Job, } // FindJobIDByAddress provides a mock function with given fields: address, evmChainID, qopts -func (_m *ORM) FindJobIDByAddress(address ethkey.EIP55Address, evmChainID *big.Big, qopts ...pg.QOpt) (int32, error) { +func (_m *ORM) FindJobIDByAddress(address types.EIP55Address, evmChainID *big.Big, qopts ...pg.QOpt) (int32, error) { _va := make([]interface{}, len(qopts)) for _i := range qopts { _va[_i] = qopts[_i] @@ -238,16 +238,16 @@ func (_m *ORM) FindJobIDByAddress(address ethkey.EIP55Address, evmChainID *big.B var r0 int32 var r1 error - if rf, ok := ret.Get(0).(func(ethkey.EIP55Address, *big.Big, ...pg.QOpt) (int32, error)); ok { + if rf, ok := ret.Get(0).(func(types.EIP55Address, *big.Big, ...pg.QOpt) (int32, error)); ok { return rf(address, evmChainID, qopts...) } - if rf, ok := ret.Get(0).(func(ethkey.EIP55Address, *big.Big, ...pg.QOpt) int32); ok { + if rf, ok := ret.Get(0).(func(types.EIP55Address, *big.Big, ...pg.QOpt) int32); ok { r0 = rf(address, evmChainID, qopts...) } else { r0 = ret.Get(0).(int32) } - if rf, ok := ret.Get(1).(func(ethkey.EIP55Address, *big.Big, ...pg.QOpt) error); ok { + if rf, ok := ret.Get(1).(func(types.EIP55Address, *big.Big, ...pg.QOpt) error); ok { r1 = rf(address, evmChainID, qopts...) } else { r1 = ret.Error(1) diff --git a/core/services/job/models.go b/core/services/job/models.go index 233912d09c2..218be21bc54 100644 --- a/core/services/job/models.go +++ b/core/services/job/models.go @@ -20,10 +20,10 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" clnull "github.com/smartcontractkit/chainlink/v2/core/null" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" "github.com/smartcontractkit/chainlink/v2/core/services/relay" "github.com/smartcontractkit/chainlink/v2/core/services/signatures/secp256k1" @@ -247,24 +247,24 @@ func (pr *PipelineRun) SetID(value string) error { // OCROracleSpec defines the job spec for OCR jobs. type OCROracleSpec struct { - ID int32 `toml:"-"` - ContractAddress ethkey.EIP55Address `toml:"contractAddress"` - P2PV2Bootstrappers pq.StringArray `toml:"p2pv2Bootstrappers" db:"p2pv2_bootstrappers"` - IsBootstrapPeer bool `toml:"isBootstrapPeer"` - EncryptedOCRKeyBundleID *models.Sha256Hash `toml:"keyBundleID"` - TransmitterAddress *ethkey.EIP55Address `toml:"transmitterAddress"` - ObservationTimeout models.Interval `toml:"observationTimeout"` - BlockchainTimeout models.Interval `toml:"blockchainTimeout"` - ContractConfigTrackerSubscribeInterval models.Interval `toml:"contractConfigTrackerSubscribeInterval"` - ContractConfigTrackerPollInterval models.Interval `toml:"contractConfigTrackerPollInterval"` - ContractConfigConfirmations uint16 `toml:"contractConfigConfirmations"` - EVMChainID *big.Big `toml:"evmChainID" db:"evm_chain_id"` - DatabaseTimeout *models.Interval `toml:"databaseTimeout"` - ObservationGracePeriod *models.Interval `toml:"observationGracePeriod"` - ContractTransmitterTransmitTimeout *models.Interval `toml:"contractTransmitterTransmitTimeout"` - CaptureEATelemetry bool `toml:"captureEATelemetry"` - CreatedAt time.Time `toml:"-"` - UpdatedAt time.Time `toml:"-"` + ID int32 `toml:"-"` + ContractAddress evmtypes.EIP55Address `toml:"contractAddress"` + P2PV2Bootstrappers pq.StringArray `toml:"p2pv2Bootstrappers" db:"p2pv2_bootstrappers"` + IsBootstrapPeer bool `toml:"isBootstrapPeer"` + EncryptedOCRKeyBundleID *models.Sha256Hash `toml:"keyBundleID"` + TransmitterAddress *evmtypes.EIP55Address `toml:"transmitterAddress"` + ObservationTimeout models.Interval `toml:"observationTimeout"` + BlockchainTimeout models.Interval `toml:"blockchainTimeout"` + ContractConfigTrackerSubscribeInterval models.Interval `toml:"contractConfigTrackerSubscribeInterval"` + ContractConfigTrackerPollInterval models.Interval `toml:"contractConfigTrackerPollInterval"` + ContractConfigConfirmations uint16 `toml:"contractConfigConfirmations"` + EVMChainID *big.Big `toml:"evmChainID" db:"evm_chain_id"` + DatabaseTimeout *models.Interval `toml:"databaseTimeout"` + ObservationGracePeriod *models.Interval `toml:"observationGracePeriod"` + ContractTransmitterTransmitTimeout *models.Interval `toml:"contractTransmitterTransmitTimeout"` + CaptureEATelemetry bool `toml:"captureEATelemetry"` + CreatedAt time.Time `toml:"-"` + UpdatedAt time.Time `toml:"-"` } // GetID is a getter function that returns the ID of the spec. @@ -443,7 +443,7 @@ func (w *WebhookSpec) SetID(value string) error { type DirectRequestSpec struct { ID int32 `toml:"-"` - ContractAddress ethkey.EIP55Address `toml:"contractAddress"` + ContractAddress evmtypes.EIP55Address `toml:"contractAddress"` MinIncomingConfirmations clnull.Uint32 `toml:"minIncomingConfirmations"` Requesters models.AddressCollection `toml:"requesters"` MinContractPayment *commonassets.Link `toml:"minContractPaymentLinkJuels"` @@ -473,9 +473,9 @@ func (s *CronSpec) SetID(value string) error { } type FluxMonitorSpec struct { - ID int32 `toml:"-"` - ContractAddress ethkey.EIP55Address `toml:"contractAddress"` - Threshold tomlutils.Float32 `toml:"threshold,float"` + ID int32 `toml:"-"` + ContractAddress evmtypes.EIP55Address `toml:"contractAddress"` + Threshold tomlutils.Float32 `toml:"threshold,float"` // AbsoluteThreshold is the maximum absolute change allowed in a fluxmonitored // value before a new round should be kicked off, so that the current value // can be reported on-chain. @@ -494,13 +494,13 @@ type FluxMonitorSpec struct { } type KeeperSpec struct { - ID int32 `toml:"-"` - ContractAddress ethkey.EIP55Address `toml:"contractAddress"` - MinIncomingConfirmations *uint32 `toml:"minIncomingConfirmations"` - FromAddress ethkey.EIP55Address `toml:"fromAddress"` - EVMChainID *big.Big `toml:"evmChainID"` - CreatedAt time.Time `toml:"-"` - UpdatedAt time.Time `toml:"-"` + ID int32 `toml:"-"` + ContractAddress evmtypes.EIP55Address `toml:"contractAddress"` + MinIncomingConfirmations *uint32 `toml:"minIncomingConfirmations"` + FromAddress evmtypes.EIP55Address `toml:"fromAddress"` + EVMChainID *big.Big `toml:"evmChainID"` + CreatedAt time.Time `toml:"-"` + UpdatedAt time.Time `toml:"-"` } type VRFSpec struct { @@ -508,7 +508,7 @@ type VRFSpec struct { // BatchCoordinatorAddress is the address of the batch vrf coordinator to use. // This is required if batchFulfillmentEnabled is set to true in the job spec. - BatchCoordinatorAddress *ethkey.EIP55Address `toml:"batchCoordinatorAddress"` + BatchCoordinatorAddress *evmtypes.EIP55Address `toml:"batchCoordinatorAddress"` // BatchFulfillmentEnabled indicates to the vrf job to use the batch vrf coordinator // for fulfilling requests. If set to true, batchCoordinatorAddress must be set in // the job spec. @@ -523,16 +523,16 @@ type VRFSpec struct { // VRFOwnerAddress is the address of the VRFOwner address to use. // // V2 only. - VRFOwnerAddress *ethkey.EIP55Address `toml:"vrfOwnerAddress"` + VRFOwnerAddress *evmtypes.EIP55Address `toml:"vrfOwnerAddress"` - CoordinatorAddress ethkey.EIP55Address `toml:"coordinatorAddress"` - PublicKey secp256k1.PublicKey `toml:"publicKey"` - MinIncomingConfirmations uint32 `toml:"minIncomingConfirmations"` - EVMChainID *big.Big `toml:"evmChainID"` - FromAddresses []ethkey.EIP55Address `toml:"fromAddresses"` - PollPeriod time.Duration `toml:"pollPeriod"` // For v2 jobs - RequestedConfsDelay int64 `toml:"requestedConfsDelay"` // For v2 jobs. Optional, defaults to 0 if not provided. - RequestTimeout time.Duration `toml:"requestTimeout"` // Optional, defaults to 24hr if not provided. + CoordinatorAddress evmtypes.EIP55Address `toml:"coordinatorAddress"` + PublicKey secp256k1.PublicKey `toml:"publicKey"` + MinIncomingConfirmations uint32 `toml:"minIncomingConfirmations"` + EVMChainID *big.Big `toml:"evmChainID"` + FromAddresses []evmtypes.EIP55Address `toml:"fromAddresses"` + PollPeriod time.Duration `toml:"pollPeriod"` // For v2 jobs + RequestedConfsDelay int64 `toml:"requestedConfsDelay"` // For v2 jobs. Optional, defaults to 0 if not provided. + RequestTimeout time.Duration `toml:"requestTimeout"` // Optional, defaults to 24hr if not provided. // GasLanePrice specifies the gas lane price for this VRF job. // If the specified keys in FromAddresses do not have the provided gas price the job @@ -563,15 +563,15 @@ type BlockhashStoreSpec struct { // CoordinatorV1Address is the VRF V1 coordinator to watch for unfulfilled requests. If empty, // no V1 coordinator will be watched. - CoordinatorV1Address *ethkey.EIP55Address `toml:"coordinatorV1Address"` + CoordinatorV1Address *evmtypes.EIP55Address `toml:"coordinatorV1Address"` // CoordinatorV2Address is the VRF V2 coordinator to watch for unfulfilled requests. If empty, // no V2 coordinator will be watched. - CoordinatorV2Address *ethkey.EIP55Address `toml:"coordinatorV2Address"` + CoordinatorV2Address *evmtypes.EIP55Address `toml:"coordinatorV2Address"` // CoordinatorV2PlusAddress is the VRF V2Plus coordinator to watch for unfulfilled requests. If empty, // no V2Plus coordinator will be watched. - CoordinatorV2PlusAddress *ethkey.EIP55Address `toml:"coordinatorV2PlusAddress"` + CoordinatorV2PlusAddress *evmtypes.EIP55Address `toml:"coordinatorV2PlusAddress"` // LookbackBlocks defines the maximum age of blocks whose hashes should be stored. LookbackBlocks int32 `toml:"lookbackBlocks"` @@ -587,10 +587,10 @@ type BlockhashStoreSpec struct { // BlockhashStoreAddress is the address of the BlockhashStore contract to store blockhashes // into. - BlockhashStoreAddress ethkey.EIP55Address `toml:"blockhashStoreAddress"` + BlockhashStoreAddress evmtypes.EIP55Address `toml:"blockhashStoreAddress"` // BatchBlockhashStoreAddress is the address of the trusted BlockhashStore contract to store blockhashes - TrustedBlockhashStoreAddress *ethkey.EIP55Address `toml:"trustedBlockhashStoreAddress"` + TrustedBlockhashStoreAddress *evmtypes.EIP55Address `toml:"trustedBlockhashStoreAddress"` // BatchBlockhashStoreBatchSize is the number of blockhashes to store in a single batch TrustedBlockhashStoreBatchSize int32 `toml:"trustedBlockhashStoreBatchSize"` @@ -605,7 +605,7 @@ type BlockhashStoreSpec struct { EVMChainID *big.Big `toml:"evmChainID"` // FromAddress is the sender address that should be used to store blockhashes. - FromAddresses []ethkey.EIP55Address `toml:"fromAddresses"` + FromAddresses []evmtypes.EIP55Address `toml:"fromAddresses"` // CreatedAt is the time this job was created. CreatedAt time.Time `toml:"-"` @@ -620,15 +620,15 @@ type BlockHeaderFeederSpec struct { // CoordinatorV1Address is the VRF V1 coordinator to watch for unfulfilled requests. If empty, // no V1 coordinator will be watched. - CoordinatorV1Address *ethkey.EIP55Address `toml:"coordinatorV1Address"` + CoordinatorV1Address *evmtypes.EIP55Address `toml:"coordinatorV1Address"` // CoordinatorV2Address is the VRF V2 coordinator to watch for unfulfilled requests. If empty, // no V2 coordinator will be watched. - CoordinatorV2Address *ethkey.EIP55Address `toml:"coordinatorV2Address"` + CoordinatorV2Address *evmtypes.EIP55Address `toml:"coordinatorV2Address"` // CoordinatorV2PlusAddress is the VRF V2Plus coordinator to watch for unfulfilled requests. If empty, // no V2Plus coordinator will be watched. - CoordinatorV2PlusAddress *ethkey.EIP55Address `toml:"coordinatorV2PlusAddress"` + CoordinatorV2PlusAddress *evmtypes.EIP55Address `toml:"coordinatorV2PlusAddress"` // LookbackBlocks defines the maximum age of blocks whose hashes should be stored. LookbackBlocks int32 `toml:"lookbackBlocks"` @@ -638,11 +638,11 @@ type BlockHeaderFeederSpec struct { // BlockhashStoreAddress is the address of the BlockhashStore contract to store blockhashes // into. - BlockhashStoreAddress ethkey.EIP55Address `toml:"blockhashStoreAddress"` + BlockhashStoreAddress evmtypes.EIP55Address `toml:"blockhashStoreAddress"` // BatchBlockhashStoreAddress is the address of the BatchBlockhashStore contract to store blockhashes // into. - BatchBlockhashStoreAddress ethkey.EIP55Address `toml:"batchBlockhashStoreAddress"` + BatchBlockhashStoreAddress evmtypes.EIP55Address `toml:"batchBlockhashStoreAddress"` // PollPeriod defines how often recent blocks should be scanned for blockhash storage. PollPeriod time.Duration `toml:"pollPeriod"` @@ -654,7 +654,7 @@ type BlockHeaderFeederSpec struct { EVMChainID *big.Big `toml:"evmChainID"` // FromAddress is the sender address that should be used to store blockhashes. - FromAddresses []ethkey.EIP55Address `toml:"fromAddresses"` + FromAddresses []evmtypes.EIP55Address `toml:"fromAddresses"` // GetBlockHashesBatchSize is the RPC call batch size for retrieving blockhashes GetBlockhashesBatchSize uint16 `toml:"getBlockhashesBatchSize"` @@ -675,7 +675,7 @@ type LegacyGasStationServerSpec struct { // ForwarderAddress is the address of EIP2771 forwarder that verifies signature // and forwards requests to target contracts - ForwarderAddress ethkey.EIP55Address `toml:"forwarderAddress"` + ForwarderAddress evmtypes.EIP55Address `toml:"forwarderAddress"` // EVMChainID defines the chain ID from which the meta-transaction request originates. EVMChainID *big.Big `toml:"evmChainID"` @@ -685,7 +685,7 @@ type LegacyGasStationServerSpec struct { CCIPChainSelector *big.Big `toml:"ccipChainSelector"` // FromAddress is the sender address that should be used to send meta-transactions - FromAddresses []ethkey.EIP55Address `toml:"fromAddresses"` + FromAddresses []evmtypes.EIP55Address `toml:"fromAddresses"` // CreatedAt is the time this job was created. CreatedAt time.Time `toml:"-"` @@ -700,10 +700,10 @@ type LegacyGasStationSidecarSpec struct { // ForwarderAddress is the address of EIP2771 forwarder that verifies signature // and forwards requests to target contracts - ForwarderAddress ethkey.EIP55Address `toml:"forwarderAddress"` + ForwarderAddress evmtypes.EIP55Address `toml:"forwarderAddress"` // OffRampAddress is the address of CCIP OffRamp for the given chainID - OffRampAddress ethkey.EIP55Address `toml:"offRampAddress"` + OffRampAddress evmtypes.EIP55Address `toml:"offRampAddress"` // LookbackBlocks defines the maximum number of blocks to search for on-chain events. LookbackBlocks int32 `toml:"lookbackBlocks"` @@ -785,13 +785,13 @@ type EALSpec struct { // ForwarderAddress is the address of EIP2771 forwarder that verifies signature // and forwards requests to target contracts - ForwarderAddress ethkey.EIP55Address `toml:"forwarderAddress"` + ForwarderAddress evmtypes.EIP55Address `toml:"forwarderAddress"` // EVMChainID defines the chain ID from which the meta-transaction request originates. EVMChainID *big.Big `toml:"evmChainID"` // FromAddress is the sender address that should be used to send meta-transactions - FromAddresses []ethkey.EIP55Address `toml:"fromAddresses"` + FromAddresses []evmtypes.EIP55Address `toml:"fromAddresses"` // LookbackBlocks defines the maximum age of blocks to lookback in status tracker LookbackBlocks int32 `toml:"lookbackBlocks"` diff --git a/core/services/job/orm.go b/core/services/job/orm.go index c608e2cc544..6c8533d1dee 100644 --- a/core/services/job/orm.go +++ b/core/services/job/orm.go @@ -22,12 +22,12 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/bridges" 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/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/null" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" medianconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/median/config" "github.com/smartcontractkit/chainlink/v2/core/services/pg" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" @@ -52,7 +52,7 @@ type ORM interface { FindJobTx(ctx context.Context, id int32) (Job, error) FindJob(ctx context.Context, id int32) (Job, error) FindJobByExternalJobID(uuid uuid.UUID, qopts ...pg.QOpt) (Job, error) - FindJobIDByAddress(address ethkey.EIP55Address, evmChainID *big.Big, qopts ...pg.QOpt) (int32, error) + FindJobIDByAddress(address evmtypes.EIP55Address, evmChainID *big.Big, qopts ...pg.QOpt) (int32, error) FindOCR2JobIDByAddress(contractID string, feedID *common.Hash, qopts ...pg.QOpt) (int32, error) FindJobIDsWithBridge(name string) ([]int32, error) DeleteJob(id int32, qopts ...pg.QOpt) error @@ -731,7 +731,7 @@ type OCRConfig interface { ContractSubscribeInterval() time.Duration KeyBundleID() (string, error) ObservationTimeout() time.Duration - TransmitterAddress() (ethkey.EIP55Address, error) + TransmitterAddress() (evmtypes.EIP55Address, error) } // LoadConfigVarsLocalOCR loads local OCR vars into the OCROracleSpec. @@ -842,7 +842,7 @@ func (o *orm) FindJobByExternalJobID(externalJobID uuid.UUID, qopts ...pg.QOpt) } // FindJobIDByAddress - finds a job id by contract address. Currently only OCR and FM jobs are supported -func (o *orm) FindJobIDByAddress(address ethkey.EIP55Address, evmChainID *big.Big, qopts ...pg.QOpt) (jobID int32, err error) { +func (o *orm) FindJobIDByAddress(address evmtypes.EIP55Address, evmChainID *big.Big, qopts ...pg.QOpt) (jobID int32, err error) { q := o.q.WithOpts(qopts...) err = q.Transaction(func(tx pg.Queryer) error { stmt := ` @@ -1321,7 +1321,7 @@ func toVRFSpecRow(spec *VRFSpec) vrfSpecRow { func (r vrfSpecRow) toVRFSpec() *VRFSpec { for _, a := range r.FromAddresses { r.VRFSpec.FromAddresses = append(r.VRFSpec.FromAddresses, - ethkey.EIP55AddressFromAddress(common.BytesToAddress(a))) + evmtypes.EIP55AddressFromAddress(common.BytesToAddress(a))) } return r.VRFSpec } @@ -1360,7 +1360,7 @@ func toBlockhashStoreSpecRow(spec *BlockhashStoreSpec) blockhashStoreSpecRow { func (r blockhashStoreSpecRow) toBlockhashStoreSpec() *BlockhashStoreSpec { for _, a := range r.FromAddresses { r.BlockhashStoreSpec.FromAddresses = append(r.BlockhashStoreSpec.FromAddresses, - ethkey.EIP55AddressFromAddress(common.BytesToAddress(a))) + evmtypes.EIP55AddressFromAddress(common.BytesToAddress(a))) } return r.BlockhashStoreSpec } @@ -1399,7 +1399,7 @@ func toBlockHeaderFeederSpecRow(spec *BlockHeaderFeederSpec) blockHeaderFeederSp func (r blockHeaderFeederSpecRow) toBlockHeaderFeederSpec() *BlockHeaderFeederSpec { for _, a := range r.FromAddresses { r.BlockHeaderFeederSpec.FromAddresses = append(r.BlockHeaderFeederSpec.FromAddresses, - ethkey.EIP55AddressFromAddress(common.BytesToAddress(a))) + evmtypes.EIP55AddressFromAddress(common.BytesToAddress(a))) } return r.BlockHeaderFeederSpec } @@ -1438,7 +1438,7 @@ func toLegacyGasStationServerSpecRow(spec *LegacyGasStationServerSpec) legacyGas func (r legacyGasStationServerSpecRow) toLegacyGasStationServerSpec() *LegacyGasStationServerSpec { for _, a := range r.FromAddresses { r.LegacyGasStationServerSpec.FromAddresses = append(r.LegacyGasStationServerSpec.FromAddresses, - ethkey.EIP55AddressFromAddress(common.BytesToAddress(a))) + evmtypes.EIP55AddressFromAddress(common.BytesToAddress(a))) } return r.LegacyGasStationServerSpec } diff --git a/core/services/job/runner_integration_test.go b/core/services/job/runner_integration_test.go index 2722e190e24..8c631984680 100644 --- a/core/services/job/runner_integration_test.go +++ b/core/services/job/runner_integration_test.go @@ -29,6 +29,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/auth" "github.com/smartcontractkit/chainlink/v2/core/bridges" + "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/core/internal/testutils/configtest" @@ -38,7 +39,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/ocr" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/validate" "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" @@ -67,7 +67,7 @@ func TestRunner(t *testing.T) { require.NoError(t, err) kbid := models.MustSha256HashFromHex(kb.ID()) c.OCR.KeyBundleID = &kbid - taddress := ethkey.EIP55AddressFromAddress(transmitterAddress) + taddress := types.EIP55AddressFromAddress(transmitterAddress) c.OCR.TransmitterAddress = &taddress c.OCR2.DatabaseTimeout = commonconfig.MustNewDuration(time.Second) c.OCR2.ContractTransmitterTransmitTimeout = commonconfig.MustNewDuration(time.Second) diff --git a/core/services/keeper/integration_test.go b/core/services/keeper/integration_test.go index e92d2c2a58f..d78b1fb2ca5 100644 --- a/core/services/keeper/integration_test.go +++ b/core/services/keeper/integration_test.go @@ -20,6 +20,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/forwarders" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/authorized_forwarder" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/basic_upkeep_contract" @@ -36,7 +37,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keeper" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" webpresenters "github.com/smartcontractkit/chainlink/v2/core/web/presenters" ) @@ -77,7 +77,7 @@ func deployKeeperRegistry( require.NoError(t, err) backend.Commit() - wrapper, err := keeper.NewRegistryWrapper(ethkey.EIP55AddressFromAddress(regAddr), backend) + wrapper, err := keeper.NewRegistryWrapper(evmtypes.EIP55AddressFromAddress(regAddr), backend) require.NoError(t, err) return regAddr, wrapper case keeper.RegistryVersion_1_2: @@ -104,7 +104,7 @@ func deployKeeperRegistry( ) require.NoError(t, err) backend.Commit() - wrapper, err := keeper.NewRegistryWrapper(ethkey.EIP55AddressFromAddress(regAddr), backend) + wrapper, err := keeper.NewRegistryWrapper(evmtypes.EIP55AddressFromAddress(regAddr), backend) require.NoError(t, err) return regAddr, wrapper case keeper.RegistryVersion_1_3: @@ -140,7 +140,7 @@ func deployKeeperRegistry( ) require.NoError(t, err) backend.Commit() - wrapper, err := keeper.NewRegistryWrapper(ethkey.EIP55AddressFromAddress(regAddr), backend) + wrapper, err := keeper.NewRegistryWrapper(evmtypes.EIP55AddressFromAddress(regAddr), backend) require.NoError(t, err) return regAddr, wrapper default: @@ -181,7 +181,7 @@ func TestKeeperEthIntegration(t *testing.T) { // setup node key nodeKey := cltest.MustGenerateRandomKey(t) nodeAddress := nodeKey.Address - nodeAddressEIP55 := ethkey.EIP55AddressFromAddress(nodeAddress) + nodeAddressEIP55 := evmtypes.EIP55AddressFromAddress(nodeAddress) // setup blockchain sergey := testutils.MustNewSimTransactor(t) // owns all the link @@ -254,7 +254,7 @@ func TestKeeperEthIntegration(t *testing.T) { require.NoError(t, app.Start(testutils.Context(t))) // create job - regAddrEIP55 := ethkey.EIP55AddressFromAddress(regAddr) + regAddrEIP55 := evmtypes.EIP55AddressFromAddress(regAddr) job := cltest.MustInsertKeeperJob(t, db, korm, nodeAddressEIP55, regAddrEIP55) err = app.JobSpawner().StartService(testutils.Context(t), job) require.NoError(t, err) @@ -333,7 +333,7 @@ func TestKeeperForwarderEthIntegration(t *testing.T) { // setup node key nodeKey := cltest.MustGenerateRandomKey(t) nodeAddress := nodeKey.Address - nodeAddressEIP55 := ethkey.EIP55AddressFromAddress(nodeAddress) + nodeAddressEIP55 := evmtypes.EIP55AddressFromAddress(nodeAddress) // setup blockchain sergey := testutils.MustNewSimTransactor(t) // owns all the link @@ -423,7 +423,7 @@ func TestKeeperForwarderEthIntegration(t *testing.T) { require.Equal(t, addr, fwdrAddress) // create job - regAddrEIP55 := ethkey.EIP55AddressFromAddress(regAddr) + regAddrEIP55 := evmtypes.EIP55AddressFromAddress(regAddr) jb := job.Job{ ID: 1, @@ -447,9 +447,9 @@ func TestKeeperForwarderEthIntegration(t *testing.T) { JobID: jb.ID, KeeperIndex: 0, NumKeepers: 2, - KeeperIndexMap: map[ethkey.EIP55Address]int32{ + KeeperIndexMap: map[evmtypes.EIP55Address]int32{ nodeAddressEIP55: 0, - ethkey.EIP55AddressFromAddress(nelly.From): 1, + evmtypes.EIP55AddressFromAddress(nelly.From): 1, }, } err = korm.UpsertRegistry(®istry) @@ -489,7 +489,7 @@ func TestMaxPerformDataSize(t *testing.T) { // setup node key nodeKey := cltest.MustGenerateRandomKey(t) nodeAddress := nodeKey.Address - nodeAddressEIP55 := ethkey.EIP55AddressFromAddress(nodeAddress) + nodeAddressEIP55 := evmtypes.EIP55AddressFromAddress(nodeAddress) // setup blockchain sergey := testutils.MustNewSimTransactor(t) // owns all the link @@ -558,7 +558,7 @@ func TestMaxPerformDataSize(t *testing.T) { require.NoError(t, app.Start(testutils.Context(t))) // create job - regAddrEIP55 := ethkey.EIP55AddressFromAddress(regAddr) + regAddrEIP55 := evmtypes.EIP55AddressFromAddress(regAddr) job := cltest.MustInsertKeeperJob(t, db, korm, nodeAddressEIP55, regAddrEIP55) err = app.JobSpawner().StartService(testutils.Context(t), job) require.NoError(t, err) diff --git a/core/services/keeper/models.go b/core/services/keeper/models.go index fe034bcc505..69bd0e6a577 100644 --- a/core/services/keeper/models.go +++ b/core/services/keeper/models.go @@ -8,20 +8,20 @@ import ( "github.com/pkg/errors" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/null" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ) -type KeeperIndexMap map[ethkey.EIP55Address]int32 +type KeeperIndexMap map[types.EIP55Address]int32 type Registry struct { ID int64 BlockCountPerTurn int32 CheckGas uint32 - ContractAddress ethkey.EIP55Address - FromAddress ethkey.EIP55Address + ContractAddress types.EIP55Address + FromAddress types.EIP55Address JobID int32 KeeperIndex int32 NumKeepers int32 diff --git a/core/services/keeper/orm.go b/core/services/keeper/orm.go index fc8770cd864..55dd6c52e68 100644 --- a/core/services/keeper/orm.go +++ b/core/services/keeper/orm.go @@ -7,9 +7,9 @@ import ( "github.com/lib/pq" "github.com/pkg/errors" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/pg" ) @@ -40,7 +40,7 @@ func (korm ORM) Registries() ([]Registry, error) { } // RegistryByContractAddress returns a single registry based on provided address -func (korm ORM) RegistryByContractAddress(registryAddress ethkey.EIP55Address) (Registry, error) { +func (korm ORM) RegistryByContractAddress(registryAddress types.EIP55Address) (Registry, error) { var registry Registry err := korm.q.Get(®istry, `SELECT * FROM keeper_registries WHERE keeper_registries.contract_address = $1`, registryAddress) return registry, errors.Wrap(err, "failed to get registry") @@ -86,7 +86,7 @@ RETURNING * } // UpdateUpkeepLastKeeperIndex updates the last keeper index for an upkeep -func (korm ORM) UpdateUpkeepLastKeeperIndex(jobID int32, upkeepID *big.Big, fromAddress ethkey.EIP55Address) error { +func (korm ORM) UpdateUpkeepLastKeeperIndex(jobID int32, upkeepID *big.Big, fromAddress types.EIP55Address) error { _, err := korm.q.Exec(` UPDATE upkeep_registrations SET @@ -125,7 +125,7 @@ DELETE FROM upkeep_registrations WHERE registry_id IN ( // -- OR is it my buddy's turn AND they were the last keeper to do the perform for this upkeep // DEV: note we cast upkeep_id and binaryHash as 32 bits, even though both are 256 bit numbers when performing XOR. This is enough information // to distribute the upkeeps over the keepers so long as num keepers < 4294967296 -func (korm ORM) EligibleUpkeepsForRegistry(registryAddress ethkey.EIP55Address, blockNumber int64, gracePeriod int64, binaryHash string) (upkeeps []UpkeepRegistration, err error) { +func (korm ORM) EligibleUpkeepsForRegistry(registryAddress types.EIP55Address, blockNumber int64, gracePeriod int64, binaryHash string) (upkeeps []UpkeepRegistration, err error) { stmt := ` SELECT upkeep_registrations.* FROM upkeep_registrations @@ -212,7 +212,7 @@ WHERE registry_id = $1 } // SetLastRunInfoForUpkeepOnJob sets the last run block height and the associated keeper index only if the new block height is greater than the previous. -func (korm ORM) SetLastRunInfoForUpkeepOnJob(jobID int32, upkeepID *big.Big, height int64, fromAddress ethkey.EIP55Address, qopts ...pg.QOpt) (int64, error) { +func (korm ORM) SetLastRunInfoForUpkeepOnJob(jobID int32, upkeepID *big.Big, height int64, fromAddress types.EIP55Address, qopts ...pg.QOpt) (int64, error) { res, err := korm.q.WithOpts(qopts...).Exec(` UPDATE upkeep_registrations SET last_run_block_height = $1, diff --git a/core/services/keeper/orm_test.go b/core/services/keeper/orm_test.go index 2ce459886ae..ed58554ef0d 100644 --- a/core/services/keeper/orm_test.go +++ b/core/services/keeper/orm_test.go @@ -15,6 +15,7 @@ import ( "github.com/jmoiron/sqlx" evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" evmutils "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" @@ -23,7 +24,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/keeper" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/utils" bigmath "github.com/smartcontractkit/chainlink/v2/core/utils/big_math" ) @@ -400,9 +400,9 @@ func TestKeeperDB_NewSetLastRunInfoForUpkeepOnJob(t *testing.T) { registry, j := cltest.MustInsertKeeperRegistry(t, db, orm, ethKeyStore, 0, 1, 20) upkeep := cltest.MustInsertUpkeepForRegistry(t, db, config.Database(), registry) registry.NumKeepers = 2 - registry.KeeperIndexMap = map[ethkey.EIP55Address]int32{ + registry.KeeperIndexMap = map[types.EIP55Address]int32{ registry.FromAddress: 0, - ethkey.EIP55AddressFromAddress(evmutils.ZeroAddress): 1, + types.EIP55AddressFromAddress(evmutils.ZeroAddress): 1, } err := orm.UpsertRegistry(®istry) require.NoError(t, err, "UPDATE keeper_registries") @@ -418,7 +418,7 @@ func TestKeeperDB_NewSetLastRunInfoForUpkeepOnJob(t *testing.T) { require.Equal(t, rowsAffected, int64(0)) assertLastRunHeight(t, db, upkeep, 100, 0) // update to same block height allowed - rowsAffected, err = orm.SetLastRunInfoForUpkeepOnJob(j.ID, upkeep.UpkeepID, 100, ethkey.EIP55AddressFromAddress(evmutils.ZeroAddress)) + rowsAffected, err = orm.SetLastRunInfoForUpkeepOnJob(j.ID, upkeep.UpkeepID, 100, types.EIP55AddressFromAddress(evmutils.ZeroAddress)) require.NoError(t, err) require.Equal(t, rowsAffected, int64(1)) assertLastRunHeight(t, db, upkeep, 100, 1) diff --git a/core/services/keeper/registry_interface.go b/core/services/keeper/registry_interface.go index fd1c2314a41..c80be29154a 100644 --- a/core/services/keeper/registry_interface.go +++ b/core/services/keeper/registry_interface.go @@ -17,7 +17,6 @@ import ( registry1_2 "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/keeper_registry_wrapper1_2" registry1_3 "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/keeper_registry_wrapper1_3" type_and_version "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/type_and_version_interface_wrapper" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ) type RegistryVersion int32 @@ -53,7 +52,7 @@ type upkeepGetter interface { // RegistryWrapper implements a layer on top of different versions of registry wrappers // to provide a unified layer to rest of the codebase type RegistryWrapper struct { - Address ethkey.EIP55Address + Address evmtypes.EIP55Address Version RegistryVersion contract1_1 *registry1_1.KeeperRegistry contract1_2 *registry1_2.KeeperRegistry @@ -61,7 +60,7 @@ type RegistryWrapper struct { evmClient evmclient.Client } -func NewRegistryWrapper(address ethkey.EIP55Address, evmClient evmclient.Client) (*RegistryWrapper, error) { +func NewRegistryWrapper(address evmtypes.EIP55Address, evmClient evmclient.Client) (*RegistryWrapper, error) { interface_wrapper, err := type_and_version.NewTypeAndVersionInterface( address.Address(), evmClient, diff --git a/core/services/keeper/registry_synchronizer_process_logs.go b/core/services/keeper/registry_synchronizer_process_logs.go index 7b82f49ae4c..b0a3f6af5bd 100644 --- a/core/services/keeper/registry_synchronizer_process_logs.go +++ b/core/services/keeper/registry_synchronizer_process_logs.go @@ -7,11 +7,11 @@ import ( "github.com/pkg/errors" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/log" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" registry1_1 "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/keeper_registry_wrapper1_1" registry1_2 "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/keeper_registry_wrapper1_2" registry1_3 "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/keeper_registry_wrapper1_3" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ) func (rs *RegistrySynchronizer) processLogs() { @@ -144,7 +144,7 @@ func (rs *RegistrySynchronizer) handleUpkeepPerformed(broadcast log.Broadcast) e if err != nil { return errors.Wrap(err, "Unable to fetch upkeep ID from performed log") } - rowsAffected, err := rs.orm.SetLastRunInfoForUpkeepOnJob(rs.job.ID, big.New(log.UpkeepID), int64(broadcast.RawLog().BlockNumber), ethkey.EIP55AddressFromAddress(log.FromKeeper)) + rowsAffected, err := rs.orm.SetLastRunInfoForUpkeepOnJob(rs.job.ID, big.New(log.UpkeepID), int64(broadcast.RawLog().BlockNumber), types.EIP55AddressFromAddress(log.FromKeeper)) if err != nil { return errors.Wrap(err, "failed to set last run to 0") } @@ -152,7 +152,7 @@ func (rs *RegistrySynchronizer) handleUpkeepPerformed(broadcast log.Broadcast) e "jobID", rs.job.ID, "upkeepID", log.UpkeepID.String(), "blockNumber", int64(broadcast.RawLog().BlockNumber), - "fromAddr", ethkey.EIP55AddressFromAddress(log.FromKeeper), + "fromAddr", types.EIP55AddressFromAddress(log.FromKeeper), "rowsAffected", rowsAffected, ) return nil diff --git a/core/services/keeper/registry_synchronizer_sync.go b/core/services/keeper/registry_synchronizer_sync.go index 7614ed15edb..cdca9512976 100644 --- a/core/services/keeper/registry_synchronizer_sync.go +++ b/core/services/keeper/registry_synchronizer_sync.go @@ -7,9 +7,9 @@ import ( "github.com/pkg/errors" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ) func (rs *RegistrySynchronizer) fullSync() { @@ -130,7 +130,7 @@ func (rs *RegistrySynchronizer) syncUpkeep(getter upkeepGetter, registry Registr return errors.Wrap(err, "failed to upsert upkeep") } - if err := rs.orm.UpdateUpkeepLastKeeperIndex(rs.job.ID, upkeepID, ethkey.EIP55AddressFromAddress(upkeep.LastKeeper)); err != nil { + if err := rs.orm.UpdateUpkeepLastKeeperIndex(rs.job.ID, upkeepID, types.EIP55AddressFromAddress(upkeep.LastKeeper)); err != nil { return errors.Wrap(err, "failed to update upkeep last keeper index") } @@ -149,9 +149,9 @@ func (rs *RegistrySynchronizer) newRegistryFromChain() (Registry, error) { } keeperIndex := int32(-1) - keeperMap := map[ethkey.EIP55Address]int32{} + keeperMap := map[types.EIP55Address]int32{} for idx, address := range registryConfig.KeeperAddresses { - keeperMap[ethkey.EIP55AddressFromAddress(address)] = int32(idx) + keeperMap[types.EIP55AddressFromAddress(address)] = int32(idx) if address == fromAddress { keeperIndex = int32(idx) } @@ -174,7 +174,7 @@ func (rs *RegistrySynchronizer) newRegistryFromChain() (Registry, error) { // CalcPositioningConstant calculates a positioning constant. // The positioning constant is fixed because upkeepID and registryAddress are immutable -func CalcPositioningConstant(upkeepID *big.Big, registryAddress ethkey.EIP55Address) (int32, error) { +func CalcPositioningConstant(upkeepID *big.Big, registryAddress types.EIP55Address) (int32, error) { upkeepBytes := make([]byte, binary.MaxVarintLen64) binary.PutVarint(upkeepBytes, upkeepID.Mod(big.NewI(math.MaxInt64)).Int64()) bytesToHash := utils.ConcatBytes(upkeepBytes, registryAddress.Bytes()) diff --git a/core/services/keeper/registry_synchronizer_sync_test.go b/core/services/keeper/registry_synchronizer_sync_test.go index e6f42a83201..e4d8e44e20a 100644 --- a/core/services/keeper/registry_synchronizer_sync_test.go +++ b/core/services/keeper/registry_synchronizer_sync_test.go @@ -10,10 +10,10 @@ import ( "github.com/stretchr/testify/require" "go.uber.org/zap/zapcore" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ) // GetUpkeepFailure implements the upkeepGetter interface with an induced error and nil @@ -32,7 +32,7 @@ func TestSyncUpkeepWithCallback_UpkeepNotFound(t *testing.T) { logger: log.(logger.SugaredLogger), } - addr := ethkey.EIP55Address(testutils.NewAddress().Hex()) + addr := types.EIP55Address(testutils.NewAddress().Hex()) registry := Registry{ ContractAddress: addr, } diff --git a/core/services/keeper/upkeep_executer_unit_test.go b/core/services/keeper/upkeep_executer_unit_test.go index 8589720ca5f..9b7a5609e94 100644 --- a/core/services/keeper/upkeep_executer_unit_test.go +++ b/core/services/keeper/upkeep_executer_unit_test.go @@ -7,10 +7,10 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" ) @@ -24,8 +24,8 @@ func (r *registry) PerformGasOverhead() uint32 { return r.pgo } func (r *registry) MaxPerformDataSize() uint32 { return r.mpds } func TestBuildJobSpec(t *testing.T) { - from := ethkey.EIP55Address(testutils.NewAddress().Hex()) - contract := ethkey.EIP55Address(testutils.NewAddress().Hex()) + from := types.EIP55Address(testutils.NewAddress().Hex()) + contract := types.EIP55Address(testutils.NewAddress().Hex()) chainID := "250" jb := job.Job{ ID: 10, diff --git a/core/services/keystore/keys/ethkey/export.go b/core/services/keystore/keys/ethkey/export.go index 451a7453433..dfa85dedc98 100644 --- a/core/services/keystore/keys/ethkey/export.go +++ b/core/services/keystore/keys/ethkey/export.go @@ -5,12 +5,13 @@ import ( "github.com/google/uuid" "github.com/pkg/errors" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/utils" ) type EncryptedEthKeyExport struct { KeyType string `json:"keyType"` - Address EIP55Address `json:"address"` + Address types.EIP55Address `json:"address"` Crypto keystore.CryptoJSON `json:"crypto"` } diff --git a/core/services/keystore/keys/ethkey/key.go b/core/services/keystore/keys/ethkey/key.go index 6335ed55adc..02f256b320d 100644 --- a/core/services/keystore/keys/ethkey/key.go +++ b/core/services/keystore/keys/ethkey/key.go @@ -4,6 +4,7 @@ import ( "time" "github.com/smartcontractkit/chainlink-common/pkg/sqlutil" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ) // NOTE: This model refers to the OLD key and is only used for migrations @@ -14,7 +15,7 @@ import ( // By default, a key is assumed to represent an ethereum account. type Key struct { ID int32 - Address EIP55Address + Address types.EIP55Address JSON sqlutil.JSON `json:"-"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` diff --git a/core/services/keystore/keys/ethkey/key_v2.go b/core/services/keystore/keys/ethkey/key_v2.go index 15dc15d3f02..88cc9185787 100644 --- a/core/services/keystore/keys/ethkey/key_v2.go +++ b/core/services/keystore/keys/ethkey/key_v2.go @@ -9,6 +9,8 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" + + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ) var curve = crypto.S256() @@ -22,7 +24,7 @@ func (raw Raw) Key() KeyV2 { privateKey.D = d privateKey.PublicKey.X, privateKey.PublicKey.Y = curve.ScalarBaseMult(d.Bytes()) address := crypto.PubkeyToAddress(privateKey.PublicKey) - eip55 := EIP55AddressFromAddress(address) + eip55 := types.EIP55AddressFromAddress(address) return KeyV2{ Address: address, EIP55Address: eip55, @@ -42,7 +44,7 @@ var _ fmt.GoStringer = &KeyV2{} type KeyV2 struct { Address common.Address - EIP55Address EIP55Address + EIP55Address types.EIP55Address privateKey *ecdsa.PrivateKey } @@ -56,7 +58,7 @@ func NewV2() (KeyV2, error) { func FromPrivateKey(privKey *ecdsa.PrivateKey) (key KeyV2) { address := crypto.PubkeyToAddress(privKey.PublicKey) - eip55 := EIP55AddressFromAddress(address) + eip55 := types.EIP55AddressFromAddress(address) return KeyV2{ Address: address, EIP55Address: eip55, diff --git a/core/services/keystore/keys/ethkey/key_v2_test.go b/core/services/keystore/keys/ethkey/key_v2_test.go index 82b1084eb97..79a470103ed 100644 --- a/core/services/keystore/keys/ethkey/key_v2_test.go +++ b/core/services/keystore/keys/ethkey/key_v2_test.go @@ -8,6 +8,8 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ) func TestEthKeyV2_ToKey(t *testing.T) { @@ -20,7 +22,7 @@ func TestEthKeyV2_ToKey(t *testing.T) { assert.Equal(t, k.privateKey, privateKeyECDSA) assert.Equal(t, k.privateKey.PublicKey.X, privateKeyECDSA.PublicKey.X) assert.Equal(t, k.privateKey.PublicKey.Y, privateKeyECDSA.PublicKey.Y) - assert.Equal(t, EIP55AddressFromAddress(crypto.PubkeyToAddress(privateKeyECDSA.PublicKey)).Hex(), k.ID()) + assert.Equal(t, types.EIP55AddressFromAddress(crypto.PubkeyToAddress(privateKeyECDSA.PublicKey)).Hex(), k.ID()) } func TestEthKeyV2_RawPrivateKey(t *testing.T) { diff --git a/core/services/keystore/keys/ethkey/models.go b/core/services/keystore/keys/ethkey/models.go index df4c474b7b9..43af2caffc5 100644 --- a/core/services/keystore/keys/ethkey/models.go +++ b/core/services/keystore/keys/ethkey/models.go @@ -3,12 +3,13 @@ package ethkey import ( "time" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" ) type State struct { ID int32 - Address EIP55Address + Address types.EIP55Address EVMChainID big.Big Disabled bool CreatedAt time.Time diff --git a/core/services/ocr/config_overrider.go b/core/services/ocr/config_overrider.go index ac87d0e3924..a58cb402695 100644 --- a/core/services/ocr/config_overrider.go +++ b/core/services/ocr/config_overrider.go @@ -14,8 +14,8 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/services" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/utils" ) @@ -23,7 +23,7 @@ type ConfigOverriderImpl struct { services.StateMachine logger logger.Logger flags *ContractFlags - contractAddress ethkey.EIP55Address + contractAddress types.EIP55Address pollTicker utils.TickerBase lastStateChangeTimestamp time.Time @@ -49,7 +49,7 @@ type DeltaCConfig interface { func NewConfigOverriderImpl( logger logger.Logger, cfg DeltaCConfig, - contractAddress ethkey.EIP55Address, + contractAddress types.EIP55Address, flags *ContractFlags, pollTicker utils.TickerBase, ) (*ConfigOverriderImpl, error) { diff --git a/core/services/ocr/config_overrider_test.go b/core/services/ocr/config_overrider_test.go index e01102a62f8..1f782989e66 100644 --- a/core/services/ocr/config_overrider_test.go +++ b/core/services/ocr/config_overrider_test.go @@ -15,18 +15,18 @@ import ( ocrtypes "github.com/smartcontractkit/libocr/offchainreporting/types" "github.com/smartcontractkit/chainlink-common/pkg/services/servicetest" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" evmutils "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/mocks" "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/ocr" "github.com/smartcontractkit/chainlink/v2/core/utils" ) type configOverriderUni struct { overrider *ocr.ConfigOverriderImpl - contractAddress ethkey.EIP55Address + contractAddress types.EIP55Address } type deltaCConfig struct{} @@ -164,10 +164,10 @@ func Test_OCRConfigOverrider(t *testing.T) { flagsContract := mocks.NewFlags(t) flags := &ocr.ContractFlags{FlagsInterface: flagsContract} - address1, err := ethkey.NewEIP55Address(common.BigToAddress(big.NewInt(10000)).Hex()) + address1, err := types.NewEIP55Address(common.BigToAddress(big.NewInt(10000)).Hex()) require.NoError(t, err) - address2, err := ethkey.NewEIP55Address(common.BigToAddress(big.NewInt(1234567890)).Hex()) + address2, err := types.NewEIP55Address(common.BigToAddress(big.NewInt(1234567890)).Hex()) require.NoError(t, err) overrider1a, err := ocr.NewConfigOverriderImpl(testLogger, deltaCConfig{}, address1, flags, nil) @@ -185,7 +185,7 @@ func Test_OCRConfigOverrider(t *testing.T) { }) } -func checkFlagsAddress(t *testing.T, contractAddress ethkey.EIP55Address) func(args mock.Arguments) { +func checkFlagsAddress(t *testing.T, contractAddress types.EIP55Address) func(args mock.Arguments) { return func(args mock.Arguments) { require.Equal(t, []common.Address{ evmutils.ZeroAddress, diff --git a/core/services/ocr/delegate.go b/core/services/ocr/delegate.go index 0411aea6923..bcdda397e20 100644 --- a/core/services/ocr/delegate.go +++ b/core/services/ocr/delegate.go @@ -21,12 +21,12 @@ import ( txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/offchain_aggregator_wrapper" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" "github.com/smartcontractkit/chainlink/v2/core/services/pg" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" @@ -323,7 +323,7 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, jb job.Job) (services [] return services, nil } -func (d *Delegate) maybeCreateConfigOverrider(logger logger.Logger, chain legacyevm.Chain, contractAddress ethkey.EIP55Address) (*ConfigOverriderImpl, error) { +func (d *Delegate) maybeCreateConfigOverrider(logger logger.Logger, chain legacyevm.Chain, contractAddress types.EIP55Address) (*ConfigOverriderImpl, error) { flagsContractAddress := chain.Config().EVM().FlagsContractAddress() if flagsContractAddress != "" { flags, err := NewFlags(flagsContractAddress, chain.Client()) diff --git a/core/services/ocr/validate.go b/core/services/ocr/validate.go index 0524ed24d0b..a0f2353eac1 100644 --- a/core/services/ocr/validate.go +++ b/core/services/ocr/validate.go @@ -12,9 +12,9 @@ import ( "github.com/smartcontractkit/chainlink/v2/common/config" evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/ocrcommon" ) @@ -29,7 +29,7 @@ type OCRValidationConfig interface { ContractSubscribeInterval() time.Duration KeyBundleID() (string, error) ObservationTimeout() time.Duration - TransmitterAddress() (ethkey.EIP55Address, error) + TransmitterAddress() (types.EIP55Address, error) } type insecureConfig interface { diff --git a/core/services/ocr2/database_test.go b/core/services/ocr2/database_test.go index b70ac629da1..486bf1fd708 100644 --- a/core/services/ocr2/database_test.go +++ b/core/services/ocr2/database_test.go @@ -5,6 +5,7 @@ import ( "testing" "time" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" medianconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/median/config" "github.com/stretchr/testify/assert" @@ -19,14 +20,13 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/testhelpers" ) const defaultPluginID = 0 -func MustInsertOCROracleSpec(t *testing.T, db *sqlx.DB, transmitterAddress ethkey.EIP55Address) job.OCR2OracleSpec { +func MustInsertOCROracleSpec(t *testing.T, db *sqlx.DB, transmitterAddress types.EIP55Address) job.OCR2OracleSpec { t.Helper() spec := job.OCR2OracleSpec{} diff --git a/core/services/ocr2/plugins/ocr2keeper/util.go b/core/services/ocr2/plugins/ocr2keeper/util.go index 4fdddfe7f02..35bd62eeed8 100644 --- a/core/services/ocr2/plugins/ocr2keeper/util.go +++ b/core/services/ocr2/plugins/ocr2keeper/util.go @@ -18,10 +18,10 @@ import ( ocr2keepers20runner "github.com/smartcontractkit/chainlink-automation/pkg/v2/runner" ocr2keepers21 "github.com/smartcontractkit/chainlink-common/pkg/types/automation" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" evmregistry20 "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v20" evmregistry21 "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21" evmregistry21transmit "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/transmit" @@ -86,7 +86,7 @@ func EVMDependencies20( return nil, nil, nil, nil, err } - rAddr := ethkey.MustEIP55Address(spec.OCR2OracleSpec.ContractID).Address() + rAddr := evmtypes.MustEIP55Address(spec.OCR2OracleSpec.ContractID).Address() if registry, err = evmregistry20.NewEVMRegistryService(rAddr, chain, lggr); err != nil { return nil, nil, nil, nil, err } @@ -103,7 +103,7 @@ func EVMDependencies20( } func FilterNamesFromSpec20(spec *job.OCR2OracleSpec) (names []string, err error) { - addr, err := ethkey.NewEIP55Address(spec.ContractID) + addr, err := evmtypes.NewEIP55Address(spec.ContractID) if err != nil { return nil, err } @@ -117,7 +117,7 @@ func EVMDependencies21( } func FilterNamesFromSpec21(spec *job.OCR2OracleSpec) (names []string, err error) { - addr, err := ethkey.NewEIP55Address(spec.ContractID) + addr, err := evmtypes.NewEIP55Address(spec.ContractID) if err != nil { return nil, err } diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator.go index e7dd3174413..4c4acc57ff8 100644 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator.go +++ b/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator.go @@ -37,7 +37,6 @@ import ( vrf_wrapper "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ocr2vrf/generated/vrf_coordinator" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" ocr2vrfconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2vrf/config" ) @@ -1142,16 +1141,16 @@ func filterName(beaconAddress, coordinatorAddress, dkgAddress common.Address) st func FilterNamesFromSpec(spec *job.OCR2OracleSpec) (names []string, err error) { var cfg ocr2vrfconfig.PluginConfig - var beaconAddress, coordinatorAddress, dkgAddress ethkey.EIP55Address + var beaconAddress, coordinatorAddress, dkgAddress evmtypes.EIP55Address if err = json.Unmarshal(spec.PluginConfig.Bytes(), &cfg); err != nil { err = errors.Wrap(err, "failed to unmarshal ocr2vrf plugin config") return nil, err } - if beaconAddress, err = ethkey.NewEIP55Address(spec.ContractID); err == nil { - if coordinatorAddress, err = ethkey.NewEIP55Address(cfg.VRFCoordinatorAddress); err == nil { - if dkgAddress, err = ethkey.NewEIP55Address(cfg.DKGContractAddress); err == nil { + if beaconAddress, err = evmtypes.NewEIP55Address(spec.ContractID); err == nil { + if coordinatorAddress, err = evmtypes.NewEIP55Address(cfg.VRFCoordinatorAddress); err == nil { + if dkgAddress, err = evmtypes.NewEIP55Address(cfg.DKGContractAddress); err == nil { return []string{filterName(beaconAddress.Address(), coordinatorAddress.Address(), dkgAddress.Address())}, nil } } diff --git a/core/services/ocrcommon/telemetry_test.go b/core/services/ocrcommon/telemetry_test.go index caa8ccfcc01..e7a59622d97 100644 --- a/core/services/ocrcommon/telemetry_test.go +++ b/core/services/ocrcommon/telemetry_test.go @@ -19,11 +19,11 @@ import ( mercuryv1 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v1" mercuryv2 "github.com/smartcontractkit/chainlink-common/pkg/types/mercury/v2" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" "github.com/smartcontractkit/chainlink/v2/core/services/synchronization" "github.com/smartcontractkit/chainlink/v2/core/services/synchronization/mocks" @@ -126,7 +126,7 @@ func TestGetContract(t *testing.T) { job: &j, lggr: nil, } - contractAddress := ethkey.EIP55Address(utils.RandomAddress().String()) + contractAddress := evmtypes.EIP55Address(utils.RandomAddress().String()) j.Type = job.Type(pipeline.OffchainReportingJobType) j.OCROracleSpec.ContractAddress = contractAddress @@ -208,7 +208,7 @@ func TestSendEATelemetry(t *testing.T) { jb := job.Job{ Type: job.Type(pipeline.OffchainReportingJobType), OCROracleSpec: &job.OCROracleSpec{ - ContractAddress: ethkey.EIP55AddressFromAddress(feedAddress), + ContractAddress: evmtypes.EIP55AddressFromAddress(feedAddress), CaptureEATelemetry: true, EVMChainID: (*ubig.Big)(big.NewInt(9)), }, diff --git a/core/services/relay/evm/evm.go b/core/services/relay/evm/evm.go index 2819ae3f9e8..ddddb82aaed 100644 --- a/core/services/relay/evm/evm.go +++ b/core/services/relay/evm/evm.go @@ -25,10 +25,10 @@ import ( txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr" txm "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/chains/legacyevm" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/llo" "github.com/smartcontractkit/chainlink/v2/core/services/llo/bm" lloconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/llo/config" @@ -374,8 +374,8 @@ func (r *Relayer) NewConfigProvider(args commontypes.RelayArgs) (configProvider } func FilterNamesFromRelayArgs(args commontypes.RelayArgs) (filterNames []string, err error) { - var addr ethkey.EIP55Address - if addr, err = ethkey.NewEIP55Address(args.ContractID); err != nil { + var addr evmtypes.EIP55Address + if addr, err = evmtypes.NewEIP55Address(args.ContractID); err != nil { return nil, err } var relayConfig types.RelayConfig diff --git a/core/services/relay/evm/ocr2keeper.go b/core/services/relay/evm/ocr2keeper.go index f6342df5280..8a62281c9e2 100644 --- a/core/services/relay/evm/ocr2keeper.go +++ b/core/services/relay/evm/ocr2keeper.go @@ -17,11 +17,11 @@ import ( commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink-common/pkg/types/automation" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" ac "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/i_automation_v21_plus_common" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" evm "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/encoding" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider" @@ -105,7 +105,7 @@ func (r *ocr2keeperRelayer) NewOCR2KeeperProvider(rargs commontypes.RelayArgs, p services.configWatcher = cfgWatcher services.contractTransmitter = contractTransmitter - addr := ethkey.MustEIP55Address(rargs.ContractID).Address() + addr := evmtypes.MustEIP55Address(rargs.ContractID).Address() registryContract, err := ac.NewIAutomationV21PlusCommon(addr, client.Client()) if err != nil { diff --git a/core/services/vrf/v2/bhs_feeder_test.go b/core/services/vrf/v2/bhs_feeder_test.go index 0ce674f5168..b39fd0dec7f 100644 --- a/core/services/vrf/v2/bhs_feeder_test.go +++ b/core/services/vrf/v2/bhs_feeder_test.go @@ -10,11 +10,11 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest/heavyweight" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/vrf/vrftesthelpers" ) @@ -39,14 +39,14 @@ func TestStartHeartbeats(t *testing.T) { bhsKeyAddresses = append(bhsKeyAddresses, bhsKey.Address.String()) keys = append(keys, bhsKey) keySpecificOverrides = append(keySpecificOverrides, toml.KeySpecific{ - Key: ptr[ethkey.EIP55Address](bhsKey.EIP55Address), + Key: ptr[types.EIP55Address](bhsKey.EIP55Address), GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, }) sendEth(t, ownerKey, uni.backend, bhsKey.Address, 10) } keySpecificOverrides = append(keySpecificOverrides, toml.KeySpecific{ // Gas lane. - Key: ptr[ethkey.EIP55Address](vrfKey.EIP55Address), + Key: ptr[types.EIP55Address](vrfKey.EIP55Address), GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, }) diff --git a/core/services/vrf/v2/integration_helpers_test.go b/core/services/vrf/v2/integration_helpers_test.go index 71724b928c1..c67195d25aa 100644 --- a/core/services/vrf/v2/integration_helpers_test.go +++ b/core/services/vrf/v2/integration_helpers_test.go @@ -23,6 +23,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" v2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" evmutils "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_consumer_v2_upgradeable_example" @@ -67,11 +68,11 @@ func testSingleConsumerHappyPath( config, db := heavyweight.FullTestDBV2(t, func(c *chainlink.Config, s *chainlink.Secrets) { simulatedOverrides(t, assets.GWei(10), toml.KeySpecific{ // Gas lane. - Key: ptr[ethkey.EIP55Address](key1.EIP55Address), + Key: ptr[types.EIP55Address](key1.EIP55Address), GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, }, toml.KeySpecific{ // Gas lane. - Key: ptr[ethkey.EIP55Address](key2.EIP55Address), + Key: ptr[types.EIP55Address](key2.EIP55Address), GasEstimator: toml.KeySpecificGasEstimator{PriceMax: gasLanePriceWei}, })(c, s) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) diff --git a/core/web/evm_chains_controller_test.go b/core/web/evm_chains_controller_test.go index ea3d5476cec..5d31374cfb7 100644 --- a/core/web/evm_chains_controller_test.go +++ b/core/web/evm_chains_controller_test.go @@ -12,12 +12,12 @@ import ( "github.com/stretchr/testify/require" evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/web" "github.com/smartcontractkit/chainlink/v2/core/web/presenters" ) @@ -48,7 +48,7 @@ func Test_EVMChainsController_Show(t *testing.T) { }, RPCBlockQueryDelay: ptr[uint16](23), MinIncomingConfirmations: ptr[uint32](12), - LinkContractAddress: ptr(ethkey.EIP55AddressFromAddress(testutils.NewAddress())), + LinkContractAddress: ptr(types.EIP55AddressFromAddress(testutils.NewAddress())), }), }, wantStatusCode: http.StatusOK, diff --git a/core/web/jobs_controller_test.go b/core/web/jobs_controller_test.go index 0dc04ff34e8..1e83d60cb7e 100644 --- a/core/web/jobs_controller_test.go +++ b/core/web/jobs_controller_test.go @@ -28,13 +28,13 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/utils" evmclimocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks" + "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/core/internal/testutils/configtest" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/services/directrequest" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/p2pkey" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/vrfkey" "github.com/smartcontractkit/chainlink/v2/core/services/pg" @@ -79,7 +79,7 @@ func TestJobsController_Create_ValidationFailure_OffchainReportingSpec(t *testin t.Run(tc.name, func(t *testing.T) { ta, client := setupJobsControllerTests(t) - var address ethkey.EIP55Address + var address types.EIP55Address if tc.taExists { key, _ := cltest.MustInsertRandomKey(t, ta.KeyStore.Eth()) address = key.EIP55Address @@ -191,7 +191,7 @@ func TestJobController_Create_HappyPath(t *testing.T) { assert.Equal(t, jb.OCROracleSpec.ContractConfigConfirmations, resource.OffChainReportingSpec.ContractConfigConfirmations) assert.NotNil(t, resource.PipelineSpec.DotDAGSource) // Sanity check to make sure it inserted correctly - require.Equal(t, ethkey.EIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C"), jb.OCROracleSpec.ContractAddress) + require.Equal(t, types.EIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C"), jb.OCROracleSpec.ContractAddress) }, }, { @@ -221,13 +221,13 @@ func TestJobController_Create_HappyPath(t *testing.T) { require.NoError(t, err) require.NotNil(t, jb.KeeperSpec) - require.Equal(t, ethkey.EIP55Address("0x9E40733cC9df84636505f4e6Db28DCa0dC5D1bba"), jb.KeeperSpec.ContractAddress) - require.Equal(t, ethkey.EIP55Address("0xa8037A20989AFcBC51798de9762b351D63ff462e"), jb.KeeperSpec.FromAddress) + require.Equal(t, types.EIP55Address("0x9E40733cC9df84636505f4e6Db28DCa0dC5D1bba"), jb.KeeperSpec.ContractAddress) + require.Equal(t, types.EIP55Address("0xa8037A20989AFcBC51798de9762b351D63ff462e"), jb.KeeperSpec.FromAddress) assert.Equal(t, nameAndExternalJobID, jb.Name.ValueOrZero()) // Sanity check to make sure it inserted correctly - require.Equal(t, ethkey.EIP55Address("0x9E40733cC9df84636505f4e6Db28DCa0dC5D1bba"), jb.KeeperSpec.ContractAddress) - require.Equal(t, ethkey.EIP55Address("0xa8037A20989AFcBC51798de9762b351D63ff462e"), jb.KeeperSpec.FromAddress) + require.Equal(t, types.EIP55Address("0x9E40733cC9df84636505f4e6Db28DCa0dC5D1bba"), jb.KeeperSpec.ContractAddress) + require.Equal(t, types.EIP55Address("0xa8037A20989AFcBC51798de9762b351D63ff462e"), jb.KeeperSpec.FromAddress) }, }, { @@ -286,7 +286,7 @@ func TestJobController_Create_HappyPath(t *testing.T) { assert.Equal(t, nameAndExternalJobID, jb.Name.ValueOrZero()) assert.NotNil(t, resource.PipelineSpec.DotDAGSource) // Sanity check to make sure it inserted correctly - require.Equal(t, ethkey.EIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C"), jb.DirectRequestSpec.ContractAddress) + require.Equal(t, types.EIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C"), jb.DirectRequestSpec.ContractAddress) require.Equal(t, jb.ExternalJobID.String(), nameAndExternalJobID) }, }, @@ -336,7 +336,7 @@ func TestJobController_Create_HappyPath(t *testing.T) { assert.Equal(t, nameAndExternalJobID, jb.Name.ValueOrZero()) assert.NotNil(t, jb.PipelineSpec.DotDagSource) - assert.Equal(t, ethkey.EIP55Address("0x3cCad4715152693fE3BC4460591e3D3Fbd071b42"), jb.FluxMonitorSpec.ContractAddress) + assert.Equal(t, types.EIP55Address("0x3cCad4715152693fE3BC4460591e3D3Fbd071b42"), jb.FluxMonitorSpec.ContractAddress) assert.Equal(t, time.Second, jb.FluxMonitorSpec.IdleTimerPeriod) assert.Equal(t, false, jb.FluxMonitorSpec.IdleTimerDisabled) assert.Equal(t, tomlutils.Float32(0.5), jb.FluxMonitorSpec.Threshold) diff --git a/core/web/presenters/eth_key_test.go b/core/web/presenters/eth_key_test.go index 46402141a4c..9ba7c432e6a 100644 --- a/core/web/presenters/eth_key_test.go +++ b/core/web/presenters/eth_key_test.go @@ -7,6 +7,7 @@ import ( commonassets "github.com/smartcontractkit/chainlink-common/pkg/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" @@ -22,7 +23,7 @@ func TestETHKeyResource(t *testing.T) { addressStr = "0x2aCFF2ec69aa9945Ed84f4F281eCCF6911A3B0eD" address = common.HexToAddress(addressStr) ) - eip55address, err := ethkey.NewEIP55Address(addressStr) + eip55address, err := types.NewEIP55Address(addressStr) require.NoError(t, err) key := ethkey.KeyV2{ Address: address, diff --git a/core/web/presenters/job.go b/core/web/presenters/job.go index 7c8643015dd..ca4bec64bca 100644 --- a/core/web/presenters/job.go +++ b/core/web/presenters/job.go @@ -10,10 +10,10 @@ import ( commonassets "github.com/smartcontractkit/chainlink-common/pkg/assets" commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" clnull "github.com/smartcontractkit/chainlink/v2/core/null" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" "github.com/smartcontractkit/chainlink/v2/core/services/relay" "github.com/smartcontractkit/chainlink/v2/core/services/signatures/secp256k1" @@ -43,7 +43,7 @@ const ( // DirectRequestSpec defines the spec details of a DirectRequest Job type DirectRequestSpec struct { - ContractAddress ethkey.EIP55Address `json:"contractAddress"` + ContractAddress types.EIP55Address `json:"contractAddress"` MinIncomingConfirmations clnull.Uint32 `json:"minIncomingConfirmations"` MinContractPayment *commonassets.Link `json:"minContractPaymentLinkJuels"` Requesters models.AddressCollection `json:"requesters"` @@ -72,20 +72,20 @@ func NewDirectRequestSpec(spec *job.DirectRequestSpec) *DirectRequestSpec { // FluxMonitorSpec defines the spec details of a FluxMonitor Job type FluxMonitorSpec struct { - ContractAddress ethkey.EIP55Address `json:"contractAddress"` - Threshold float32 `json:"threshold"` - AbsoluteThreshold float32 `json:"absoluteThreshold"` - PollTimerPeriod string `json:"pollTimerPeriod"` - PollTimerDisabled bool `json:"pollTimerDisabled"` - IdleTimerPeriod string `json:"idleTimerPeriod"` - IdleTimerDisabled bool `json:"idleTimerDisabled"` - DrumbeatEnabled bool `json:"drumbeatEnabled"` - DrumbeatSchedule *string `json:"drumbeatSchedule"` - DrumbeatRandomDelay *string `json:"drumbeatRandomDelay"` - MinPayment *commonassets.Link `json:"minPayment"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` - EVMChainID *big.Big `json:"evmChainID"` + ContractAddress types.EIP55Address `json:"contractAddress"` + Threshold float32 `json:"threshold"` + AbsoluteThreshold float32 `json:"absoluteThreshold"` + PollTimerPeriod string `json:"pollTimerPeriod"` + PollTimerDisabled bool `json:"pollTimerDisabled"` + IdleTimerPeriod string `json:"idleTimerPeriod"` + IdleTimerDisabled bool `json:"idleTimerDisabled"` + DrumbeatEnabled bool `json:"drumbeatEnabled"` + DrumbeatSchedule *string `json:"drumbeatSchedule"` + DrumbeatRandomDelay *string `json:"drumbeatRandomDelay"` + MinPayment *commonassets.Link `json:"minPayment"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` + EVMChainID *big.Big `json:"evmChainID"` } // NewFluxMonitorSpec initializes a new DirectFluxMonitorSpec from a @@ -120,23 +120,23 @@ func NewFluxMonitorSpec(spec *job.FluxMonitorSpec) *FluxMonitorSpec { // OffChainReportingSpec defines the spec details of a OffChainReporting Job type OffChainReportingSpec struct { - ContractAddress ethkey.EIP55Address `json:"contractAddress"` - P2PV2Bootstrappers pq.StringArray `json:"p2pv2Bootstrappers"` - IsBootstrapPeer bool `json:"isBootstrapPeer"` - EncryptedOCRKeyBundleID *models.Sha256Hash `json:"keyBundleID"` - TransmitterAddress *ethkey.EIP55Address `json:"transmitterAddress"` - ObservationTimeout models.Interval `json:"observationTimeout"` - BlockchainTimeout models.Interval `json:"blockchainTimeout"` - ContractConfigTrackerSubscribeInterval models.Interval `json:"contractConfigTrackerSubscribeInterval"` - ContractConfigTrackerPollInterval models.Interval `json:"contractConfigTrackerPollInterval"` - ContractConfigConfirmations uint16 `json:"contractConfigConfirmations"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` - EVMChainID *big.Big `json:"evmChainID"` - DatabaseTimeout *models.Interval `json:"databaseTimeout"` - ObservationGracePeriod *models.Interval `json:"observationGracePeriod"` - ContractTransmitterTransmitTimeout *models.Interval `json:"contractTransmitterTransmitTimeout"` - CollectTelemetry bool `json:"collectTelemetry,omitempty"` + ContractAddress types.EIP55Address `json:"contractAddress"` + P2PV2Bootstrappers pq.StringArray `json:"p2pv2Bootstrappers"` + IsBootstrapPeer bool `json:"isBootstrapPeer"` + EncryptedOCRKeyBundleID *models.Sha256Hash `json:"keyBundleID"` + TransmitterAddress *types.EIP55Address `json:"transmitterAddress"` + ObservationTimeout models.Interval `json:"observationTimeout"` + BlockchainTimeout models.Interval `json:"blockchainTimeout"` + ContractConfigTrackerSubscribeInterval models.Interval `json:"contractConfigTrackerSubscribeInterval"` + ContractConfigTrackerPollInterval models.Interval `json:"contractConfigTrackerPollInterval"` + ContractConfigConfirmations uint16 `json:"contractConfigConfirmations"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` + EVMChainID *big.Big `json:"evmChainID"` + DatabaseTimeout *models.Interval `json:"databaseTimeout"` + ObservationGracePeriod *models.Interval `json:"observationGracePeriod"` + ContractTransmitterTransmitTimeout *models.Interval `json:"contractTransmitterTransmitTimeout"` + CollectTelemetry bool `json:"collectTelemetry,omitempty"` } // NewOffChainReportingSpec initializes a new OffChainReportingSpec from a @@ -217,11 +217,11 @@ func NewPipelineSpec(spec *pipeline.Spec) PipelineSpec { // KeeperSpec defines the spec details of a Keeper Job type KeeperSpec struct { - ContractAddress ethkey.EIP55Address `json:"contractAddress"` - FromAddress ethkey.EIP55Address `json:"fromAddress"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` - EVMChainID *big.Big `json:"evmChainID"` + ContractAddress types.EIP55Address `json:"contractAddress"` + FromAddress types.EIP55Address `json:"fromAddress"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` + EVMChainID *big.Big `json:"evmChainID"` } // NewKeeperSpec generates a new KeeperSpec from a job.KeeperSpec @@ -266,13 +266,13 @@ func NewCronSpec(spec *job.CronSpec) *CronSpec { } type VRFSpec struct { - BatchCoordinatorAddress *ethkey.EIP55Address `json:"batchCoordinatorAddress"` + BatchCoordinatorAddress *types.EIP55Address `json:"batchCoordinatorAddress"` BatchFulfillmentEnabled bool `json:"batchFulfillmentEnabled"` CustomRevertsPipelineEnabled *bool `json:"customRevertsPipelineEnabled,omitempty"` BatchFulfillmentGasMultiplier float64 `json:"batchFulfillmentGasMultiplier"` - CoordinatorAddress ethkey.EIP55Address `json:"coordinatorAddress"` + CoordinatorAddress types.EIP55Address `json:"coordinatorAddress"` PublicKey secp256k1.PublicKey `json:"publicKey"` - FromAddresses []ethkey.EIP55Address `json:"fromAddresses"` + FromAddresses []types.EIP55Address `json:"fromAddresses"` PollPeriod commonconfig.Duration `json:"pollPeriod"` MinIncomingConfirmations uint32 `json:"confirmations"` CreatedAt time.Time `json:"createdAt"` @@ -284,7 +284,7 @@ type VRFSpec struct { BackoffMaxDelay commonconfig.Duration `json:"backoffMaxDelay"` GasLanePrice *assets.Wei `json:"gasLanePrice"` RequestedConfsDelay int64 `json:"requestedConfsDelay"` - VRFOwnerAddress *ethkey.EIP55Address `json:"vrfOwnerAddress,omitempty"` + VRFOwnerAddress *types.EIP55Address `json:"vrfOwnerAddress,omitempty"` } func NewVRFSpec(spec *job.VRFSpec) *VRFSpec { @@ -313,21 +313,21 @@ func NewVRFSpec(spec *job.VRFSpec) *VRFSpec { // BlockhashStoreSpec defines the job parameters for a blockhash store feeder job. type BlockhashStoreSpec struct { - CoordinatorV1Address *ethkey.EIP55Address `json:"coordinatorV1Address"` - CoordinatorV2Address *ethkey.EIP55Address `json:"coordinatorV2Address"` - CoordinatorV2PlusAddress *ethkey.EIP55Address `json:"coordinatorV2PlusAddress"` - WaitBlocks int32 `json:"waitBlocks"` - LookbackBlocks int32 `json:"lookbackBlocks"` - HeartbeatPeriod time.Duration `json:"heartbeatPeriod"` - BlockhashStoreAddress ethkey.EIP55Address `json:"blockhashStoreAddress"` - TrustedBlockhashStoreAddress *ethkey.EIP55Address `json:"trustedBlockhashStoreAddress"` - TrustedBlockhashStoreBatchSize int32 `json:"trustedBlockhashStoreBatchSize"` - PollPeriod time.Duration `json:"pollPeriod"` - RunTimeout time.Duration `json:"runTimeout"` - EVMChainID *big.Big `json:"evmChainID"` - FromAddresses []ethkey.EIP55Address `json:"fromAddresses"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` + CoordinatorV1Address *types.EIP55Address `json:"coordinatorV1Address"` + CoordinatorV2Address *types.EIP55Address `json:"coordinatorV2Address"` + CoordinatorV2PlusAddress *types.EIP55Address `json:"coordinatorV2PlusAddress"` + WaitBlocks int32 `json:"waitBlocks"` + LookbackBlocks int32 `json:"lookbackBlocks"` + HeartbeatPeriod time.Duration `json:"heartbeatPeriod"` + BlockhashStoreAddress types.EIP55Address `json:"blockhashStoreAddress"` + TrustedBlockhashStoreAddress *types.EIP55Address `json:"trustedBlockhashStoreAddress"` + TrustedBlockhashStoreBatchSize int32 `json:"trustedBlockhashStoreBatchSize"` + PollPeriod time.Duration `json:"pollPeriod"` + RunTimeout time.Duration `json:"runTimeout"` + EVMChainID *big.Big `json:"evmChainID"` + FromAddresses []types.EIP55Address `json:"fromAddresses"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` } // NewBlockhashStoreSpec creates a new BlockhashStoreSpec for the given parameters. @@ -351,19 +351,19 @@ func NewBlockhashStoreSpec(spec *job.BlockhashStoreSpec) *BlockhashStoreSpec { // BlockHeaderFeederSpec defines the job parameters for a blcok header feeder job. type BlockHeaderFeederSpec struct { - CoordinatorV1Address *ethkey.EIP55Address `json:"coordinatorV1Address"` - CoordinatorV2Address *ethkey.EIP55Address `json:"coordinatorV2Address"` - CoordinatorV2PlusAddress *ethkey.EIP55Address `json:"coordinatorV2PlusAddress"` - WaitBlocks int32 `json:"waitBlocks"` - LookbackBlocks int32 `json:"lookbackBlocks"` - BlockhashStoreAddress ethkey.EIP55Address `json:"blockhashStoreAddress"` - BatchBlockhashStoreAddress ethkey.EIP55Address `json:"batchBlockhashStoreAddress"` - PollPeriod time.Duration `json:"pollPeriod"` - RunTimeout time.Duration `json:"runTimeout"` - EVMChainID *big.Big `json:"evmChainID"` - FromAddresses []ethkey.EIP55Address `json:"fromAddresses"` - GetBlockhashesBatchSize uint16 `json:"getBlockhashesBatchSize"` - StoreBlockhashesBatchSize uint16 `json:"storeBlockhashesBatchSize"` + CoordinatorV1Address *types.EIP55Address `json:"coordinatorV1Address"` + CoordinatorV2Address *types.EIP55Address `json:"coordinatorV2Address"` + CoordinatorV2PlusAddress *types.EIP55Address `json:"coordinatorV2PlusAddress"` + WaitBlocks int32 `json:"waitBlocks"` + LookbackBlocks int32 `json:"lookbackBlocks"` + BlockhashStoreAddress types.EIP55Address `json:"blockhashStoreAddress"` + BatchBlockhashStoreAddress types.EIP55Address `json:"batchBlockhashStoreAddress"` + PollPeriod time.Duration `json:"pollPeriod"` + RunTimeout time.Duration `json:"runTimeout"` + EVMChainID *big.Big `json:"evmChainID"` + FromAddresses []types.EIP55Address `json:"fromAddresses"` + GetBlockhashesBatchSize uint16 `json:"getBlockhashesBatchSize"` + StoreBlockhashesBatchSize uint16 `json:"storeBlockhashesBatchSize"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` diff --git a/core/web/presenters/job_test.go b/core/web/presenters/job_test.go index b782452948b..963e5790110 100644 --- a/core/web/presenters/job_test.go +++ b/core/web/presenters/job_test.go @@ -15,10 +15,10 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/assets" evmassets "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" clnull "github.com/smartcontractkit/chainlink/v2/core/null" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" "github.com/smartcontractkit/chainlink/v2/core/services/signatures/secp256k1" "github.com/smartcontractkit/chainlink/v2/core/store/models" @@ -28,34 +28,34 @@ import ( func TestJob(t *testing.T) { // Used in multiple tests timestamp := time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC) - contractAddress, err := ethkey.NewEIP55Address("0x9E40733cC9df84636505f4e6Db28DCa0dC5D1bba") + contractAddress, err := types.NewEIP55Address("0x9E40733cC9df84636505f4e6Db28DCa0dC5D1bba") require.NoError(t, err) cronSchedule := "0 0 0 1 1 *" evmChainID := big.NewI(42) - fromAddress, err := ethkey.NewEIP55Address("0xa8037A20989AFcBC51798de9762b351D63ff462e") + fromAddress, err := types.NewEIP55Address("0xa8037A20989AFcBC51798de9762b351D63ff462e") require.NoError(t, err) // Used in OCR tests var ocrKeyBundleID = "f5bf259689b26f1374efb3c9a9868796953a0f814bb2d39b968d0e61b58620a5" ocrKeyID := models.MustSha256HashFromHex(ocrKeyBundleID) - transmitterAddress, err := ethkey.NewEIP55Address("0x27548a32b9aD5D64c5945EaE9Da5337bc3169D15") + transmitterAddress, err := types.NewEIP55Address("0x27548a32b9aD5D64c5945EaE9Da5337bc3169D15") require.NoError(t, err) // Used in blockhashstore test - v1CoordAddress, err := ethkey.NewEIP55Address("0x16988483b46e695f6c8D58e6e1461DC703e008e1") + v1CoordAddress, err := types.NewEIP55Address("0x16988483b46e695f6c8D58e6e1461DC703e008e1") require.NoError(t, err) - v2CoordAddress, err := ethkey.NewEIP55Address("0x2C409DD6D4eBDdA190B5174Cc19616DD13884262") + v2CoordAddress, err := types.NewEIP55Address("0x2C409DD6D4eBDdA190B5174Cc19616DD13884262") require.NoError(t, err) - v2PlusCoordAddress, err := ethkey.NewEIP55Address("0x92B5e28Ac583812874e4271380c7d070C5FB6E6b") + v2PlusCoordAddress, err := types.NewEIP55Address("0x92B5e28Ac583812874e4271380c7d070C5FB6E6b") require.NoError(t, err) // Used in blockheaderfeeder test - batchBHSAddress, err := ethkey.NewEIP55Address("0xF6bB415b033D19EFf24A872a4785c6e1C4426103") + batchBHSAddress, err := types.NewEIP55Address("0xF6bB415b033D19EFf24A872a4785c6e1C4426103") require.NoError(t, err) - trustedBlockhashStoreAddress, err := ethkey.NewEIP55Address("0x0ad9FE7a58216242a8475ca92F222b0640E26B63") + trustedBlockhashStoreAddress, err := types.NewEIP55Address("0x0ad9FE7a58216242a8475ca92F222b0640E26B63") require.NoError(t, err) trustedBlockhashStoreBatchSize := int32(20) @@ -489,7 +489,7 @@ func TestJob(t *testing.T) { CreatedAt: timestamp, UpdatedAt: timestamp, EVMChainID: evmChainID, - FromAddresses: []ethkey.EIP55Address{fromAddress}, + FromAddresses: []types.EIP55Address{fromAddress}, PublicKey: vrfPubKey, RequestedConfsDelay: 10, ChunkSize: 25, @@ -572,7 +572,7 @@ func TestJob(t *testing.T) { PollPeriod: 25 * time.Second, RunTimeout: 10 * time.Second, EVMChainID: big.NewI(4), - FromAddresses: []ethkey.EIP55Address{fromAddress}, + FromAddresses: []types.EIP55Address{fromAddress}, TrustedBlockhashStoreAddress: &trustedBlockhashStoreAddress, TrustedBlockhashStoreBatchSize: trustedBlockhashStoreBatchSize, }, @@ -652,7 +652,7 @@ func TestJob(t *testing.T) { PollPeriod: 25 * time.Second, RunTimeout: 10 * time.Second, EVMChainID: big.NewI(4), - FromAddresses: []ethkey.EIP55Address{fromAddress}, + FromAddresses: []types.EIP55Address{fromAddress}, GetBlockhashesBatchSize: 5, StoreBlockhashesBatchSize: 10, }, diff --git a/core/web/resolver/eth_key.go b/core/web/resolver/eth_key.go index a9c060ef0c1..d986374ec21 100644 --- a/core/web/resolver/eth_key.go +++ b/core/web/resolver/eth_key.go @@ -6,6 +6,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/graph-gophers/graphql-go" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/web/loader" @@ -13,7 +14,7 @@ import ( type ETHKey struct { state ethkey.State - addr ethkey.EIP55Address + addr types.EIP55Address chain legacyevm.Chain } diff --git a/core/web/resolver/eth_key_test.go b/core/web/resolver/eth_key_test.go index 7d1e3ff5025..40a60263f06 100644 --- a/core/web/resolver/eth_key_test.go +++ b/core/web/resolver/eth_key_test.go @@ -16,6 +16,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" mocks2 "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest" @@ -60,11 +61,11 @@ func TestResolver_ETHKeys(t *testing.T) { keys := []ethkey.KeyV2{ { Address: address, - EIP55Address: ethkey.EIP55AddressFromAddress(address), + EIP55Address: evmtypes.EIP55AddressFromAddress(address), }, { Address: secondAddress, - EIP55Address: ethkey.EIP55AddressFromAddress(secondAddress), + EIP55Address: evmtypes.EIP55AddressFromAddress(secondAddress), }, } gError := errors.New("error") @@ -82,7 +83,7 @@ func TestResolver_ETHKeys(t *testing.T) { before: func(f *gqlTestFramework) { states := []ethkey.State{ { - Address: ethkey.MustEIP55Address(address.Hex()), + Address: evmtypes.MustEIP55Address(address.Hex()), EVMChainID: *big.NewI(12), Disabled: false, CreatedAt: f.Timestamp(), @@ -149,7 +150,7 @@ func TestResolver_ETHKeys(t *testing.T) { before: func(f *gqlTestFramework) { states := []ethkey.State{ { - Address: ethkey.MustEIP55Address(address.Hex()), + Address: evmtypes.MustEIP55Address(address.Hex()), EVMChainID: *big.NewI(12), Disabled: false, CreatedAt: f.Timestamp(), @@ -243,7 +244,7 @@ func TestResolver_ETHKeys(t *testing.T) { before: func(f *gqlTestFramework) { states := []ethkey.State{ { - Address: ethkey.MustEIP55Address(address.Hex()), + Address: evmtypes.MustEIP55Address(address.Hex()), EVMChainID: *big.NewI(12), Disabled: false, CreatedAt: f.Timestamp(), @@ -275,7 +276,7 @@ func TestResolver_ETHKeys(t *testing.T) { before: func(f *gqlTestFramework) { states := []ethkey.State{ { - Address: ethkey.MustEIP55Address(address.Hex()), + Address: evmtypes.MustEIP55Address(address.Hex()), EVMChainID: *big.NewI(12), Disabled: false, CreatedAt: f.Timestamp(), @@ -306,7 +307,7 @@ func TestResolver_ETHKeys(t *testing.T) { before: func(f *gqlTestFramework) { states := []ethkey.State{ { - Address: ethkey.MustEIP55Address(address.Hex()), + Address: evmtypes.MustEIP55Address(address.Hex()), EVMChainID: *big.NewI(12), Disabled: false, CreatedAt: f.Timestamp(), @@ -368,7 +369,7 @@ func TestResolver_ETHKeys(t *testing.T) { before: func(f *gqlTestFramework) { states := []ethkey.State{ { - Address: ethkey.EIP55AddressFromAddress(address), + Address: evmtypes.EIP55AddressFromAddress(address), EVMChainID: *big.NewI(12), Disabled: false, CreatedAt: f.Timestamp(), diff --git a/core/web/resolver/spec_test.go b/core/web/resolver/spec_test.go index 828e8538071..2fa8281e3c7 100644 --- a/core/web/resolver/spec_test.go +++ b/core/web/resolver/spec_test.go @@ -13,10 +13,10 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" + evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" clnull "github.com/smartcontractkit/chainlink/v2/core/null" "github.com/smartcontractkit/chainlink/v2/core/services/job" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/relay" "github.com/smartcontractkit/chainlink/v2/core/services/signatures/secp256k1" "github.com/smartcontractkit/chainlink/v2/core/store/models" @@ -81,7 +81,7 @@ func TestResolver_DirectRequestSpec(t *testing.T) { id = int32(1) requesterAddress = common.HexToAddress("0x3cCad4715152693fE3BC4460591e3D3Fbd071b42") ) - contractAddress, err := ethkey.NewEIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C") + contractAddress, err := evmtypes.NewEIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C") require.NoError(t, err) testCases := []GQLTestCase{ @@ -146,7 +146,7 @@ func TestResolver_FluxMonitorSpec(t *testing.T) { var ( id = int32(1) ) - contractAddress, err := ethkey.NewEIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C") + contractAddress, err := evmtypes.NewEIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C") require.NoError(t, err) testCases := []GQLTestCase{ @@ -296,7 +296,7 @@ func TestResolver_KeeperSpec(t *testing.T) { id = int32(1) fromAddress = common.HexToAddress("0x3cCad4715152693fE3BC4460591e3D3Fbd071b42") ) - contractAddress, err := ethkey.NewEIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C") + contractAddress, err := evmtypes.NewEIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C") require.NoError(t, err) testCases := []GQLTestCase{ @@ -311,7 +311,7 @@ func TestResolver_KeeperSpec(t *testing.T) { ContractAddress: contractAddress, CreatedAt: f.Timestamp(), EVMChainID: ubig.NewI(42), - FromAddress: ethkey.EIP55AddressFromAddress(fromAddress), + FromAddress: evmtypes.EIP55AddressFromAddress(fromAddress), }, }, nil) }, @@ -355,10 +355,10 @@ func TestResolver_OCRSpec(t *testing.T) { var ( id = int32(1) ) - contractAddress, err := ethkey.NewEIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C") + contractAddress, err := evmtypes.NewEIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C") require.NoError(t, err) - transmitterAddress, err := ethkey.NewEIP55Address("0x3cCad4715152693fE3BC4460591e3D3Fbd071b42") + transmitterAddress, err := evmtypes.NewEIP55Address("0x3cCad4715152693fE3BC4460591e3D3Fbd071b42") require.NoError(t, err) keyBundleID := models.MustSha256HashFromHex("f5bf259689b26f1374efb3c9a9868796953a0f814bb2d39b968d0e61b58620a5") @@ -452,10 +452,10 @@ func TestResolver_OCR2Spec(t *testing.T) { var ( id = int32(1) ) - contractAddress, err := ethkey.NewEIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C") + contractAddress, err := evmtypes.NewEIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C") require.NoError(t, err) - transmitterAddress, err := ethkey.NewEIP55Address("0x3cCad4715152693fE3BC4460591e3D3Fbd071b42") + transmitterAddress, err := evmtypes.NewEIP55Address("0x3cCad4715152693fE3BC4460591e3D3Fbd071b42") require.NoError(t, err) keyBundleID := models.MustSha256HashFromHex("f5bf259689b26f1374efb3c9a9868796953a0f814bb2d39b968d0e61b58620a5") @@ -555,16 +555,16 @@ func TestResolver_VRFSpec(t *testing.T) { var ( id = int32(1) ) - coordinatorAddress, err := ethkey.NewEIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C") + coordinatorAddress, err := evmtypes.NewEIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C") require.NoError(t, err) - batchCoordinatorAddress, err := ethkey.NewEIP55Address("0x0ad9FE7a58216242a8475ca92F222b0640E26B63") + batchCoordinatorAddress, err := evmtypes.NewEIP55Address("0x0ad9FE7a58216242a8475ca92F222b0640E26B63") require.NoError(t, err) - fromAddress1, err := ethkey.NewEIP55Address("0x3cCad4715152693fE3BC4460591e3D3Fbd071b42") + fromAddress1, err := evmtypes.NewEIP55Address("0x3cCad4715152693fE3BC4460591e3D3Fbd071b42") require.NoError(t, err) - fromAddress2, err := ethkey.NewEIP55Address("0x2301958F1BFbC9A068C2aC9c6166Bf483b95864C") + fromAddress2, err := evmtypes.NewEIP55Address("0x2301958F1BFbC9A068C2aC9c6166Bf483b95864C") require.NoError(t, err) pubKey, err := secp256k1.NewPublicKeyFromHex("0x9dc09a0f898f3b5e8047204e7ce7e44b587920932f08431e29c9bf6923b8450a01") @@ -586,7 +586,7 @@ func TestResolver_VRFSpec(t *testing.T) { CoordinatorAddress: coordinatorAddress, CreatedAt: f.Timestamp(), EVMChainID: ubig.NewI(42), - FromAddresses: []ethkey.EIP55Address{fromAddress1, fromAddress2}, + FromAddresses: []evmtypes.EIP55Address{fromAddress1, fromAddress2}, PollPeriod: 1 * time.Minute, PublicKey: pubKey, RequestedConfsDelay: 10, @@ -713,25 +713,25 @@ func TestResolver_BlockhashStoreSpec(t *testing.T) { var ( id = int32(1) ) - coordinatorV1Address, err := ethkey.NewEIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C") + coordinatorV1Address, err := evmtypes.NewEIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C") require.NoError(t, err) - coordinatorV2Address, err := ethkey.NewEIP55Address("0x2fcA960AF066cAc46085588a66dA2D614c7Cd337") + coordinatorV2Address, err := evmtypes.NewEIP55Address("0x2fcA960AF066cAc46085588a66dA2D614c7Cd337") require.NoError(t, err) - coordinatorV2PlusAddress, err := ethkey.NewEIP55Address("0x92B5e28Ac583812874e4271380c7d070C5FB6E6b") + coordinatorV2PlusAddress, err := evmtypes.NewEIP55Address("0x92B5e28Ac583812874e4271380c7d070C5FB6E6b") require.NoError(t, err) - fromAddress1, err := ethkey.NewEIP55Address("0x3cCad4715152693fE3BC4460591e3D3Fbd071b42") + fromAddress1, err := evmtypes.NewEIP55Address("0x3cCad4715152693fE3BC4460591e3D3Fbd071b42") require.NoError(t, err) - fromAddress2, err := ethkey.NewEIP55Address("0xD479d7c994D298cA05bF270136ED9627b7E684D3") + fromAddress2, err := evmtypes.NewEIP55Address("0xD479d7c994D298cA05bF270136ED9627b7E684D3") require.NoError(t, err) - blockhashStoreAddress, err := ethkey.NewEIP55Address("0xb26A6829D454336818477B946f03Fb21c9706f3A") + blockhashStoreAddress, err := evmtypes.NewEIP55Address("0xb26A6829D454336818477B946f03Fb21c9706f3A") require.NoError(t, err) - trustedBlockhashStoreAddress, err := ethkey.NewEIP55Address("0x0ad9FE7a58216242a8475ca92F222b0640E26B63") + trustedBlockhashStoreAddress, err := evmtypes.NewEIP55Address("0x0ad9FE7a58216242a8475ca92F222b0640E26B63") require.NoError(t, err) trustedBlockhashStoreBatchSize := int32(20) @@ -749,7 +749,7 @@ func TestResolver_BlockhashStoreSpec(t *testing.T) { CoordinatorV2PlusAddress: &coordinatorV2PlusAddress, CreatedAt: f.Timestamp(), EVMChainID: ubig.NewI(42), - FromAddresses: []ethkey.EIP55Address{fromAddress1, fromAddress2}, + FromAddresses: []evmtypes.EIP55Address{fromAddress1, fromAddress2}, PollPeriod: 1 * time.Minute, RunTimeout: 37 * time.Second, WaitBlocks: 100, @@ -821,22 +821,22 @@ func TestResolver_BlockHeaderFeederSpec(t *testing.T) { var ( id = int32(1) ) - coordinatorV1Address, err := ethkey.NewEIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C") + coordinatorV1Address, err := evmtypes.NewEIP55Address("0x613a38AC1659769640aaE063C651F48E0250454C") require.NoError(t, err) - coordinatorV2Address, err := ethkey.NewEIP55Address("0x2fcA960AF066cAc46085588a66dA2D614c7Cd337") + coordinatorV2Address, err := evmtypes.NewEIP55Address("0x2fcA960AF066cAc46085588a66dA2D614c7Cd337") require.NoError(t, err) - coordinatorV2PlusAddress, err := ethkey.NewEIP55Address("0x92B5e28Ac583812874e4271380c7d070C5FB6E6b") + coordinatorV2PlusAddress, err := evmtypes.NewEIP55Address("0x92B5e28Ac583812874e4271380c7d070C5FB6E6b") require.NoError(t, err) - fromAddress, err := ethkey.NewEIP55Address("0x3cCad4715152693fE3BC4460591e3D3Fbd071b42") + fromAddress, err := evmtypes.NewEIP55Address("0x3cCad4715152693fE3BC4460591e3D3Fbd071b42") require.NoError(t, err) - blockhashStoreAddress, err := ethkey.NewEIP55Address("0xb26A6829D454336818477B946f03Fb21c9706f3A") + blockhashStoreAddress, err := evmtypes.NewEIP55Address("0xb26A6829D454336818477B946f03Fb21c9706f3A") require.NoError(t, err) - batchBHSAddress, err := ethkey.NewEIP55Address("0xd23BAE30019853Caf1D08b4C03291b10AD7743Df") + batchBHSAddress, err := evmtypes.NewEIP55Address("0xd23BAE30019853Caf1D08b4C03291b10AD7743Df") require.NoError(t, err) testCases := []GQLTestCase{ @@ -853,7 +853,7 @@ func TestResolver_BlockHeaderFeederSpec(t *testing.T) { CoordinatorV2PlusAddress: &coordinatorV2PlusAddress, CreatedAt: f.Timestamp(), EVMChainID: ubig.NewI(42), - FromAddresses: []ethkey.EIP55Address{fromAddress}, + FromAddresses: []evmtypes.EIP55Address{fromAddress}, PollPeriod: 1 * time.Minute, RunTimeout: 37 * time.Second, WaitBlocks: 100, diff --git a/integration-tests/types/config/node/core.go b/integration-tests/types/config/node/core.go index 024a05f63e4..23efdf13a8b 100644 --- a/integration-tests/types/config/node/core.go +++ b/integration-tests/types/config/node/core.go @@ -18,10 +18,10 @@ import ( it_utils "github.com/smartcontractkit/chainlink/integration-tests/utils" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/config/toml" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/utils" ) @@ -214,7 +214,7 @@ func WithVRFv2EVMEstimator(addresses []string, maxGasPriceGWei int64) NodeConfig var keySpecicifArr []evmcfg.KeySpecific for _, addr := range addresses { keySpecicifArr = append(keySpecicifArr, evmcfg.KeySpecific{ - Key: ptr.Ptr(ethkey.EIP55Address(addr)), + Key: ptr.Ptr(types.EIP55Address(addr)), GasEstimator: evmcfg.KeySpecificGasEstimator{ PriceMax: est, },