Skip to content
Merged
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: 12 additions & 12 deletions .github/AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<scope>
GitHub Actions in the Chainlink Go monorepo.
</scope>

<rules>
## Rules

- Prefer runs-on runners when ubuntu-latest is insufficient.
- Minimize YAML and shell in workflows.
- Minimize YAML and shell in workflows. Utilize the [Go CI CLI](../tools/ci/) for any bash requiring more than basic commands.
- Resolve smartcontractkit/.github from a local clone. Ask the user for the path if you cannot find it.
</rules>

<docs>
- runs-on: https://runs-on.com/docs/
</docs>
## New Features

- Can [reference local actions without checkout step](https://github.blog/changelog/2026-07-30-reference-same-repository-actions-with-self-repository-syntax/) with `uses: $/path/to/action`

## Docs & Tools

<tools>
- https://github.com/kalverra/octometrics — per-workflow debugging
- https://github.com/kalverra/octometrics-action — runner resource monitoring
</tools>
- [runs-on](https://runs-on.com/docs/): Docs for our runs-on runners
- [octometrics](https://github.com/kalverra/octometrics): Debugging and analyzing workflows
- [octometrics-action](https://github.com/kalverra/octometrics-action): Runner resource monitoring
- [Go CI CLI](../tools/ci/): Custom logic for /chainlink workflows
48 changes: 18 additions & 30 deletions .github/workflows/ccip-system-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@
description:
"When true, restricts the matrix to tests flagged mixed_version=true
(used by the release rollout job)."
run_mixed_version_tests:
required: false
type: boolean
default: false
description:
"Whether to run the mixed-version tests. Only used for manual
workflow_dispatch runs; these tests are skipped on automatic runs."
workflow_call:
inputs:
chainlink_image_repository_path:
Expand Down Expand Up @@ -107,6 +114,13 @@
description:
"When true, restricts the matrix to tests flagged mixed_version=true
(used by the release rollout job)."
run_mixed_version_tests:
required: false
type: boolean
default: false
description:
"Whether to run the mixed-version tests. Only used for manual
workflow_dispatch runs; these tests are skipped on automatic runs."

jobs:
define-test-matrix:
Expand All @@ -120,42 +134,16 @@
steps:
- name: Resolve Spot Setting
id: spot
uses: $/.github/actions/setup-runner-spot

Check failure on line 137 in .github/workflows/ccip-system-tests.yaml

View workflow job for this annotation

GitHub Actions / Validate Github Action Workflows

[actionlint] reported by reviewdog 🐶 specifying action "$/.github/actions/setup-runner-spot" in invalid format because ref is missing. available formats are "{owner}/{repo}@{ref}" or "{owner}/{repo}/{path}@{ref}" [action] Raw Output: e:.github/workflows/ccip-system-tests.yaml:137:15: specifying action "$/.github/actions/setup-runner-spot" in invalid format because ref is missing. available formats are "{owner}/{repo}@{ref}" or "{owner}/{repo}/{path}@{ref}" [action]

# TODO(DX-5101): replace this inline jq matrix step with `ci matrix ccip`
- name: Define test matrix
id: define-matrix
shell: bash
env:
RUN_ID: ${{ github.run_id }}
RUN_ATTEMPT: ${{ github.run_attempt }}
SPOT_FLAG: ${{ steps.spot.outputs.spot_flag }}
run: |
TESTS_JSON='[
{"test_name":"Test_CCIPGasPriceUpdatesWriteFrequency","timeout":"15m","selected_network":"SIMULATED_1,SIMULATED_2"},
{"test_name":"TestRMN_GlobalCurseTwoMessagesOnTwoLanes","timeout":"15m","selected_network":"SIMULATED_1,SIMULATED_2","rmn_rageproxy_version":"master-amd6416f5d86","rmn_afn2proxy_version":"master-amd64-10b42b2"},
{"test_name":"TestDeleteCCIPJobs-TestRevokeJobs","timeout":"15m","selected_network":"SIMULATED_1,SIMULATED_2","job_timeout":20},
{"test_name":"Test_CCIPMixedVersionDON","timeout":"20m","selected_network":"SIMULATED_1,SIMULATED_2","mixed_version":true},
{"test_name":"Test_CCIPRollingUpgrade","timeout":"30m","selected_network":"SIMULATED_1,SIMULATED_2","mixed_version":true}
]'

tests=$(echo "$TESTS_JSON" | jq -c \
--argjson run_id "$RUN_ID" \
--arg run_attempt "$RUN_ATTEMPT" \
--arg spot_flag "$SPOT_FLAG" '
to_entries | map(.value + {
test_id: .key,
runs_on: ("runs-on=\($run_id)-\(.key)-\($run_attempt)/cpu=8/ram=64/family=r6i+r7i+r8i/\($spot_flag)/image=ubuntu24-full-x64/extras=s3-cache+tmpfs")
})
')

# Release rollout callers pass mixed_version_only=true to run only the
# mixed-version / rolling-upgrade tests instead of the full smoke suite.
if [[ "${{ inputs.mixed_version_only }}" == "true" ]]; then
tests=$(echo "$tests" | jq -c '[ .[] | select(.mixed_version == true) ]')
fi

echo "matrix=$tests" | tee -a "${GITHUB_OUTPUT}"
RUNNER_SPOT_FLAG: ${{ steps.spot.outputs.spot_flag }}
RUN_MIXED_VERSION_TESTS: ${{ inputs.run_mixed_version_tests }}
MIXED_VERSION_ONLY: ${{ inputs.mixed_version_only }}
run: ci matrix ccip

run-ccip-tests:
name: ${{ matrix.tests.test_name }}
Expand Down
35 changes: 2 additions & 33 deletions .github/workflows/cre-mixed-env-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,45 +112,14 @@
steps:
- name: Resolve Spot Setting
id: spot
uses: $/.github/actions/setup-runner-spot

Check failure on line 115 in .github/workflows/cre-mixed-env-tests.yaml

View workflow job for this annotation

GitHub Actions / Validate Github Action Workflows

[actionlint] reported by reviewdog 🐶 specifying action "$/.github/actions/setup-runner-spot" in invalid format because ref is missing. available formats are "{owner}/{repo}@{ref}" or "{owner}/{repo}/{path}@{ref}" [action] Raw Output: e:.github/workflows/cre-mixed-env-tests.yaml:115:15: specifying action "$/.github/actions/setup-runner-spot" in invalid format because ref is missing. available formats are "{owner}/{repo}@{ref}" or "{owner}/{repo}/{path}@{ref}" [action]

- name: Define mixed-env test matrix
id: define-matrix
shell: bash
env:
RUN_ID: ${{ github.run_id }}
RUN_ATTEMPT: ${{ github.run_attempt }}
SPOT_FLAG: ${{ steps.spot.outputs.spot_flag }}
run: |
# Tests worth running under mixed-env: the OCR3/DON2DON-heavy ones.
# The confidential relay test runs against its own topology (the
# standard mixed-env topology lacks the confidential-workflows /
# confidential-relay capabilities and ConfidentialWorkflows.Enabled).
TESTS='[
"Test_CRE_V2_Suite_Bucket_A",
"Test_CRE_V2_Suite_Bucket_B",
"Test_CRE_V2_EVM_Read_HeavyCalls",
"Test_CRE_V2_EVM_Read_StateQueries",
"Test_CRE_V2_EVM_Read_TxArtifacts"
]'
# Per-test topology override. Tests not listed here default to the
# standard mixed-env topology (configs/mixed-env-don.toml).
PER_TEST_CONFIGS='{
"Test_CRE_V2_ConfidentialWorkflows_Relay": "configs/mixed-env-confidential-workflows.toml"
}'
matrix=$(jq -c -n \
--argjson tests "$TESTS" \
--argjson per "$PER_TEST_CONFIGS" \
--argjson run_id "$RUN_ID" \
--arg run_attempt "$RUN_ATTEMPT" \
--arg spot_flag "$SPOT_FLAG" '
$tests | to_entries | map({
test_name: .value,
test_id: .key,
configs: ($per[.value] // "configs/mixed-env-don.toml"),
runs_on: "runs-on=\($run_id)-\(.key)-\($run_attempt)/cpu=16/ram=64/family=m7i+m8i/\($spot_flag)/image=ubuntu24-full-x64/extras=s3-cache+tmpfs"
})')
echo "matrix=$matrix" | tee -a "${GITHUB_OUTPUT}"
RUNNER_SPOT_FLAG: ${{ steps.spot.outputs.spot_flag }}
run: ci matrix mixed-env

run-mixed-env-tests:
name: ${{ matrix.tests.test_name }} (mixed-env)
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/ccip/revert-reason/handler/reason_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ func Test_RevertReasonFromTx(t *testing.T) {
type args struct {
txHash string
}
var tests []struct {
tests := []struct {
name string
fields fields
args args
expected string
} // TODO: Add test cases.
}{} // TODO: Add test cases.
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
h := &BaseHandler{
Expand Down
12 changes: 7 additions & 5 deletions core/scripts/ccip/shared/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@ package shared

import (
"context"
"errors"
"testing"
"time"

"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-common/pkg/logger"
evmclient "github.com/smartcontractkit/chainlink-evm/pkg/client"
)

const RetryTiming = 5 * time.Second
const CrossChainTimeout = 5 * time.Minute
const TxInclusionTimeout = 3 * time.Minute
const (
RetryTiming = 5 * time.Second
CrossChainTimeout = 5 * time.Minute
TxInclusionTimeout = 3 * time.Minute
)

// WaitForMined wait for a tx to be included on chain. It will panic when
// the tx is reverted/successful based on the shouldSucceed parameter.
func WaitForMined(lggr logger.Logger, client ethereum.TransactionReader, hash common.Hash, shouldSucceed bool) error {
maxIterations := TxInclusionTimeout / RetryTiming
for i := 0; i < int(maxIterations); i++ {
for range maxIterations {
lggr.Info("[MINING] waiting for tx to be mined...")
receipt, _ := client.TransactionReceipt(context.Background(), hash)

Expand Down
20 changes: 11 additions & 9 deletions core/scripts/common/avalanche.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (b *AvaBloom) Add(d []byte) {
}

// add is internal version of Add, which takes a scratch buffer for reuse (needs to be at least 6 bytes)
func (b *AvaBloom) add(d []byte, buf []byte) {
func (b *AvaBloom) add(d, buf []byte) {
i1, v1, i2, v2, i3, v3 := bloomValues(d, buf)
b[i1] |= v1
b[i2] |= v2
Expand All @@ -49,25 +49,25 @@ func (b *AvaBloom) add(d []byte, buf []byte) {
// Big converts b to a big integer.
// Note: Converting a bloom filter to a big.Int and then calling GetBytes
// does not return the same bytes, since big.Int will trim leading zeroes
func (b AvaBloom) Big() *big.Int {
func (b *AvaBloom) Big() *big.Int {
return new(big.Int).SetBytes(b[:])
}

// Bytes returns the backing byte slice of the bloom
func (b AvaBloom) Bytes() []byte {
func (b *AvaBloom) Bytes() []byte {
return b[:]
}

// Test checks if the given topic is present in the bloom filter
func (b AvaBloom) Test(topic []byte) bool {
func (b *AvaBloom) Test(topic []byte) bool {
i1, v1, i2, v2, i3, v3 := bloomValues(topic, make([]byte, 6))
return v1 == v1&b[i1] &&
v2 == v2&b[i2] &&
v3 == v3&b[i3]
}

// MarshalText encodes b as a hex string with 0x prefix.
func (b AvaBloom) MarshalText() ([]byte, error) {
func (b *AvaBloom) MarshalText() ([]byte, error) {
return hexutil.Bytes(b[:]).MarshalText()
}

Expand All @@ -77,10 +77,10 @@ func (b *AvaBloom) UnmarshalText(input []byte) error {
}

// bloomValues returns the bytes (index-value pairs) to set for the given data
func bloomValues(data []byte, hashbuf []byte) (uint, byte, uint, byte, uint, byte) {
func bloomValues(data, hashbuf []byte) (uint, byte, uint, byte, uint, byte) {
sha := crypto.NewKeccakState()
sha.Write(data)
sha.Read(hashbuf) //nolint:errcheck
sha.Read(hashbuf) //nolint:errcheck // keccak state read does not error
// The actual bits to flip
v1 := byte(1 << (hashbuf[1] & 0x7))
v2 := byte(1 << (hashbuf[3] & 0x7))
Expand Down Expand Up @@ -284,13 +284,15 @@ func (h *AvaHeader) UnmarshalJSON(input []byte) error {
}
return nil
}

func (h *AvaHeader) Hash() common.Hash {
return rlpHash(h)
}

func rlpHash(x any) (h common.Hash) {
sha := crypto.NewKeccakState()
sha.Reset()
rlp.Encode(sha, x) //nolint:errcheck
sha.Read(h[:]) //nolint:errcheck
rlp.Encode(sha, x) //nolint:errcheck // rlp encode to hash buffer does not fail
sha.Read(h[:]) //nolint:errcheck // keccak state read does not error
return h
}
36 changes: 13 additions & 23 deletions core/scripts/common/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package common

import (
"context"
"crypto/ecdsa"
"crypto/tls"
"encoding/hex"
"flag"
Expand Down Expand Up @@ -88,20 +87,9 @@ func SetupEnv(overrideNonce bool) Environment {
PanicErr(err)

// Owner key. Make sure it has eth
b, err := hex.DecodeString(accountKey)
privateKey, err := crypto.HexToECDSA(accountKey)
PanicErr(err)
d := new(big.Int).SetBytes(b)

pkX, pkY := crypto.S256().ScalarBaseMult(d.Bytes())
privateKey := ecdsa.PrivateKey{
PublicKey: ecdsa.PublicKey{
Curve: crypto.S256(),
X: pkX,
Y: pkY,
},
D: d,
}
owner, err := bind.NewKeyedTransactorWithChainID(&privateKey, big.NewInt(chainID))
owner, err := bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(chainID))
PanicErr(err)
// Explicitly set gas price to ensure non-eip 1559
gp, err := ec.SuggestGasPrice(context.Background())
Expand All @@ -121,10 +109,10 @@ func SetupEnv(overrideNonce bool) Environment {
block, err := ec.BlockNumber(context.Background())
PanicErr(err)

nonce, err := ec.NonceAt(context.Background(), owner.From, big.NewInt(int64(block)))
nonce, err := ec.NonceAt(context.Background(), owner.From, new(big.Int).SetUint64(block))
PanicErr(err)

owner.Nonce = big.NewInt(int64(nonce))
owner.Nonce = new(big.Int).SetUint64(nonce)
}
owner.GasPrice = gp.Mul(gp, big.NewInt(2))
fmt.Println("Modified Gas Price that will be set:", owner.GasPrice, "wei")
Expand Down Expand Up @@ -306,7 +294,7 @@ func ConfirmCodeAt(ctx context.Context, client *ethclient.Client, addr common.Ad
// of *big.Int objects.
func ParseBigIntSlice(arg string) (ret []*big.Int) {
parts := strings.Split(arg, ",")
ret = []*big.Int{}
ret = make([]*big.Int, 0, len(parts))
for _, part := range parts {
ret = append(ret, decimal.RequireFromString(part).BigInt())
}
Expand All @@ -329,7 +317,7 @@ func ParseIntSlice(arg string) (ret []int) {
// of common.Address objects.
func ParseAddressSlice(arg string) (ret []common.Address) {
parts := strings.Split(arg, ",")
ret = []common.Address{}
ret = make([]common.Address, 0, len(parts))
for _, part := range parts {
ret = append(ret, common.HexToAddress(part))
}
Expand All @@ -340,7 +328,7 @@ func ParseAddressSlice(arg string) (ret []common.Address) {
// common.Hash objects.
func ParseHashSlice(arg string) (ret []common.Hash) {
parts := strings.Split(arg, ",")
ret = []common.Hash{}
ret = make([]common.Hash, 0, len(parts))
for _, part := range parts {
ret = append(ret, common.HexToHash(part))
}
Expand All @@ -365,7 +353,7 @@ func FundNode(e Environment, address string, fundingAmount *big.Int) {
block, err := e.Ec.BlockNumber(context.Background())
PanicErr(err)

nonce, err := e.Ec.NonceAt(context.Background(), e.Owner.From, big.NewInt(int64(block)))
nonce, err := e.Ec.NonceAt(context.Background(), e.Owner.From, new(big.Int).SetUint64(block))
PanicErr(err)
// Special case for Arbitrum since gas estimation there is different.

Expand Down Expand Up @@ -556,19 +544,21 @@ func IsPolygonEdgeNetwork(chainID int64) bool {
}

func CalculateLatestBlockHeader(env Environment, blockNumberInput int) (err error) {
blockNumber := uint64(blockNumberInput)
var blockNumber uint64
if blockNumberInput == -1 {
blockNumber, err = env.Ec.BlockNumber(context.Background())
if err != nil {
return fmt.Errorf("failed to fetch latest block: %w", err)
}
} else {
blockNumber = uint64(blockNumberInput) //nolint:gosec // block number fits in uint64
}

// GetRLPHeaders method increments the blockNum sent by 1 and then fetches
// block headers for the child block.
blockNumber = blockNumber - 1
blockNumber--

blockNumberBigInts := []*big.Int{big.NewInt(int64(blockNumber))}
blockNumberBigInts := []*big.Int{new(big.Int).SetUint64(blockNumber)}
headers, hashes, err := GetRlpHeaders(env, blockNumberBigInts, true)
if err != nil {
fmt.Println(err)
Expand Down
Loading
Loading