diff --git a/mcms/changesets/legacy/deploy_mcms_with_timelock.go b/legacy/mcms/changesets/deploy_mcms_with_timelock.go similarity index 92% rename from mcms/changesets/legacy/deploy_mcms_with_timelock.go rename to legacy/mcms/changesets/deploy_mcms_with_timelock.go index 62cec3e..19fcec3 100644 --- a/mcms/changesets/legacy/deploy_mcms_with_timelock.go +++ b/legacy/mcms/changesets/deploy_mcms_with_timelock.go @@ -1,4 +1,4 @@ -package legacy +package changesets import ( "context" @@ -11,13 +11,12 @@ import ( mcmscontracts "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/contracts/mcms" xerrgroup "golang.org/x/sync/errgroup" - evmchangesets "github.com/smartcontractkit/cld-changesets/pkg/family/evm/changesets" - evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm/legacy" + cldfproposalutils "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils" + "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/evm" + evmchangesets "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/evm/changesets" + solchangesets "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana/changesets" opsevm "github.com/smartcontractkit/cld-changesets/pkg/family/evm/operations" - solchangesets "github.com/smartcontractkit/cld-changesets/pkg/family/solana/changesets/legacy" - - cldfproposalutils "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils" "github.com/ethereum/go-ethereum/common" "github.com/gagliardetto/solana-go" @@ -126,8 +125,8 @@ func DeployMCMSWithTimelockV2( // load mcms state with qualifier awareness // we load the state one by one to avoid early return from MaybeLoadMCMSWithTimelockStateWithQualifier // due to one of the chain not found - var chainstate *evmstate.MCMSWithTimelockState - s, err := evmstate.MaybeLoadMCMSWithTimelockStateWithQualifier(env, []uint64{chainSel}, qualifier) + var chainstate *evm.MCMSWithTimelockState + s, err := evm.MaybeLoadMCMSWithTimelockStateWithQualifier(env, []uint64{chainSel}, qualifier) if err != nil { // if the state is not found for chain, we assume it's a fresh deployment // this includes "no addresses found" which is expected for new qualifiers @@ -214,14 +213,14 @@ func grantRolePreconditions(e cldf.Environment, cfg GrantRoleInput) error { } // loads MCMS state for each chain using per-chain qualifiers from cfg.MCMS.TimelockQualifierPerChain when available -func loadMCMSStatePerChainWithQualifier(e cldf.Environment, cfg GrantRoleInput) (map[uint64]*evmstate.MCMSWithTimelockState, error) { - result := make(map[uint64]*evmstate.MCMSWithTimelockState) +func loadMCMSStatePerChainWithQualifier(e cldf.Environment, cfg GrantRoleInput) (map[uint64]*evm.MCMSWithTimelockState, error) { + result := make(map[uint64]*evm.MCMSWithTimelockState) for selector := range cfg.ExistingProposerByChain { qualifier := "" if cfg.MCMS != nil && cfg.MCMS.TimelockQualifierPerChain != nil { qualifier = cfg.MCMS.TimelockQualifierPerChain[selector] } - chainState, err := evmstate.MaybeLoadMCMSWithTimelockStateWithQualifier(e, []uint64{selector}, qualifier) + chainState, err := evm.MaybeLoadMCMSWithTimelockStateWithQualifier(e, []uint64{selector}, qualifier) if err != nil { return nil, err } @@ -236,7 +235,7 @@ func grantRoleLogic(e cldf.Environment, cfg GrantRoleInput) (cldf.ChangesetOutpu if err != nil { return cldf.ChangesetOutput{}, err } - mcmsStateForProposal := make(map[uint64]evmstate.MCMSWithTimelockState) + mcmsStateForProposal := make(map[uint64]evm.MCMSWithTimelockState) for k, v := range mcmsState { if v != nil { // Replace the proposer MCM in state with the existing proposer. @@ -249,7 +248,7 @@ func grantRoleLogic(e cldf.Environment, cfg GrantRoleInput) (cldf.ChangesetOutpu return cldf.ChangesetOutput{}, fmt.Errorf("failed to create ManyChainMultiSig for existing proposer %s on chain %d: %w", cfg.ExistingProposerByChain[k].Hex(), k, err) } - mcmsStateForProposal[k] = evmstate.MCMSWithTimelockState{ + mcmsStateForProposal[k] = evm.MCMSWithTimelockState{ CancellerMcm: v.CancellerMcm, BypasserMcm: v.BypasserMcm, ProposerMcm: existingProposerMcm, @@ -281,7 +280,7 @@ func grantRoleLogic(e cldf.Environment, cfg GrantRoleInput) (cldf.ChangesetOutpu return out, nil } -func ValidateOwnership(ctx context.Context, mcms bool, deployerKey, timelock common.Address, contract evmstate.Ownable) error { +func ValidateOwnership(ctx context.Context, mcms bool, deployerKey, timelock common.Address, contract evm.Ownable) error { owner, err := contract.Owner(&bind.CallOpts{Context: ctx}) if err != nil { return fmt.Errorf("failed to get owner: %w", err) diff --git a/mcms/changesets/legacy/deploy_mcms_with_timelock_test.go b/legacy/mcms/changesets/deploy_mcms_with_timelock_test.go similarity index 95% rename from mcms/changesets/legacy/deploy_mcms_with_timelock_test.go rename to legacy/mcms/changesets/deploy_mcms_with_timelock_test.go index 388a889..4e2ee7c 100644 --- a/mcms/changesets/legacy/deploy_mcms_with_timelock_test.go +++ b/legacy/mcms/changesets/deploy_mcms_with_timelock_test.go @@ -1,5 +1,5 @@ //nolint:testifylint // inverting want and got is more succinct -package legacy_test +package changesets_test import ( "context" @@ -19,12 +19,12 @@ import ( "github.com/smartcontractkit/quarantine" "github.com/stretchr/testify/require" - mcmschangesets "github.com/smartcontractkit/cld-changesets/mcms/changesets/legacy" + mcmschangesets "github.com/smartcontractkit/cld-changesets/legacy/mcms/changesets" + evmstate "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/evm" + solana2 "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" + soltestutils "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana/testutils" cldchangesetscommon "github.com/smartcontractkit/cld-changesets/pkg/common" - evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm/legacy" familysolana "github.com/smartcontractkit/cld-changesets/pkg/family/solana" - "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" - soltestutils2 "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy/testutils" timelockBindings "github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/v0_1_1/timelock" "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" @@ -267,7 +267,7 @@ func TestDeployMCMSWithTimelockV2(t *testing.T) { evmSelector := chain_selectors.TEST_90000001.Selector solSelector := chain_selectors.TEST_22222222222222222222222222222222222222222222.Selector - programsPath, programIDs, ab := soltestutils2.PreloadMCMS(t, solSelector) + programsPath, programIDs, ab := soltestutils.PreloadMCMS(t, solSelector) rt, err := runtime.New(t.Context(), runtime.WithEnvOpts( environment.WithEVMSimulated(t, []uint64{evmSelector}), @@ -361,7 +361,7 @@ func TestDeployMCMSWithTimelockV2(t *testing.T) { require.NoError(t, err) require.Len(t, evmMCMSState, 1) - solMCMSState := soltestutils2.GetMCMSStateFromAddressBook(t, rt.State().AddressBook, solChain) + solMCMSState := soltestutils.GetMCMSStateFromAddressBook(t, rt.State().AddressBook, solChain) // --- assert --- @@ -456,7 +456,7 @@ func TestDeployMCMSWithTimelockV2SkipInitSolana(t *testing.T) { t.Parallel() selector := chain_selectors.TEST_22222222222222222222222222222222222222222222.Selector - programsPath, programIDs, ab := soltestutils2.PreloadMCMS(t, selector) + programsPath, programIDs, ab := soltestutils.PreloadMCMS(t, selector) rt, err := runtime.New(t.Context(), runtime.WithEnvOpts( environment.WithSolanaContainer(t, []uint64{selector}, programsPath, programIDs), @@ -518,7 +518,7 @@ func TestDeployMCMSWithTimelockV2SkipInitSolana(t *testing.T) { ) require.NoError(t, err) - solanaState, err := legacy.MaybeLoadMCMSWithTimelockState(rt.Environment(), []uint64{selector}) + solanaState, err := solana2.MaybeLoadMCMSWithTimelockState(rt.Environment(), []uint64{selector}) require.NoError(t, err) // Call deploy again, seeds and addresses from original state should not change @@ -527,7 +527,7 @@ func TestDeployMCMSWithTimelockV2SkipInitSolana(t *testing.T) { ) require.NoError(t, err) - solanaStateNew, err := legacy.MaybeLoadMCMSWithTimelockState(rt.Environment(), []uint64{selector}) + solanaStateNew, err := solana2.MaybeLoadMCMSWithTimelockState(rt.Environment(), []uint64{selector}) require.NoError(t, err) // --- assert --- @@ -549,12 +549,12 @@ func TestDeployMCMSWithTimelockV2SkipInitSolana(t *testing.T) { // ----- helpers ----- -func mcmSignerPDA(programID solana.PublicKey, seed legacy.PDASeed) string { +func mcmSignerPDA(programID solana.PublicKey, seed solana2.PDASeed) string { return familysolana.GetMCMSignerPDA(programID, seed).String() } func solanaTimelockConfig( - ctx context.Context, t *testing.T, chain cldf_solana.Chain, programID solana.PublicKey, seed legacy.PDASeed, + ctx context.Context, t *testing.T, chain cldf_solana.Chain, programID solana.PublicKey, seed solana2.PDASeed, ) timelockBindings.Config { t.Helper() diff --git a/mcms/changesets/legacy/firedrill.go b/legacy/mcms/changesets/firedrill.go similarity index 97% rename from mcms/changesets/legacy/firedrill.go rename to legacy/mcms/changesets/firedrill.go index f161b61..6537bf8 100644 --- a/mcms/changesets/legacy/firedrill.go +++ b/legacy/mcms/changesets/firedrill.go @@ -1,4 +1,4 @@ -package legacy +package changesets import ( "errors" @@ -13,8 +13,8 @@ import ( chainsel "github.com/smartcontractkit/chain-selectors" cldf_chain "github.com/smartcontractkit/chainlink-deployments-framework/chain" + evmstate "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/evm" mcops "github.com/smartcontractkit/cld-changesets/mcms/operations" - evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm/legacy" ) var _ cldf.ChangeSetV2[FireDrillConfig] = MCMSSignFireDrillChangeset{} diff --git a/mcms/changesets/legacy/firedrill_test.go b/legacy/mcms/changesets/firedrill_test.go similarity index 99% rename from mcms/changesets/legacy/firedrill_test.go rename to legacy/mcms/changesets/firedrill_test.go index a28c5ba..d9e84bc 100644 --- a/mcms/changesets/legacy/firedrill_test.go +++ b/legacy/mcms/changesets/firedrill_test.go @@ -1,4 +1,4 @@ -package legacy +package changesets import ( "testing" diff --git a/mcms/changesets/legacy/fund_mcm_pdas.go b/legacy/mcms/changesets/fund_mcm_pdas.go similarity index 91% rename from mcms/changesets/legacy/fund_mcm_pdas.go rename to legacy/mcms/changesets/fund_mcm_pdas.go index 0c6dcc7..3f7501a 100644 --- a/mcms/changesets/legacy/fund_mcm_pdas.go +++ b/legacy/mcms/changesets/fund_mcm_pdas.go @@ -1,5 +1,5 @@ // Package changesets provides reusable MCMS changesets. -package legacy +package changesets import ( "errors" @@ -10,8 +10,8 @@ import ( cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" + solana2 "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" solanastate "github.com/smartcontractkit/cld-changesets/pkg/family/solana" - "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" ) var _ cldf.ChangeSetV2[FundMCMSignerConfig] = FundMCMSignersChangeset{} @@ -44,7 +44,7 @@ func (f FundMCMSignersChangeset) VerifyPreconditions(e cldf.Environment, config if err != nil { return fmt.Errorf("failed to get existing addresses: %w", err) } - mcmState, err := legacy.MaybeLoadMCMSWithTimelockChainState(solChain, addreses) + mcmState, err := solana2.MaybeLoadMCMSWithTimelockChainState(solChain, addreses) if err != nil { return fmt.Errorf("failed to load MCMS state: %w", err) } @@ -78,33 +78,33 @@ func (f FundMCMSignersChangeset) Apply(e cldf.Environment, config FundMCMSignerC if err != nil { return cldf.ChangesetOutput{}, fmt.Errorf("failed to get existing addresses: %w", err) } - mcmState, err := legacy.MaybeLoadMCMSWithTimelockChainState(solChain, addreses) + mcmState, err := solana2.MaybeLoadMCMSWithTimelockChainState(solChain, addreses) if err != nil { return cldf.ChangesetOutput{}, fmt.Errorf("failed to load MCMS state: %w", err) } - err = legacy.FundFromDeployerKey( + err = solana2.FundFromDeployerKey( solChain, []solana.PublicKey{solanastate.GetTimelockSignerPDA(mcmState.TimelockProgram, mcmState.TimelockSeed)}, cfgAmounts.Timelock) if err != nil { return cldf.ChangesetOutput{}, fmt.Errorf("failed to fund timelock signer on chain %d: %w", chainSelector, err) } - err = legacy.FundFromDeployerKey( + err = solana2.FundFromDeployerKey( solChain, []solana.PublicKey{solanastate.GetMCMSignerPDA(mcmState.McmProgram, mcmState.ProposerMcmSeed)}, cfgAmounts.ProposeMCM) if err != nil { return cldf.ChangesetOutput{}, fmt.Errorf("failed to fund MCMS proposer on chain %d: %w", chainSelector, err) } - err = legacy.FundFromDeployerKey( + err = solana2.FundFromDeployerKey( solChain, []solana.PublicKey{solanastate.GetMCMSignerPDA(mcmState.McmProgram, mcmState.CancellerMcmSeed)}, cfgAmounts.CancellerMCM) if err != nil { return cldf.ChangesetOutput{}, fmt.Errorf("failed to fund MCMS canceller on chain %d: %w", chainSelector, err) } - err = legacy.FundFromDeployerKey( + err = solana2.FundFromDeployerKey( solChain, []solana.PublicKey{solanastate.GetMCMSignerPDA(mcmState.McmProgram, mcmState.BypasserMcmSeed)}, cfgAmounts.BypasserMCM) diff --git a/mcms/changesets/legacy/fund_mcm_pdas_test.go b/legacy/mcms/changesets/fund_mcm_pdas_test.go similarity index 87% rename from mcms/changesets/legacy/fund_mcm_pdas_test.go rename to legacy/mcms/changesets/fund_mcm_pdas_test.go index 32e17de..10dfb65 100644 --- a/mcms/changesets/legacy/fund_mcm_pdas_test.go +++ b/legacy/mcms/changesets/fund_mcm_pdas_test.go @@ -1,4 +1,4 @@ -package legacy +package changesets import ( "context" @@ -21,9 +21,9 @@ import ( "github.com/smartcontractkit/chainlink-deployments-framework/pkg/logger" "github.com/stretchr/testify/require" + solana2 "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" cldchangesetscommon "github.com/smartcontractkit/cld-changesets/pkg/common" solanastate "github.com/smartcontractkit/cld-changesets/pkg/family/solana" - "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" ) func TestFundMCMSignersChangeset_VerifyPreconditions(t *testing.T) { @@ -228,29 +228,29 @@ func testFundMCMSignersEnv(t *testing.T, selector uint64, client *rpc.Client, co })) } -func saveMCMSAddresses(t *testing.T, addressBook cldf.AddressBook, selector uint64, completeState bool) *legacy.MCMSWithTimelockState { +func saveMCMSAddresses(t *testing.T, addressBook cldf.AddressBook, selector uint64, completeState bool) *solana2.MCMSWithTimelockState { t.Helper() mcmDummyProgram := solana.NewWallet().PublicKey() timelockProgram := solana.NewWallet().PublicKey() - state := &legacy.MCMSWithTimelockState{ - MCMSWithTimelockPrograms: &legacy.MCMSWithTimelockPrograms{ + state := &solana2.MCMSWithTimelockState{ + MCMSWithTimelockPrograms: &solana2.MCMSWithTimelockPrograms{ McmProgram: mcmDummyProgram, TimelockProgram: timelockProgram, - ProposerMcmSeed: legacy.PDASeed{'t', 'e', 's', 't', '1'}, - CancellerMcmSeed: legacy.PDASeed{'t', 'e', 's', 't', '2'}, - BypasserMcmSeed: legacy.PDASeed{'t', 'e', 's', 't', '3'}, - TimelockSeed: legacy.PDASeed{'t', 'e', 's', 't'}, + ProposerMcmSeed: solana2.PDASeed{'t', 'e', 's', 't', '1'}, + CancellerMcmSeed: solana2.PDASeed{'t', 'e', 's', 't', '2'}, + BypasserMcmSeed: solana2.PDASeed{'t', 'e', 's', 't', '3'}, + TimelockSeed: solana2.PDASeed{'t', 'e', 's', 't'}, }, } if !completeState { - state.ProposerMcmSeed = legacy.PDASeed{} - state.CancellerMcmSeed = legacy.PDASeed{} - state.BypasserMcmSeed = legacy.PDASeed{} - state.TimelockSeed = legacy.PDASeed{} + state.ProposerMcmSeed = solana2.PDASeed{} + state.CancellerMcmSeed = solana2.PDASeed{} + state.BypasserMcmSeed = solana2.PDASeed{} + state.TimelockSeed = solana2.PDASeed{} - require.NoError(t, addressBook.Save(selector, legacy.EncodeAddressWithSeed(state.McmProgram, state.BypasserMcmSeed), cldf.NewTypeAndVersion( + require.NoError(t, addressBook.Save(selector, solana2.EncodeAddressWithSeed(state.McmProgram, state.BypasserMcmSeed), cldf.NewTypeAndVersion( mcmscontracts.BypasserManyChainMultisig, cldchangesetscommon.Version1_0_0, ))) @@ -258,19 +258,19 @@ func saveMCMSAddresses(t *testing.T, addressBook cldf.AddressBook, selector uint return state } - require.NoError(t, addressBook.Save(selector, legacy.EncodeAddressWithSeed(state.TimelockProgram, state.TimelockSeed), cldf.NewTypeAndVersion( + require.NoError(t, addressBook.Save(selector, solana2.EncodeAddressWithSeed(state.TimelockProgram, state.TimelockSeed), cldf.NewTypeAndVersion( mcmscontracts.RBACTimelock, cldchangesetscommon.Version1_0_0, ))) - require.NoError(t, addressBook.Save(selector, legacy.EncodeAddressWithSeed(state.McmProgram, state.ProposerMcmSeed), cldf.NewTypeAndVersion( + require.NoError(t, addressBook.Save(selector, solana2.EncodeAddressWithSeed(state.McmProgram, state.ProposerMcmSeed), cldf.NewTypeAndVersion( mcmscontracts.ProposerManyChainMultisig, cldchangesetscommon.Version1_0_0, ))) - require.NoError(t, addressBook.Save(selector, legacy.EncodeAddressWithSeed(state.McmProgram, state.CancellerMcmSeed), cldf.NewTypeAndVersion( + require.NoError(t, addressBook.Save(selector, solana2.EncodeAddressWithSeed(state.McmProgram, state.CancellerMcmSeed), cldf.NewTypeAndVersion( mcmscontracts.CancellerManyChainMultisig, cldchangesetscommon.Version1_0_0, ))) - require.NoError(t, addressBook.Save(selector, legacy.EncodeAddressWithSeed(state.McmProgram, state.BypasserMcmSeed), cldf.NewTypeAndVersion( + require.NoError(t, addressBook.Save(selector, solana2.EncodeAddressWithSeed(state.McmProgram, state.BypasserMcmSeed), cldf.NewTypeAndVersion( mcmscontracts.BypasserManyChainMultisig, cldchangesetscommon.Version1_0_0, ))) diff --git a/mcms/changesets/legacy/grant_role_timelock.go b/legacy/mcms/changesets/grant_role_timelock.go similarity index 97% rename from mcms/changesets/legacy/grant_role_timelock.go rename to legacy/mcms/changesets/grant_role_timelock.go index cbaee90..7ce7078 100644 --- a/mcms/changesets/legacy/grant_role_timelock.go +++ b/legacy/mcms/changesets/grant_role_timelock.go @@ -1,4 +1,4 @@ -package legacy +package changesets import ( "errors" @@ -16,9 +16,9 @@ import ( cldfproposalutils "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils" fwops "github.com/smartcontractkit/chainlink-deployments-framework/operations" - mcmscontract "github.com/smartcontractkit/cld-changesets/mcms/legacy/proposeutils" + mcmscontract "github.com/smartcontractkit/cld-changesets/legacy/mcms/proposeutils" + solanastate "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" mcops "github.com/smartcontractkit/cld-changesets/mcms/operations" - solanastate "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" ) // GrantRoleTimelockSolana grants the given accounts access to the given role on the timelock diff --git a/mcms/changesets/legacy/grant_role_timelock_test.go b/legacy/mcms/changesets/grant_role_timelock_test.go similarity index 99% rename from mcms/changesets/legacy/grant_role_timelock_test.go rename to legacy/mcms/changesets/grant_role_timelock_test.go index 9890b28..7cf312e 100644 --- a/mcms/changesets/legacy/grant_role_timelock_test.go +++ b/legacy/mcms/changesets/grant_role_timelock_test.go @@ -1,4 +1,4 @@ -package legacy +package changesets import ( "fmt" diff --git a/mcms/legacy/proposeutils/propose.go b/legacy/mcms/proposeutils/propose.go similarity index 98% rename from mcms/legacy/proposeutils/propose.go rename to legacy/mcms/proposeutils/propose.go index d1f7ab8..08108a2 100644 --- a/mcms/legacy/proposeutils/propose.go +++ b/legacy/mcms/proposeutils/propose.go @@ -21,8 +21,8 @@ import ( cldfproposalutils "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils" tonstate "github.com/smartcontractkit/chainlink-ton/deployment/state" - evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm/legacy" - solstate "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" + evmstate "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/evm" + solstate "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" ) const ( diff --git a/mcms/legacy/proposeutils/propose_test.go b/legacy/mcms/proposeutils/propose_test.go similarity index 100% rename from mcms/legacy/proposeutils/propose_test.go rename to legacy/mcms/proposeutils/propose_test.go diff --git a/pkg/family/aptos/legacy/state.go b/legacy/pkg/family/aptos/state.go similarity index 99% rename from pkg/family/aptos/legacy/state.go rename to legacy/pkg/family/aptos/state.go index 857b240..2e4040e 100644 --- a/pkg/family/aptos/legacy/state.go +++ b/legacy/pkg/family/aptos/state.go @@ -1,4 +1,4 @@ -package legacy +package aptos import ( "fmt" diff --git a/pkg/family/aptos/legacy/state_test.go b/legacy/pkg/family/aptos/state_test.go similarity index 99% rename from pkg/family/aptos/legacy/state_test.go rename to legacy/pkg/family/aptos/state_test.go index 7dfaa84..6566e69 100644 --- a/pkg/family/aptos/legacy/state_test.go +++ b/legacy/pkg/family/aptos/state_test.go @@ -1,4 +1,4 @@ -package legacy +package aptos import ( "context" diff --git a/pkg/family/evm/changesets/deploy_mcms_with_timelock.go b/legacy/pkg/family/evm/changesets/deploy_mcms_with_timelock.go similarity index 99% rename from pkg/family/evm/changesets/deploy_mcms_with_timelock.go rename to legacy/pkg/family/evm/changesets/deploy_mcms_with_timelock.go index 79357d7..392131d 100644 --- a/pkg/family/evm/changesets/deploy_mcms_with_timelock.go +++ b/legacy/pkg/family/evm/changesets/deploy_mcms_with_timelock.go @@ -18,8 +18,8 @@ import ( "github.com/smartcontractkit/chainlink-deployments-framework/operations" "github.com/spf13/cast" + evmstate "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/evm" "github.com/smartcontractkit/cld-changesets/pkg/contract/mcms/view/v1_0" - evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm/legacy" opsevm "github.com/smartcontractkit/cld-changesets/pkg/family/evm/operations" seqs "github.com/smartcontractkit/cld-changesets/pkg/family/evm/sequences" ) diff --git a/pkg/family/evm/legacy/ownable.go b/legacy/pkg/family/evm/ownable.go similarity index 96% rename from pkg/family/evm/legacy/ownable.go rename to legacy/pkg/family/evm/ownable.go index e709b1a..db25a2f 100644 --- a/pkg/family/evm/legacy/ownable.go +++ b/legacy/pkg/family/evm/ownable.go @@ -1,4 +1,4 @@ -package legacy +package evm import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" diff --git a/pkg/family/evm/legacy/proposal_adapter.go b/legacy/pkg/family/evm/proposal_adapter.go similarity index 97% rename from pkg/family/evm/legacy/proposal_adapter.go rename to legacy/pkg/family/evm/proposal_adapter.go index a40712a..1f8092c 100644 --- a/pkg/family/evm/legacy/proposal_adapter.go +++ b/legacy/pkg/family/evm/proposal_adapter.go @@ -1,4 +1,4 @@ -package legacy +package evm import ( cldfproposalutils "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils" diff --git a/pkg/family/evm/legacy/state.go b/legacy/pkg/family/evm/state.go similarity index 99% rename from pkg/family/evm/legacy/state.go rename to legacy/pkg/family/evm/state.go index d78af5c..ce252e3 100644 --- a/pkg/family/evm/legacy/state.go +++ b/legacy/pkg/family/evm/state.go @@ -1,4 +1,4 @@ -package legacy +package evm import ( "errors" diff --git a/pkg/family/evm/legacy/state_test.go b/legacy/pkg/family/evm/state_test.go similarity index 99% rename from pkg/family/evm/legacy/state_test.go rename to legacy/pkg/family/evm/state_test.go index fcc11d4..6d6cba1 100644 --- a/pkg/family/evm/legacy/state_test.go +++ b/legacy/pkg/family/evm/state_test.go @@ -1,4 +1,4 @@ -package legacy +package evm import ( "context" diff --git a/pkg/family/solana/changesets/legacy/access_controller.go b/legacy/pkg/family/solana/changesets/access_controller.go similarity index 97% rename from pkg/family/solana/changesets/legacy/access_controller.go rename to legacy/pkg/family/solana/changesets/access_controller.go index 5ab34e2..53b6714 100644 --- a/pkg/family/solana/changesets/legacy/access_controller.go +++ b/legacy/pkg/family/solana/changesets/access_controller.go @@ -1,4 +1,4 @@ -package legacy +package changesets import ( "errors" @@ -17,10 +17,10 @@ import ( cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" + legacy2 "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" + "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana/solutils" cldchangesetscommon "github.com/smartcontractkit/cld-changesets/pkg/common" familysolana "github.com/smartcontractkit/cld-changesets/pkg/family/solana" - legacy2 "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" - "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy/solutils" ) func deployAccessControllerProgram( diff --git a/pkg/family/solana/changesets/legacy/deploy_mcm.go b/legacy/pkg/family/solana/changesets/deploy_mcm.go similarity index 97% rename from pkg/family/solana/changesets/legacy/deploy_mcm.go rename to legacy/pkg/family/solana/changesets/deploy_mcm.go index 7c89d1a..7250869 100644 --- a/pkg/family/solana/changesets/legacy/deploy_mcm.go +++ b/legacy/pkg/family/solana/changesets/deploy_mcm.go @@ -1,4 +1,4 @@ -package legacy +package changesets import ( "crypto/rand" @@ -18,10 +18,10 @@ import ( mcmBindings "github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings/v0_1_1/mcm" solanaUtils "github.com/smartcontractkit/chainlink-ccip/chains/solana/utils/common" + legacy2 "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" + "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana/solutils" cldchangesetscommon "github.com/smartcontractkit/cld-changesets/pkg/common" familysolana "github.com/smartcontractkit/cld-changesets/pkg/family/solana" - legacy2 "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" - "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy/solutils" ) func deployMCMProgram( diff --git a/pkg/family/solana/changesets/legacy/deploy_mcms_with_timelock.go b/legacy/pkg/family/solana/changesets/deploy_mcms_with_timelock.go similarity index 98% rename from pkg/family/solana/changesets/legacy/deploy_mcms_with_timelock.go rename to legacy/pkg/family/solana/changesets/deploy_mcms_with_timelock.go index 5f221e6..5e4e9f2 100644 --- a/pkg/family/solana/changesets/legacy/deploy_mcms_with_timelock.go +++ b/legacy/pkg/family/solana/changesets/deploy_mcms_with_timelock.go @@ -1,4 +1,4 @@ -package legacy +package changesets import ( "context" @@ -11,7 +11,7 @@ import ( mcmscontracts "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/contracts/mcms" cldfproposalutils "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils" - familysolana "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" + familysolana "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" solseqs "github.com/smartcontractkit/cld-changesets/pkg/family/solana/sequences" cldf_solana "github.com/smartcontractkit/chainlink-deployments-framework/chain/solana" diff --git a/pkg/family/solana/changesets/legacy/deploy_timelock.go b/legacy/pkg/family/solana/changesets/deploy_timelock.go similarity index 97% rename from pkg/family/solana/changesets/legacy/deploy_timelock.go rename to legacy/pkg/family/solana/changesets/deploy_timelock.go index 5b8fd9a..4652086 100644 --- a/pkg/family/solana/changesets/legacy/deploy_timelock.go +++ b/legacy/pkg/family/solana/changesets/deploy_timelock.go @@ -1,4 +1,4 @@ -package legacy +package changesets import ( "errors" @@ -16,10 +16,10 @@ import ( cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" + legacy2 "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" + "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana/solutils" cldchangesetscommon "github.com/smartcontractkit/cld-changesets/pkg/common" familysolana "github.com/smartcontractkit/cld-changesets/pkg/family/solana" - legacy2 "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" - "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy/solutils" ) func deployTimelockProgram( diff --git a/pkg/family/solana/legacy/fund.go b/legacy/pkg/family/solana/fund.go similarity index 98% rename from pkg/family/solana/legacy/fund.go rename to legacy/pkg/family/solana/fund.go index c2d684b..fcd703c 100644 --- a/pkg/family/solana/legacy/fund.go +++ b/legacy/pkg/family/solana/fund.go @@ -1,4 +1,4 @@ -package legacy +package solana import ( "fmt" diff --git a/pkg/family/solana/legacy/fund_test.go b/legacy/pkg/family/solana/fund_test.go similarity index 99% rename from pkg/family/solana/legacy/fund_test.go rename to legacy/pkg/family/solana/fund_test.go index 2b6ebf5..ec5e80b 100644 --- a/pkg/family/solana/legacy/fund_test.go +++ b/legacy/pkg/family/solana/fund_test.go @@ -1,4 +1,4 @@ -package legacy +package solana import ( "testing" diff --git a/pkg/family/solana/legacy/proposal_adapter.go b/legacy/pkg/family/solana/proposal_adapter.go similarity index 97% rename from pkg/family/solana/legacy/proposal_adapter.go rename to legacy/pkg/family/solana/proposal_adapter.go index a0b83b1..fdc6154 100644 --- a/pkg/family/solana/legacy/proposal_adapter.go +++ b/legacy/pkg/family/solana/proposal_adapter.go @@ -1,4 +1,4 @@ -package legacy +package solana import ( mcmssolanasdk "github.com/smartcontractkit/mcms/sdk/solana" diff --git a/pkg/family/solana/legacy/solutils/artifacts.go b/legacy/pkg/family/solana/solutils/artifacts.go similarity index 100% rename from pkg/family/solana/legacy/solutils/artifacts.go rename to legacy/pkg/family/solana/solutils/artifacts.go diff --git a/pkg/family/solana/legacy/solutils/artifacts_test.go b/legacy/pkg/family/solana/solutils/artifacts_test.go similarity index 100% rename from pkg/family/solana/legacy/solutils/artifacts_test.go rename to legacy/pkg/family/solana/solutils/artifacts_test.go diff --git a/pkg/family/solana/legacy/solutils/directory.go b/legacy/pkg/family/solana/solutils/directory.go similarity index 100% rename from pkg/family/solana/legacy/solutils/directory.go rename to legacy/pkg/family/solana/solutils/directory.go diff --git a/pkg/family/solana/legacy/solutils/fund.go b/legacy/pkg/family/solana/solutils/fund.go similarity index 100% rename from pkg/family/solana/legacy/solutils/fund.go rename to legacy/pkg/family/solana/solutils/fund.go diff --git a/pkg/family/solana/legacy/state.go b/legacy/pkg/family/solana/state.go similarity index 99% rename from pkg/family/solana/legacy/state.go rename to legacy/pkg/family/solana/state.go index e5039b8..6542490 100644 --- a/pkg/family/solana/legacy/state.go +++ b/legacy/pkg/family/solana/state.go @@ -1,4 +1,4 @@ -package legacy +package solana import ( "errors" diff --git a/pkg/family/solana/legacy/state_test.go b/legacy/pkg/family/solana/state_test.go similarity index 99% rename from pkg/family/solana/legacy/state_test.go rename to legacy/pkg/family/solana/state_test.go index 4485ec5..6c902d9 100644 --- a/pkg/family/solana/legacy/state_test.go +++ b/legacy/pkg/family/solana/state_test.go @@ -1,4 +1,4 @@ -package legacy +package solana import ( "context" diff --git a/pkg/family/solana/legacy/testutils/artifacts.go b/legacy/pkg/family/solana/testutils/artifacts.go similarity index 94% rename from pkg/family/solana/legacy/testutils/artifacts.go rename to legacy/pkg/family/solana/testutils/artifacts.go index 051ab20..a468a50 100644 --- a/pkg/family/solana/legacy/testutils/artifacts.go +++ b/legacy/pkg/family/solana/testutils/artifacts.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy/solutils" + "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana/solutils" ) var ( diff --git a/pkg/family/solana/legacy/testutils/datastore.go b/legacy/pkg/family/solana/testutils/datastore.go similarity index 91% rename from pkg/family/solana/legacy/testutils/datastore.go rename to legacy/pkg/family/solana/testutils/datastore.go index afc4e9a..d70415b 100644 --- a/pkg/family/solana/legacy/testutils/datastore.go +++ b/legacy/pkg/family/solana/testutils/datastore.go @@ -9,9 +9,9 @@ import ( cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" + familysolana "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" + "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana/solutils" "github.com/smartcontractkit/cld-changesets/pkg/common" - familysolana "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" - "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy/solutils" ) // PreloadAddressBookWithMCMSPrograms creates and returns an address book containing preloaded MCMS diff --git a/pkg/family/solana/legacy/testutils/fund.go b/legacy/pkg/family/solana/testutils/fund.go similarity index 84% rename from pkg/family/solana/legacy/testutils/fund.go rename to legacy/pkg/family/solana/testutils/fund.go index a0c7705..7d78e8a 100644 --- a/pkg/family/solana/legacy/testutils/fund.go +++ b/legacy/pkg/family/solana/testutils/fund.go @@ -8,10 +8,9 @@ import ( cldfsolana "github.com/smartcontractkit/chainlink-deployments-framework/chain/solana" - "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy/solutils" - + solstate "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" + "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana/solutils" pdasol "github.com/smartcontractkit/cld-changesets/pkg/family/solana" - solstate "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" ) // FundSignerPDAs funds the timelock signer and MCMS signer PDAs with 1 SOL for testing diff --git a/pkg/family/solana/legacy/testutils/preload.go b/legacy/pkg/family/solana/testutils/preload.go similarity index 96% rename from pkg/family/solana/legacy/testutils/preload.go rename to legacy/pkg/family/solana/testutils/preload.go index 1cede87..7568fae 100644 --- a/pkg/family/solana/legacy/testutils/preload.go +++ b/legacy/pkg/family/solana/testutils/preload.go @@ -10,7 +10,7 @@ import ( cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" - "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy/solutils" + "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana/solutils" ) // LoadMCMSPrograms loads the MCMS program artifacts into the given directory. diff --git a/link/changesets/deploy_link_token_test.go b/link/changesets/deploy_link_token_test.go index 1f1fb64..3831feb 100644 --- a/link/changesets/deploy_link_token_test.go +++ b/link/changesets/deploy_link_token_test.go @@ -16,8 +16,8 @@ import ( "github.com/smartcontractkit/chainlink-deployments-framework/engine/test/environment" "github.com/smartcontractkit/chainlink-deployments-framework/engine/test/runtime" + evmstate "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/evm" cldchangesetscommon "github.com/smartcontractkit/cld-changesets/pkg/common" - evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm/legacy" ) func TestDeployLinkToken(t *testing.T) { diff --git a/mcms/operations/firedrill.go b/mcms/operations/firedrill.go index 2e38bc8..263a43b 100644 --- a/mcms/operations/firedrill.go +++ b/mcms/operations/firedrill.go @@ -18,9 +18,9 @@ import ( cldfproposalutils "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils" fwops "github.com/smartcontractkit/chainlink-deployments-framework/operations" - mcmscontract "github.com/smartcontractkit/cld-changesets/mcms/legacy/proposeutils" - evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm/legacy" - solanastate "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" + mcmscontract "github.com/smartcontractkit/cld-changesets/legacy/mcms/proposeutils" + evmstate "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/evm" + solanastate "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" ) // FireDrillInput is JSON-serializable input for the MCMS signing fire-drill proposal operation. diff --git a/mcms/operations/firedrill_test.go b/mcms/operations/firedrill_test.go index 67b3d91..78bcae8 100644 --- a/mcms/operations/firedrill_test.go +++ b/mcms/operations/firedrill_test.go @@ -15,7 +15,7 @@ import ( mcmstypes "github.com/smartcontractkit/mcms/types" "github.com/stretchr/testify/require" - evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm/legacy" + evmstate "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/evm" ) func testFireDrillEnv(t *testing.T, chains cldf_chain.BlockChains) cldf.Environment { diff --git a/mcms/operations/grant_role_timelock.go b/mcms/operations/grant_role_timelock.go index 6410eca..0d46f30 100644 --- a/mcms/operations/grant_role_timelock.go +++ b/mcms/operations/grant_role_timelock.go @@ -15,8 +15,8 @@ import ( cldfsolana "github.com/smartcontractkit/chainlink-deployments-framework/chain/solana" fwops "github.com/smartcontractkit/chainlink-deployments-framework/operations" + solanastate "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" pdasol "github.com/smartcontractkit/cld-changesets/pkg/family/solana" - solanastate "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" ) type OpSolanaGrantRoleTimelockDeps struct { diff --git a/common/changeset/run_changeset.go b/pkg/common/changeset/run_changeset.go similarity index 100% rename from common/changeset/run_changeset.go rename to pkg/common/changeset/run_changeset.go diff --git a/pkg/common/changeset/test_helpers.go b/pkg/common/changeset/test_helpers.go index fd7ef41..15223b5 100644 --- a/pkg/common/changeset/test_helpers.go +++ b/pkg/common/changeset/test_helpers.go @@ -10,10 +10,10 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" - evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm/legacy" - cldftesthelpers "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils/testhelpers" + evmstate "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/evm" + "github.com/smartcontractkit/chainlink-evm/pkg/utils" cldf_evm "github.com/smartcontractkit/chainlink-deployments-framework/chain/evm" diff --git a/common/changeset/token_approve.go b/pkg/common/changeset/token_approve.go similarity index 100% rename from common/changeset/token_approve.go rename to pkg/common/changeset/token_approve.go diff --git a/common/changeset/token_approve_test.go b/pkg/common/changeset/token_approve_test.go similarity index 100% rename from common/changeset/token_approve_test.go rename to pkg/common/changeset/token_approve_test.go diff --git a/pkg/family/evm/operations/utils.go b/pkg/family/evm/operations/utils.go index 7c1fd0f..5e7cfb8 100644 --- a/pkg/family/evm/operations/utils.go +++ b/pkg/family/evm/operations/utils.go @@ -16,9 +16,6 @@ import ( "github.com/zksync-sdk/zksync2-go/accounts" "github.com/zksync-sdk/zksync2-go/clients" - mcmspropose "github.com/smartcontractkit/cld-changesets/mcms/legacy/proposeutils" - evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm/legacy" - mcmslib "github.com/smartcontractkit/mcms" mcmssdk "github.com/smartcontractkit/mcms/sdk" mcmstypes "github.com/smartcontractkit/mcms/types" @@ -27,6 +24,9 @@ import ( cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" cldfproposalutils "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils" "github.com/smartcontractkit/chainlink-deployments-framework/operations" + + mcmspropose "github.com/smartcontractkit/cld-changesets/legacy/mcms/proposeutils" + evmstate "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/evm" ) // EVMCallInput is the input structure for an EVM call operation. diff --git a/pkg/family/evm/operations/utils_test.go b/pkg/family/evm/operations/utils_test.go index 149612f..7e1257b 100644 --- a/pkg/family/evm/operations/utils_test.go +++ b/pkg/family/evm/operations/utils_test.go @@ -16,8 +16,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - mcmschangesets "github.com/smartcontractkit/cld-changesets/mcms/changesets/legacy" - evmstate "github.com/smartcontractkit/cld-changesets/pkg/family/evm/legacy" + mcmschangesets "github.com/smartcontractkit/cld-changesets/legacy/mcms/changesets" + evmstate "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/evm" opsevm "github.com/smartcontractkit/cld-changesets/pkg/family/evm/operations" chain_selectors "github.com/smartcontractkit/chain-selectors" diff --git a/pkg/family/solana/mcms_pda.go b/pkg/family/solana/mcms_pda.go index ec04ad1..7ac65dd 100644 --- a/pkg/family/solana/mcms_pda.go +++ b/pkg/family/solana/mcms_pda.go @@ -3,7 +3,7 @@ package solana import ( "github.com/gagliardetto/solana-go" - "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" + solana2 "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" ) const ( @@ -16,37 +16,37 @@ const ( ) // GetMCMSignerPDA returns the PDA for the MCMS signer -func GetMCMSignerPDA(programID solana.PublicKey, seed legacy.PDASeed) solana.PublicKey { +func GetMCMSignerPDA(programID solana.PublicKey, seed solana2.PDASeed) solana.PublicKey { seeds := [][]byte{[]byte(pdaPrefixMultisigSigner), seed[:]} return getPDA(programID, seeds) } // GetMCMConfigPDA returns the PDA for the MCMS config -func GetMCMConfigPDA(programID solana.PublicKey, seed legacy.PDASeed) solana.PublicKey { +func GetMCMConfigPDA(programID solana.PublicKey, seed solana2.PDASeed) solana.PublicKey { seeds := [][]byte{[]byte(pdaPrefixMultisigConfig), seed[:]} return getPDA(programID, seeds) } // GetMCMRootMetadataPDA returns the PDA for the MCMS root metadata -func GetMCMRootMetadataPDA(programID solana.PublicKey, seed legacy.PDASeed) solana.PublicKey { +func GetMCMRootMetadataPDA(programID solana.PublicKey, seed solana2.PDASeed) solana.PublicKey { seeds := [][]byte{[]byte(pdaPrefixRootMetadata), seed[:]} return getPDA(programID, seeds) } // GetMCMExpiringRootAndOpCountPDA returns the PDA for the MCMS expiring root and op count -func GetMCMExpiringRootAndOpCountPDA(programID solana.PublicKey, seed legacy.PDASeed) solana.PublicKey { +func GetMCMExpiringRootAndOpCountPDA(programID solana.PublicKey, seed solana2.PDASeed) solana.PublicKey { seeds := [][]byte{[]byte(pdaPrefixExpiringRootAndOpCount), seed[:]} return getPDA(programID, seeds) } // GetTimelockConfigPDA returns the PDA for the Timelock config -func GetTimelockConfigPDA(programID solana.PublicKey, seed legacy.PDASeed) solana.PublicKey { +func GetTimelockConfigPDA(programID solana.PublicKey, seed solana2.PDASeed) solana.PublicKey { seeds := [][]byte{[]byte(pdaPrefixTimelockConfig), seed[:]} return getPDA(programID, seeds) } // GetTimelockSignerPDA returns the PDA for the Timelock signer -func GetTimelockSignerPDA(programID solana.PublicKey, seed legacy.PDASeed) solana.PublicKey { +func GetTimelockSignerPDA(programID solana.PublicKey, seed solana2.PDASeed) solana.PublicKey { seeds := [][]byte{[]byte(pdaPrefixTimelockSigner), seed[:]} return getPDA(programID, seeds) } diff --git a/pkg/family/solana/mcms_pda_test.go b/pkg/family/solana/mcms_pda_test.go index 0166ed0..5ce7b55 100644 --- a/pkg/family/solana/mcms_pda_test.go +++ b/pkg/family/solana/mcms_pda_test.go @@ -6,7 +6,7 @@ import ( "github.com/gagliardetto/solana-go" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" + solana2 "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" ) func TestMCMSPDA(t *testing.T) { @@ -17,7 +17,7 @@ func TestMCMSPDA(t *testing.T) { tests := []struct { name string prefix string - fn func(programID solana.PublicKey, seed legacy.PDASeed) solana.PublicKey + fn func(programID solana.PublicKey, seed solana2.PDASeed) solana.PublicKey }{ {name: "GetMCMSignerPDA", prefix: pdaPrefixMultisigSigner, fn: GetMCMSignerPDA}, {name: "GetMCMConfigPDA", prefix: pdaPrefixMultisigConfig, fn: GetMCMConfigPDA}, @@ -67,9 +67,9 @@ func mustFindPDA(t *testing.T, seeds [][]byte, programID solana.PublicKey) solan return pda } -func testPDASeed(t *testing.T) legacy.PDASeed { +func testPDASeed(t *testing.T) solana2.PDASeed { t.Helper() - var s legacy.PDASeed + var s solana2.PDASeed for i := range s { s[i] = byte(i + 1) } diff --git a/pkg/family/solana/operations/operation.go b/pkg/family/solana/operations/operation.go index 6298ab8..b45b4e1 100644 --- a/pkg/family/solana/operations/operation.go +++ b/pkg/family/solana/operations/operation.go @@ -22,14 +22,14 @@ import ( cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink-deployments-framework/operations" + solana2 "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" cldchangesetscommon "github.com/smartcontractkit/cld-changesets/pkg/common" familysolana "github.com/smartcontractkit/cld-changesets/pkg/family/solana" - "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" ) type Deps struct { Env cldf.Environment - State *legacy.MCMSWithTimelockState + State *solana2.MCMSWithTimelockState Datastore datastore.MutableDataStore Chain cldfsol.Chain } @@ -166,7 +166,7 @@ func initAccessController(b operations.Bundle, deps Deps, in InitAccessControlle "account", account.PublicKey(), ) - err = deps.State.SetState(in.ContractType, account.PublicKey(), legacy.PDASeed{}) + err = deps.State.SetState(in.ContractType, account.PublicKey(), solana2.PDASeed{}) if err != nil { return out, fmt.Errorf("failed to save onchain state: %w", err) } @@ -240,7 +240,7 @@ func initMCM(b operations.Bundle, deps Deps, in InitMCMInput) (InitMCMOutput, er return out, fmt.Errorf("failed to get mcm state: %w", err) } - if mcmSeed != (legacy.PDASeed{}) { + if mcmSeed != (solana2.PDASeed{}) { mcmConfigPDA := familysolana.GetMCMConfigPDA(mcmProgram, mcmSeed) var data mcmBindings.MultisigConfig err = solanaUtils.GetAccountDataBorshInto(b.GetContext(), deps.Chain.Client, mcmConfigPDA, rpc.CommitmentConfirmed, &data) @@ -268,7 +268,7 @@ func initMCM(b operations.Bundle, deps Deps, in InitMCMInput) (InitMCMOutput, er return out, fmt.Errorf("failed to initialize mcm: %w", err) } - mcmAddress := legacy.EncodeAddressWithSeed(programID, seed) + mcmAddress := solana2.EncodeAddressWithSeed(programID, seed) configurer := mcmsSolanaSdk.NewConfigurer(deps.Chain.Client, *deps.Chain.DeployerKey, mcmsTypes.ChainSelector(deps.Chain.ChainSelector())) tx, err := configurer.SetConfig(b.GetContext(), mcmAddress, &in.MCMConfig, false) @@ -299,7 +299,7 @@ func initMCM(b operations.Bundle, deps Deps, in InitMCMInput) (InitMCMOutput, er return out, nil } -func initializeMCM(b operations.Bundle, deps Deps, mcmProgram solana.PublicKey, multisigID legacy.PDASeed) error { +func initializeMCM(b operations.Bundle, deps Deps, mcmProgram solana.PublicKey, multisigID solana2.PDASeed) error { var mcmConfig mcmBindings.MultisigConfig err := deps.Chain.GetAccountDataBorshInto(b.GetContext(), familysolana.GetMCMConfigPDA(mcmProgram, multisigID), &mcmConfig) if err == nil { @@ -360,7 +360,7 @@ func initTimelock(b operations.Bundle, deps Deps, in InitTimelockInput) (InitTim return out, fmt.Errorf("failed to get timelock state: %w", err) } - if (timelockSeed != legacy.PDASeed{}) { + if (timelockSeed != solana2.PDASeed{}) { timelockConfigPDA := familysolana.GetTimelockConfigPDA(timelockProgram, timelockSeed) var timelockConfig timelockBindings.Config err = deps.Chain.GetAccountDataBorshInto(b.GetContext(), timelockConfigPDA, &timelockConfig) @@ -389,7 +389,7 @@ func initTimelock(b operations.Bundle, deps Deps, in InitTimelockInput) (InitTim return out, fmt.Errorf("failed to initialize timelock: %w", err) } - timelockAddress := legacy.EncodeAddressWithSeed(programID, seed) + timelockAddress := solana2.EncodeAddressWithSeed(programID, seed) err = deps.Datastore.Addresses().Add(datastore.AddressRef{ Address: timelockAddress, @@ -409,7 +409,7 @@ func initTimelock(b operations.Bundle, deps Deps, in InitTimelockInput) (InitTim } func initializeTimelock(b operations.Bundle, deps Deps, timelockProgram solana.PublicKey, - timelockID legacy.PDASeed, minDelay *big.Int) error { + timelockID solana2.PDASeed, minDelay *big.Int) error { if minDelay == nil { minDelay = big.NewInt(0) } @@ -488,14 +488,14 @@ func addAccess(b operations.Bundle, deps Deps, in AddAccessInput) (AddAccessOutp return out, nil } -func randomSeed() (legacy.PDASeed, error) { +func randomSeed() (solana2.PDASeed, error) { const alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - seed := legacy.PDASeed{} + seed := solana2.PDASeed{} for i := range seed { n, err := rand.Int(rand.Reader, big.NewInt(int64(len(alphabet)))) if err != nil { - return legacy.PDASeed{}, fmt.Errorf("failed to generate random seed byte: %w", err) + return solana2.PDASeed{}, fmt.Errorf("failed to generate random seed byte: %w", err) } seed[i] = alphabet[n.Int64()] } diff --git a/pkg/family/solana/sequences/sequence.go b/pkg/family/solana/sequences/sequence.go index b5008f6..f562290 100644 --- a/pkg/family/solana/sequences/sequence.go +++ b/pkg/family/solana/sequences/sequence.go @@ -16,10 +16,10 @@ import ( cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" "github.com/smartcontractkit/chainlink-deployments-framework/operations" + solana2 "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana" + "github.com/smartcontractkit/cld-changesets/legacy/pkg/family/solana/solutils" cldchangesetscommon "github.com/smartcontractkit/cld-changesets/pkg/common" familysolana "github.com/smartcontractkit/cld-changesets/pkg/family/solana" - "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy" - "github.com/smartcontractkit/cld-changesets/pkg/family/solana/legacy/solutils" solops "github.com/smartcontractkit/cld-changesets/pkg/family/solana/operations" ) @@ -122,7 +122,7 @@ func deployAccessController(b operations.Bundle, deps solops.Deps) error { return fmt.Errorf("failed to add access controller to datastore: %w", err) } - err = deps.State.SetState(mcmscontracts.AccessControllerProgram, programID, legacy.PDASeed{}) + err = deps.State.SetState(mcmscontracts.AccessControllerProgram, programID, solana2.PDASeed{}) if err != nil { return fmt.Errorf("failed to save onchain state: %w", err) } @@ -185,7 +185,7 @@ func deployMCM(b operations.Bundle, deps solops.Deps) error { return fmt.Errorf("failed to add mcm to datastore: %w", err) } - err = deps.State.SetState(mcmscontracts.ManyChainMultisigProgram, programID, legacy.PDASeed{}) + err = deps.State.SetState(mcmscontracts.ManyChainMultisigProgram, programID, solana2.PDASeed{}) if err != nil { return fmt.Errorf("failed to save onchain state: %w", err) } @@ -264,7 +264,7 @@ func deployTimelock(b operations.Bundle, deps solops.Deps) error { return fmt.Errorf("failed to add timelock to datastore: %w", err) } - err = deps.State.SetState(mcmscontracts.RBACTimelockProgram, programID, legacy.PDASeed{}) + err = deps.State.SetState(mcmscontracts.RBACTimelockProgram, programID, solana2.PDASeed{}) if err != nil { return fmt.Errorf("failed to save onchain state: %w", err) }