Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solana support #15428

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
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
48 changes: 24 additions & 24 deletions deployment/ccip/changeset/accept_ownership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func Test_NewAcceptOwnershipChangeset(t *testing.T) {
dest := allChains[1]

timelocks := map[uint64]*gethwrappers.RBACTimelock{
source: state.Chains[source].Timelock,
dest: state.Chains[dest].Timelock,
source: state.EVMState.Chains[source].Timelock,
dest: state.EVMState.Chains[dest].Timelock,
}

// at this point we have the initial deploys done, now we need to transfer ownership
Expand Down Expand Up @@ -64,23 +64,23 @@ func genTestTransferOwnershipConfig(

// chain contracts
for _, chain := range chains {
timelocksPerChain[chain] = state.Chains[chain].Timelock.Address()
timelocksPerChain[chain] = state.EVMState.Chains[chain].Timelock.Address()
contracts[chain] = []common.Address{
state.Chains[chain].OnRamp.Address(),
state.Chains[chain].OffRamp.Address(),
state.Chains[chain].FeeQuoter.Address(),
state.Chains[chain].NonceManager.Address(),
state.Chains[chain].RMNRemote.Address(),
state.EVMState.Chains[chain].OnRamp.Address(),
state.EVMState.Chains[chain].OffRamp.Address(),
state.EVMState.Chains[chain].FeeQuoter.Address(),
state.EVMState.Chains[chain].NonceManager.Address(),
state.EVMState.Chains[chain].RMNRemote.Address(),
}
}

// home chain
homeChainTimelockAddress := state.Chains[e.HomeChainSel].Timelock.Address()
homeChainTimelockAddress := state.EVMState.Chains[e.HomeChainSel].Timelock.Address()
timelocksPerChain[e.HomeChainSel] = homeChainTimelockAddress
contracts[e.HomeChainSel] = append(contracts[e.HomeChainSel],
state.Chains[e.HomeChainSel].CapabilityRegistry.Address(),
state.Chains[e.HomeChainSel].CCIPHome.Address(),
state.Chains[e.HomeChainSel].RMNHome.Address(),
state.EVMState.Chains[e.HomeChainSel].CapabilityRegistry.Address(),
state.EVMState.Chains[e.HomeChainSel].CCIPHome.Address(),
state.EVMState.Chains[e.HomeChainSel].RMNHome.Address(),
)

return commonchangeset.TransferToMCMSWithTimelockConfig{
Expand All @@ -99,26 +99,26 @@ func assertTimelockOwnership(
// check that the ownership has been transferred correctly
for _, chain := range chains {
for _, contract := range []common.Address{
state.Chains[chain].OnRamp.Address(),
state.Chains[chain].OffRamp.Address(),
state.Chains[chain].FeeQuoter.Address(),
state.Chains[chain].NonceManager.Address(),
state.Chains[chain].RMNRemote.Address(),
state.EVMState.Chains[chain].OnRamp.Address(),
state.EVMState.Chains[chain].OffRamp.Address(),
state.EVMState.Chains[chain].FeeQuoter.Address(),
state.EVMState.Chains[chain].NonceManager.Address(),
state.EVMState.Chains[chain].RMNRemote.Address(),
} {
owner, _, err := commonchangeset.LoadOwnableContract(contract, e.Env.Chains[chain].Client)
owner, _, err := commonchangeset.LoadOwnableContract(contract, e.Env.Chains[chain].EVMChain.Client)
require.NoError(t, err)
require.Equal(t, state.Chains[chain].Timelock.Address(), owner)
require.Equal(t, state.EVMState.Chains[chain].Timelock.Address(), owner)
}
}

// check home chain contracts ownership
homeChainTimelockAddress := state.Chains[e.HomeChainSel].Timelock.Address()
homeChainTimelockAddress := state.EVMState.Chains[e.HomeChainSel].Timelock.Address()
for _, contract := range []common.Address{
state.Chains[e.HomeChainSel].CapabilityRegistry.Address(),
state.Chains[e.HomeChainSel].CCIPHome.Address(),
state.Chains[e.HomeChainSel].RMNHome.Address(),
state.EVMState.Chains[e.HomeChainSel].CapabilityRegistry.Address(),
state.EVMState.Chains[e.HomeChainSel].CCIPHome.Address(),
state.EVMState.Chains[e.HomeChainSel].RMNHome.Address(),
} {
owner, _, err := commonchangeset.LoadOwnableContract(contract, e.Env.Chains[e.HomeChainSel].Client)
owner, _, err := commonchangeset.LoadOwnableContract(contract, e.Env.Chains[e.HomeChainSel].EVMChain.Client)
require.NoError(t, err)
require.Equal(t, homeChainTimelockAddress, owner)
}
Expand Down
22 changes: 11 additions & 11 deletions deployment/ccip/changeset/cs_active_candidate.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ func PromoteAllCandidatesChangeset(
nodes deployment.Nodes,
) (deployment.ChangesetOutput, error) {
promoteCandidateOps, err := promoteAllCandidatesForChainOps(
state.Chains[homeChainSel].CapabilityRegistry,
state.Chains[homeChainSel].CCIPHome,
state.EVMState.Chains[homeChainSel].CapabilityRegistry,
state.EVMState.Chains[homeChainSel].CCIPHome,
newChainSel,
nodes.NonBootstraps(),
)
Expand All @@ -37,10 +37,10 @@ func PromoteAllCandidatesChangeset(

var (
timelocksPerChain = map[uint64]common.Address{
homeChainSel: state.Chains[homeChainSel].Timelock.Address(),
homeChainSel: state.EVMState.Chains[homeChainSel].Timelock.Address(),
}
proposerMCMSes = map[uint64]*gethwrappers.ManyChainMultiSig{
homeChainSel: state.Chains[homeChainSel].ProposerMcm,
homeChainSel: state.EVMState.Chains[homeChainSel].ProposerMcm,
}
)
prop, err := proposalutils.BuildProposalFromBatches(
Expand Down Expand Up @@ -76,15 +76,15 @@ func SetCandidatePluginChangeset(
) (deployment.ChangesetOutput, error) {
ccipOCRParams := DefaultOCRParams(
feedChainSel,
tokenConfig.GetTokenInfo(e.Logger, state.Chains[newChainSel].LinkToken, state.Chains[newChainSel].Weth9),
tokenConfig.GetTokenInfo(e.Logger, state.EVMState.Chains[newChainSel].LinkToken, state.EVMState.Chains[newChainSel].Weth9),
nil,
)
newDONArgs, err := internal.BuildOCR3ConfigForCCIPHome(
ocrSecrets,
state.Chains[newChainSel].OffRamp,
state.EVMState.Chains[newChainSel].OffRamp,
e.Chains[newChainSel],
nodes.NonBootstraps(),
state.Chains[homeChainSel].RMNHome.Address(),
state.EVMState.Chains[homeChainSel].RMNHome.Address(),
ccipOCRParams.OCRParameters,
ccipOCRParams.CommitOffChainConfig,
ccipOCRParams.ExecuteOffChainConfig,
Expand All @@ -100,8 +100,8 @@ func SetCandidatePluginChangeset(

setCandidateMCMSOps, err := setCandidateOnExistingDon(
execConfig,
state.Chains[homeChainSel].CapabilityRegistry,
state.Chains[homeChainSel].CCIPHome,
state.EVMState.Chains[homeChainSel].CapabilityRegistry,
state.EVMState.Chains[homeChainSel].CCIPHome,
newChainSel,
nodes.NonBootstraps(),
)
Expand All @@ -111,10 +111,10 @@ func SetCandidatePluginChangeset(

var (
timelocksPerChain = map[uint64]common.Address{
homeChainSel: state.Chains[homeChainSel].Timelock.Address(),
homeChainSel: state.EVMState.Chains[homeChainSel].Timelock.Address(),
}
proposerMCMSes = map[uint64]*gethwrappers.ManyChainMultiSig{
homeChainSel: state.Chains[homeChainSel].ProposerMcm,
homeChainSel: state.EVMState.Chains[homeChainSel].ProposerMcm,
}
)
prop, err := proposalutils.BuildProposalFromBatches(
Expand Down
52 changes: 26 additions & 26 deletions deployment/ccip/changeset/cs_active_candidate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ func TestActiveCandidate(t *testing.T) {
if src == dest {
continue
}
latesthdr, err := destChain.Client.HeaderByNumber(testcontext.Get(t), nil)
latesthdr, err := destChain.EVMChain.Client.HeaderByNumber(testcontext.Get(t), nil)
require.NoError(t, err)
block := latesthdr.Number.Uint64()
startBlocks[dest] = &block
msgSentEvent := TestSendRequest(t, e, state, src, dest, false, router.ClientEVM2AnyMessage{
Receiver: common.LeftPadBytes(state.Chains[dest].Receiver.Address().Bytes(), 32),
Receiver: common.LeftPadBytes(state.EVMState.Chains[dest].Receiver.Address().Bytes(), 32),
Data: []byte("hello world"),
TokenAmounts: nil,
FeeToken: common.HexToAddress("0x0"),
Expand All @@ -80,8 +80,8 @@ func TestActiveCandidate(t *testing.T) {

//After commit is reported on all chains, token prices should be updated in FeeQuoter.
for dest := range e.Chains {
linkAddress := state.Chains[dest].LinkToken.Address()
feeQuoter := state.Chains[dest].FeeQuoter
linkAddress := state.EVMState.Chains[dest].LinkToken.Address()
feeQuoter := state.EVMState.Chains[dest].FeeQuoter
timestampedPrice, err := feeQuoter.GetTokenPrice(nil, linkAddress)
require.NoError(t, err)
require.Equal(t, MockLinkPrice, timestampedPrice.Value)
Expand All @@ -93,7 +93,7 @@ func TestActiveCandidate(t *testing.T) {
// compose the transfer ownership and accept ownership changesets
timelocks := make(map[uint64]*gethwrappers.RBACTimelock)
for _, chain := range allChains {
timelocks[chain] = state.Chains[chain].Timelock
timelocks[chain] = state.EVMState.Chains[chain].Timelock
}
_, err = commonchangeset.ApplyChangesets(t, e, timelocks, []commonchangeset.ChangesetApplication{
// note this doesn't have proposals.
Expand All @@ -109,10 +109,10 @@ func TestActiveCandidate(t *testing.T) {
require.NoError(t, err)

// [ACTIVE, CANDIDATE] setup by setting candidate through cap reg
capReg, ccipHome := state.Chains[tenv.HomeChainSel].CapabilityRegistry, state.Chains[tenv.HomeChainSel].CCIPHome
capReg, ccipHome := state.EVMState.Chains[tenv.HomeChainSel].CapabilityRegistry, state.EVMState.Chains[tenv.HomeChainSel].CCIPHome
donID, err := internal.DonIDForChain(capReg, ccipHome, tenv.FeedChainSel)
require.NoError(t, err)
donInfo, err := state.Chains[tenv.HomeChainSel].CapabilityRegistry.GetDON(nil, donID)
donInfo, err := state.EVMState.Chains[tenv.HomeChainSel].CapabilityRegistry.GetDON(nil, donID)
require.NoError(t, err)
require.Equal(t, 5, len(donInfo.NodeP2PIds))
require.Equal(t, uint32(4), donInfo.ConfigCount)
Expand All @@ -136,16 +136,16 @@ func TestActiveCandidate(t *testing.T) {

// this will construct ocr3 configurations for the
// commit and exec plugin we will be using
rmnHomeAddress := state.Chains[tenv.HomeChainSel].RMNHome.Address()
tokenConfig := NewTestTokenConfig(state.Chains[tenv.FeedChainSel].USDFeeds)
rmnHomeAddress := state.EVMState.Chains[tenv.HomeChainSel].RMNHome.Address()
tokenConfig := NewTestTokenConfig(state.EVMState.Chains[tenv.FeedChainSel].USDFeeds)
ccipOCRParams := DefaultOCRParams(
tenv.FeedChainSel,
tokenConfig.GetTokenInfo(e.Logger, state.Chains[tenv.FeedChainSel].LinkToken, state.Chains[tenv.FeedChainSel].Weth9),
tokenConfig.GetTokenInfo(e.Logger, state.EVMState.Chains[tenv.FeedChainSel].LinkToken, state.EVMState.Chains[tenv.FeedChainSel].Weth9),
nil,
)
ocr3ConfigMap, err := internal.BuildOCR3ConfigForCCIPHome(
deployment.XXXGenerateTestOCRSecrets(),
state.Chains[tenv.FeedChainSel].OffRamp,
state.EVMState.Chains[tenv.FeedChainSel].OffRamp,
e.Chains[tenv.FeedChainSel],
nodes.NonBootstraps(),
rmnHomeAddress,
Expand All @@ -157,16 +157,16 @@ func TestActiveCandidate(t *testing.T) {

var (
timelocksPerChain = map[uint64]common.Address{
tenv.HomeChainSel: state.Chains[tenv.HomeChainSel].Timelock.Address(),
tenv.HomeChainSel: state.EVMState.Chains[tenv.HomeChainSel].Timelock.Address(),
}
proposerMCMSes = map[uint64]*gethwrappers.ManyChainMultiSig{
tenv.HomeChainSel: state.Chains[tenv.HomeChainSel].ProposerMcm,
tenv.HomeChainSel: state.EVMState.Chains[tenv.HomeChainSel].ProposerMcm,
}
)
setCommitCandidateOp, err := setCandidateOnExistingDon(
ocr3ConfigMap[cctypes.PluginTypeCCIPCommit],
state.Chains[tenv.HomeChainSel].CapabilityRegistry,
state.Chains[tenv.HomeChainSel].CCIPHome,
state.EVMState.Chains[tenv.HomeChainSel].CapabilityRegistry,
state.EVMState.Chains[tenv.HomeChainSel].CCIPHome,
tenv.FeedChainSel,
nodes.NonBootstraps(),
)
Expand All @@ -177,13 +177,13 @@ func TestActiveCandidate(t *testing.T) {
}}, "set new candidates on commit plugin", 0)
require.NoError(t, err)
setCommitCandidateSigned := commonchangeset.SignProposal(t, e, setCommitCandidateProposal)
commonchangeset.ExecuteProposal(t, e, setCommitCandidateSigned, state.Chains[tenv.HomeChainSel].Timelock, tenv.HomeChainSel)
commonchangeset.ExecuteProposal(t, e, setCommitCandidateSigned, state.EVMState.Chains[tenv.HomeChainSel].Timelock, tenv.HomeChainSel)

// create the op for the commit plugin as well
setExecCandidateOp, err := setCandidateOnExistingDon(
ocr3ConfigMap[cctypes.PluginTypeCCIPExec],
state.Chains[tenv.HomeChainSel].CapabilityRegistry,
state.Chains[tenv.HomeChainSel].CCIPHome,
state.EVMState.Chains[tenv.HomeChainSel].CapabilityRegistry,
state.EVMState.Chains[tenv.HomeChainSel].CCIPHome,
tenv.FeedChainSel,
nodes.NonBootstraps(),
)
Expand All @@ -195,10 +195,10 @@ func TestActiveCandidate(t *testing.T) {
}}, "set new candidates on commit and exec plugins", 0)
require.NoError(t, err)
setExecCandidateSigned := commonchangeset.SignProposal(t, e, setExecCandidateProposal)
commonchangeset.ExecuteProposal(t, e, setExecCandidateSigned, state.Chains[tenv.HomeChainSel].Timelock, tenv.HomeChainSel)
commonchangeset.ExecuteProposal(t, e, setExecCandidateSigned, state.EVMState.Chains[tenv.HomeChainSel].Timelock, tenv.HomeChainSel)

// check setup was successful by confirming number of nodes from cap reg
donInfo, err = state.Chains[tenv.HomeChainSel].CapabilityRegistry.GetDON(nil, donID)
donInfo, err = state.EVMState.Chains[tenv.HomeChainSel].CapabilityRegistry.GetDON(nil, donID)
require.NoError(t, err)
require.Equal(t, 4, len(donInfo.NodeP2PIds))
require.Equal(t, uint32(6), donInfo.ConfigCount)
Expand All @@ -211,32 +211,32 @@ func TestActiveCandidate(t *testing.T) {

// [NEW ACTIVE, NO CANDIDATE] promote to active
// confirm by getting old candidate digest and making sure new active matches
oldCandidateDigest, err := state.Chains[tenv.HomeChainSel].CCIPHome.GetCandidateDigest(nil, donID, uint8(cctypes.PluginTypeCCIPExec))
oldCandidateDigest, err := state.EVMState.Chains[tenv.HomeChainSel].CCIPHome.GetCandidateDigest(nil, donID, uint8(cctypes.PluginTypeCCIPExec))
require.NoError(t, err)

promoteOps, err := promoteAllCandidatesForChainOps(state.Chains[tenv.HomeChainSel].CapabilityRegistry, state.Chains[tenv.HomeChainSel].CCIPHome, tenv.FeedChainSel, nodes.NonBootstraps())
promoteOps, err := promoteAllCandidatesForChainOps(state.EVMState.Chains[tenv.HomeChainSel].CapabilityRegistry, state.EVMState.Chains[tenv.HomeChainSel].CCIPHome, tenv.FeedChainSel, nodes.NonBootstraps())
require.NoError(t, err)
promoteProposal, err := proposalutils.BuildProposalFromBatches(timelocksPerChain, proposerMCMSes, []timelock.BatchChainOperation{{
ChainIdentifier: mcms.ChainIdentifier(tenv.HomeChainSel),
Batch: promoteOps,
}}, "promote candidates and revoke actives", 0)
require.NoError(t, err)
promoteSigned := commonchangeset.SignProposal(t, e, promoteProposal)
commonchangeset.ExecuteProposal(t, e, promoteSigned, state.Chains[tenv.HomeChainSel].Timelock, tenv.HomeChainSel)
commonchangeset.ExecuteProposal(t, e, promoteSigned, state.EVMState.Chains[tenv.HomeChainSel].Timelock, tenv.HomeChainSel)
// [NEW ACTIVE, NO CANDIDATE] done promoting

// [NEW ACTIVE, NO CANDIDATE] check onchain state
newActiveDigest, err := state.Chains[tenv.HomeChainSel].CCIPHome.GetActiveDigest(nil, donID, uint8(cctypes.PluginTypeCCIPExec))
newActiveDigest, err := state.EVMState.Chains[tenv.HomeChainSel].CCIPHome.GetActiveDigest(nil, donID, uint8(cctypes.PluginTypeCCIPExec))
require.NoError(t, err)
require.Equal(t, oldCandidateDigest, newActiveDigest)

newCandidateDigest, err := state.Chains[tenv.HomeChainSel].CCIPHome.GetCandidateDigest(nil, donID, uint8(cctypes.PluginTypeCCIPCommit))
newCandidateDigest, err := state.EVMState.Chains[tenv.HomeChainSel].CCIPHome.GetCandidateDigest(nil, donID, uint8(cctypes.PluginTypeCCIPCommit))
require.NoError(t, err)
require.Equal(t, newCandidateDigest, [32]byte{})
// [NEW ACTIVE, NO CANDIDATE] done checking on chain state

// [NEW ACTIVE, NO CANDIDATE] send successful request on new active
donInfo, err = state.Chains[tenv.HomeChainSel].CapabilityRegistry.GetDON(nil, donID)
donInfo, err = state.EVMState.Chains[tenv.HomeChainSel].CapabilityRegistry.GetDON(nil, donID)
require.NoError(t, err)
require.Equal(t, uint32(8), donInfo.ConfigCount)

Expand Down
Loading
Loading