-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keystone e2e test #15182
Open
DeividasK
wants to merge
122
commits into
develop
Choose a base branch
from
dk-keystone-e2e-test
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Keystone e2e test #15182
Changes from all commits
Commits
Show all changes
122 commits
Select commit
Hold shift + click to select a range
36031ed
init, wip
skudasov 5420691
fix go mod
skudasov fc73619
fix go mod again
skudasov 038b11e
update
skudasov b7a94b5
fix go mod
skudasov 05b2233
ready to test
skudasov ab0baf3
update deps
skudasov 0a13f5e
update
skudasov 7d8ffb3
update README
skudasov dce9c56
fix
skudasov d6cc825
fix readme
skudasov 9be9a8a
try mockserver in CI
skudasov dc8fe4d
try reach the localhost mock in CI
skudasov cc4e526
check it can work both locally and in CI without code modification
skudasov e0465e6
check again
skudasov c75d06e
use the same Go version
skudasov c143938
example of CL client connection
skudasov 85d9973
connect all the clients
skudasov 3111ad8
example with contracts
skudasov d1ca470
finalize
skudasov cf1ea62
readmes
skudasov 95c9562
ignore caching, update
skudasov 2674e22
change CI workflow name
skudasov 8e8597a
re-trigger
skudasov 8fd3436
fix readme
skudasov 547f054
switch to v0.1.0
skudasov 7639522
fix go mod
skudasov d2581b2
use strict config version
skudasov 430f573
update go mod
skudasov 2ddc36c
add Sepolia example
skudasov 81c972f
simplify configuration
skudasov 5a82459
copy capabilities into container
skudasov f28c64a
expose p2p ports, add Fuji example
skudasov 87beabc
fund nodes
skudasov 29d8b77
use shared PG nodeset
skudasov db528ae
static node names
skudasov cde6a27
capabilities perms
skudasov 91aa2a4
capabilities perms again
skudasov f5a1a79
unified config for one or more node overrides
skudasov b1145e3
comment config
skudasov 7503510
docker rebuild from config
skudasov 3cd15e1
simplify, explicit rebuild using config, no flags
skudasov 95e45ae
--wip-- [skip CI]
DeividasK 5298829
Fetch node keys and generate OCR3 config
DeividasK 8c942eb
Configure KV store OCR contract
DeividasK dc0aeb6
--wip-- [skip CI]
DeividasK 9bcf265
Merge
DeividasK 725a5d3
Working capability setup
DeividasK 67e3efa
Deploy mock streams capabilities
DeividasK 3ce6f55
OCR3 not working (incorrect keys)
DeividasK e2b0887
--wip-- [skip CI]
DeividasK df8f8d3
OCR3 capability added successfully
DeividasK 1590f69
Target capability configuration
DeividasK db84b3c
--wip-- [skip CI]
DeividasK d2f2a73
--wip-- [skip CI]
DeividasK 0881f6a
--wip-- [skip CI]
DeividasK e0eba92
--wip-- [skip CI]
DeividasK e6e73fd
--wip-- [skip CI]
DeividasK 5d381df
OCR endpoint initializes
DeividasK 342aae6
fix, use default configs on start and replace config instead overridi…
skudasov 4c4d151
--wip-- [skip CI]
DeividasK 421ebf6
Merge branch 'develop' into dk-keystone-e2e-test
DeividasK b7fee52
Add workflows
DeividasK fd9acca
--wip-- [skip CI]
DeividasK 781f6c6
E2E test sets up the environment correctly
DeividasK 6642fee
Cleanup
DeividasK b7e606d
Cleanup
DeividasK 73caca4
Run the test in CI
DeividasK 64bbe1b
Less logs; increase timeout
DeividasK 0dfdbfc
Reduce timeout
DeividasK d170c19
Move things around and cleanup
DeividasK a05205d
Refactor capabiliteis registry evm contract wrapper
DeividasK a60018e
Update go.mod and tidy
DeividasK f892377
Update CI config
DeividasK 5a47543
Cleanup
DeividasK 6e49339
Increase go test timeout
DeividasK dda8e3b
Upgrade CTFv2
DeividasK c366f08
try beefy machine
skudasov c9c9228
Double OCR timeouts config
DeividasK a86bff5
Add sleep 20
DeividasK 1b8fe62
Log URLs
DeividasK 001c70d
Add mroe sleep
DeividasK 5c26247
Try another thing
DeividasK 1a21e70
Print entire job spec
DeividasK 1ec9511
try the version with exposed raw IPs
skudasov e1974e6
increase timeout, try non-aliased network
skudasov a3fa576
try 32 cores and log ips
skudasov 1630563
try no-ipv6 network
skudasov 532d64c
long blocks, add logs
skudasov 6481c5b
fix upload
skudasov 3aec009
update the framework, switch back the runner
skudasov e74c833
Use explicit linux amd64 streams binary
DeividasK e202dce
Polish
DeividasK 7aa7883
Go mod tidy
DeividasK 851990d
Remove sleep
DeividasK 271a5db
Reduce test waiting time
DeividasK 7058d3a
Run generate
DeividasK 31249fe
Reduce test timeout windown
DeividasK f41b892
Merge remote-tracking branch 'origin/develop' into dk-keystone-e2e-test
DeividasK 1f25769
update CTF, update dockerfile paths
skudasov a04e8b3
Move e2e tests to the integration-tests folder
DeividasK c0c9078
Update CI
DeividasK 1b3d82e
Re-generate & tidy
DeividasK ef5d6d4
Fix lint issues
DeividasK 8e4dcdd
upgrade CTF
skudasov 53c1a3d
Merge branch 'develop' into dk-keystone-e2e-test
skudasov 5006478
merge
skudasov 29680ef
try with built image
skudasov 843b6ff
debug image
skudasov 50ac1b8
combine CL image with version
skudasov d16311a
try tag
skudasov c92fea5
require build
skudasov 591c9f2
try different region
skudasov fcbd7f7
stub missing region
skudasov 7cfab70
re-trigger
skudasov 49b858e
auth
skudasov e7bd381
remove incompatible image build
skudasov 18bc11a
rollback config
skudasov 9f62f89
Updates to get the test working again
DeividasK bb02a58
Add more logs
DeividasK 4a14601
Change OCR configuration
DeividasK d0b7af3
Change OCR config again
DeividasK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,4 @@ credentials.env | |
gcr_creds.env | ||
|
||
go.work | ||
go.work.sum | ||
go.work.sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# CTFv2 - Observability stack | ||
**/compose | ||
**/compose/* | ||
**/*cache.toml | ||
|
||
# CTFv2 - Blockscout | ||
**/blockscout |
70 changes: 70 additions & 0 deletions
70
...tests/capabilities/components/evmcontracts/capabilities_registry/capabilities_registry.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package capabilities_registry | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/ethereum/go-ethereum/accounts/abi/bind" | ||
"github.com/ethereum/go-ethereum/common" | ||
|
||
"github.com/smartcontractkit/chainlink-testing-framework/seth" | ||
cr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry" | ||
) | ||
|
||
type CapabilitiesRegistryInstance struct { | ||
Address common.Address | ||
Contract *cr.CapabilitiesRegistry | ||
sc *seth.Client | ||
ExistingHashedCapabilitiesIDs [][32]byte | ||
} | ||
|
||
func Deploy(sc *seth.Client) (*CapabilitiesRegistryInstance, error) { | ||
capabilitiesRegistryAddress, tx, capabilitiesRegistryContract, err := cr.DeployCapabilitiesRegistry( | ||
sc.NewTXOpts(), | ||
sc.Client, | ||
) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
_, err = bind.WaitMined(context.Background(), sc.Client, tx) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
fmt.Printf("🚀 Deployed \033[1mcapabilities_registry\033[0m contract at \033[1m%s\033[0m\n", capabilitiesRegistryAddress) | ||
return &CapabilitiesRegistryInstance{ | ||
sc: sc, | ||
Address: capabilitiesRegistryAddress, | ||
Contract: capabilitiesRegistryContract, | ||
}, nil | ||
} | ||
|
||
func (cr *CapabilitiesRegistryInstance) AddCapabilities(capabilities []cr.CapabilitiesRegistryCapability) error { | ||
tx, err := cr.Contract.AddCapabilities( | ||
cr.sc.NewTXOpts(), | ||
capabilities, | ||
) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
_, err = bind.WaitMined(context.Background(), cr.sc.Client, tx) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
for _, capability := range capabilities { | ||
hashedCapabilityID, err := cr.Contract.GetHashedCapabilityId( | ||
cr.sc.NewCallOpts(), | ||
capability.LabelledName, | ||
capability.Version, | ||
) | ||
if err != nil { | ||
return err | ||
} | ||
cr.ExistingHashedCapabilitiesIDs = append(cr.ExistingHashedCapabilitiesIDs, hashedCapabilityID) | ||
} | ||
|
||
return nil | ||
} |
67 changes: 67 additions & 0 deletions
67
integration-tests/capabilities/components/evmcontracts/forwarder/forwarder.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package forwarder | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/ethereum/go-ethereum/accounts/abi/bind" | ||
"github.com/ethereum/go-ethereum/common" | ||
|
||
"github.com/smartcontractkit/chainlink-testing-framework/seth" | ||
|
||
forwarder_wrapper "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder" | ||
) | ||
|
||
type ForwarderInstance struct { | ||
Address common.Address | ||
Contract *forwarder_wrapper.KeystoneForwarder | ||
sc *seth.Client | ||
ExistingHashedCapabilitiesIDs [][32]byte | ||
} | ||
|
||
func Deploy(sc *seth.Client) (*ForwarderInstance, error) { | ||
forwarderAddress, tx, forwarderContract, err := forwarder_wrapper.DeployKeystoneForwarder( | ||
sc.NewTXOpts(), | ||
sc.Client, | ||
) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
_, err = bind.WaitMined(context.Background(), sc.Client, tx) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
fmt.Printf("🚀 Deployed \033[1mforwarder\033[0m contract at \033[1m%s\033[0m\n", forwarderAddress) | ||
return &ForwarderInstance{ | ||
sc: sc, | ||
Address: forwarderAddress, | ||
Contract: forwarderContract, | ||
}, nil | ||
} | ||
|
||
func (i *ForwarderInstance) SetConfig( | ||
donID uint32, | ||
configVersion uint32, | ||
f uint8, | ||
signers []common.Address, | ||
) error { | ||
tx, err := i.Contract.SetConfig( | ||
i.sc.NewTXOpts(), | ||
donID, | ||
configVersion, | ||
f, | ||
signers, | ||
) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
_, err = bind.WaitMined(context.Background(), i.sc.Client, tx) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package onchain | ||
|
||
import ( | ||
"context" | ||
"crypto/ecdsa" | ||
"errors" | ||
"fmt" | ||
"math/big" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/ethereum/go-ethereum/crypto" | ||
"github.com/ethereum/go-ethereum/ethclient" | ||
|
||
"github.com/smartcontractkit/chainlink-testing-framework/framework" | ||
"github.com/smartcontractkit/chainlink-testing-framework/framework/clclient" | ||
"github.com/smartcontractkit/chainlink-testing-framework/seth" | ||
) | ||
|
||
func SendETH(client *ethclient.Client, privateKeyHex string, toAddress string, amount *big.Float) error { | ||
privateKey, err := crypto.HexToECDSA(privateKeyHex) | ||
if err != nil { | ||
return fmt.Errorf("failed to parse private key: %w", err) | ||
} | ||
wei := new(big.Int) | ||
amountWei := new(big.Float).Mul(amount, big.NewFloat(1e18)) | ||
amountWei.Int(wei) | ||
|
||
publicKey := privateKey.Public() | ||
publicKeyECDSA, ok := publicKey.(*ecdsa.PublicKey) | ||
if !ok { | ||
return fmt.Errorf("error casting public key to ECDSA") | ||
} | ||
fromAddress := crypto.PubkeyToAddress(*publicKeyECDSA) | ||
|
||
nonce, err := client.PendingNonceAt(context.Background(), fromAddress) | ||
if err != nil { | ||
return fmt.Errorf("failed to fetch nonce: %w", err) | ||
} | ||
|
||
gasPrice, err := client.SuggestGasPrice(context.Background()) | ||
if err != nil { | ||
return fmt.Errorf("failed to fetch gas price: %w", err) | ||
} | ||
gasLimit := uint64(21000) // Standard gas limit for ETH transfer | ||
|
||
tx := types.NewTransaction(nonce, common.HexToAddress(toAddress), wei, gasLimit, gasPrice, nil) | ||
|
||
chainID, err := client.NetworkID(context.Background()) | ||
if err != nil { | ||
return fmt.Errorf("failed to fetch chain ID: %w", err) | ||
} | ||
signedTx, err := types.SignTx(tx, types.NewEIP155Signer(chainID), privateKey) | ||
if err != nil { | ||
return fmt.Errorf("failed to sign transaction: %w", err) | ||
} | ||
|
||
err = client.SendTransaction(context.Background(), signedTx) | ||
if err != nil { | ||
return fmt.Errorf("failed to send transaction: %w", err) | ||
} | ||
framework.L.Info().Msgf("Transaction sent: %s", signedTx.Hash().Hex()) | ||
return nil | ||
} | ||
|
||
func FundNodes(sc *seth.Client, nodes []*clclient.ChainlinkClient, pkey string, ethAmount float64) error { | ||
if ethAmount == 0 { | ||
return errors.New("funds_eth is 0, set some value in config, ex.: funds_eth = 30.0") | ||
} | ||
for _, cl := range nodes { | ||
ek, err := cl.ReadPrimaryETHKey() | ||
if err != nil { | ||
return err | ||
} | ||
if err := SendETH(sc.Client, pkey, ek.Attributes.Address, big.NewFloat(ethAmount)); err != nil { | ||
return fmt.Errorf("failed to fund CL node %s: %w", ek.Attributes.Address, err) | ||
} | ||
} | ||
return nil | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we not reuse, extend and unify on the work in deployment/keystone?
ccip is doing something similiar -- all deployment logic is unified and they have a
devenv
for integration tests