Skip to content

Commit 6ccc97d

Browse files
committed
Merge remote-tracking branch 'origin/develop' into dx-3050-chip-fanout-router
2 parents ab31144 + 0889bf5 commit 6ccc97d

File tree

103 files changed

+7394
-348
lines changed

Some content is hidden

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

103 files changed

+7394
-348
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"chainlink": patch
3+
---
4+
5+
#internal
6+
7+
Add Aptos local CRE read/write support, including Capabilities Registry OCR config for Aptos write and CI coverage for the Aptos write roundtrip and expected-failure scenarios.

.github/workflows/cre-system-tests.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ jobs:
7575
7676
# Add list of tests with certain topologies
7777
PER_TEST_TOPOLOGIES_JSON=${PER_TEST_TOPOLOGIES_JSON:-'{
78+
"Test_CRE_V2_Aptos_Suite": [
79+
{"topology":"workflow-gateway-aptos","configs":"configs/workflow-gateway-don-aptos.toml"}
80+
],
7881
"Test_CRE_V2_Solana_Suite": [
7982
{"topology":"workflow","configs":"configs/workflow-don-solana.toml"}
8083
],
@@ -213,6 +216,35 @@ jobs:
213216
chmod +x bin/ctf
214217
echo "::endgroup::"
215218
219+
- name: Install Aptos CLI
220+
if: ${{ matrix.tests.test_name == 'Test_CRE_V2_Aptos_Suite' }}
221+
shell: bash
222+
env:
223+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
224+
APTOS_CLI_TAG: "aptos-cli-v7.8.0"
225+
run: |
226+
echo "::startgroup::Install Aptos CLI"
227+
bin_dir="$HOME/.local/bin"
228+
mkdir -p "$bin_dir"
229+
230+
gh release download "${APTOS_CLI_TAG}" \
231+
--pattern "aptos-cli-*-Ubuntu-24.04-x86_64.zip" \
232+
--clobber \
233+
--repo aptos-labs/aptos-core \
234+
-O aptos-cli.zip
235+
236+
unzip -o aptos-cli.zip -d aptos-cli-extract >/dev/null
237+
aptos_path="$(find aptos-cli-extract -type f -name aptos | head -n1)"
238+
if [[ -z "$aptos_path" ]]; then
239+
echo "failed to locate aptos binary in release archive"
240+
exit 1
241+
fi
242+
243+
install -m 0755 "$aptos_path" "$bin_dir/aptos"
244+
echo "$bin_dir" >> "$GITHUB_PATH"
245+
"$bin_dir/aptos" --version
246+
echo "::endgroup::"
247+
216248
- name: Start local CRE${{ matrix.tests.cre_version }}
217249
shell: bash
218250
id: start-local-cre

.github/workflows/integration-tests.yml

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,10 @@ jobs:
624624
steps:
625625
- name: Check Core test results
626626
id: check_core_results
627+
env:
628+
TEST_RESULTS: ${{ needs.run-core-e2e-tests.outputs.test_results }}
627629
run: |
628-
results='${{ needs.run-core-e2e-tests.outputs.test_results }}'
630+
results="$TEST_RESULTS"
629631
echo "Core e2e test results:"
630632
echo "$results" | jq .
631633
@@ -634,9 +636,12 @@ jobs:
634636
635637
- name: Check CCIP test results
636638
id: check_ccip_results
639+
env:
640+
JOB_RESULT: ${{ needs.run-ccip-e2e-tests.result }}
641+
TEST_RESULTS: ${{ needs.run-ccip-e2e-tests.outputs.test_results }}
637642
run: |
638-
if [[ '${{ needs.run-ccip-e2e-tests.result }}' != 'skipped' ]]; then
639-
results='${{ needs.run-ccip-e2e-tests.outputs.test_results }}'
643+
if [[ "$JOB_RESULT" != "skipped" ]]; then
644+
results="$TEST_RESULTS"
640645
echo "CCIP test results:"
641646
echo "$results" | jq .
642647
else
@@ -646,64 +651,75 @@ jobs:
646651
- name: Fail the job if core tests were not successful
647652
if: always()
648653
env:
649-
RESULT: ${{ needs.run-core-e2e-tests.result }}
654+
JOB_RESULT: ${{ needs.run-core-e2e-tests.result }}
650655
run: |
651-
if [[ "${RESULT}" == "failure" ]]; then
656+
if [[ "${JOB_RESULT}" == "failure" ]]; then
652657
echo "::error::Core E2E tests failed."
653658
exit 1
654-
elif [[ "${RESULT}" == "cancelled" ]]; then
659+
elif [[ "${JOB_RESULT}" == "cancelled" ]]; then
655660
echo "::error::Core E2E tests were cancelled."
656661
exit 1
657-
elif [[ "${RESULT}" == "skipped" ]]; then
662+
elif [[ "${JOB_RESULT}" == "skipped" ]]; then
658663
echo "::warning::Core E2E tests were skipped."
659664
fi
660665
661666
- name: Fail the job if core CRE tests were not successful
662667
if: always()
663668
env:
664-
RESULT: ${{ needs.run-core-cre-e2e-tests.result }}
669+
JOB_RESULT: ${{ needs.run-core-cre-e2e-tests.result }}
665670
run: |
666-
if [[ "${RESULT}" == "failure" ]]; then
671+
if [[ "${JOB_RESULT}" == "failure" ]]; then
667672
echo "::error::Core CRE E2E tests failed."
668673
exit 1
669-
elif [[ "${RESULT}" == "cancelled" ]]; then
674+
elif [[ "${JOB_RESULT}" == "cancelled" ]]; then
670675
echo "::error::Core CRE E2E tests were cancelled."
671676
exit 1
672-
elif [[ "${RESULT}" == "skipped" ]]; then
677+
elif [[ "${JOB_RESULT}" == "skipped" ]]; then
673678
echo "::warning::Core CRE E2E tests were skipped."
674679
fi
675680
676681
- name: Fail the job if core CRE regression tests were not successful
677682
if: always()
678683
env:
679-
RESULT: ${{ needs.run-core-cre-e2e-regression-tests.result }}
684+
JOB_RESULT: ${{ needs.run-core-cre-e2e-regression-tests.result }}
680685
run: |
681-
if [[ "${RESULT}" == "failure" ]]; then
686+
if [[ "${JOB_RESULT}" == "failure" ]]; then
682687
echo "::error::Core CRE E2E regression tests failed."
683688
exit 1
684-
elif [[ "${RESULT}" == "cancelled" ]]; then
689+
elif [[ "${JOB_RESULT}" == "cancelled" ]]; then
685690
echo "::error::Core CRE E2E regression tests were cancelled."
686691
exit 1
687-
elif [[ "${RESULT}" == "skipped" ]]; then
692+
elif [[ "${JOB_RESULT}" == "skipped" ]]; then
688693
echo "::warning::Core CRE E2E regression tests were skipped."
689694
fi
690695
691696
- name: Warn if CCIP tests were not successful
692697
if: always()
693698
env:
694-
RESULT: ${{ needs.run-ccip-e2e-tests.result }}
699+
JOB_RESULT: ${{ needs.run-ccip-e2e-tests.result }}
695700
run: |
696-
if [[ "${RESULT}" == "failure" ]]; then
701+
if [[ "${JOB_RESULT}" == "failure" ]]; then
697702
echo "::warning::CCIP E2E tests failed in one of the runs. Not failing as they are not mandatory."
698-
elif [[ "${RESULT}" == "cancelled" ]]; then
703+
elif [[ "${JOB_RESULT}" == "cancelled" ]]; then
699704
echo "::warning::CCIP E2E tests were cancelled."
700-
elif [[ "${RESULT}" == "skipped" ]]; then
705+
elif [[ "${JOB_RESULT}" == "skipped" ]]; then
701706
echo "::warning::CCIP E2E tests were skipped."
702707
fi
703708
704-
- name: Fail the job if Chainlink image wasn't built
705-
if: always() && needs.build-chainlink.result == 'failure'
706-
run: exit 1
709+
- name: Fail the job if Chainlink image was cancelled or failed to build
710+
if: always()
711+
env:
712+
JOB_RESULT: ${{ needs.build-chainlink.result }}
713+
run: |
714+
if [[ "${JOB_RESULT}" == "failure" ]]; then
715+
echo "::error::Chainlink image build failed."
716+
exit 1
717+
elif [[ "${JOB_RESULT}" == "cancelled" ]]; then
718+
echo "::error::Chainlink image build was cancelled."
719+
exit 1
720+
elif [[ "${JOB_RESULT}" == "skipped" ]]; then
721+
echo "::warning::Chainlink image build was skipped."
722+
fi
707723
708724
show-chainlink-node-coverage:
709725
name: Show Chainlink Node Go Coverage

core/capabilities/vault/validator.go

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import (
77
"fmt"
88
"strconv"
99

10-
"github.com/ethereum/go-ethereum/common"
1110
"github.com/smartcontractkit/tdh2/go/tdh2/tdh2easy"
1211

1312
vaultcommon "github.com/smartcontractkit/chainlink-common/pkg/capabilities/actions/vault"
1413
pkgconfig "github.com/smartcontractkit/chainlink-common/pkg/config"
1514
"github.com/smartcontractkit/chainlink-common/pkg/settings/limits"
1615
"github.com/smartcontractkit/chainlink/v2/core/capabilities/vault/vaulttypes"
16+
"github.com/smartcontractkit/chainlink/v2/core/capabilities/vault/vaultutils"
1717
)
1818

1919
type RequestValidator struct {
@@ -65,7 +65,7 @@ func (r *RequestValidator) validateWriteRequest(publicKey *tdh2easy.PublicKey, i
6565
if err := r.validateCiphertextSize(req.EncryptedValue); err != nil {
6666
return fmt.Errorf("secret encrypted value at index %d is invalid: %w", idx, err)
6767
}
68-
err := EnsureRightLabelOnSecret(publicKey, req.EncryptedValue, req.Id.Owner)
68+
err := EnsureRightLabelOnSecret(publicKey, req.EncryptedValue, req.Id.Owner, "")
6969
if err != nil {
7070
return errors.New("Encrypted Secret at index [" + strconv.Itoa(idx) + "] doesn't have owner as the label. Error: " + err.Error())
7171
}
@@ -159,27 +159,40 @@ func NewRequestValidator(
159159
}
160160
}
161161

162-
func EnsureRightLabelOnSecret(publicKey *tdh2easy.PublicKey, secret, owner string) error {
162+
// EnsureRightLabelOnSecret verifies that the TDH2 ciphertext label matches either the
163+
// workflowOwner (Ethereum address, left-padded) or the orgID (SHA256 hash). Either
164+
// parameter can be empty to skip that check. The function succeeds if the label matches
165+
// at least one non-empty owner.
166+
func EnsureRightLabelOnSecret(publicKey *tdh2easy.PublicKey, secret string, workflowOwner string, orgID string) error {
163167
cipherText := &tdh2easy.Ciphertext{}
164168
cipherBytes, err := hex.DecodeString(secret)
165169
if err != nil {
166170
return errors.New("failed to decode encrypted value:" + err.Error())
167171
}
168172
if publicKey == nil {
169-
// Public key can be nil if gateway cache isn't populated yet(immediately after gateway reboots)
170-
// Ok to not validate in such cases, since this validation also runs on Vault Nodes
173+
// Public key can be nil if gateway cache isn't populated yet (immediately after gateway reboots).
174+
// Ok to not validate in such cases, since this validation also runs on Vault Nodes.
171175
return nil
172176
}
173177
err = cipherText.UnmarshalVerify(cipherBytes, publicKey)
174178
if err != nil {
175179
return errors.New("failed to verify encrypted value:" + err.Error())
176180
}
177181
secretLabel := cipherText.Label()
178-
ownerAddr := common.HexToAddress(owner)
179-
var ownerLabel [32]byte
180-
copy(ownerLabel[12:], ownerAddr.Bytes()) // left-pad with 12 zero
181-
if secretLabel != ownerLabel {
182-
return errors.New("secret label [" + hex.EncodeToString(secretLabel[:]) + "] does not match owner label [" + hex.EncodeToString(ownerLabel[:]) + "]")
182+
183+
if workflowOwner != "" {
184+
expected := vaultutils.WorkflowOwnerToLabel(workflowOwner)
185+
if secretLabel == expected {
186+
return nil
187+
}
183188
}
184-
return nil
189+
190+
if orgID != "" {
191+
expected := vaultutils.OrgIDToLabel(orgID)
192+
if secretLabel == expected {
193+
return nil
194+
}
195+
}
196+
197+
return errors.New("secret label [" + hex.EncodeToString(secretLabel[:]) + "] does not match any of the provided owner labels")
185198
}

0 commit comments

Comments
 (0)