Skip to content

Commit

Permalink
Merge branch 'develop' into add-starknet-devnet-down
Browse files Browse the repository at this point in the history
  • Loading branch information
willyrgf authored Jul 11, 2024
2 parents 2216892 + 0361209 commit 8d2111a
Show file tree
Hide file tree
Showing 10 changed files with 273 additions and 218 deletions.
46 changes: 8 additions & 38 deletions integration-tests/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,17 @@ import (
"github.com/stretchr/testify/require"
"gopkg.in/guregu/null.v4"

common_cfg "github.com/smartcontractkit/chainlink-common/pkg/config"
"github.com/smartcontractkit/chainlink-common/pkg/types"
ctfconfig "github.com/smartcontractkit/chainlink-testing-framework/config"
"github.com/smartcontractkit/chainlink-testing-framework/k8s/environment"
"github.com/smartcontractkit/chainlink-testing-framework/k8s/pkg/helm/chainlink"
mock_adapter "github.com/smartcontractkit/chainlink-testing-framework/k8s/pkg/helm/mock-adapter"
"github.com/smartcontractkit/chainlink-testing-framework/utils/ptr"
"github.com/smartcontractkit/chainlink/integration-tests/client"
"github.com/smartcontractkit/chainlink/integration-tests/docker/test_env"
"github.com/smartcontractkit/chainlink/integration-tests/types/config/node"
cl "github.com/smartcontractkit/chainlink/v2/core/services/chainlink"
"github.com/smartcontractkit/chainlink/v2/core/services/job"

chainconfig "github.com/smartcontractkit/chainlink-starknet/integration-tests/config"
"github.com/smartcontractkit/chainlink-starknet/integration-tests/testconfig"
"github.com/smartcontractkit/chainlink-starknet/ops/devnet"
"github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config"
"github.com/smartcontractkit/chainlink-starknet/relayer/pkg/starknet"
)

Expand Down Expand Up @@ -96,6 +90,11 @@ func New(testConfig *testconfig.TestConfig) *Common {
RPCL2InternalAPIKey: chainDetails.L2RPCInternalAPIKey,
},
}
// provide getters for TestConfig (pointers to chain + rpc details)
c.TestConfig.GetChainID = func() string { return c.ChainDetails.ChainID }
c.TestConfig.GetFeederURL = func() string { return c.ChainDetails.FeederURL }
c.TestConfig.GetRPCL2Internal = func() string { return c.RPCDetails.RPCL2Internal }
c.TestConfig.GetRPCL2InternalAPIKey = func() string { return c.RPCDetails.RPCL2InternalAPIKey }

return c
}
Expand All @@ -108,8 +107,7 @@ func (c *Common) Default(t *testing.T, namespacePrefix string) (*Common, error)
}

if *c.TestConfig.Common.InsideK8s {
toml := c.DefaultNodeConfig()
tomlString, err := toml.TOMLString()
tomlString, err := c.TestConfig.GetNodeConfigTOML()
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -147,34 +145,6 @@ func (c *Common) Default(t *testing.T, namespacePrefix string) (*Common, error)
return c, nil
}

func (c *Common) DefaultNodeConfig() *cl.Config {
starkConfig := config.TOMLConfig{
Enabled: ptr.Ptr(true),
ChainID: ptr.Ptr(c.ChainDetails.ChainID),
FeederURL: common_cfg.MustParseURL(c.ChainDetails.FeederURL),
Nodes: []*config.Node{
{
Name: ptr.Ptr("primary"),
URL: common_cfg.MustParseURL(c.RPCDetails.RPCL2Internal),
APIKey: ptr.Ptr(c.RPCDetails.RPCL2InternalAPIKey),
},
},
}
baseConfig := node.NewBaseConfig()
baseConfig.Starknet = config.TOMLConfigs{
&starkConfig,
}
baseConfig.OCR2.Enabled = ptr.Ptr(true)
baseConfig.P2P.V2.Enabled = ptr.Ptr(true)
fiveSecondDuration := common_cfg.MustNewDuration(5 * time.Second)

baseConfig.P2P.V2.DeltaDial = fiveSecondDuration
baseConfig.P2P.V2.DeltaReconcile = fiveSecondDuration
baseConfig.P2P.V2.ListenAddresses = &[]string{"0.0.0.0:6690"}

return baseConfig
}

func (c *Common) SetLocalEnvironment(t *testing.T) {
// Run scripts to set up local test environment
log.Info().Msg("Starting starknet-devnet container...")
Expand Down Expand Up @@ -274,7 +244,7 @@ func (c *Common) CreateJobsForContract(cc *ChainlinkClient, observationSource st

oracleSpec := job.OCR2OracleSpec{
ContractID: ocrControllerAddress,
Relay: types.NetworkStarkNet,
Relay: c.ChainDetails.ChainName,
RelayConfig: bootstrapRelayConfig,
ContractConfigConfirmations: 1, // don't wait for confirmation on devnet
}
Expand Down Expand Up @@ -317,7 +287,7 @@ func (c *Common) CreateJobsForContract(cc *ChainlinkClient, observationSource st

oracleSpec = job.OCR2OracleSpec{
ContractID: ocrControllerAddress,
Relay: types.NetworkStarkNet,
Relay: c.ChainDetails.ChainName,
RelayConfig: relayConfig,
PluginType: "median",
OCRKeyBundleID: null.StringFrom(cc.NKeys[nIdx].OCR2Key.Data.ID),
Expand Down
1 change: 0 additions & 1 deletion integration-tests/common/test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ func (m *OCRv2TestState) DeployCluster() {
WithTestInstance(m.TestConfig.T).
WithTestConfig(m.TestConfig.TestConfig).
WithMockAdapter().
WithCLNodeConfig(m.Common.DefaultNodeConfig()).
WithCLNodes(*m.Common.TestConfig.OCR2.NodeCount).
WithCLNodeOptions(m.Common.TestEnvDetails.NodeOpts...).
WithStandardCleanup().
Expand Down
96 changes: 46 additions & 50 deletions integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ require (
github.com/NethermindEth/juno v0.3.1
github.com/NethermindEth/starknet.go v0.7.1-0.20240401080518-34a506f3cfdb
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df
github.com/go-resty/resty/v2 v2.7.0
github.com/go-resty/resty/v2 v2.11.0
github.com/google/uuid v1.6.0
github.com/lib/pq v1.10.9
github.com/pelletier/go-toml/v2 v2.1.1
github.com/rs/zerolog v1.30.0
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240625074419-c278d083facf
github.com/pelletier/go-toml/v2 v2.2.2
github.com/rs/zerolog v1.31.0
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240703234618-dc1fbe45acc0
github.com/smartcontractkit/chainlink-starknet/ops v0.0.0-20231205180940-ea2e3e916725
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240524210559-72df72854128
github.com/smartcontractkit/chainlink-testing-framework v1.28.8
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240506164029-09f8c7fcd63b
github.com/smartcontractkit/chainlink/v2 v2.10.0-beta0.0.20240524220010-00d58a812b46
github.com/smartcontractkit/seth v0.1.6-0.20240429143720-cacb8160ecec
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240625074951-06ab5e670dba
github.com/smartcontractkit/chainlink-testing-framework v1.31.7
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240708135824-bf9122a8cee6
github.com/smartcontractkit/chainlink/v2 v2.10.0-beta0.0.20240708135824-bf9122a8cee6
github.com/smartcontractkit/seth v1.0.12
github.com/stretchr/testify v1.9.0
github.com/testcontainers/testcontainers-go v0.28.0
go.uber.org/zap v1.26.0
golang.org/x/text v0.14.0
golang.org/x/text v0.16.0
gopkg.in/guregu/null.v4 v4.0.0
)

Expand All @@ -33,7 +33,7 @@ require (
cosmossdk.io/errors v1.0.0 // indirect
cosmossdk.io/math v1.1.2 // indirect
dario.cat/mergo v1.0.0 // indirect
filippo.io/edwards25519 v1.0.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 // indirect
Expand All @@ -46,8 +46,6 @@ require (
github.com/CosmWasm/wasmd v0.40.1 // indirect
github.com/CosmWasm/wasmvm v1.2.4 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/K-Phoen/grabana v0.22.1 // indirect
github.com/K-Phoen/sdk v0.12.4 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
Expand Down Expand Up @@ -77,7 +75,7 @@ require (
github.com/c9s/goprocinfo v0.0.0-20210130143923-c95fcf8c64a8 // indirect
github.com/cdk8s-team/cdk8s-core-go/cdk8s/v2 v2.7.5 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chai2010/gettext-go v1.0.2 // indirect
Expand Down Expand Up @@ -186,7 +184,7 @@ require (
github.com/gogo/protobuf v1.3.3 // indirect
github.com/gogo/status v1.1.1 // indirect
github.com/golang-jwt/jwt/v5 v5.2.0 // indirect
github.com/golang/glog v1.1.2 // indirect
github.com/golang/glog v1.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
Expand All @@ -204,21 +202,20 @@ require (
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/gorilla/sessions v1.2.2 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gosimple/slug v1.13.1 // indirect
github.com/gosimple/unidecode v1.0.1 // indirect
github.com/grafana/dskit v0.0.0-20231120170505-765e343eda4f // indirect
github.com/grafana/gomemcache v0.0.0-20231023152154-6947259a0586 // indirect
github.com/grafana/grafana-foundation-sdk/go v0.0.0-20240326122733-6f96a993222b // indirect
github.com/grafana/loki v1.6.2-0.20231215164305-b51b7d7b5503 // indirect
github.com/grafana/loki/pkg/push v0.0.0-20231201111602-11ef833ed3e4 // indirect
github.com/grafana/pyroscope-go v1.1.1 // indirect
github.com/grafana/pyroscope-go/godeltaprof v0.1.6 // indirect
github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/gtank/merlin v0.1.1 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
Expand Down Expand Up @@ -260,7 +257,7 @@ require (
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/jmoiron/sqlx v1.3.5 // indirect
github.com/jmoiron/sqlx v1.4.0 // indirect
github.com/jonboulle/clockwork v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
Expand Down Expand Up @@ -340,7 +337,7 @@ require (
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/russross/blackfriday v1.6.0 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
Expand All @@ -355,16 +352,16 @@ require (
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/slack-go/slack v0.12.2 // indirect
github.com/smartcontractkit/chain-selectors v1.0.10 // indirect
github.com/smartcontractkit/chainlink-automation v1.0.3 // indirect
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524214833-c362c2ebbd2d // indirect
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 // indirect
github.com/smartcontractkit/chainlink-automation v1.0.4 // indirect
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240621143432-85370a54b141 // indirect
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240702144807-761f63e7b527 // indirect
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240522213638-159fb2d99917 // indirect
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240524201401-88d0b3763b20 // indirect
github.com/smartcontractkit/chainlink-vrf v0.0.0-20231120191722-fef03814f868 // indirect
github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c // indirect
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240708130426-294b81e4afe7 // indirect
github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240405215812-5a72bc9af239 // indirect
github.com/smartcontractkit/libocr v0.0.0-20240702141926-063ceef8c42e // indirect
github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect
github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect
github.com/smartcontractkit/wasp v0.4.5 // indirect
github.com/smartcontractkit/wasp v0.4.7 // indirect
github.com/smartcontractkit/wsrpc v0.8.1 // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/sony/gobreaker v0.5.0 // indirect
Expand Down Expand Up @@ -414,40 +411,39 @@ require (
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/collector/pdata v1.0.0-rcv0016 // indirect
go.opentelemetry.io/collector/semconv v0.87.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.52.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.opentelemetry.io/otel v1.27.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 // indirect
go.opentelemetry.io/otel/metric v1.27.0 // indirect
go.opentelemetry.io/otel/sdk v1.27.0 // indirect
go.opentelemetry.io/otel/trace v1.27.0 // indirect
go.opentelemetry.io/proto/otlp v1.2.0 // indirect
go.starlark.net v0.0.0-20220817180228-f738f5508c12 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/goleak v1.3.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/ratelimit v0.3.0 // indirect
go4.org/netipx v0.0.0-20230125063823-8449b0a6169f // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.18.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
gonum.org/v1/gonum v0.14.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect
google.golang.org/grpc v1.64.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
Expand Down
Loading

0 comments on commit 8d2111a

Please sign in to comment.