Skip to content
Draft
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: 4 additions & 2 deletions chainwrappers/chainaccessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import (
"github.com/block-vision/sui-go-sdk/sui"
sol "github.com/gagliardetto/solana-go"
solrpc "github.com/gagliardetto/solana-go/rpc"
cldfcanton "github.com/smartcontractkit/chainlink-deployments-framework/chain/canton"
"github.com/xssnick/tonutils-go/ton"
tonwallet "github.com/xssnick/tonutils-go/ton/wallet"

evmsdk "github.com/smartcontractkit/mcms/sdk/evm"
suisuisdk "github.com/smartcontractkit/mcms/sdk/sui"
suisdk "github.com/smartcontractkit/mcms/sdk/sui"
)

type ChainAccessor interface {
Expand All @@ -21,7 +22,8 @@ type ChainAccessor interface {
AptosClient(selector uint64) (aptoslib.AptosRpcClient, bool)
AptosSigner(selector uint64) (aptoslib.TransactionSigner, bool)
SuiClient(selector uint64) (sui.ISuiAPI, bool)
SuiSigner(selector uint64) (suisuisdk.SuiSigner, bool)
SuiSigner(selector uint64) (suisdk.SuiSigner, bool)
TonClient(selector uint64) (ton.APIClientWrapped, bool)
TonSigner(selector uint64) (*tonwallet.Wallet, bool)
CantonChain(selector uint64) (cldfcanton.Chain, bool)
}
3 changes: 3 additions & 0 deletions chainwrappers/converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/smartcontractkit/mcms/sdk"
"github.com/smartcontractkit/mcms/sdk/aptos"
"github.com/smartcontractkit/mcms/sdk/canton"
"github.com/smartcontractkit/mcms/sdk/evm"
"github.com/smartcontractkit/mcms/sdk/solana"
"github.com/smartcontractkit/mcms/sdk/sui"
Expand Down Expand Up @@ -51,6 +52,8 @@ func BuildConverter(selector types.ChainSelector, metadata types.ChainMetadata)
converter, _ = sui.NewTimelockConverter()
case chainsel.FamilyTon:
converter = ton.NewTimelockConverter(ton.DefaultSendAmount)
case chainsel.FamilyCanton:
converter = canton.NewTimelockConverter()
default:
return nil, fmt.Errorf("unsupported chain family %s", fam)
}
Expand Down
2 changes: 0 additions & 2 deletions chainwrappers/executors.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ func BuildExecutors(
action types.TimelockAction,
) (map[types.ChainSelector]sdk.Executor, error) {
executors := map[types.ChainSelector]sdk.Executor{}

for chainSelector, metadata := range chainMetadata {
encoder, ok := encoders[chainSelector]
if !ok {
return nil, fmt.Errorf("missing encoder for chain selector %d", chainSelector)
}

executor, err := BuildExecutor(chains, chainSelector, encoder, action, metadata)
if err != nil {
return nil, err
Expand Down
19 changes: 19 additions & 0 deletions chainwrappers/inspectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/smartcontractkit/mcms/sdk"
"github.com/smartcontractkit/mcms/sdk/aptos"
cantonsdk "github.com/smartcontractkit/mcms/sdk/canton"
"github.com/smartcontractkit/mcms/sdk/evm"
"github.com/smartcontractkit/mcms/sdk/solana"
"github.com/smartcontractkit/mcms/sdk/sui"
Expand Down Expand Up @@ -50,6 +51,13 @@ func BuildInspector(

rawSelector := uint64(selector)
switch family {
case chainsel.FamilyCanton:
ch, ok := chains.CantonChain(rawSelector)
if !ok || len(ch.Participants) == 0 {
return nil, fmt.Errorf("missing Canton chain participant for selector %d", rawSelector)
}
participant := ch.Participants[0]
return cantonsdk.NewInspector(participant.LedgerServices.State, participant.PartyID, cantonRole(action)), nil
case chainsel.FamilyEVM:
client, ok := chains.EVMClient(rawSelector)
if !ok {
Expand Down Expand Up @@ -107,3 +115,14 @@ func BuildInspector(
return nil, fmt.Errorf("unsupported chain family %s", family)
}
}

func cantonRole(action types.TimelockAction) cantonsdk.TimelockRole {
switch action {
case types.TimelockActionBypass:
return cantonsdk.TimelockRoleBypasser
case types.TimelockActionCancel:
return cantonsdk.TimelockRoleCanceller
default:
return cantonsdk.TimelockRoleProposer
}
}
58 changes: 58 additions & 0 deletions chainwrappers/mocks/chain_accessor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion chainwrappers/timelock_executors.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func BuildTimelockExecutors(
action types.TimelockAction,
) (map[types.ChainSelector]sdk.TimelockExecutor, error) {
executors := map[types.ChainSelector]sdk.TimelockExecutor{}

for chainSelector, metadata := range chainMetadata {
executor, err := BuildTimelockExecutor(chains, chainSelector, action, metadata)
if err != nil {
Expand Down
10 changes: 10 additions & 0 deletions e2e/config.canton.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[settings]
private_keys = [
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
"0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a"
]

[canton_config]
type = "canton"
number_of_canton_validators = 1
Loading
Loading