-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into CCIP-4256-extract-mcms-to-common-own-chan…
…geset
- Loading branch information
Showing
16 changed files
with
426 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,7 +210,7 @@ jobs: | |
contents: read | ||
needs: [build-chainlink, changes] | ||
if: github.event_name == 'pull_request' && ( needs.changes.outputs.core_changes == 'true' || needs.changes.outputs.github_ci_changes == 'true') | ||
uses: smartcontractkit/.github/.github/workflows/run-e2e-tests.yml@5412507526722a7b1c5d719fa686eed5a1bc4035 # [email protected] | ||
uses: smartcontractkit/.github/.github/workflows/run-e2e-tests.yml@27467f0073162e0ca77d33ce26f649b3d0f4c188 #[email protected] | ||
with: | ||
workflow_name: Run Core E2E Tests For PR | ||
chainlink_version: ${{ inputs.evm-ref || github.sha }} | ||
|
@@ -251,7 +251,7 @@ jobs: | |
contents: read | ||
needs: [build-chainlink, changes] | ||
if: github.event_name == 'merge_group' && ( needs.changes.outputs.core_changes == 'true' || needs.changes.outputs.github_ci_changes == 'true') | ||
uses: smartcontractkit/.github/.github/workflows/run-e2e-tests.yml@5412507526722a7b1c5d719fa686eed5a1bc4035 # ctf-run-tests@0.2.0 | ||
uses: smartcontractkit/.github/.github/workflows/run-e2e-tests.yml@27467f0073162e0ca77d33ce26f649b3d0f4c188 #ctf-run-tests@1.0.0 | ||
with: | ||
workflow_name: Run Core E2E Tests For Merge Queue | ||
chainlink_version: ${{ inputs.evm-ref || github.sha }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package changeset | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock" | ||
|
||
"github.com/smartcontractkit/chainlink/deployment" | ||
ccipdeployment "github.com/smartcontractkit/chainlink/deployment/ccip" | ||
) | ||
|
||
var _ deployment.ChangeSet[DeployChainContractsConfig] = DeployChainContracts | ||
|
||
func DeployChainContracts(env deployment.Environment, c DeployChainContractsConfig) (deployment.ChangesetOutput, error) { | ||
newAddresses := deployment.NewMemoryAddressBook() | ||
err := ccipdeployment.DeployChainContractsForChains(env, newAddresses, c.HomeChainSelector, c.ChainSelectors) | ||
if err != nil { | ||
env.Logger.Errorw("Failed to deploy CCIP contracts", "err", err, "newAddresses", newAddresses) | ||
return deployment.ChangesetOutput{AddressBook: newAddresses}, deployment.MaybeDataErr(err) | ||
} | ||
return deployment.ChangesetOutput{ | ||
Proposals: []timelock.MCMSWithTimelockProposal{}, | ||
AddressBook: newAddresses, | ||
JobSpecs: nil, | ||
}, nil | ||
} | ||
|
||
type DeployChainContractsConfig struct { | ||
ChainSelectors []uint64 | ||
HomeChainSelector uint64 | ||
} | ||
|
||
func (c DeployChainContractsConfig) Validate() error { | ||
for _, cs := range c.ChainSelectors { | ||
if err := deployment.IsValidChainSelector(cs); err != nil { | ||
return fmt.Errorf("invalid chain selector: %d - %w", cs, err) | ||
} | ||
} | ||
if err := deployment.IsValidChainSelector(c.HomeChainSelector); err != nil { | ||
return fmt.Errorf("invalid home chain selector: %d - %w", c.HomeChainSelector, err) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package changeset | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
"go.uber.org/zap/zapcore" | ||
|
||
"github.com/smartcontractkit/chainlink/deployment" | ||
ccdeploy "github.com/smartcontractkit/chainlink/deployment/ccip" | ||
"github.com/smartcontractkit/chainlink/deployment/environment/memory" | ||
"github.com/smartcontractkit/chainlink/v2/core/logger" | ||
) | ||
|
||
func TestDeployChainContractsChangeset(t *testing.T) { | ||
lggr := logger.TestLogger(t) | ||
e := memory.NewMemoryEnvironment(t, lggr, zapcore.InfoLevel, memory.MemoryEnvironmentConfig{ | ||
Bootstraps: 1, | ||
Chains: 2, | ||
Nodes: 4, | ||
}) | ||
selectors := e.AllChainSelectors() | ||
homeChainSel := selectors[0] | ||
nodes, err := deployment.NodeInfo(e.NodeIDs, e.Offchain) | ||
require.NoError(t, err) | ||
p2pIds := nodes.NonBootstraps().PeerIDs() | ||
// deploy home chain | ||
homeChainCfg := DeployHomeChainConfig{ | ||
HomeChainSel: homeChainSel, | ||
RMNStaticConfig: ccdeploy.NewTestRMNStaticConfig(), | ||
RMNDynamicConfig: ccdeploy.NewTestRMNDynamicConfig(), | ||
NodeOperators: ccdeploy.NewTestNodeOperator(e.Chains[homeChainSel].DeployerKey.From), | ||
NodeP2PIDsPerNodeOpAdmin: map[string][][32]byte{ | ||
"NodeOperator": p2pIds, | ||
}, | ||
} | ||
output, err := DeployHomeChain(e, homeChainCfg) | ||
require.NoError(t, err) | ||
require.NoError(t, e.ExistingAddresses.Merge(output.AddressBook)) | ||
|
||
// deploy pre-requisites | ||
prerequisites, err := DeployPrerequisites(e, DeployPrerequisiteConfig{ | ||
ChainSelectors: selectors, | ||
}) | ||
require.NoError(t, err) | ||
require.NoError(t, e.ExistingAddresses.Merge(prerequisites.AddressBook)) | ||
|
||
// deploy ccip chain contracts | ||
output, err = DeployChainContracts(e, DeployChainContractsConfig{ | ||
ChainSelectors: selectors, | ||
HomeChainSelector: homeChainSel, | ||
MCMSCfg: ccdeploy.NewTestMCMSConfig(t, e), | ||
}) | ||
require.NoError(t, err) | ||
require.NoError(t, e.ExistingAddresses.Merge(output.AddressBook)) | ||
|
||
// load onchain state | ||
state, err := ccdeploy.LoadOnchainState(e) | ||
require.NoError(t, err) | ||
|
||
// verify all contracts populated | ||
require.NotNil(t, state.Chains[homeChainSel].CapabilityRegistry) | ||
require.NotNil(t, state.Chains[homeChainSel].CCIPHome) | ||
require.NotNil(t, state.Chains[homeChainSel].RMNHome) | ||
for _, sel := range selectors { | ||
require.NotNil(t, state.Chains[sel].LinkToken) | ||
require.NotNil(t, state.Chains[sel].Weth9) | ||
require.NotNil(t, state.Chains[sel].TokenAdminRegistry) | ||
require.NotNil(t, state.Chains[sel].RegistryModule) | ||
require.NotNil(t, state.Chains[sel].Router) | ||
require.NotNil(t, state.Chains[sel].RMNRemote) | ||
require.NotNil(t, state.Chains[sel].TestRouter) | ||
require.NotNil(t, state.Chains[sel].NonceManager) | ||
require.NotNil(t, state.Chains[sel].FeeQuoter) | ||
require.NotNil(t, state.Chains[sel].OffRamp) | ||
require.NotNil(t, state.Chains[sel].OnRamp) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package changeset | ||
|
||
import ( | ||
"github.com/pkg/errors" | ||
"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock" | ||
|
||
"github.com/smartcontractkit/chainlink/deployment" | ||
ccipdeployment "github.com/smartcontractkit/chainlink/deployment/ccip" | ||
) | ||
|
||
func Jobspec(env deployment.Environment, _ any) (deployment.ChangesetOutput, error) { | ||
js, err := ccipdeployment.NewCCIPJobSpecs(env.NodeIDs, env.Offchain) | ||
if err != nil { | ||
return deployment.ChangesetOutput{}, errors.Wrapf(err, "failed to create job specs") | ||
} | ||
return deployment.ChangesetOutput{ | ||
Proposals: []timelock.MCMSWithTimelockProposal{}, | ||
AddressBook: deployment.NewMemoryAddressBook(), | ||
JobSpecs: js, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package changeset | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
"go.uber.org/zap/zapcore" | ||
|
||
"github.com/smartcontractkit/chainlink/deployment" | ||
"github.com/smartcontractkit/chainlink/deployment/environment/memory" | ||
ccip "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/validate" | ||
"github.com/smartcontractkit/chainlink/v2/core/logger" | ||
) | ||
|
||
func TestJobSpecChangeset(t *testing.T) { | ||
lggr := logger.TestLogger(t) | ||
e := memory.NewMemoryEnvironment(t, lggr, zapcore.InfoLevel, memory.MemoryEnvironmentConfig{ | ||
Chains: 1, | ||
Nodes: 4, | ||
}) | ||
output, err := Jobspec(e, nil) | ||
require.NoError(t, err) | ||
require.NotNil(t, output.JobSpecs) | ||
nodes, err := deployment.NodeInfo(e.NodeIDs, e.Offchain) | ||
require.NoError(t, err) | ||
for _, node := range nodes { | ||
jobs, exists := output.JobSpecs[node.NodeID] | ||
require.True(t, exists) | ||
require.NotNil(t, jobs) | ||
for _, job := range jobs { | ||
_, err = ccip.ValidatedCCIPSpec(job) | ||
require.NoError(t, err) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.