Skip to content

Commit

Permalink
Merge branch 'develop' into etb/instructions-codec
Browse files Browse the repository at this point in the history
  • Loading branch information
EasterTheBunny authored Dec 10, 2024
2 parents 19c8a2d + 1357aa0 commit 2972da2
Show file tree
Hide file tree
Showing 16 changed files with 393 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/e2e_custom_cl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
required: true
default: develop
type: string
team:
description: Team to run the tests for (e.g. BIX, CCIP)
required: true
type: string

env:
CL_ECR: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink
Expand Down Expand Up @@ -335,6 +339,7 @@ jobs:
env:
E2E_TEST_CHAINLINK_IMAGE: ${{ env.CL_ECR }}
E2E_TEST_SOLANA_SECRET: thisisatestingonlysecret
CHAINLINK_USER_TEAM: ${{ github.event.inputs.team || 'BIX' }}

e2e_program_upgrade_tests:
name: E2E Program Upgrade Tests
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/e2e_testnet_daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
description: 'Key to run tests with custom test secrets like ws url, rpc url, private key, etc.'
required: false
type: string
team:
description: Team to run the tests for (e.g. BIX, CCIP)
required: true
type: string
schedule:
- cron: '0 6 * * *'
# Only run 1 of this workflow at a time per PR
Expand Down Expand Up @@ -175,4 +179,5 @@ jobs:
E2E_TEST_COMMON_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} # default private key
E2E_TEST_COMMON_RPC_URL: https://api.devnet.solana.com # default url
E2E_TEST_COMMON_WS_URL: https://api.devnet.solana.com # default url
E2E_TEST_SOLANA_SECRET: thisisatestingonlysecret
E2E_TEST_SOLANA_SECRET: thisisatestingonlysecret
CHAINLINK_USER_TEAM: ${{ github.event.inputs.team || 'BIX' }}
9 changes: 8 additions & 1 deletion .github/workflows/soak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ on:
default: develop
required: true
type: string
team:
description: Team to run the tests for (e.g. BIX, CCIP)
required: true
type: string
default: BIX
env:
CL_ECR: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink
CONTRACT_ARTIFACTS_PATH: contracts/target/deploy
Expand All @@ -41,6 +46,7 @@ jobs:
e2e_custom_build_artifacts:
name: E2E Custom Build Artifacts
environment: integration
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
Expand Down Expand Up @@ -116,4 +122,5 @@ jobs:
cache_key_id: solana-e2e-${{ env.MOD_CACHE_VERSION }}
cache_restore_only: "false"
env:
E2E_TEST_SOLANA_SECRET: thisisatestingonlysecret
E2E_TEST_SOLANA_SECRET: thisisatestingonlysecret
CHAINLINK_USER_TEAM: ${{ inputs.team }}
14 changes: 14 additions & 0 deletions integration-tests/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,24 @@ func BuildNodeContractPairID(node *client.ChainlinkClient, ocr2Addr string) (str
}

func (c *Common) Default(t *testing.T, namespacePrefix string) (*Common, error) {
productName := "data-feedsv2.0"
nsLabels, err := environment.GetRequiredChainLinkNamespaceLabels(productName, "soak")
if err != nil {
return nil, err
}

workloadPodLabels, err := environment.GetRequiredChainLinkWorkloadAndPodLabels(productName, "soak")
if err != nil {
return nil, err
}

c.TestEnvDetails.K8Config = &environment.Config{
NamespacePrefix: fmt.Sprintf("solana-%s", namespacePrefix),
TTL: c.TestEnvDetails.TestDuration,
Test: t,
Labels: nsLabels,
WorkloadLabels: workloadPodLabels,
PodLabels: workloadPodLabels,
}

if *c.TestConfig.Common.InsideK8s {
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ require (
github.com/pelletier/go-toml/v2 v2.2.3
github.com/rs/zerolog v1.33.0
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241127162636-07aa781ee1f4
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241127210503-88cca3779525
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.17
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241204153209-c3a71b0eef99
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.18
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.9
github.com/smartcontractkit/chainlink/deployment v0.0.0-20241127192805-54ea74a13bfe
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20241204033247-732cc15aa87d
github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20241204033247-732cc15aa87d
github.com/smartcontractkit/chainlink/deployment v0.0.0-20241205144849-138d4c51ad0d
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20241205144849-138d4c51ad0d
github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20241205144849-138d4c51ad0d
github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12
github.com/stretchr/testify v1.9.0
github.com/testcontainers/testcontainers-go v0.34.0
Expand Down
16 changes: 8 additions & 8 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1429,20 +1429,20 @@ github.com/smartcontractkit/chainlink-protos/orchestrator v0.3.2 h1:onBe3DqNrbtO
github.com/smartcontractkit/chainlink-protos/orchestrator v0.3.2/go.mod h1:m/A3lqD7ms/RsQ9BT5P2uceYY0QX5mIt4KQxT2G6qEo=
github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8 h1:tNS7U9lrxkFvEuyxQv11HHOiV9LPDGC9wYEy+yM/Jv4=
github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8/go.mod h1:EBrEgcdIbwepqguClkv8Ohy7CbyWSJaE4EC9aBJlQK0=
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.17 h1:Fw2F8fKa5QdOUzLAj6Y/EB6XFC0QtK2pw5bqQSatL4A=
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.17/go.mod h1:NwmlNKqrb02v4Sci4b5KW644nfH2BW+FrKbWwTN5r6M=
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.18 h1:a3xetGZh2nFO1iX5xd9OuqiCkgbWLvW6fTN6fgVubPo=
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.18/go.mod h1:NwmlNKqrb02v4Sci4b5KW644nfH2BW+FrKbWwTN5r6M=
github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 h1:VIxK8u0Jd0Q/VuhmsNm6Bls6Tb31H/sA3A/rbc5hnhg=
github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0/go.mod h1:lyAu+oMXdNUzEDScj2DXB2IueY+SDXPPfyl/kb63tMM=
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.9 h1:yB1x5UXvpZNka+5h57yo1/GrKfXKCqMzChCISpldZx4=
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.9/go.mod h1:lJk0atEJ5Zyo3Tqrmf1Pl9jUEe79EgDb9bD3K5OTUBI=
github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.2 h1:7bCdbTUWzyczQg+kwHCxlx6y07zE8HNB8+ntTne6qd8=
github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.2/go.mod h1:MltlNu3jcXm/DyLN98I5TFNtu/o1NNAcaPAFKMXWk70=
github.com/smartcontractkit/chainlink/deployment v0.0.0-20241127192805-54ea74a13bfe h1:jUS49b8OODR6552wqvzNBMXHwgXV7iPZmz9lmESTsto=
github.com/smartcontractkit/chainlink/deployment v0.0.0-20241127192805-54ea74a13bfe/go.mod h1:ueUOL11tGBu1TTonZcIeD6/3av2iZE5AydxtclG8Dvo=
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20241204033247-732cc15aa87d h1:vV41ofCA5TGaHpoD2UHiN/VAR8xRqycWw4Fy75pXQj8=
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20241204033247-732cc15aa87d/go.mod h1:xCJuze3GgG6Ec/gLMAS/47FC/SzEa/Y+YiD5g4wvYTM=
github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20241204033247-732cc15aa87d h1:W5f72PgRWg1ChYQBcwBZosrypWSwx7ShQNx3TKi7rwI=
github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20241204033247-732cc15aa87d/go.mod h1:ofC2S3XuOMdqEew73eCNmV7jgWxayBayuEOLELR1CBM=
github.com/smartcontractkit/chainlink/deployment v0.0.0-20241205144849-138d4c51ad0d h1:nxjwsxk3qZOEFuoYJN9a61xBvwkFZLNMv24Z9QjYlnE=
github.com/smartcontractkit/chainlink/deployment v0.0.0-20241205144849-138d4c51ad0d/go.mod h1:jz4/Ko0lL7fhiuiBsVB53MNX2lEWK0VRfsxz232XRGA=
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20241205144849-138d4c51ad0d h1:Sl3/QHSA91H9nSaAVo9biKRpqIfWTKcGAKbCoWO6jr8=
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20241205144849-138d4c51ad0d/go.mod h1:iRiKHT+MfvjrIuJuO/cGuWBxULctmlz2DFD3KDDU7oI=
github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20241205144849-138d4c51ad0d h1:YSHlmOAuZvaBmjhENcLuyaDRy6+CcVqvsy6bF30Ovxw=
github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20241205144849-138d4c51ad0d/go.mod h1:r2inuDnmNVZzUD/AsqgBs9exi9mIYwg8BgAnT+PyXU4=
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs=
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA=
github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 h1:NzZGjaqez21I3DU7objl3xExTH4fxYvzTqar8DC6360=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/testconfig/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ inside_k8 = false
network = "localnet"
user = "default"
stateful_db = false
devnet_image = "anzaxyz/agave:v2.0.17"
devnet_image = "anzaxyz/agave:v2.0.18"

[OCR2]
node_count = 6
Expand Down
53 changes: 53 additions & 0 deletions pkg/solana/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ type Reader interface {
ChainID(ctx context.Context) (mn.StringID, error)
GetFeeForMessage(ctx context.Context, msg string) (uint64, error)
GetLatestBlock(ctx context.Context) (*rpc.GetBlockResult, error)
GetTransaction(ctx context.Context, txHash solana.Signature, opts *rpc.GetTransactionOpts) (*rpc.GetTransactionResult, error)
GetBlocks(ctx context.Context, startSlot uint64, endSlot *uint64) (rpc.BlocksResult, error)
GetBlocksWithLimit(ctx context.Context, startSlot uint64, limit uint64) (*rpc.BlocksResult, error)
GetBlock(ctx context.Context, slot uint64) (*rpc.GetBlockResult, error)
GetSignaturesForAddressWithOpts(ctx context.Context, addr solana.PublicKey, opts *rpc.GetSignaturesForAddressOpts) ([]*rpc.TransactionSignature, error)
}

// AccountReader is an interface that allows users to pass either the solana rpc client or the relay client
Expand Down Expand Up @@ -121,6 +124,43 @@ func (c *Client) SlotHeightWithCommitment(ctx context.Context, commitment rpc.Co
return v.(uint64), err
}

func (c *Client) GetSignaturesForAddressWithOpts(ctx context.Context, addr solana.PublicKey, opts *rpc.GetSignaturesForAddressOpts) ([]*rpc.TransactionSignature, error) {
done := c.latency("signatures_for_address")
defer done()

ctx, cancel := context.WithTimeout(ctx, c.contextDuration)
defer cancel()
if opts == nil {
opts = &rpc.GetSignaturesForAddressOpts{}
}
if opts.Commitment == "" {
opts.Commitment = c.commitment
}
return c.rpc.GetSignaturesForAddressWithOpts(ctx, addr, opts)
}

func (c *Client) GetTransaction(ctx context.Context, txHash solana.Signature, opts *rpc.GetTransactionOpts) (*rpc.GetTransactionResult, error) {
done := c.latency("transaction")
defer done()

ctx, cancel := context.WithTimeout(ctx, c.contextDuration)
defer cancel()

if opts == nil {
opts = &rpc.GetTransactionOpts{
Encoding: solana.EncodingBase64,
}
}
if opts.Commitment == "" {
opts.Commitment = c.commitment
}

v, err, _ := c.requestGroup.Do("GetTransaction", func() (interface{}, error) {
return c.rpc.GetTransaction(ctx, txHash, opts)
})
return v.(*rpc.GetTransactionResult), err
}

func (c *Client) GetAccountInfoWithOpts(ctx context.Context, addr solana.PublicKey, opts *rpc.GetAccountInfoOpts) (*rpc.GetAccountInfoResult, error) {
done := c.latency("account_info")
defer done()
Expand All @@ -131,6 +171,19 @@ func (c *Client) GetAccountInfoWithOpts(ctx context.Context, addr solana.PublicK
return c.rpc.GetAccountInfoWithOpts(ctx, addr, opts)
}

func (c *Client) GetBlocks(ctx context.Context, startSlot uint64, endSlot *uint64) (out rpc.BlocksResult, err error) {
done := c.latency("blocks")
defer done()

ctx, cancel := context.WithTimeout(ctx, c.contextDuration)
defer cancel()

v, err, _ := c.requestGroup.Do("GetBlocks", func() (interface{}, error) {
return c.rpc.GetBlocks(ctx, startSlot, endSlot, c.commitment)
})
return v.(rpc.BlocksResult), err
}

func (c *Client) LatestBlockhash(ctx context.Context) (*rpc.GetLatestBlockhashResult, error) {
done := c.latency("latest_blockhash")
defer done()
Expand Down
44 changes: 44 additions & 0 deletions pkg/solana/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,50 @@ func TestClient_Writer_Integration(t *testing.T) {

assert.Nil(t, statuses[0].Err)
assert.NotNil(t, statuses[1].Err)

getTxResult, err := c.GetTransaction(ctx, sigSuccess, nil)
assert.NoError(t, err)
assert.NotNil(t, getTxResult)

sigs, err := c.GetSignaturesForAddressWithOpts(ctx, pubKey, nil)
assert.NoError(t, err)
requiredSigs := map[solana.Signature]bool{
sigSuccess: false,
sigFail: false,
}
for _, sig := range sigs {
if _, required := requiredSigs[sig.Signature]; required {
requiredSigs[sig.Signature] = true
}
}
require.True(t, requiredSigs[sigSuccess] && requiredSigs[sigFail])
}

func TestClient_GetBlocks(t *testing.T) {
url := SetupLocalSolNode(t)
privKey, err := solana.NewRandomPrivateKey()
require.NoError(t, err)
pubKey := privKey.PublicKey()
FundTestAccounts(t, []solana.PublicKey{pubKey}, url)

requestTimeout := 5 * time.Second
lggr := logger.Test(t)
cfg := config.NewDefault()

ctx := tests.Context(t)
c, err := NewClient(url, cfg, requestTimeout, lggr)
require.NoError(t, err)

// Verify we can retrieve blocks
startSlot := uint64(1)
endSlot := uint64(10)
require.Eventually(t,
func() bool {
blocks, err := c.GetBlocks(ctx, startSlot, &endSlot)
require.NoError(t, err) // don't mask error within false
return len(blocks) >= 2 // slots != blocks (expect multiple blocks for 10 slots)
},
requestTimeout, 500*time.Millisecond)
}

func TestClient_SendTxDuplicates_Integration(t *testing.T) {
Expand Down
Loading

0 comments on commit 2972da2

Please sign in to comment.