From 6f44c5b7149953ace3595ae9d6da0c41de588677 Mon Sep 17 00:00:00 2001 From: connorwstein Date: Thu, 1 Aug 2024 15:35:16 -0400 Subject: [PATCH] Fix aliases, run mockery --- .../ocrimpls/contract_transmitter_test.go | 12 +++---- .../ccip/oraclecreator/inprocess.go | 34 +++++++++---------- .../ccip/types/mocks/oracle_creator.go | 3 +- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/core/capabilities/ccip/ocrimpls/contract_transmitter_test.go b/core/capabilities/ccip/ocrimpls/contract_transmitter_test.go index 025e81e8c2..4e0a7162aa 100644 --- a/core/capabilities/ccip/ocrimpls/contract_transmitter_test.go +++ b/core/capabilities/ccip/ocrimpls/contract_transmitter_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - ocrimpls2 "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ocrimpls" + "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ocrimpls" cctypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -243,7 +243,7 @@ func newTestUniverse[RI any](t *testing.T, ks *keyringsAndSigners[RI]) *testUniv for i := 0; i < 4; i++ { kb, err2 := ocr2key.New(kschaintype.EVM) require.NoError(t, err2, "failed to create key") - kr := ocrimpls2.NewOnchainKeyring[RI](kb, logger.TestLogger(t)) + kr := ocrimpls.NewOnchainKeyring[RI](kb, logger.TestLogger(t)) signers = append(signers, common.BytesToAddress(kr.PublicKey())) keyrings = append(keyrings, kr) } @@ -309,21 +309,21 @@ func newTestUniverse[RI any](t *testing.T, ks *keyringsAndSigners[RI]) *testUniv require.NoError(t, chainWriter.Start(testutils.Context(t)), "failed to start chain writer") t.Cleanup(func() { require.NoError(t, chainWriter.Close()) }) - transmitterWithSigs := ocrimpls2.XXXNewContractTransmitterTestsOnly[RI]( + transmitterWithSigs := ocrimpls.XXXNewContractTransmitterTestsOnly[RI]( chainWriter, ocrtypes.Account(transmitters[0].Hex()), contractName, methodTransmitWithSignatures, ocr3HelperAddr.Hex(), - ocrimpls2.ToCommitCalldata, + ocrimpls.ToCommitCalldata, ) - transmitterWithoutSigs := ocrimpls2.XXXNewContractTransmitterTestsOnly[RI]( + transmitterWithoutSigs := ocrimpls.XXXNewContractTransmitterTestsOnly[RI]( chainWriter, ocrtypes.Account(transmitters[0].Hex()), contractName, methodTransmitWithoutSignatures, ocr3HelperAddr.Hex(), - ocrimpls2.ToExecCalldata, + ocrimpls.ToExecCalldata, ) return &testUniverse[RI]{ diff --git a/core/capabilities/ccip/oraclecreator/inprocess.go b/core/capabilities/ccip/oraclecreator/inprocess.go index 70bd435840..1d17867846 100644 --- a/core/capabilities/ccip/oraclecreator/inprocess.go +++ b/core/capabilities/ccip/oraclecreator/inprocess.go @@ -5,9 +5,9 @@ import ( "fmt" "time" - ccipevm2 "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ccipevm" - evm2 "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/configs/evm" - ocrimpls2 "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ocrimpls" + "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ccipevm" + evmconfig "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/configs/evm" + "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ocrimpls" cctypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types" "github.com/ethereum/go-ethereum/common" @@ -111,7 +111,7 @@ func (i *inprocessOracleCreator) CreateBootstrapOracle(config cctypes.OCR3Config bootstrapperArgs := libocr3.BootstrapperArgs{ BootstrapperFactory: i.peerWrapper.Peer2, V2Bootstrappers: i.bootstrapperLocators, - ContractConfigTracker: ocrimpls2.NewConfigTracker(config), + ContractConfigTracker: ocrimpls.NewConfigTracker(config), Database: i.db, LocalConfig: defaultLocalConfig(), Logger: ocrcommon.NewOCRWrapper( @@ -128,7 +128,7 @@ func (i *inprocessOracleCreator) CreateBootstrapOracle(config cctypes.OCR3Config hexutil.Encode(config.Config.OfframpAddress), synchronization.OCR3CCIPBootstrap, ), - OffchainConfigDigester: ocrimpls2.NewConfigDigester(config.ConfigDigest), + OffchainConfigDigester: ocrimpls.NewConfigDigester(config.ConfigDigest), } bootstrapper, err := libocr3.NewBootstrapper(bootstrapperArgs) if err != nil { @@ -154,9 +154,9 @@ func (i *inprocessOracleCreator) CreatePluginOracle(pluginType cctypes.PluginTyp for _, chain := range i.chains.Slice() { var chainReaderConfig evmrelaytypes.ChainReaderConfig if chain.ID().Uint64() == destChainID { - chainReaderConfig = evm2.DestReaderConfig() + chainReaderConfig = evmconfig.DestReaderConfig() } else { - chainReaderConfig = evm2.SourceReaderConfig() + chainReaderConfig = evmconfig.SourceReaderConfig() } cr, err2 := evm.NewChainReaderService( context.Background(), @@ -208,7 +208,7 @@ func (i *inprocessOracleCreator) CreatePluginOracle(pluginType cctypes.PluginTyp chain.Client(), chain.TxManager(), chain.GasEstimator(), - evm2.ChainWriterConfigRaw(fromAddress, chain.Config().EVM().GasEstimator().PriceMaxKey(fromAddress)), + evmconfig.ChainWriterConfigRaw(fromAddress, chain.Config().EVM().GasEstimator().PriceMaxKey(fromAddress)), ) if err2 != nil { return nil, fmt.Errorf("failed to create chain writer for chain %s: %w", chain.ID(), err2) @@ -235,7 +235,7 @@ func (i *inprocessOracleCreator) CreatePluginOracle(pluginType cctypes.PluginTyp if !ok { return nil, fmt.Errorf("no OCR key bundle found for chain family %s, forgot to create one?", destChainFamily) } - onchainKeyring := ocrimpls2.NewOnchainKeyring[[]byte](keybundle, i.lggr) + onchainKeyring := ocrimpls.NewOnchainKeyring[[]byte](keybundle, i.lggr) // build the contract transmitter // assume that we are using the first account in the keybundle as the from account @@ -262,13 +262,13 @@ func (i *inprocessOracleCreator) CreatePluginOracle(pluginType cctypes.PluginTyp Named(fmt.Sprintf("%d", config.Config.ChainSelector)). Named(hexutil.Encode(config.Config.OfframpAddress)), ccipreaderpkg.OCR3ConfigWithMeta(config), - ccipevm2.NewCommitPluginCodecV1(), - ccipevm2.NewMessageHasherV1(), + ccipevm.NewCommitPluginCodecV1(), + ccipevm.NewMessageHasherV1(), i.homeChainReader, contractReaders, chainWriters, ) - transmitter = ocrimpls2.NewCommitContractTransmitter[[]byte](destChainWriter, + transmitter = ocrimpls.NewCommitContractTransmitter[[]byte](destChainWriter, ocrtypes.Account(destFromAccounts[0]), hexutil.Encode(config.Config.OfframpAddress), // TODO: this works for evm only, how about non-evm? ) @@ -279,13 +279,13 @@ func (i *inprocessOracleCreator) CreatePluginOracle(pluginType cctypes.PluginTyp Named(destRelayID.String()). Named(hexutil.Encode(config.Config.OfframpAddress)), ccipreaderpkg.OCR3ConfigWithMeta(config), - ccipevm2.NewExecutePluginCodecV1(), - ccipevm2.NewMessageHasherV1(), + ccipevm.NewExecutePluginCodecV1(), + ccipevm.NewMessageHasherV1(), i.homeChainReader, contractReaders, chainWriters, ) - transmitter = ocrimpls2.NewExecContractTransmitter[[]byte](destChainWriter, + transmitter = ocrimpls.NewExecContractTransmitter[[]byte](destChainWriter, ocrtypes.Account(destFromAccounts[0]), hexutil.Encode(config.Config.OfframpAddress), // TODO: this works for evm only, how about non-evm? ) @@ -297,7 +297,7 @@ func (i *inprocessOracleCreator) CreatePluginOracle(pluginType cctypes.PluginTyp BinaryNetworkEndpointFactory: i.peerWrapper.Peer2, Database: i.db, V2Bootstrappers: i.bootstrapperLocators, - ContractConfigTracker: ocrimpls2.NewConfigTracker(config), + ContractConfigTracker: ocrimpls.NewConfigTracker(config), ContractTransmitter: transmitter, LocalConfig: defaultLocalConfig(), Logger: ocrcommon.NewOCRWrapper( @@ -314,7 +314,7 @@ func (i *inprocessOracleCreator) CreatePluginOracle(pluginType cctypes.PluginTyp string(config.Config.OfframpAddress), synchronization.OCR3CCIPCommit, ), - OffchainConfigDigester: ocrimpls2.NewConfigDigester(config.ConfigDigest), + OffchainConfigDigester: ocrimpls.NewConfigDigester(config.ConfigDigest), OffchainKeyring: keybundle, OnchainKeyring: onchainKeyring, ReportingPluginFactory: factory, diff --git a/core/capabilities/ccip/types/mocks/oracle_creator.go b/core/capabilities/ccip/types/mocks/oracle_creator.go index 795253b019..d83ad042bf 100644 --- a/core/capabilities/ccip/types/mocks/oracle_creator.go +++ b/core/capabilities/ccip/types/mocks/oracle_creator.go @@ -3,9 +3,8 @@ package mocks import ( + types "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types" mock "github.com/stretchr/testify/mock" - - "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types" ) // OracleCreator is an autogenerated mock type for the OracleCreator type