Skip to content

Commit

Permalink
Merge branch 'develop' into aw/LoadTest-aws
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAustinWang committed Feb 10, 2025
2 parents 0c8a9bb + 54cc1a6 commit 737dad1
Show file tree
Hide file tree
Showing 94 changed files with 3,798 additions and 2,814 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
outputs:
affected-modules: ${{ steps.resolved-modules.outputs.module_names }}
deployment-changes: ${{ steps.match-some.outputs.deployment == 'true' }}
scripts-changes: ${{ steps.match-some.outputs.scripts == 'true' }}
should-run-ci-core: >-
${{
steps.match-some.outputs.core-ci == 'true' ||
Expand All @@ -37,12 +36,6 @@ jobs:
steps.match-some.outputs.golang-ci == 'true' ||
steps.match-every.outputs.non-ignored == 'true'
}}
should-run-scripts-test: >-
${{
steps.match-some.outputs.scripts == 'true' ||
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch'
}}
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
Expand All @@ -56,7 +49,6 @@ jobs:
# "if any changed file matches one or more of the conditions" (https://github.com/dorny/paths-filter/issues/225)
predicate-quantifier: some
# deployment - any changes to files in the `deployments/`
# scripts - any changes to files in the `core/scripts/`
# core-ci - any changes that could affect this workflow definition
# golang-ci - any changes that could affect the linting result
filters: |
Expand All @@ -69,8 +61,6 @@ jobs:
- '.golangci.yml'
- '.github/workflows/ci-core.yml'
- '.github/actions/**'
scripts:
- 'core/scripts/**'
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: match-every
with:
Expand Down Expand Up @@ -347,7 +337,7 @@ jobs:
name: test-scripts
needs: [filter]
runs-on: ubuntu-latest
if: ${{ needs.filter.outputs.should-run-scripts-test == 'true' }}
if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }}
steps:
- name: Checkout
uses: actions/[email protected]
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/client-compatibility-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ jobs:
# comment_on_pr: false
# theme: 'dark'
- name: Run Tests
uses: smartcontractkit/.github/actions/ctf-run-tests@b6e37806737eef87e8c9137ceeb23ef0bff8b1db # ctf-run-tests@0.1.0
uses: smartcontractkit/.github/actions/ctf-run-tests@725dd141dd77cc87dad420e9484416fc4ae26be2 # ctf-run-tests@v0.5.0
with:
test_command_to_run: cd ./integration-tests && touch .root_dir && go test -timeout 30m -count=1 -json ${{ matrix.evm_node.run }} 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage -hidepassingtests=false -hidepassinglogs
test_download_vendor_packages_command: cd ./integration-tests && go mod download
Expand All @@ -668,10 +668,11 @@ jobs:
cache_restore_only: "true"
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ""
should_tidy: "false"
go_coverage_src_dir: /var/tmp/go-coverage
go_coverage_dest_dir: ${{ github.workspace }}/.covdata
main-dns-zone: ${{ secrets.MAIN_DNS_ZONE_PUBLIC_SDLC }}
k8s-cluster-name: ${{ secrets.AWS_K8S_CLUSTER_NAME_SDLC }}
env:
E2E_TEST_SELECTED_NETWORK: ${{ env.SELECTED_NETWORKS}}
E2E_TEST_CHAINLINK_IMAGE: ${{ env.CHAINLINK_IMAGE }}
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/flakeguard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
- name: Install flakeguard
if: ${{ inputs.runAllTests == false }}
shell: bash
run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@051b483f1e9e99b0219d1ccea4d8f7bf3be203b7 # [email protected]
run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@103764eb5a9f02e0f3dc677f0d9da2e6796a978c # [email protected]

- name: Find new or updated test packages
if: ${{ inputs.runAllTests == false && env.RUN_CUSTOM_TEST_PACKAGES == '' }}
Expand Down Expand Up @@ -334,7 +334,7 @@ jobs:

- name: Install flakeguard
shell: bash
run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@051b483f1e9e99b0219d1ccea4d8f7bf3be203b7 # [email protected]
run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@103764eb5a9f02e0f3dc677f0d9da2e6796a978c # [email protected]

- name: Run tests with flakeguard
shell: bash
Expand Down Expand Up @@ -411,7 +411,7 @@ jobs:

- name: Install flakeguard
shell: bash
run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@051b483f1e9e99b0219d1ccea4d8f7bf3be203b7 # [email protected]
run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@103764eb5a9f02e0f3dc677f0d9da2e6796a978c # [email protected]

- name: Aggregate Flakeguard Results
id: results
Expand Down Expand Up @@ -454,10 +454,10 @@ jobs:

# Print out the summary file
echo -e "\nFlakeguard Summary:"
jq . ./flakeguard-report/all-test-summary.json
jq .summary_data ./flakeguard-report/all-test-results.json

# Read the summary from the generated report
summary=$(jq -c '.' ./flakeguard-report/all-test-summary.json)
summary=$(jq -c '.summary_data' ./flakeguard-report/all-test-results.json)
echo "summary=$summary" >> $GITHUB_OUTPUT

- name: Upload All Test Results as Artifact
Expand Down Expand Up @@ -503,7 +503,6 @@ jobs:
if [ "$GH_EVENT_NAME" = "pull_request" ]; then
flakeguard generate-report \
--aggregated-results-path ./flakeguard-report/all-test-results.json \
--summary-path ./flakeguard-report/all-test-summary.json \
--output-path ./flakeguard-report \
--github-repository "${{ github.repository }}" \
--github-run-id "${{ github.run_id }}" \
Expand All @@ -518,7 +517,6 @@ jobs:
else
flakeguard generate-report \
--aggregated-results-path ./flakeguard-report/all-test-results.json \
--summary-path ./flakeguard-report/all-test-summary.json \
--output-path ./flakeguard-report \
--github-repository "${{ github.repository }}" \
--github-run-id "${{ github.run_id }}" \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/integration-tests-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
uses: smartcontractkit/.github/actions/ctf-build-test-image@6781e048ecc1aadf7d605722c32e8068a5f829ce # [email protected]
with:
other_tags: ${{ steps.tags.outputs.other_tags }}
suites: 'chaos migration reorg smoke soak benchmark load ccip-tests/load ccip-tests/smoke ccip-tests/chaos'
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ACCOUNT_NUMBER: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ jobs:
ref: ${{ needs.get_solana_sha.outputs.sha }}
- name: Run Setup
if: needs.changes.outputs.core_changes == 'true' || github.event_name == 'workflow_dispatch'
uses: smartcontractkit/.github/actions/ctf-setup-run-tests-environment@49cb1613e96c9ce17f7290e4dabd38f43aa9bd4d # ctf-setup-run-tests-environment@0.0.0
uses: smartcontractkit/.github/actions/ctf-setup-run-tests-environment@4ff522b1aef76519d2ced17b5d052927754fd34b # ctf-setup-run-tests-environment@v0.2.1
with:
go_mod_path: ./integration-tests/go.mod
cache_restore_only: true
Expand All @@ -698,7 +698,8 @@ jobs:
dockerhub_password: ${{ secrets.DOCKERHUB_READONLY_PASSWORD }}
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
main-dns-zone: ${{ secrets.MAIN_DNS_ZONE_PUBLIC_SDLC }}
k8s-cluster-name: ${{ secrets.AWS_K8S_CLUSTER_NAME_SDLC }}
- name: Pull Artifacts
if: needs.changes.outputs.core_changes == 'true' || github.event_name == 'workflow_dispatch'
run: |
Expand Down Expand Up @@ -743,7 +744,7 @@ jobs:
echo "BASE64_CONFIG_OVERRIDE=$BASE64_CONFIG_OVERRIDE" >> $GITHUB_ENV
- name: Run Tests
if: needs.changes.outputs.core_changes == 'true' || github.event_name == 'workflow_dispatch'
uses: smartcontractkit/.github/actions/ctf-run-tests@b8731364b119e88983e94b0c4da87fc27ddb41b8 # ctf-run-tests@0.0.0
uses: smartcontractkit/.github/actions/ctf-run-tests@725dd141dd77cc87dad420e9484416fc4ae26be2 # ctf-run-tests@v0.5.0
with:
test_command_to_run: export ENV_JOB_IMAGE=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-solana-tests:${{ needs.get_solana_sha.outputs.sha }} && make test_smoke
test_config_override_base64: ${{ env.BASE64_CONFIG_OVERRIDE }}
Expand All @@ -762,10 +763,12 @@ jobs:
/tmp/gotest.log
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ""
run_setup: false
go_coverage_src_dir: /var/tmp/go-coverage
go_coverage_dest_dir: ${{ github.workspace }}/.covdata
main-dns-zone: ${{ secrets.MAIN_DNS_ZONE_PUBLIC_SDLC }}
k8s-cluster-name: ${{ secrets.AWS_K8S_CLUSTER_NAME_SDLC }}

env:
E2E_TEST_CHAINLINK_IMAGE: ${{ env.CHAINLINK_IMAGE }}
E2E_TEST_SOLANA_SECRET: thisisatestingonlysecret
Expand Down
14 changes: 7 additions & 7 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ install-ocr3-capability: ## Build & install the chainlink-ocr3-capability binary
.PHONY: install-plugins
install-plugins: ## Build & install LOOPP binaries for products and chains.
cd $(shell go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-feeds) && \
go install ./cmd/chainlink-feeds
go install $(GOFLAGS) ./cmd/chainlink-feeds
cd $(shell go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-data-streams) && \
go install ./mercury/cmd/chainlink-mercury
cd $(shell go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-cosmos) && \
go install ./pkg/cosmos/cmd/chainlink-cosmos
go install $(GOFLAGS) ./mercury/cmd/chainlink-mercury
cd $(shell go mod download -json github.com/smartcontractkit/chainlink-cosmos@f740e9ae54e79762991bdaf8ad6b50363261c056 | jq -r .Dir) && \
go install $(GOFLAGS) ./pkg/cosmos/cmd/chainlink-cosmos
cd $(shell go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-solana) && \
go install ./pkg/solana/cmd/chainlink-solana
cd $(shell go list -m -f "{{.Dir}}" github.com/smartcontractkit/chainlink-starknet/relayer) && \
go install ./pkg/chainlink/cmd/chainlink-starknet
go install $(GOFLAGS) ./pkg/solana/cmd/chainlink-solana
cd $(shell go mod download -json github.com/smartcontractkit/chainlink-starknet/relayer@9a780650af4708e4bd9b75495feff2c5b4054e46 | jq -r .Dir) && \
go install $(GOFLAGS) ./pkg/chainlink/cmd/chainlink-starknet

.PHONY: docker ## Build the chainlink docker image
docker:
Expand Down
2 changes: 0 additions & 2 deletions core/chains/evm/logpoller/log_poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -892,8 +892,6 @@ func (lp *logPoller) blocksFromFinalizedLogs(ctx context.Context, logs []types.L

// backfill will query FilterLogs in batches for logs in the
// block range [start, end] and save them to the db.
// Retries until ctx cancelled. Will return an error if cancelled
// or if there is an error backfilling.
func (lp *logPoller) backfill(ctx context.Context, start, end int64) error {
batchSize := lp.backfillBatchSize
for from := start; from <= end; from += batchSize {
Expand Down
3 changes: 3 additions & 0 deletions core/chains/evm/logpoller/log_poller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,9 @@ func TestTooManyLogResults(t *testing.T) {
}
from := fq.FromBlock.Uint64()
to := fq.ToBlock.Uint64()
if to-from >= 8 {
return []types.Log{}, context.DeadlineExceeded // simulate RPC client timeout as a "too many results" scenario
}
if to-from >= 4 {
return []types.Log{}, tooLargeErr // return "too many results" error if block range spans 4 or more blocks
}
Expand Down
37 changes: 37 additions & 0 deletions core/cmd/chains_commands_integration_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//go:build integration

package cmd_test

import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink/v2/core/cmd"
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/cosmostest"
"github.com/smartcontractkit/chainlink/v2/core/services/chainlink"
)

func TestShell_IndexCosmosChains(t *testing.T) {
t.Parallel()

chainID := cosmostest.RandomChainID()
chain := chainlink.RawConfig{
"ChainID": chainID,
"Nodes": []map[string]any{{
"Name": "primary",
"TendermintURL": "http://tender.mint",
}},
}
app := cosmosStartNewApplication(t, chain)
client, r := app.NewShellAndRenderer()

require.NoError(t, cmd.NewChainClient(client, "cosmos").IndexChains(cltest.EmptyCLIContext()))
chains := *r.Renders[0].(*cmd.ChainPresenters)
require.Len(t, chains, 1)
c := chains[0]
assert.Equal(t, chainID, c.ID)
assertTableRenders(t, r)
}
21 changes: 0 additions & 21 deletions core/cmd/chains_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,17 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

coscfg "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/config"
solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config"

client2 "github.com/smartcontractkit/chainlink-integrations/evm/client"
"github.com/smartcontractkit/chainlink-integrations/evm/utils/big"
"github.com/smartcontractkit/chainlink/v2/core/cmd"
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/cosmostest"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/solanatest"
"github.com/smartcontractkit/chainlink/v2/core/services/chainlink"
)

func TestShell_IndexCosmosChains(t *testing.T) {
t.Parallel()

chainID := cosmostest.RandomChainID()
chain := coscfg.TOMLConfig{
ChainID: ptr(chainID),
Enabled: ptr(true),
}
app := cosmosStartNewApplication(t, &chain)
client, r := app.NewShellAndRenderer()

require.NoError(t, cmd.NewChainClient(client, "cosmos").IndexChains(cltest.EmptyCLIContext()))
chains := *r.Renders[0].(*cmd.ChainPresenters)
require.Len(t, chains, 1)
c := chains[0]
assert.Equal(t, chainID, c.ID)
assertTableRenders(t, r)
}

func newRandChainID() *big.Big {
return big.New(testutils.NewRandomEVMChainID())
}
Expand Down
36 changes: 15 additions & 21 deletions core/cmd/cosmos_transaction_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"encoding/json"
"errors"
"fmt"
"math/big"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/urfave/cli"
"go.uber.org/multierr"

Expand Down Expand Up @@ -67,31 +67,25 @@ func (s *Shell) CosmosSendNativeToken(c *cli.Context) (err error) {
return s.errorOut(errors.New("four arguments expected: token, amount, fromAddress and toAddress"))
}

err = sdk.ValidateDenom(c.Args().Get(0))
if err != nil {
return s.errorOut(fmt.Errorf("invalid native token: %w", err))
token := c.Args().Get(0)
if token == "" {
return s.errorOut(errors.New("missing token"))
}

amount, err := sdk.NewDecFromStr(c.Args().Get(1))
if err != nil {
return s.errorOut(multierr.Combine(
fmt.Errorf("invalid coin: %w", err)))
unparsedAmount := c.Args().Get(1)
amount, ok := new(big.Int).SetString(unparsedAmount, 10)
if !ok {
return s.errorOut(fmt.Errorf("invalid int: %s", unparsedAmount))
}

unparsedFromAddress := c.Args().Get(2)
fromAddress, err := sdk.AccAddressFromBech32(unparsedFromAddress)
if err != nil {
return s.errorOut(multierr.Combine(
fmt.Errorf("while parsing withdrawal source address %v",
unparsedFromAddress), err))
if unparsedFromAddress == "" {
return s.errorOut(errors.New("missing from address"))
}

unparsedDestinationAddress := c.Args().Get(3)
destinationAddress, err := sdk.AccAddressFromBech32(unparsedDestinationAddress)
if err != nil {
return s.errorOut(multierr.Combine(
fmt.Errorf("while parsing withdrawal destination address %v",
unparsedDestinationAddress), err))
if unparsedDestinationAddress == "" {
return s.errorOut(errors.New("missing destination address"))
}

chainID := c.String("id")
Expand All @@ -100,11 +94,11 @@ func (s *Shell) CosmosSendNativeToken(c *cli.Context) (err error) {
}

request := cosmos.SendRequest{
DestinationAddress: destinationAddress,
FromAddress: fromAddress,
DestinationAddress: unparsedDestinationAddress,
FromAddress: unparsedFromAddress,
Amount: amount,
CosmosChainID: chainID,
Token: c.Args().Get(0),
Token: token,
AllowHigherAmounts: c.IsSet("force"),
}

Expand Down
Loading

0 comments on commit 737dad1

Please sign in to comment.