Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package legacy
package changesets

import (
"context"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand All @@ -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.
Expand All @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//nolint:testifylint // inverting want and got is more succinct
package legacy_test
package changesets_test

import (
"context"
Expand All @@ -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"
Expand Down Expand Up @@ -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}),
Expand Down Expand Up @@ -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 ---

Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand All @@ -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 ---
Expand All @@ -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()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package legacy
package changesets

import (
"errors"
Expand All @@ -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{}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package legacy
package changesets

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Package changesets provides reusable MCMS changesets.
package legacy
package changesets

import (
"errors"
Expand All @@ -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{}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package legacy
package changesets

import (
"context"
Expand All @@ -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) {
Expand Down Expand Up @@ -228,49 +228,49 @@ 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,
)))

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,
)))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package legacy
package changesets

import (
"errors"
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package legacy
package changesets

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package legacy
package aptos

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package legacy
package aptos

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package legacy
package evm

import (
"github.com/ethereum/go-ethereum/accounts/abi/bind"
Expand Down
Loading
Loading