Skip to content

Commit a3511c0

Browse files
authored
Merge branch 'main' into jade/devenv-ton-config-override
2 parents 6a1bbd9 + 6396d35 commit a3511c0

134 files changed

Lines changed: 3362 additions & 1850 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/build-cl/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@ runs:
5858
fi
5959
if [ -n "${{ inputs.ccip_ref }}" ]; then
6060
go get github.com/smartcontractkit/chainlink-ccip@${{ inputs.ccip_ref }}
61+
go get github.com/smartcontractkit/chainlink-ccip/chains/evm@${{ inputs.ccip_ref }}
6162
fi
6263
make gomodtidy

.github/workflows/ccip-integration-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ jobs:
229229
run: |
230230
cd $GITHUB_WORKSPACE/chainlink
231231
go get github.com/smartcontractkit/chainlink-ccip@${{ steps.get_sha.outputs.sha }}
232+
go get github.com/smartcontractkit/chainlink-ccip/chains/evm@${{ steps.get_sha.outputs.sha }}
232233
make gomodtidy
233234
- name: Setup Postgres
234235
uses: ./.github/actions/setup-postgres

.github/workflows/solidity-build-and-publish.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,38 @@ jobs:
9393
git add --all
9494
git diff --minimal --color --cached --exit-code
9595
96+
native-compile-check:
97+
name: Native Compilation Required Check
98+
runs-on: ubuntu-latest
99+
needs: [native-compile]
100+
if: always()
101+
steps:
102+
- name: Check native-compile result
103+
run: |
104+
result="${{ needs.native-compile.result }}"
105+
if [[ "$result" == "success" || "$result" == "skipped" ]]; then
106+
echo "Native compilation passed or was skipped"
107+
else
108+
echo "::error::Native compilation did not succeed (result: $result)"
109+
exit 1
110+
fi
111+
112+
lint-check:
113+
name: Solidity Lint Required Check
114+
runs-on: ubuntu-latest
115+
needs: [lint]
116+
if: always()
117+
steps:
118+
- name: Check lint result
119+
run: |
120+
result="${{ needs.lint.result }}"
121+
if [[ "$result" == "success" || "$result" == "skipped" ]]; then
122+
echo "Solidity lint passed or was skipped"
123+
else
124+
echo "::error::Solidity lint did not succeed (result: $result)"
125+
exit 1
126+
fi
127+
96128
# The if statements for steps after checkout repo is a workaround for
97129
# passing required check for PRs that don't have filtered changes.
98130
lint:

.github/workflows/test_smoke.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ jobs:
4747
( inputs.custom_config != '' && inputs.custom_config || 'env.toml' )
4848
|| 'env.toml'
4949
}}
50+
# Won't currently work because proper curse detection is not in a chainlink release and
51+
# we aren't building a fresh chainlink image from source in PRs.
52+
# - name: TestE2ECurse
53+
# config: env.toml,env-anvil.toml
5054
fail-fast: false
5155
steps:
5256
- name: Checkout code
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
package deploy
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/ethereum/go-ethereum/common"
7+
chain_selectors "github.com/smartcontractkit/chain-selectors"
8+
ccipocr3 "github.com/smartcontractkit/chainlink-common/pkg/types/ccipocr3"
9+
"github.com/smartcontractkit/chainlink-deployments-framework/datastore"
10+
cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment"
11+
cldf_ops "github.com/smartcontractkit/chainlink-deployments-framework/operations"
12+
13+
"github.com/smartcontractkit/chainlink-ccip/chains/evm/gobindings/generated/v1_6_0/ccip_home"
14+
"github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment/internal"
15+
deploycore "github.com/smartcontractkit/chainlink-ccip/deployment/deploy"
16+
"github.com/smartcontractkit/chainlink-ccip/deployment/utils"
17+
"github.com/smartcontractkit/chainlink-ccip/deployment/utils/changesets"
18+
datastore_utils "github.com/smartcontractkit/chainlink-ccip/deployment/utils/datastore"
19+
capabilities_registry "github.com/smartcontractkit/chainlink-evm/gethwrappers/keystone/generated/capabilities_registry_1_1_0"
20+
21+
mcms_types "github.com/smartcontractkit/mcms/types"
22+
)
23+
24+
func SetOCR3Config(deployerReg *deploycore.DeployerRegistry, mcmsReg *changesets.MCMSReaderRegistry) cldf.ChangeSetV2[deploycore.SetOCR3ConfigArgs] {
25+
return cldf.CreateChangeSet(setOCR3ConfigApply(deployerReg, mcmsReg), setOCR3ConfigVerify(deployerReg, mcmsReg))
26+
}
27+
28+
func setOCR3ConfigVerify(_ *deploycore.DeployerRegistry, _ *changesets.MCMSReaderRegistry) func(cldf.Environment, deploycore.SetOCR3ConfigArgs) error {
29+
return func(e cldf.Environment, cfg deploycore.SetOCR3ConfigArgs) error {
30+
// TODO: implement
31+
return nil
32+
}
33+
}
34+
35+
func ocr3ConfigArgs(e cldf.Environment, homeChainSelector uint64, chainSelector uint64, configType utils.ConfigType) ([]deploycore.OCR3ConfigArgs, error) {
36+
ccipHomeAddr, err := datastore_utils.FindAndFormatRef(e.DataStore, datastore.AddressRef{
37+
ChainSelector: homeChainSelector,
38+
Type: datastore.ContractType(utils.CCIPHome),
39+
Version: &deploycore.OCR3Version,
40+
}, homeChainSelector, datastore_utils.FullRef)
41+
if err != nil {
42+
return nil, fmt.Errorf("failed to find CCIPHome address in datastore: %w", err)
43+
}
44+
45+
ccipHome, err := ccip_home.NewCCIPHome(common.HexToAddress(ccipHomeAddr.Address), e.BlockChains.EVMChains()[homeChainSelector].Client)
46+
if err != nil {
47+
return nil, fmt.Errorf("failed to instantiate CCIPHome contract: %w", err)
48+
}
49+
50+
crAddr, err := datastore_utils.FindAndFormatRef(e.DataStore, datastore.AddressRef{
51+
ChainSelector: homeChainSelector,
52+
Type: datastore.ContractType(utils.CapabilitiesRegistry),
53+
Version: &deploycore.CapabilitiesRegistryVersion,
54+
}, homeChainSelector, datastore_utils.FullRef)
55+
if err != nil {
56+
return nil, fmt.Errorf("failed to find CapabilitiesRegistry address in datastore: %w", err)
57+
}
58+
59+
cr, err := capabilities_registry.NewCapabilitiesRegistry(common.HexToAddress(crAddr.Address), e.BlockChains.EVMChains()[homeChainSelector].Client)
60+
if err != nil {
61+
return nil, fmt.Errorf("failed to instantiate CapabilitiesRegistry contract: %w", err)
62+
}
63+
donID, err := internal.DonIDForChain(
64+
cr,
65+
ccipHome,
66+
chainSelector,
67+
)
68+
if err != nil {
69+
return nil, fmt.Errorf("failed to get DON ID: %w", err)
70+
}
71+
72+
if configType == "" {
73+
configType = utils.ConfigTypeActive
74+
}
75+
76+
ocr3Args, err := internal.BuildSetOCR3ConfigArgs(
77+
donID,
78+
ccipHome,
79+
chainSelector,
80+
configType,
81+
)
82+
if err != nil {
83+
return nil, fmt.Errorf("failed to build OCR3 config args: %w", err)
84+
}
85+
86+
var args []deploycore.OCR3ConfigArgs
87+
for _, arg := range ocr3Args {
88+
args = append(args, deploycore.OCR3ConfigArgs{
89+
ConfigDigest: arg.ConfigDigest,
90+
PluginType: ccipocr3.PluginType(arg.OcrPluginType),
91+
F: arg.F,
92+
IsSignatureVerificationEnabled: arg.IsSignatureVerificationEnabled,
93+
Signers: arg.Signers,
94+
Transmitters: arg.Transmitters,
95+
})
96+
}
97+
return args, nil
98+
}
99+
100+
func setOCR3ConfigApply(d *deploycore.DeployerRegistry, mcmsRegistry *changesets.MCMSReaderRegistry) func(cldf.Environment, deploycore.SetOCR3ConfigArgs) (cldf.ChangesetOutput, error) {
101+
return func(e cldf.Environment, cfg deploycore.SetOCR3ConfigArgs) (cldf.ChangesetOutput, error) {
102+
reports := make([]cldf_ops.Report[any, any], 0)
103+
batchOps := make([]mcms_types.BatchOperation, 0)
104+
for _, selector := range cfg.RemoteChainSels {
105+
family, err := chain_selectors.GetSelectorFamily(selector)
106+
if err != nil {
107+
return cldf.ChangesetOutput{}, err
108+
}
109+
adapter, exists := d.GetDeployer(family, &deploycore.OCR3Version)
110+
if !exists {
111+
return cldf.ChangesetOutput{}, fmt.Errorf("no deployer registered for chain family %s and version %s", family, deploycore.OCR3Version.String())
112+
}
113+
args, err := ocr3ConfigArgs(e, cfg.HomeChainSel, selector, cfg.ConfigType)
114+
if err != nil {
115+
return cldf.ChangesetOutput{}, err
116+
}
117+
configs := make(map[ccipocr3.PluginType]deploycore.OCR3ConfigArgs, 2)
118+
for _, arg := range args {
119+
configs[arg.PluginType] = arg
120+
}
121+
ocrReport, err := cldf_ops.ExecuteSequence(e.OperationsBundle, adapter.SetOCR3Config(), e.BlockChains,
122+
deploycore.SetOCR3ConfigInput{
123+
ChainSelector: selector,
124+
Datastore: e.DataStore,
125+
Configs: configs,
126+
})
127+
if err != nil {
128+
return cldf.ChangesetOutput{}, fmt.Errorf("failed to deploy Contract on chain with selector %d: %w", selector, err)
129+
}
130+
reports = append(reports, ocrReport.ExecutionReports...)
131+
batchOps = append(batchOps, ocrReport.Output.BatchOps...)
132+
}
133+
134+
return changesets.NewOutputBuilder(e, mcmsRegistry).
135+
WithReports(reports).
136+
WithBatchOps(batchOps).
137+
Build(cfg.MCMS)
138+
}
139+
}

0 commit comments

Comments
 (0)