Skip to content
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

BCI-1780: Failed Tx Inclusion RPC Changes #325

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion integration-tests/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
uuid "github.com/satori/go.uuid"
"gopkg.in/guregu/null.v4"

"github.com/smartcontractkit/caigo/gateway"
"github.com/NethermindEth/starknet.go/gateway"

"github.com/smartcontractkit/chainlink-env/environment"
"github.com/smartcontractkit/chainlink-env/pkg/alias"
Expand Down
49 changes: 32 additions & 17 deletions integration-tests/common/test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import (
"testing"
"time"

caigo "github.com/smartcontractkit/caigo"
caigotypes "github.com/smartcontractkit/caigo/types"
"github.com/NethermindEth/juno/core/felt"
caigo "github.com/NethermindEth/starknet.go"
starknettypes "github.com/NethermindEth/starknet.go/types"
starknetutils "github.com/NethermindEth/starknet.go/utils"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -266,20 +268,28 @@ func (testState *Test) ValidateRounds(rounds int, isSoak bool) error {
var positive bool

// validate balance in aggregator
linkContractAddress, err := starknetutils.HexToFelt(testState.LinkTokenAddr)
if err != nil {
return err
}
contractAddress, err := starknetutils.HexToFelt(testState.OCRAddr)
if err != nil {
return err
}
resLINK, errLINK := testState.Starknet.CallContract(ctx, starknet.CallOps{
ContractAddress: caigotypes.StrToFelt(testState.LinkTokenAddr),
Selector: "balance_of",
Calldata: []string{testState.OCRAddr},
ContractAddress: linkContractAddress,
Selector: starknettypes.GetSelectorFromNameFelt("balance_of"),
Calldata: []*felt.Felt{contractAddress},
})
require.NoError(testState.T, errLINK, "Reader balance from LINK contract should not fail")
require.NoError(testState.T, errLINK, "Reader balance from LINK contract should not fail", "err", errLINK)
resAgg, errAgg := testState.Starknet.CallContract(ctx, starknet.CallOps{
ContractAddress: caigotypes.StrToFelt(testState.OCRAddr),
Selector: "link_available_for_payment",
ContractAddress: contractAddress,
Selector: starknettypes.GetSelectorFromNameFelt("link_available_for_payment"),
})
require.NoError(testState.T, errAgg, "Reader balance from LINK contract should not fail")
balLINK, _ := new(big.Int).SetString(resLINK[0], 0)
balAgg, _ := new(big.Int).SetString(resAgg[1], 0)
isNegative, _ := new(big.Int).SetString(resAgg[0], 0)
require.NoError(testState.T, errAgg, "link_available_for_payment should not fail", "err", errAgg)
balLINK := resLINK[0].BigInt(big.NewInt(0))
balAgg := resAgg[1].BigInt(big.NewInt(0))
isNegative := resAgg[0].BigInt(big.NewInt(0))
if isNegative.Sign() > 0 {
balAgg = new(big.Int).Neg(balAgg)
}
Expand All @@ -289,8 +299,8 @@ func (testState *Test) ValidateRounds(rounds int, isSoak bool) error {

for start := time.Now(); time.Since(start) < testState.Common.TestDuration; {
l.Info().Msg(fmt.Sprintf("Elapsed time: %s, Round wait: %s ", time.Since(start), testState.Common.TestDuration))
res, err := testState.OCR2Client.LatestTransmissionDetails(ctx, caigotypes.StrToFelt(testState.OCRAddr))
require.NoError(testState.T, err, "Failed to get latest transmission details")
res, err2 := testState.OCR2Client.LatestTransmissionDetails(ctx, contractAddress)
require.NoError(testState.T, err2, "Failed to get latest transmission details")
// end condition: enough rounds have occurred
if !isSoak && increasing >= rounds && positive {
break
Expand Down Expand Up @@ -361,15 +371,20 @@ func (testState *Test) ValidateRounds(rounds int, isSoak bool) error {

// Test proxy reading
// TODO: would be good to test proxy switching underlying feeds

proxyAddress, err := starknetutils.HexToFelt(testState.ProxyAddr)
if err != nil {
return err
}
roundDataRaw, err := testState.Starknet.CallContract(ctx, starknet.CallOps{
ContractAddress: caigotypes.StrToFelt(testState.ProxyAddr),
Selector: "latest_round_data",
ContractAddress: proxyAddress,
Selector: starknettypes.GetSelectorFromNameFelt("latest_round_data"),
})
if !isSoak {
require.NoError(testState.T, err, "Reading round data from proxy should not fail")
assert.Equal(testState.T, len(roundDataRaw), 5, "Round data from proxy should match expected size")
}
valueBig, err := starknet.HexToUnsignedBig(roundDataRaw[1])
valueBig := roundDataRaw[1].BigInt(big.NewInt(0))
require.NoError(testState.T, err)
value := valueBig.Int64()
if value < 0 {
Expand Down
14 changes: 12 additions & 2 deletions integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ module github.com/smartcontractkit/chainlink-starknet/integration-tests
go 1.20

require (
github.com/NethermindEth/juno v0.3.1
github.com/NethermindEth/starknet.go v0.4.2-0.20230830055456-308b763a11d3
github.com/rs/zerolog v1.29.1
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b
github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704
github.com/smartcontractkit/chainlink-env v0.36.1-0.20230802063028-a432269a7384
github.com/smartcontractkit/chainlink-relay v0.1.7-0.20230808141159-4e20b0757f3a
github.com/smartcontractkit/chainlink-starknet/ops v0.0.0-20230329050701-40e3b18bb026
Expand All @@ -14,6 +15,13 @@ require (
github.com/smartcontractkit/chainlink/v2 v2.2.1-0.20230809180636-8e89b62488d7
)

require (
github.com/bits-and-blooms/bitset v1.7.0 // indirect
github.com/consensys/gnark-crypto v0.11.0 // indirect
github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect
github.com/test-go/testify v1.1.4 // indirect
)

require (
contrib.go.opencensus.io/exporter/stackdriver v0.13.5 // indirect
cosmossdk.io/errors v1.0.0 // indirect
Expand Down Expand Up @@ -48,7 +56,7 @@ require (
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // indirect
github.com/cockroachdb/pebble v0.0.0-20230209222158-0568b5fd3d14 // indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/cometbft/cometbft v0.37.2 // indirect
github.com/cometbft/cometbft-db v0.7.0 // indirect
Expand Down Expand Up @@ -380,6 +388,8 @@ require (
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace github.com/NethermindEth/starknet.go => github.com/augustbleeds/starknet.go v0.4.2-0.20230912155424-048179bee72e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove?

Or group below and add a comment? And would it be worth creating a smartcontkit/strknet.go fork repo?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the review, the replace was just meant to be a temp solution. I can remove it now because starknet.go has merged the changes into their repo!


replace (
// Fix go mod tidy issue for ambiguous imports from go-ethereum
// See https://github.com/ugorji/go/issues/279
Expand Down
12 changes: 10 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0
github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0=
github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
github.com/NethermindEth/juno v0.3.1 h1:AW72LiAm9gqUeCVJWvepnZcTnpU4Vkl0KzPMxS+42FA=
github.com/NethermindEth/juno v0.3.1/go.mod h1:SGbTpgGaCsxhFsKOid7Ylnz//WZ8swtILk+NbHGsk/Q=
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/OneOfOne/xxhash v1.2.5 h1:zl/OfRA6nftbBK9qTohYBJ5xvw6C/oNKizR7cZGl3cI=
Expand All @@ -113,6 +115,8 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV
github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/augustbleeds/starknet.go v0.4.2-0.20230912155424-048179bee72e h1:MDgZ7KPzwKRSzwSHqiifOXdyavuapggpXfYR7bPqW7c=
github.com/augustbleeds/starknet.go v0.4.2-0.20230912155424-048179bee72e/go.mod h1:jYturIQWt6EvmiALjvNgHNzNtACuS+Rb7MngXLaPHeI=
github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHSxpiH9JdtuBj0=
github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY=
github.com/avast/retry-go/v4 v4.3.4 h1:pHLkL7jvCvP317I8Ge+Km2Yhntv3SdkJm7uekkqbKhM=
Expand All @@ -133,6 +137,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s=
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bits-and-blooms/bitset v1.7.0 h1:YjAGVd3XmtK9ktAbX8Zg2g2PwLIMjGREZJHlV4j7NEo=
github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
github.com/blendle/zapdriver v1.3.1 h1:C3dydBOWYRiOk+B8X9IVZ5IOe+7cl+tGOexN4QqHfpE=
github.com/blendle/zapdriver v1.3.1/go.mod h1:mdXfREi6u5MArG4j9fewC+FGnXaBR+T4Ox4J2u4eHCc=
Expand Down Expand Up @@ -193,8 +199,8 @@ github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZO
github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs=
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE=
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs=
github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 h1:ytcWPaNPhNoGMWEhDvS3zToKcDpRsLuRolQJBVGdozk=
github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811/go.mod h1:Nb5lgvnQ2+oGlE/EyZy4+2/CxRh9KfvCXnag1vtpxVM=
github.com/cockroachdb/pebble v0.0.0-20230209222158-0568b5fd3d14 h1:4spJmU4jzTXRbaQV9yrGHBDL/nTgaebjbW4Qidtkz0w=
github.com/cockroachdb/pebble v0.0.0-20230209222158-0568b5fd3d14/go.mod h1:Nb5lgvnQ2+oGlE/EyZy4+2/CxRh9KfvCXnag1vtpxVM=
github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ=
github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM=
Expand All @@ -204,6 +210,8 @@ github.com/cometbft/cometbft-db v0.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0
github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0=
github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4=
github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak=
github.com/consensys/gnark-crypto v0.11.0 h1:QqzHQlwEqlQr5jfWblGDkwlKHpT+4QodYqqExkAtyks=
github.com/consensys/gnark-crypto v0.11.0/go.mod h1:Iq/P3HHl0ElSjsg2E1gsMwhAyxnxoKK5nVyZKd+/KhU=
github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
Expand Down
10 changes: 9 additions & 1 deletion monitoring/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ module github.com/smartcontractkit/chainlink-starknet/monitoring
go 1.20

require (
github.com/NethermindEth/juno v0.3.1
github.com/NethermindEth/starknet.go v0.4.2-0.20230830055456-308b763a11d3
github.com/prometheus/client_golang v1.15.0
github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704
github.com/smartcontractkit/chainlink-relay v0.1.7-0.20230808141159-4e20b0757f3a
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.0-20230508053614-9f2fd5fd4ff1
github.com/smartcontractkit/libocr v0.0.0-20230802221916-2271752fa829
Expand All @@ -15,15 +16,18 @@ require (
require (
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.7.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/confluentinc/confluent-kafka-go v1.9.2 // indirect
github.com/consensys/gnark-crypto v0.11.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/ethereum/go-ethereum v1.11.5 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fxamacker/cbor/v2 v2.4.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
Expand Down Expand Up @@ -57,8 +61,10 @@ require (
github.com/santhosh-tekuri/jsonschema/v5 v5.1.1 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/test-go/testify v1.1.4 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.5.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0 // indirect
go.opentelemetry.io/otel v1.16.0 // indirect
Expand All @@ -80,6 +86,8 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/NethermindEth/starknet.go => github.com/augustbleeds/starknet.go v0.4.2-0.20230912155424-048179bee72e

replace (
// Fix go mod tidy issue for ambiguous imports from go-ethereum
// See https://github.com/ugorji/go/issues/279
Expand Down
Loading
Loading