Skip to content
Open
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
6 changes: 6 additions & 0 deletions deployment/ccip/changeset/cs_orchestrate_changesets.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,19 @@ func orchestrateChangesetsLogic(e cldf.Environment, c OrchestrateChangesetsConfi
return cldf.ChangesetOutput{}, fmt.Errorf("failed to get EVM MCMS state by chain: %w", err)
}

tonMCMSState, err := state.TONMCMSStateByChain(e)
if err != nil {
return cldf.ChangesetOutput{}, fmt.Errorf("failed to get TON MCMS state by chain: %w", err)
}

// Aggregate all Timelock proposals into 1 proposal
proposal, err := proposalutils.AggregateProposalsV2(
e,
proposalutils.MCMSStates{
MCMSEVMState: evmMCMSState,
MCMSSolanaState: state.SolanaMCMSStateByChain(e),
MCMSAptosState: state.AptosMCMSStateByChain(),
MCMSTONState: tonMCMSState,
},
Comment thread
huangzhen1997 marked this conversation as resolved.
finalOutput.MCMSTimelockProposals,
c.Description,
Expand Down
4 changes: 4 additions & 0 deletions deployment/ccip/shared/stateview/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ func (c CCIPOnChainState) AptosMCMSStateByChain() map[uint64]aptos.AccountAddres
return mcmsByChain
}

func (c CCIPOnChainState) TONMCMSStateByChain(e cldf.Environment) (map[uint64]tonstate.MCMSChainState, error) {
return tonstate.LoadMCMSOnChainState(e)
}

func (c CCIPOnChainState) OffRampPermissionLessExecutionThresholdSeconds(ctx context.Context, env cldf.Environment, selector uint64) (uint32, error) {
family, err := chain_selectors.GetSelectorFamily(selector)
if err != nil {
Expand Down
49 changes: 49 additions & 0 deletions deployment/common/proposalutils/propose.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
cldf_adapters "github.com/smartcontractkit/chainlink-deployments-framework/chain/mcms/adapters"
"github.com/smartcontractkit/chainlink-deployments-framework/datastore"
cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment"
tonstate "github.com/smartcontractkit/chainlink-ton/deployment/state"
cldfproposalutils "github.com/smartcontractkit/chainlink-deployments-framework/engine/cld/mcms/proposalutils"

"github.com/smartcontractkit/chainlink/deployment/common/changeset/state"
Expand Down Expand Up @@ -61,6 +62,32 @@ func (tc *TimelockConfig) MCMBasedOnActionSolana(s state.MCMSWithTimelockStateSo
}
}

func (tc *TimelockConfig) MCMBasedOnActionTON(s *tonstate.MCMSSuiteState) (string, error) {
// if MCMSAction is not set, default to timelock.Schedule, this is to ensure no breaking changes for existing code
if tc.MCMSAction == "" {
tc.MCMSAction = types.TimelockActionSchedule
}
switch tc.MCMSAction {
case types.TimelockActionSchedule:
if s.Proposer == nil {
return "", errors.New("missing TON proposer")
}
return s.Proposer.String(), nil
case types.TimelockActionCancel:
if s.Canceller == nil {
return "", errors.New("missing TON canceller")
}
return s.Canceller.String(), nil
case types.TimelockActionBypass:
if s.Bypasser == nil {
return "", errors.New("missing TON bypasser")
}
return s.Bypasser.String(), nil
default:
return "", errors.New("invalid MCMS action")
}
}
Comment on lines +65 to +89

func (tc *TimelockConfig) MCMBasedOnAction(s state.MCMSWithTimelockState) (*gethwrappers.ManyChainMultiSig, error) {
// if MCMSAction is not set, default to timelock.Schedule, this is to ensure no breaking changes for existing code
if tc.MCMSAction == "" {
Expand Down Expand Up @@ -431,6 +458,7 @@ type MCMSStates struct {
MCMSEVMState map[uint64]state.MCMSWithTimelockState
MCMSSolanaState map[uint64]state.MCMSWithTimelockStateSolana
MCMSAptosState map[uint64]aptos.AccountAddress
MCMSTONState map[uint64]tonstate.MCMSChainState
}

// AggregateProposalsV2 aggregates multiple MCMS proposals into a single proposal by combining their operations, and
Expand Down Expand Up @@ -518,6 +546,27 @@ func AggregateProposalsV2(
}
timelocks[chainSel] = aptosMCMSAddress.StringLong()
mcmsPerChain[chainSel] = aptosMCMSAddress.StringLong()
case chain_selectors.FamilyTon:
tonMCMS, exists := mcmsTimelockStates.MCMSTONState[chainSel]
if !exists {
return nil, fmt.Errorf("missing MCMS state for TON chain %d", chainSel)
}
qualifier := mcmsConfig.TimelockQualifierPerChain[chainSel]
// Get the default qualifier suite (or iterate ByQualifier)
suite, ok := tonMCMS.ByQualifier[qualifier] // default qualifier?
if !ok || suite == nil {
return nil, fmt.Errorf("missing TON timelock for chain %d qualifier %q", chainSel, qualifier)
}
if suite.Timelock == nil {
return nil, fmt.Errorf("missing TON timelock address for chain %d", chainSel)
}
timelocks[chainSel] = suite.Timelock.String()
// Select MCMS address based on action
mcmsAddr, err := mcmsConfig.MCMBasedOnActionTON(suite)
if err != nil {
return nil, err
}
mcmsPerChain[chainSel] = mcmsAddr
Comment on lines +550 to +569
}
}

Expand Down
Loading