diff --git a/core/cmd/shell_local.go b/core/cmd/shell_local.go index 3ed4964a35e..db4d0476fb3 100644 --- a/core/cmd/shell_local.go +++ b/core/cmd/shell_local.go @@ -384,9 +384,6 @@ func (s *Shell) runNode(c *cli.Context) error { return fmt.Errorf("error listing legacy evm chains: %w", err) } for _, ch := range chainList { - if err = keyStore.Migrate(s.Config.Password().VRF(), ch.ID()); err != nil { - return errors.Wrap(err, "error migrating keystore") - } if ch.Config().EVM().AutoCreateKey() { lggr.Debugf("AutoCreateKey=true, will ensure EVM key for chain %s", ch.ID()) err2 := app.GetKeyStore().Eth().EnsureKeys(ch.ID()) diff --git a/core/services/keystore/master.go b/core/services/keystore/master.go index c32a478ba6d..ab4c3256c5c 100644 --- a/core/services/keystore/master.go +++ b/core/services/keystore/master.go @@ -51,7 +51,6 @@ type Master interface { StarkNet() StarkNet VRF() VRF Unlock(password string) error - Migrate(vrfPassword string, chainID *big.Int) error IsEmpty() (bool, error) } @@ -151,81 +150,6 @@ func (ks *master) IsEmpty() (bool, error) { return count == 0, nil } -func (ks *master) Migrate(vrfPssword string, chainID *big.Int) error { - ks.lock.Lock() - defer ks.lock.Unlock() - if ks.isLocked() { - return ErrLocked - } - csaKeys, err := ks.csa.GetV1KeysAsV2() - if err != nil { - return err - } - for _, csaKey := range csaKeys { - if _, exists := ks.keyRing.CSA[csaKey.ID()]; exists { - continue - } - ks.logger.Debugf("Migrating CSA key %s", csaKey.ID()) - ks.keyRing.CSA[csaKey.ID()] = csaKey - } - ocrKeys, err := ks.ocr.GetV1KeysAsV2() - if err != nil { - return err - } - for _, ocrKey := range ocrKeys { - if _, exists := ks.keyRing.OCR[ocrKey.ID()]; exists { - continue - } - ks.logger.Debugf("Migrating OCR key %s", ocrKey.ID()) - ks.keyRing.OCR[ocrKey.ID()] = ocrKey - } - p2pKeys, err := ks.p2p.GetV1KeysAsV2() - if err != nil { - return err - } - for _, p2pKey := range p2pKeys { - if _, exists := ks.keyRing.P2P[p2pKey.ID()]; exists { - continue - } - ks.logger.Debugf("Migrating P2P key %s", p2pKey.ID()) - ks.keyRing.P2P[p2pKey.ID()] = p2pKey - } - vrfKeys, err := ks.vrf.GetV1KeysAsV2(vrfPssword) - if err != nil { - return err - } - for _, vrfKey := range vrfKeys { - if _, exists := ks.keyRing.VRF[vrfKey.ID()]; exists { - continue - } - ks.logger.Debugf("Migrating VRF key %s", vrfKey.ID()) - ks.keyRing.VRF[vrfKey.ID()] = vrfKey - } - if err = ks.keyManager.save(); err != nil { - return err - } - ethKeys, nonces, fundings, err := ks.eth.getV1KeysAsV2() - if err != nil { - return err - } - if len(ethKeys) > 0 { - for i, ethKey := range ethKeys { - if _, exists := ks.keyRing.Eth[ethKey.ID()]; exists { - continue - } - ks.logger.Debugf("Migrating Eth key %s (and pegging to chain ID %s)", ethKey.ID(), chainID.String()) - // Note that V1 keys that were "funding" will be migrated as "disabled" - if err = ks.eth.addWithNonce(ethKey, chainID, nonces[i], fundings[i]); err != nil { - return err - } - if err = ks.keyManager.save(); err != nil { - return err - } - } - } - return nil -} - type keyManager struct { orm ksORM scryptParams utils.ScryptParams diff --git a/core/services/keystore/mocks/master.go b/core/services/keystore/mocks/master.go index 9eceec5bc71..e8b4775d662 100644 --- a/core/services/keystore/mocks/master.go +++ b/core/services/keystore/mocks/master.go @@ -3,8 +3,6 @@ package mocks import ( - big "math/big" - keystore "github.com/smartcontractkit/chainlink/v2/core/services/keystore" mock "github.com/stretchr/testify/mock" ) @@ -118,20 +116,6 @@ func (_m *Master) IsEmpty() (bool, error) { return r0, r1 } -// Migrate provides a mock function with given fields: vrfPassword, chainID -func (_m *Master) Migrate(vrfPassword string, chainID *big.Int) error { - ret := _m.Called(vrfPassword, chainID) - - var r0 error - if rf, ok := ret.Get(0).(func(string, *big.Int) error); ok { - r0 = rf(vrfPassword, chainID) - } else { - r0 = ret.Error(0) - } - - return r0 -} - // OCR provides a mock function with given fields: func (_m *Master) OCR() keystore.OCR { ret := _m.Called()