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
24 changes: 14 additions & 10 deletions docs/docs/usage/building-proposals.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ object.
package main

import (
"log"
"os"
"io"
"io"
"log"
"os"

"github.com/smartcontractkit/mcms"




"github.com/smartcontractkit/mcms"
)

func main() {
Expand All @@ -49,17 +53,17 @@ For the JSON structure of the proposal please check the [MCMS Proposal Format Do

### Build Proposal Given Staged but Non-Executed Predecessor Proposals

In scenarios where a proposal is generated with the assumption that multiple proposals are executed beforehand,
In scenarios where a proposal is generated with the assumption that multiple proposals are executed beforehand,
you can enable proposals to be signed in parallel with a pre-determined execution order. This can be achieved
by passing a list of files using the `WithPredecessors` functional option, as shown below:

```go
package main

import (
"io"
"log"
"os"
"io"

"github.com/smartcontractkit/mcms"
)
Expand Down Expand Up @@ -102,7 +106,7 @@ package main
import (
"log"

chain_selectors "github.com/smartcontractkit/chain-selectors"
chainsel "github.com/smartcontractkit/chain-selectors"

"github.com/smartcontractkit/mcms"
"github.com/smartcontractkit/mcms/types"
Expand All @@ -111,7 +115,7 @@ import (
func main() {
// Step 1: Initialize the ProposalBuilder
timelockBuilder := mcms.NewProposalBuilder()
selector := types.ChainSelector(chain_selectors.ETHEREUM_TESTNET_SEPOLIA.Selector)
selector := types.ChainSelector(chainsel.ETHEREUM_TESTNET_SEPOLIA.Selector)

// Step 2: Set Proposal Details
timelockBuilder.
Expand Down Expand Up @@ -198,7 +202,7 @@ package main
import (
"log"

chain_selectors "github.com/smartcontractkit/chain-selectors"
chainsel "github.com/smartcontractkit/chain-selectors"

"github.com/smartcontractkit/mcms"
"github.com/smartcontractkit/mcms/types"
Expand All @@ -207,7 +211,7 @@ import (
func main() {
// Step 1: Initialize the ProposalBuilder
builder := mcms.NewTimelockProposalBuilder()
selector := types.ChainSelector(chain_selectors.ETHEREUM_TESTNET_SEPOLIA.Selector)
selector := types.ChainSelector(chainsel.ETHEREUM_TESTNET_SEPOLIA.Selector)

delay, err := types.ParseDuration("1h")
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/usage/executing-proposals.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/gagliardetto/solana-go"
"github.com/gagliardetto/solana-go/rpc"
chain_selectors "github.com/smartcontractkit/chain-selectors"
chainsel "github.com/smartcontractkit/chain-selectors"

"github.com/smartcontractkit/mcms"
"github.com/smartcontractkit/mcms/sdk"
Expand All @@ -38,8 +38,8 @@ func main() {
}

// Step 2: Initialize the Chain Family Executors
evmSelector := chain_selectors.ETHEREUM_TESTNET_SEPOLIA.Selector
solanaSelector := chain_selectors.SOLANA_DEVNET.Selector
evmSelector := chainsel.ETHEREUM_TESTNET_SEPOLIA.Selector
solanaSelector := chainsel.SOLANA_DEVNET.Selector

// EVM executor
backend := backends.SimulatedBackend{}
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/usage/set-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/gagliardetto/solana-go"
rpc2 "github.com/gagliardetto/solana-go/rpc"
chain_selectors "github.com/smartcontractkit/chain-selectors"
chainsel "github.com/smartcontractkit/chain-selectors"

"github.com/smartcontractkit/mcms/sdk/evm"
mcmsSolana "github.com/smartcontractkit/mcms/sdk/solana"
Expand Down Expand Up @@ -45,7 +45,7 @@ func main() {
ctx := context.Background()

// On EVM
solanaSelector := chain_selectors.SOLANA_DEVNET.Selector
solanaSelector := chainsel.SOLANA_DEVNET.Selector
mcmsContractAddr := "0x123"
backend := backends.SimulatedBackend{}
auth := &bind.TransactOpts{}
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/usage/signing-proposals.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/gagliardetto/solana-go/rpc"
chain_selectors "github.com/smartcontractkit/chain-selectors"
chainsel "github.com/smartcontractkit/chain-selectors"

"github.com/smartcontractkit/mcms"
"github.com/smartcontractkit/mcms/sdk"
Expand All @@ -36,7 +36,7 @@ func main() {
}

// 2. Create the signable type from the proposal
selector := chain_selectors.ETHEREUM_TESTNET_SEPOLIA.Selector
selector := chainsel.ETHEREUM_TESTNET_SEPOLIA.Selector

// if evm required: Add EVM Inspector
backend := backends.SimulatedBackend{}
Expand All @@ -45,7 +45,7 @@ func main() {

// if solana required: Add Solana Inspector
client := rpc.New("https://api.devnet.solana.com")
inspectorsMap[types.ChainSelector(chain_selectors.SOLANA_DEVNET.Selector)] = solana.NewInspector(client)
inspectorsMap[types.ChainSelector(chainsel.SOLANA_DEVNET.Selector)] = solana.NewInspector(client)

// Create Signable
signable, err := mcms.NewSignable(proposal, inspectorsMap)
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/usage/timelock-proposal-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
rpc2 "github.com/gagliardetto/solana-go/rpc"
chain_selectors "github.com/smartcontractkit/chain-selectors"
chainsel "github.com/smartcontractkit/chain-selectors"

"github.com/smartcontractkit/mcms"
"github.com/smartcontractkit/mcms/sdk"
Expand All @@ -52,8 +52,8 @@ func main() {
}

// 1.1 Convert to MCMS proposal
selectorEVM := types.ChainSelector(chain_selectors.ETHEREUM_TESTNET_SEPOLIA.Selector)
selectorSolana := types.ChainSelector(chain_selectors.SOLANA_DEVNET.Selector)
selectorEVM := types.ChainSelector(chainsel.ETHEREUM_TESTNET_SEPOLIA.Selector)
selectorSolana := types.ChainSelector(chainsel.SOLANA_DEVNET.Selector)

convertersMap := make(map[types.ChainSelector]sdk.TimelockConverter)
convertersMap[selectorEVM] = &evm.TimelockConverter{}
Expand Down
6 changes: 3 additions & 3 deletions e2e/ledger/ledger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/stretchr/testify/suite"

cselectors "github.com/smartcontractkit/chain-selectors"
chainselremote "github.com/smartcontractkit/chain-selectors/remote"

"github.com/smartcontractkit/mcms"
e2e "github.com/smartcontractkit/mcms/e2e/tests"
Expand Down Expand Up @@ -151,9 +151,9 @@ func (s *ManualLedgerSigningTestSuite) TestManualLedgerSigning() {
ctx := context.Background()
s.TestSetup = *e2e.InitializeSharedTestSetup(s.T())

chainDetailsEVM, err := cselectors.GetChainDetailsByChainIDAndFamily(s.BlockchainA.Out.ChainID, s.BlockchainA.Out.Family)
chainDetailsEVM, err := chainselremote.GetChainDetailsByChainIDAndFamily(s.T().Context(), s.BlockchainA.Out.ChainID, s.BlockchainA.Out.Family)
s.Require().NoError(err)
chainDetailsSolana, err := cselectors.GetChainDetailsByChainIDAndFamily(s.SolanaChain.ChainID, s.SolanaChain.Out.Family)
chainDetailsSolana, err := chainselremote.GetChainDetailsByChainIDAndFamily(s.T().Context(), s.SolanaChain.ChainID, s.SolanaChain.Out.Family)
s.Require().NoError(err)

s.chainSelectorEVM = types.ChainSelector(chainDetailsEVM.ChainSelector)
Expand Down
5 changes: 3 additions & 2 deletions e2e/tests/aptos/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (

"github.com/stretchr/testify/suite"

cselectors "github.com/smartcontractkit/chain-selectors"
chainsel "github.com/smartcontractkit/chain-selectors"
chainselremote "github.com/smartcontractkit/chain-selectors/remote"

"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"

Expand All @@ -34,7 +35,7 @@ type TestSuite struct {

func (a *TestSuite) SetupSuite() {
a.TestSetup = *e2e.InitializeSharedTestSetup(a.T())
details, err := cselectors.GetChainDetailsByChainIDAndFamily(a.AptosChain.ChainID, cselectors.FamilyAptos)
details, err := chainselremote.GetChainDetailsByChainIDAndFamily(a.T().Context(), a.AptosChain.ChainID, chainsel.FamilyAptos)
a.Require().NoError(err)
a.ChainSelector = types.ChainSelector(details.ChainSelector)

Expand Down
6 changes: 3 additions & 3 deletions e2e/tests/evm/executable.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/samber/lo"
"github.com/stretchr/testify/suite"

cselectors "github.com/smartcontractkit/chain-selectors"
chainselremote "github.com/smartcontractkit/chain-selectors/remote"

"github.com/smartcontractkit/mcms"
e2e "github.com/smartcontractkit/mcms/e2e/tests"
Expand Down Expand Up @@ -76,7 +76,7 @@ func (s *ExecutionTestSuite) SetupSuite() {
s.ChainA.auth, err = bind.NewKeyedTransactorWithChainID(privateKey, chainIDA)
s.Require().NoError(err, "Failed to create transactor for Chain A")

chainDetailsA, err := cselectors.GetChainDetailsByChainIDAndFamily(s.BlockchainA.Out.ChainID, s.BlockchainA.Out.Family)
chainDetailsA, err := chainselremote.GetChainDetailsByChainIDAndFamily(s.T().Context(), s.BlockchainA.Out.ChainID, s.BlockchainA.Out.Family)
s.Require().NoError(err)
s.ChainA.chainSelector = mcmtypes.ChainSelector(chainDetailsA.ChainSelector)

Expand All @@ -87,7 +87,7 @@ func (s *ExecutionTestSuite) SetupSuite() {
s.ChainB.auth, err = bind.NewKeyedTransactorWithChainID(privateKey, chainIDB)
s.Require().NoError(err, "Failed to create transactor for Chain B")

chainDetailsB, err := cselectors.GetChainDetailsByChainIDAndFamily(s.BlockchainB.Out.ChainID, s.BlockchainB.Out.Family)
chainDetailsB, err := chainselremote.GetChainDetailsByChainIDAndFamily(s.T().Context(), s.BlockchainB.Out.ChainID, s.BlockchainB.Out.Family)
s.Require().NoError(err)
s.ChainB.chainSelector = mcmtypes.ChainSelector(chainDetailsB.ChainSelector)

Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/evm/set_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/stretchr/testify/suite"

cselectors "github.com/smartcontractkit/chain-selectors"
chainselremote "github.com/smartcontractkit/chain-selectors/remote"

"github.com/smartcontractkit/mcms"
e2e "github.com/smartcontractkit/mcms/e2e/tests"
Expand Down Expand Up @@ -61,7 +61,7 @@ func (s *SetRootTestSuite) SetupSuite() {

s.mcmsContract = s.deployMCMSContract()
s.timelockContract = s.deployTimelockContract(s.mcmsContract.Address().String())
chainDetails, err := cselectors.GetChainDetailsByChainIDAndFamily(s.BlockchainA.Out.ChainID, s.BlockchainA.Out.Family)
chainDetails, err := chainselremote.GetChainDetailsByChainIDAndFamily(s.T().Context(), s.BlockchainA.Out.ChainID, s.BlockchainA.Out.Family)
s.Require().NoError(err)
s.chainSelector = mcmtypes.ChainSelector(chainDetails.ChainSelector)
}
Expand Down
5 changes: 3 additions & 2 deletions e2e/tests/solana/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"

cselectors "github.com/smartcontractkit/chain-selectors"
chainsel "github.com/smartcontractkit/chain-selectors"
chainselremote "github.com/smartcontractkit/chain-selectors/remote"

"go.uber.org/zap"

Expand Down Expand Up @@ -123,7 +124,7 @@ func (s *TestSuite) SetupSuite() {
s.AccessControllerProgramID = solana.MustPublicKeyFromBase58(s.SolanaChain.SolanaPrograms["access_controller"])
s.CPIStubProgramID = solana.MustPublicKeyFromBase58(s.SolanaChain.SolanaPrograms["external_program_cpi_stub"])

details, err := cselectors.GetChainDetailsByChainIDAndFamily(s.SolanaChain.ChainID, cselectors.FamilySolana)
details, err := chainselremote.GetChainDetailsByChainIDAndFamily(s.T().Context(), s.SolanaChain.ChainID, chainsel.FamilySolana)
s.Require().NoError(err)
s.ChainSelector = types.ChainSelector(details.ChainSelector)
}
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/sui/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/block-vision/sui-go-sdk/transaction"
"github.com/stretchr/testify/suite"

cselectors "github.com/smartcontractkit/chain-selectors"
chainsel "github.com/smartcontractkit/chain-selectors"

"github.com/smartcontractkit/chainlink-sui/bindings/bind"
modulemcms "github.com/smartcontractkit/chainlink-sui/bindings/generated/mcms/mcms"
Expand Down Expand Up @@ -77,7 +77,7 @@ func (s *TestSuite) SetupSuite() {
s.client = s.SuiClient
// TODO: Find funded accounts
s.signer = testSigner
s.chainSelector = types.ChainSelector(cselectors.SUI_TESTNET.Selector)
s.chainSelector = types.ChainSelector(chainsel.SUI_TESTNET.Selector)
}

func (s *TestSuite) DeployMCMSContract() {
Expand Down
9 changes: 5 additions & 4 deletions e2e/tests/ton/executable.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (

"github.com/stretchr/testify/suite"

cselectors "github.com/smartcontractkit/chain-selectors"
chainsel "github.com/smartcontractkit/chain-selectors"
chainselremote "github.com/smartcontractkit/chain-selectors/remote"

"github.com/xssnick/tonutils-go/address"
"github.com/xssnick/tonutils-go/tlb"
Expand Down Expand Up @@ -72,12 +73,12 @@ func (s *ExecutionTestSuite) SetupSuite() {
s.signers = testutils.MakeNewECDSASigners(2)

// Initialize chains
details, err := cselectors.GetChainDetailsByChainIDAndFamily(s.TonBlockchain.ChainID, s.TonBlockchain.Family)
details, err := chainselremote.GetChainDetailsByChainIDAndFamily(s.T().Context(), s.TonBlockchain.ChainID, s.TonBlockchain.Family)
s.Require().NoError(err)
s.ChainA = types.ChainSelector(details.ChainSelector)

s.ChainB = types.ChainSelector(cselectors.GETH_TESTNET.Selector)
s.ChainC = types.ChainSelector(cselectors.GETH_DEVNET_2.Selector)
s.ChainB = types.ChainSelector(chainsel.GETH_TESTNET.Selector)
s.ChainC = types.ChainSelector(chainsel.GETH_DEVNET_2.Selector)

// Deploy contracts on chain A (the one we execute on)
s.deployMCMSContract(hash.CRC32("test.executable.mcms"))
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/ton/set_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/stretchr/testify/suite"

cselectors "github.com/smartcontractkit/chain-selectors"
chainselremote "github.com/smartcontractkit/chain-selectors/remote"

"github.com/smartcontractkit/chainlink-ton/pkg/bindings/mcms/mcms"
"github.com/smartcontractkit/chainlink-ton/pkg/ton/hash"
Expand Down Expand Up @@ -69,7 +69,7 @@ func (s *SetRootTestSuite) SetupSuite() {

s.deployMCMSContract()

chainDetails, err := cselectors.GetChainDetailsByChainIDAndFamily(s.TonBlockchain.ChainID, s.TonBlockchain.Family)
chainDetails, err := chainselremote.GetChainDetailsByChainIDAndFamily(s.T().Context(), s.TonBlockchain.ChainID, s.TonBlockchain.Family)
s.Require().NoError(err)
s.chainSelector = types.ChainSelector(chainDetails.ChainSelector)
}
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/ton/timelock_inspection.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

"github.com/ethereum/go-ethereum/common"

cselectors "github.com/smartcontractkit/chain-selectors"
chainsel "github.com/smartcontractkit/chain-selectors"

"github.com/xssnick/tonutils-go/address"
"github.com/xssnick/tonutils-go/tlb"
Expand Down Expand Up @@ -381,7 +381,7 @@ func (s *TimelockInspectionTestSuite) TestIsOperationDone() {
s.Require().NoError(err, "Failed to create TimelockExecutor")

bop := types.BatchOperation{
ChainSelector: types.ChainSelector(cselectors.TON_LOCALNET.Selector),
ChainSelector: types.ChainSelector(chainsel.TON_LOCALNET.Selector),
Transactions: []types.Transaction{
{
To: counterAddr.String(),
Expand Down
6 changes: 3 additions & 3 deletions executable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"math/big"
"testing"

cselectors "github.com/smartcontractkit/chain-selectors"
chainsel "github.com/smartcontractkit/chain-selectors"

"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -645,8 +645,8 @@ func TestExecutor_ExecuteE2E_SingleChainMultipleSignerMultipleTX_Success(t *test
func TestExecutable_TxNonce(t *testing.T) {
t.Parallel()

chainSelector1 := types.ChainSelector(cselectors.GETH_TESTNET.Selector)
chainSelector2 := types.ChainSelector(cselectors.GETH_DEVNET_2.Selector)
chainSelector1 := types.ChainSelector(chainsel.GETH_TESTNET.Selector)
chainSelector2 := types.ChainSelector(chainsel.GETH_DEVNET_2.Selector)
executor := mocks.NewExecutor(t)
executors := map[types.ChainSelector]sdk.Executor{
chainSelector1: executor,
Expand Down
Loading
Loading