diff --git a/integration-tests/common/common.go b/integration-tests/common/common.go index b4e00cf32..477574ece 100644 --- a/integration-tests/common/common.go +++ b/integration-tests/common/common.go @@ -13,8 +13,6 @@ import ( "github.com/rs/zerolog/log" "gopkg.in/guregu/null.v4" - "github.com/NethermindEth/starknet.go/gateway" - "github.com/smartcontractkit/chainlink-starknet/ops/devnet" "github.com/smartcontractkit/chainlink-testing-framework/k8s/environment" "github.com/smartcontractkit/chainlink-testing-framework/k8s/pkg/alias" @@ -30,7 +28,7 @@ var ( serviceKeyL2 = "starknet-dev" serviceKeyChainlink = "chainlink" chainName = "starknet" - chainId = gateway.GOERLI_ID + chainId = "SN_GOERLI" ) type Common struct { diff --git a/integration-tests/common/test_common.go b/integration-tests/common/test_common.go index a0d5175b7..59534111d 100644 --- a/integration-tests/common/test_common.go +++ b/integration-tests/common/test_common.go @@ -11,8 +11,7 @@ import ( "time" "github.com/NethermindEth/juno/core/felt" - caigo "github.com/NethermindEth/starknet.go" - starknettypes "github.com/NethermindEth/starknet.go/types" + curve "github.com/NethermindEth/starknet.go/curve" starknetutils "github.com/NethermindEth/starknet.go/utils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -53,7 +52,7 @@ func init() { } func pubKeyToDevnetAccount(pubkey starkkey.PublicKey) ([]byte, error) { - xHash, err := caigo.Curve.ComputeHashOnElements([]*big.Int{pubkey.X}) + xHash, err := curve.Curve.ComputeHashOnElements([]*big.Int{pubkey.X}) if err != nil { return nil, err } @@ -64,7 +63,7 @@ func pubKeyToDevnetAccount(pubkey starkkey.PublicKey) ([]byte, error) { ops.DevnetClassHash, xHash, } - hash, err := caigo.Curve.ComputeHashOnElements(elements) + hash, err := curve.Curve.ComputeHashOnElements(elements) if err != nil { return nil, err } @@ -278,13 +277,13 @@ func (testState *Test) ValidateRounds(rounds int, isSoak bool) error { } resLINK, errLINK := testState.Starknet.CallContract(ctx, starknet.CallOps{ ContractAddress: linkContractAddress, - Selector: starknettypes.GetSelectorFromNameFelt("balance_of"), + Selector: starknetutils.GetSelectorFromNameFelt("balance_of"), Calldata: []*felt.Felt{contractAddress}, }) require.NoError(testState.T, errLINK, "Reader balance from LINK contract should not fail", "err", errLINK) resAgg, errAgg := testState.Starknet.CallContract(ctx, starknet.CallOps{ ContractAddress: contractAddress, - Selector: starknettypes.GetSelectorFromNameFelt("link_available_for_payment"), + Selector: starknetutils.GetSelectorFromNameFelt("link_available_for_payment"), }) require.NoError(testState.T, errAgg, "link_available_for_payment should not fail", "err", errAgg) balLINK := resLINK[0].BigInt(big.NewInt(0)) @@ -378,7 +377,7 @@ func (testState *Test) ValidateRounds(rounds int, isSoak bool) error { } roundDataRaw, err := testState.Starknet.CallContract(ctx, starknet.CallOps{ ContractAddress: proxyAddress, - Selector: starknettypes.GetSelectorFromNameFelt("latest_round_data"), + Selector: starknetutils.GetSelectorFromNameFelt("latest_round_data"), }) if !isSoak { require.NoError(testState.T, err, "Reading round data from proxy should not fail") diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 5ec709e49..79136df08 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -3,12 +3,11 @@ module github.com/smartcontractkit/chainlink-starknet/integration-tests go 1.21.4 require ( + github.com/NethermindEth/juno v0.3.1 + github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1 github.com/google/uuid v1.4.0 github.com/lib/pq v1.10.9 - github.com/NethermindEth/juno v0.3.1 - github.com/NethermindEth/starknet.go v0.4.2-0.20230830055456-308b763a11d3 github.com/rs/zerolog v1.30.0 - github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-common v0.1.7-0.20231218150613-43bf581ae327 github.com/smartcontractkit/chainlink-starknet/ops v0.0.0-20231117204155-b253a2f56664 github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231215215547-68a402815b84 @@ -23,7 +22,6 @@ require ( 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 ) @@ -88,6 +86,7 @@ require ( github.com/cometbft/cometbft v0.37.2 // indirect github.com/cometbft/cometbft-db v0.8.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect + github.com/consensys/bavard v0.1.13 // indirect github.com/containerd/containerd v1.7.7 // indirect github.com/containerd/continuity v0.4.3 // indirect github.com/containerd/log v0.1.0 // indirect @@ -271,6 +270,7 @@ require ( github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/moby/patternmatcher v0.6.0 // indirect github.com/moby/spdystream v0.2.0 // indirect github.com/moby/sys/sequential v0.5.0 // indirect @@ -329,6 +329,7 @@ require ( github.com/shopspring/decimal v1.3.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/slack-go/slack v0.12.2 // indirect + github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-automation v1.0.1 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20231215215216-51cb121f7f33 // indirect github.com/smartcontractkit/chainlink-data-streams v0.0.0-20231204152908-a6e3fe8ff2a1 // indirect @@ -437,6 +438,7 @@ require ( k8s.io/utils v0.0.0-20230711102312-30195339c3c7 // indirect nhooyr.io/websocket v1.8.7 // indirect pgregory.net/rapid v0.5.5 // indirect + rsc.io/tmplfunc v0.0.3 // indirect sigs.k8s.io/controller-runtime v0.13.0 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/kustomize/api v0.12.1 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 10f17e971..332500cb5 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -129,8 +129,8 @@ github.com/Microsoft/hcsshim v0.11.1 h1:hJ3s7GbWlGK4YVV92sO88BQSyF4ZLVy7/awqOlPx github.com/Microsoft/hcsshim v0.11.1/go.mod h1:nFJmaO4Zr5Y7eADdFOpYswDDlNVbvcIJJNJLECr5JQg= 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/NethermindEth/starknet.go v0.4.2-0.20230830055456-308b763a11d3 h1:SAE7oDXo82lT+arBtg6sozPMt9bNSkXY1A2TxlCGRw4= -github.com/NethermindEth/starknet.go v0.4.2-0.20230830055456-308b763a11d3/go.mod h1:4fchLnLzJuwl1bnNUR+iBjKYN11afzJCdBcGZKIuFeU= +github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1 h1:9SBvy3eZut1X+wEyAFqfb7ADGj8IQw7ZnlkMwz0YOTY= +github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1/go.mod h1:V6qrbi1+fTDCftETIT1grBXIf+TvWP/4Aois1a9EF1E= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -271,12 +271,28 @@ github.com/cockroachdb/errors v1.10.0 h1:lfxS8zZz1+OjtV4MtNWgboi/W5tyLEB6VQZBXN+ github.com/cockroachdb/errors v1.10.0/go.mod h1:lknhIsEVQ9Ss/qKDBQS/UqFSvPQjOwNq2qyKAxtHRqE= 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-20230906160148-46873a6a7a06 h1:T+Np/xtzIjYM/P5NAw0e2Rf1FGvzDau1h54MKvx8G7w= +github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06/go.mod h1:bynZ3gvVyhlvjLI7PT6dmZ7g76xzJ7HpxfjgkzCGz6s= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= +github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= github.com/cometbft/cometbft v0.37.2 h1:XB0yyHGT0lwmJlFmM4+rsRnczPlHoAKFX6K8Zgc2/Jc= github.com/cometbft/cometbft v0.37.2/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo= github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0= 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/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= +github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= +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/containerd v1.7.7 h1:QOC2K4A42RQpcrZyptP6z9EJZnlHfHJUfZrAAHe15q4= +github.com/containerd/containerd v1.7.7/go.mod h1:3c4XZv6VeT9qgf9GMTxNTMFxGJrGpI2vz1yk4ye+YY8= +github.com/containerd/continuity v0.4.3 h1:6HVkalIp+2u1ZLH1J/pYX2oBVXlJZvh1X1A7bEZ9Su8= +github.com/containerd/continuity v0.4.3/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= +github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= +github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= 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= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -709,6 +725,7 @@ github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= +github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -1093,6 +1110,9 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= +github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= +github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= +github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8= @@ -2179,6 +2199,8 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8 rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= +rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= sigs.k8s.io/controller-runtime v0.13.0 h1:iqa5RNciy7ADWnIc8QxCbOX5FEKVR3uxVxKHRMc2WIQ= sigs.k8s.io/controller-runtime v0.13.0/go.mod h1:Zbz+el8Yg31jubvAEyglRZGdLAjplZl+PgtYNI6WNTI= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= diff --git a/monitoring/go.mod b/monitoring/go.mod index df3e77955..6baec3c2e 100644 --- a/monitoring/go.mod +++ b/monitoring/go.mod @@ -5,9 +5,9 @@ go 1.21 toolchain go1.21.1 require ( - github.com/prometheus/client_golang v1.17.0 github.com/NethermindEth/juno v0.3.1 - github.com/NethermindEth/starknet.go v0.4.2-0.20230804102546-d30334cf21f3 + github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1 + github.com/prometheus/client_golang v1.17.0 github.com/smartcontractkit/chainlink-common v0.1.7-0.20231218150613-43bf581ae327 github.com/smartcontractkit/chainlink-starknet/relayer v0.0.0-20230508053614-9f2fd5fd4ff1 github.com/smartcontractkit/libocr v0.0.0-20230925165524-ffa38fe11ef8 @@ -24,6 +24,7 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/confluentinc/confluent-kafka-go/v2 v2.3.0 // indirect + github.com/consensys/bavard v0.1.13 // 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 @@ -33,14 +34,12 @@ require ( github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fxamacker/cbor/v2 v2.5.0 // indirect github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0 // 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 github.com/go-stack/stack v1.8.1 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect - github.com/google/go-querystring v1.1.0 // indirect github.com/google/uuid v1.3.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0 // indirect @@ -56,6 +55,7 @@ require ( github.com/mattn/go-isatty v0.0.16 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect + github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/mwitkow/grpc-proxy v0.0.0-20230212185441-f345521cb9c9 // indirect github.com/oklog/run v1.0.0 // indirect @@ -94,6 +94,7 @@ require ( google.golang.org/protobuf v1.31.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + rsc.io/tmplfunc v0.0.3 // indirect ) replace ( diff --git a/monitoring/go.sum b/monitoring/go.sum index 18e5c61f2..6225ec13d 100644 --- a/monitoring/go.sum +++ b/monitoring/go.sum @@ -41,10 +41,21 @@ github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg6 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= +github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= +github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= +github.com/Microsoft/hcsshim v0.9.4 h1:mnUj0ivWy6UzbB1uLFqKR6F+ZyiDc7j4iGgHTpO+5+I= +github.com/Microsoft/hcsshim v0.9.4/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc= +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/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1 h1:9SBvy3eZut1X+wEyAFqfb7ADGj8IQw7ZnlkMwz0YOTY= +github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1/go.mod h1:V6qrbi1+fTDCftETIT1grBXIf+TvWP/4Aois1a9EF1E= github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +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/btcsuite/btcd/btcec/v2 v2.2.1 h1:xP60mv8fvp+0khmrN0zTdPC3cNm24rfeE6lh2R/Yv3E= github.com/btcsuite/btcd/btcec/v2 v2.2.1/go.mod h1:9/CSmJxmuvqzX9Wh2fXMWToLOHhPd11lSPuIupwTkI8= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.3 h1:SDlJ7bAm4ewvrmZtR0DaiYbQGdKPeaaIm7bM+qRhFeU= @@ -69,7 +80,21 @@ github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWH github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8= github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZOZLBCor4mBk= 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-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/confluentinc/confluent-kafka-go/v2 v2.3.0 h1:icCHutJouWlQREayFwCc7lxDAhws08td+W3/gdqgZts= +github.com/confluentinc/confluent-kafka-go/v2 v2.3.0/go.mod h1:/VTy8iEpe6mD9pkCH5BhijlUl8ulUXymKv1Qig5Rgb8= +github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= +github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= +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/cgroups v1.0.4 h1:jN/mbWBEaz+T1pi5OFtnkQ+8qnmEbAr1Oo1FRm5B0dA= +github.com/containerd/cgroups v1.0.4/go.mod h1:nLNQtsF7Sl2HxNebu77i1R0oDlhiTG+kO4JTrUzo6IA= +github.com/containerd/containerd v1.6.8 h1:h4dOFDwzHmqFEP754PgfgTeVXFnLiRc6kiqC7tplDJs= +github.com/containerd/containerd v1.6.8/go.mod h1:By6p5KqPK0/7/CgO/A6t/Gz+CUYUu2zf1hUaaymVXB0= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -103,6 +128,8 @@ github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/fxamacker/cbor/v2 v2.5.0 h1:oHsG0V/Q6E/wqTS2O1Cozzsy69nqCiguo5Q1a1ADivE= +github.com/fxamacker/cbor/v2 v2.5.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getsentry/sentry-go v0.18.0 h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkNC1sN0= @@ -138,6 +165,8 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -168,12 +197,9 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= -github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -184,6 +210,7 @@ github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -231,6 +258,9 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/leanovate/gopter v0.2.10-0.20210127095200-9abe2343507a h1:dHCfT5W7gghzPtfsW488uPmEOm85wewI+ypUwibyTdU= +github.com/leanovate/gopter v0.2.10-0.20210127095200-9abe2343507a/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/linkedin/goavro/v2 v2.9.7/go.mod h1:UgQUb2N/pmueQYH9bfqFioWxzYCZXSfF8Jw03O5sjqA= github.com/linkedin/goavro/v2 v2.12.0 h1:rIQQSj8jdAUlKQh6DttK8wCRv4t4QO09g1C4aBWXslg= github.com/linkedin/goavro/v2 v2.12.0/go.mod h1:KXx+erlq+RPlGSPmLF7xGo6SAbh8sCQ53x064+ioxhk= @@ -252,6 +282,9 @@ github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJ github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= +github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= +github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/moby/sys/mount v0.3.3 h1:fX1SVkXFJ47XWDoeFW4Sq7PdQJnV2QIDZAqjNqgEjUs= github.com/moby/sys/mount v0.3.3/go.mod h1:PBaEorSNTLG5t/+4EgukEQVlAvVEc6ZjTySwKdqp5K0= github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78= @@ -300,6 +333,18 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.2.0 h1:WCcC4vZDS1tYNxjWlwRJZQy28r8CM github.com/santhosh-tekuri/jsonschema/v5 v5.2.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231218150613-43bf581ae327 h1:7P+djpKBMQ2Cpv1ieUQdkZvDLt6owPvniHfMHSPFYjQ= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231218150613-43bf581ae327/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss= +github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= +github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= +github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0= +github.com/smartcontractkit/libocr v0.0.0-20230925165524-ffa38fe11ef8 h1:R9NkVN+1fooUJFsN9zj9gDY1B+zv54zNO785RQZRVfE= +github.com/smartcontractkit/libocr v0.0.0-20230925165524-ffa38fe11ef8/go.mod h1:2lyRkw/qLQgUWlrWWmq5nj0y90rWeO6Y+v+fCakRgb0= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -317,12 +362,18 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= +github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE= +github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU= +github.com/testcontainers/testcontainers-go v0.14.0 h1:h0D5GaYG9mhOWr2qHdEKDXpkce/VlvaYOCzTRi6UBi8= +github.com/testcontainers/testcontainers-go v0.14.0/go.mod h1:hSRGJ1G8Q5Bw2gXgPulJOLlEBaYJHeBSOkQM5JLG+JQ= github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw= github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= github.com/tklauser/numcpus v0.5.0 h1:ooe7gN0fg6myJ0EKoTAf5hebTZrH52px3New/D9iJ+A= github.com/tklauser/numcpus v0.5.0/go.mod h1:OGzpTxpcIMNGYQdit2BYL1pvk/dSOaJWjKoflh+RQjo= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= +github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -667,3 +718,5 @@ honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= +rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= diff --git a/monitoring/pkg/monitoring/source_envelope.go b/monitoring/pkg/monitoring/source_envelope.go index d8fca6f2a..323bdf788 100644 --- a/monitoring/pkg/monitoring/source_envelope.go +++ b/monitoring/pkg/monitoring/source_envelope.go @@ -6,19 +6,8 @@ import ( "math/big" "sync" -<<<<<<< HEAD - caigotypes "github.com/smartcontractkit/caigo/types" -||||||| parent of 5c692ac2 (Use latest upstream sdk: starknet.go) - caigotypes "github.com/smartcontractkit/caigo/types" - relayMonitoring "github.com/smartcontractkit/chainlink-relay/pkg/monitoring" - relayUtils "github.com/smartcontractkit/chainlink-relay/pkg/utils" -======= - starknettypes "github.com/NethermindEth/starknet.go/types" - starknetutils "github.com/NethermindEth/starknet.go/utils" "github.com/NethermindEth/juno/core/felt" - relayMonitoring "github.com/smartcontractkit/chainlink-relay/pkg/monitoring" - relayUtils "github.com/smartcontractkit/chainlink-relay/pkg/utils" ->>>>>>> 5c692ac2 (Use latest upstream sdk: starknet.go) + starknetutils "github.com/NethermindEth/starknet.go/utils" "github.com/smartcontractkit/libocr/offchainreporting2/types" "go.uber.org/multierr" @@ -179,7 +168,7 @@ var zeroBigInt = big.NewInt(0) func (s *envelopeSource) fetchLinkBalance(ctx context.Context, linkTokenAddress, contractAddress *felt.Felt) (*big.Int, error) { results, err := s.ocr2Reader.BaseReader().CallContract(ctx, starknet.CallOps{ ContractAddress: linkTokenAddress, - Selector: starknettypes.GetSelectorFromNameFelt("balanceOf"), + Selector: starknetutils.GetSelectorFromNameFelt("balanceOf"), Calldata: []*felt.Felt{contractAddress}, }) if err != nil { diff --git a/monitoring/pkg/monitoring/source_envelope_test.go b/monitoring/pkg/monitoring/source_envelope_test.go index 188551025..0833f37c5 100644 --- a/monitoring/pkg/monitoring/source_envelope_test.go +++ b/monitoring/pkg/monitoring/source_envelope_test.go @@ -6,18 +6,7 @@ import ( "testing" "time" -<<<<<<< HEAD - "github.com/smartcontractkit/caigo" - caigotypes "github.com/smartcontractkit/caigo/types" -||||||| parent of 5c692ac2 (Use latest upstream sdk: starknet.go) - "github.com/smartcontractkit/caigo" - caigotypes "github.com/smartcontractkit/caigo/types" - relayMonitoring "github.com/smartcontractkit/chainlink-relay/pkg/monitoring" -======= - "github.com/NethermindEth/starknet.go" - starknettypes "github.com/NethermindEth/starknet.go/types" - relayMonitoring "github.com/smartcontractkit/chainlink-relay/pkg/monitoring" ->>>>>>> 5c692ac2 (Use latest upstream sdk: starknet.go) + starknetutils "github.com/NethermindEth/starknet.go/utils" "github.com/smartcontractkit/libocr/offchainreporting2/types" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -76,7 +65,7 @@ func TestEnvelopeSource(t *testing.T) { ContractAddress: chainConfig.GetLinkTokenAddress(), Selector: "balanceOf", Calldata: []string{ - starknetgo.HexToBN(feedConfig.ContractAddress).String(), + starknetutils.HexToBN(feedConfig.ContractAddress).String(), }, }, ).Return(starknetReaderCallContractBalanceOfResponse, nil) @@ -104,7 +93,7 @@ var ( { RoundId: 0xf5b, LatestAnswer: bigIntFromString("-900000000"), - Transmitter: starknettypes.StrToFelt("634447934223750826572902672583054702307815157196919304685470566142330202833"), + Transmitter: starknetutils.StrToFelt("634447934223750826572902672583054702307815157196919304685470566142330202833"), LatestTimestamp: time.Date(2022, time.September, 27, 18, 51, 0, 0, time.Local), Observers: []uint8{0x1, 0x2, 0x3, 0x4}, ObservationsLen: 0x4, diff --git a/monitoring/pkg/monitoring/source_proxy.go b/monitoring/pkg/monitoring/source_proxy.go index a54a03543..9b3d15657 100644 --- a/monitoring/pkg/monitoring/source_proxy.go +++ b/monitoring/pkg/monitoring/source_proxy.go @@ -5,18 +5,10 @@ import ( "fmt" "math/big" -<<<<<<< HEAD - caigotypes "github.com/smartcontractkit/caigo/types" + "github.com/NethermindEth/juno/core/felt" + starknetutils "github.com/NethermindEth/starknet.go/utils" relayMonitoring "github.com/smartcontractkit/chainlink-common/pkg/monitoring" -||||||| parent of 5c692ac2 (Use latest upstream sdk: starknet.go) - caigotypes "github.com/smartcontractkit/caigo/types" - relayMonitoring "github.com/smartcontractkit/chainlink-relay/pkg/monitoring" -======= - starknetutils "github.com/NethermindEth/starknet.go/utils" - "github.com/NethermindEth/juno/core/felt" - relayMonitoring "github.com/smartcontractkit/chainlink-relay/pkg/monitoring" ->>>>>>> 5c692ac2 (Use latest upstream sdk: starknet.go) "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/ocr2" ) diff --git a/monitoring/pkg/monitoring/source_txresults.go b/monitoring/pkg/monitoring/source_txresults.go index d22732ab6..19ca6a885 100644 --- a/monitoring/pkg/monitoring/source_txresults.go +++ b/monitoring/pkg/monitoring/source_txresults.go @@ -5,18 +5,10 @@ import ( "fmt" "sync" -<<<<<<< HEAD - caigotypes "github.com/smartcontractkit/caigo/types" + "github.com/NethermindEth/juno/core/felt" + starknetutils "github.com/NethermindEth/starknet.go/utils" relayMonitoring "github.com/smartcontractkit/chainlink-common/pkg/monitoring" -||||||| parent of 5c692ac2 (Use latest upstream sdk: starknet.go) - caigotypes "github.com/smartcontractkit/caigo/types" - relayMonitoring "github.com/smartcontractkit/chainlink-relay/pkg/monitoring" -======= - starknetutils "github.com/NethermindEth/starknet.go/utils" - "github.com/NethermindEth/juno/core/felt" - relayMonitoring "github.com/smartcontractkit/chainlink-relay/pkg/monitoring" ->>>>>>> 5c692ac2 (Use latest upstream sdk: starknet.go) "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/ocr2" ) diff --git a/ops/go.mod b/ops/go.mod index 9f4aedd2d..68ef86922 100644 --- a/ops/go.mod +++ b/ops/go.mod @@ -5,7 +5,7 @@ go 1.21 toolchain go1.21.1 require ( - github.com/NethermindEth/starknet.go v0.4.2-0.20230830055456-308b763a11d3 + github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1 github.com/go-resty/resty/v2 v2.7.0 github.com/rs/zerolog v1.30.0 github.com/smartcontractkit/chainlink-env v0.3.29 @@ -34,6 +34,8 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chai2010/gettext-go v1.0.2 // indirect github.com/chaos-mesh/chaos-mesh/api/v1alpha1 v0.0.0-20220226050744-799408773657 // indirect + github.com/consensys/bavard v0.1.13 // indirect + github.com/consensys/gnark-crypto v0.11.0 // indirect github.com/containerd/containerd v1.7.3 // indirect github.com/cpuguy83/dockercfg v0.3.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect @@ -68,7 +70,6 @@ require ( github.com/google/btree v1.1.2 // indirect github.com/google/gnostic v0.6.9 // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/google/go-querystring v1.1.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/uuid v1.3.1 // indirect @@ -95,6 +96,7 @@ require ( github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect + github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/moby/patternmatcher v0.5.0 // indirect github.com/moby/spdystream v0.2.0 // indirect github.com/moby/sys/sequential v0.5.0 // indirect @@ -127,6 +129,7 @@ require ( github.com/spf13/cobra v1.6.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/testify v1.8.4 // indirect + github.com/test-go/testify v1.1.4 // indirect github.com/testcontainers/testcontainers-go v0.23.0 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect @@ -177,6 +180,7 @@ require ( k8s.io/kube-openapi v0.0.0-20230525220651-2546d827e515 // indirect k8s.io/kubectl v0.25.11 // indirect k8s.io/utils v0.0.0-20230711102312-30195339c3c7 // indirect + rsc.io/tmplfunc v0.0.3 // indirect sigs.k8s.io/controller-runtime v0.13.0 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/kustomize/api v0.12.1 // indirect diff --git a/ops/go.sum b/ops/go.sum index 6edbd6525..c7d907519 100644 --- a/ops/go.sum +++ b/ops/go.sum @@ -50,6 +50,14 @@ github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE= 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/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/Microsoft/hcsshim v0.10.0-rc.8 h1:YSZVvlIIDD1UxQpJp0h+dnpLUw+TrY0cx8obKsp3bek= +github.com/Microsoft/hcsshim v0.10.0-rc.8/go.mod h1:OEthFdQv/AD2RAdzR6Mm1N1KPCztGKDurW1Z8b8VGMM= +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/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1 h1:9SBvy3eZut1X+wEyAFqfb7ADGj8IQw7ZnlkMwz0YOTY= +github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1/go.mod h1:V6qrbi1+fTDCftETIT1grBXIf+TvWP/4Aois1a9EF1E= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/VictoriaMetrics/fastcache v1.10.0 h1:5hDJnLsKLpnUEToub7ETuRu8RCkb40woBZAUiKonXzY= github.com/VictoriaMetrics/fastcache v1.10.0/go.mod h1:tjiYeEfYXCqacuvYw/7UoDIeJaNxq6132xHICNP77w8= @@ -66,6 +74,8 @@ github.com/aws/jsii-runtime-go v1.75.0 h1:NhpUfyiL7/wsRuUekFsz8FFBCYLfPD/l61kKg9 github.com/aws/jsii-runtime-go v1.75.0/go.mod h1:TKCyrtM0pygEPo4rDZzbMSDNCDNTSYSN6/mGyHI6O3I= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +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/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.3 h1:SDlJ7bAm4ewvrmZtR0DaiYbQGdKPeaaIm7bM+qRhFeU= @@ -101,7 +111,17 @@ github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWH github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8= github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZOZLBCor4mBk= 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-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/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= +github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= +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/containerd v1.7.3 h1:cKwYKkP1eTj54bP3wCdXXBymmKRQMrWjkLSWZZJDa8o= +github.com/containerd/containerd v1.7.3/go.mod h1:32FOM4/O0RkNg7AjQj3hDzN9cUGtu+HMvaKUNiqCZB8= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/dockercfg v0.3.1 h1:/FpZ+JaygUR/lZP2NlFI2DVfrOEMAIKP5wWEJdoYe9E= github.com/cpuguy83/dockercfg v0.3.1/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= @@ -160,6 +180,8 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4 github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fvbommel/sortorder v1.0.2 h1:mV4o8B2hKboCdkJm+a7uX/SIpZob4JzUpc5GGnM45eo= github.com/fvbommel/sortorder v1.0.2/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui720w+kxuqRs0= +github.com/fxamacker/cbor/v2 v2.5.0 h1:oHsG0V/Q6E/wqTS2O1Cozzsy69nqCiguo5Q1a1ADivE= +github.com/fxamacker/cbor/v2 v2.5.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getsentry/sentry-go v0.19.0 h1:BcCH3CN5tXt5aML+gwmbFwVptLLQA+eT866fCO9wVOM= @@ -214,6 +236,8 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -248,13 +272,10 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= -github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -272,6 +293,7 @@ github.com/google/pprof v0.0.0-20230705174524-200ffdc848b8/go.mod h1:Jh3hGz2jkYa github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= +github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -336,6 +358,9 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/leanovate/gopter v0.2.10-0.20210127095200-9abe2343507a h1:dHCfT5W7gghzPtfsW488uPmEOm85wewI+ypUwibyTdU= +github.com/leanovate/gopter v0.2.10-0.20210127095200-9abe2343507a/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de h1:9TO3cAIGXtEhnIaL+V+BEER86oLrvS+kWobKpbJuye0= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= @@ -361,6 +386,9 @@ github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQ github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= +github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= +github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M7DBo= github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8= @@ -439,6 +467,10 @@ github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231218150613-43bf581ae327 h1:7P+djpKBMQ2Cpv1ieUQdkZvDLt6owPvniHfMHSPFYjQ= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231218150613-43bf581ae327/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= github.com/smartcontractkit/chainlink-env v0.3.29 h1:hcIw/BeuB0wKiiE3umAUNBZzWkHO24XF3OW9xSrlMbI= github.com/smartcontractkit/chainlink-env v0.3.29/go.mod h1:9c0Czq4a6wZKY20BcoAlK29DnejQIiLo/MwKYtSFnHk= github.com/smartcontractkit/chainlink-testing-framework v1.19.1 h1:MdGM5jIrBi858Cv7qzfl1Qon93YW8InohAlDQqFoIb4= @@ -472,7 +504,18 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= +github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= +github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE= +github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU= +github.com/testcontainers/testcontainers-go v0.23.0 h1:ERYTSikX01QczBLPZpqsETTBO7lInqEP349phDOVJVs= +github.com/testcontainers/testcontainers-go v0.23.0/go.mod h1:3gzuZfb7T9qfcH2pHpV4RLlWrPjeWNQah6XlYQ32c4I= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= +github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= @@ -886,6 +929,8 @@ k8s.io/utils v0.0.0-20230711102312-30195339c3c7/go.mod h1:OLgZIPagt7ERELqWJFomSt rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= +rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= sigs.k8s.io/controller-runtime v0.13.0 h1:iqa5RNciy7ADWnIc8QxCbOX5FEKVR3uxVxKHRMc2WIQ= sigs.k8s.io/controller-runtime v0.13.0/go.mod h1:Zbz+el8Yg31jubvAEyglRZGdLAjplZl+PgtYNI6WNTI= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= diff --git a/relayer/go.mod b/relayer/go.mod index 15166b753..20c429503 100644 --- a/relayer/go.mod +++ b/relayer/go.mod @@ -6,7 +6,7 @@ toolchain go1.21.1 require ( github.com/NethermindEth/juno v0.3.1 - github.com/NethermindEth/starknet.go v0.4.2-0.20230830055456-308b763a11d3 + github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1 github.com/ethereum/go-ethereum v1.11.5 github.com/hashicorp/go-plugin v1.5.2 github.com/pelletier/go-toml/v2 v2.1.0 @@ -27,6 +27,7 @@ require ( github.com/btcsuite/btcd/chaincfg/chainhash v1.0.3 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/consensys/bavard v0.1.13 // 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 @@ -41,7 +42,6 @@ require ( github.com/go-stack/stack v1.8.1 // indirect github.com/gogo/protobuf v1.3.3 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/google/go-querystring v1.1.0 // indirect github.com/google/uuid v1.3.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0 // indirect @@ -55,6 +55,7 @@ require ( github.com/mattn/go-isatty v0.0.16 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect + github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect github.com/mwitkow/grpc-proxy v0.0.0-20230212185441-f345521cb9c9 // indirect github.com/oklog/run v1.0.0 // indirect @@ -88,6 +89,7 @@ require ( google.golang.org/protobuf v1.31.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + rsc.io/tmplfunc v0.0.3 // indirect ) replace ( diff --git a/relayer/go.sum b/relayer/go.sum index a33e2c444..088f38132 100644 --- a/relayer/go.sum +++ b/relayer/go.sum @@ -39,6 +39,13 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= +github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +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/NethermindEth/starknet.go v0.6.0 h1:nEEgn9wmLS3jj8W31RAnfyzHkZtS3nSypkqo/f4bhOM= +github.com/NethermindEth/starknet.go v0.6.0/go.mod h1:V6qrbi1+fTDCftETIT1grBXIf+TvWP/4Aois1a9EF1E= +github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1 h1:9SBvy3eZut1X+wEyAFqfb7ADGj8IQw7ZnlkMwz0YOTY= +github.com/NethermindEth/starknet.go v0.6.1-0.20231218140327-915109ab5bc1/go.mod h1:V6qrbi1+fTDCftETIT1grBXIf+TvWP/4Aois1a9EF1E= github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -69,7 +76,15 @@ github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWH github.com/cockroachdb/errors v1.9.1 h1:yFVvsI0VxmRShfawbt/laCIDy/mtTqqnvoNgiy5bEV8= github.com/cockroachdb/errors v1.9.1/go.mod h1:2sxOtL2WIc096WSZqZ5h8fa17rdDq9HZOZLBCor4mBk= 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-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/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= +github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= +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/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -95,6 +110,8 @@ github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/fxamacker/cbor/v2 v2.5.0 h1:oHsG0V/Q6E/wqTS2O1Cozzsy69nqCiguo5Q1a1ADivE= +github.com/fxamacker/cbor/v2 v2.5.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getsentry/sentry-go v0.18.0 h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkNC1sN0= @@ -157,12 +174,9 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= -github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -173,6 +187,7 @@ github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -221,6 +236,9 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/leanovate/gopter v0.2.10-0.20210127095200-9abe2343507a h1:dHCfT5W7gghzPtfsW488uPmEOm85wewI+ypUwibyTdU= +github.com/leanovate/gopter v0.2.10-0.20210127095200-9abe2343507a/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -237,6 +255,9 @@ github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJ github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY= +github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU= +github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/nsf/jsondiff v0.0.0-20210926074059-1e845ec5d249 h1:NHrXEjTNQY7P0Zfx1aMrNhpgxHmow66XQtm0aQLY0AE= @@ -268,6 +289,16 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231218150613-43bf581ae327 h1:7P+djpKBMQ2Cpv1ieUQdkZvDLt6owPvniHfMHSPFYjQ= +github.com/smartcontractkit/chainlink-common v0.1.7-0.20231218150613-43bf581ae327/go.mod h1:IdlfCN9rUs8Q/hrOYe8McNBIwEOHEsi0jilb3Cw77xs= +github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss= +github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= +github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= +github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0= +github.com/smartcontractkit/libocr v0.0.0-20230925165524-ffa38fe11ef8 h1:R9NkVN+1fooUJFsN9zj9gDY1B+zv54zNO785RQZRVfE= +github.com/smartcontractkit/libocr v0.0.0-20230925165524-ffa38fe11ef8/go.mod h1:2lyRkw/qLQgUWlrWWmq5nj0y90rWeO6Y+v+fCakRgb0= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -283,12 +314,16 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= +github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE= +github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU= github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw= github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= github.com/tklauser/numcpus v0.5.0 h1:ooe7gN0fg6myJ0EKoTAf5hebTZrH52px3New/D9iJ+A= github.com/tklauser/numcpus v0.5.0/go.mod h1:OGzpTxpcIMNGYQdit2BYL1pvk/dSOaJWjKoflh+RQjo= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= +github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -634,3 +669,5 @@ honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU= +rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= diff --git a/relayer/pkg/chainlink/ocr2/client.go b/relayer/pkg/chainlink/ocr2/client.go index bc7e7d9c2..abcc6c112 100644 --- a/relayer/pkg/chainlink/ocr2/client.go +++ b/relayer/pkg/chainlink/ocr2/client.go @@ -10,7 +10,7 @@ import ( "github.com/NethermindEth/juno/core/felt" starknetrpc "github.com/NethermindEth/starknet.go/rpc" - starknettypes "github.com/NethermindEth/starknet.go/types" + starknetutils "github.com/NethermindEth/starknet.go/utils" "github.com/smartcontractkit/libocr/offchainreporting2/types" "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/starknet" @@ -53,7 +53,7 @@ func (c *Client) BaseReader() starknet.Reader { func (c *Client) BillingDetails(ctx context.Context, address *felt.Felt) (bd BillingDetails, err error) { ops := starknet.CallOps{ ContractAddress: address, - Selector: starknettypes.GetSelectorFromNameFelt("billing"), + Selector: starknetutils.GetSelectorFromNameFelt("billing"), } res, err := c.r.CallContract(ctx, ops) @@ -80,7 +80,7 @@ func (c *Client) BillingDetails(ctx context.Context, address *felt.Felt) (bd Bil func (c *Client) LatestConfigDetails(ctx context.Context, address *felt.Felt) (ccd ContractConfigDetails, err error) { ops := starknet.CallOps{ ContractAddress: address, - Selector: starknettypes.GetSelectorFromNameFelt("latest_config_details"), + Selector: starknetutils.GetSelectorFromNameFelt("latest_config_details"), } res, err := c.r.CallContract(ctx, ops) @@ -107,7 +107,7 @@ func (c *Client) LatestConfigDetails(ctx context.Context, address *felt.Felt) (c func (c *Client) LatestTransmissionDetails(ctx context.Context, address *felt.Felt) (td TransmissionDetails, err error) { ops := starknet.CallOps{ ContractAddress: address, - Selector: starknettypes.GetSelectorFromNameFelt("latest_transmission_details"), + Selector: starknetutils.GetSelectorFromNameFelt("latest_transmission_details"), } res, err := c.r.CallContract(ctx, ops) @@ -150,7 +150,7 @@ func (c *Client) LatestTransmissionDetails(ctx context.Context, address *felt.Fe func (c *Client) LatestRoundData(ctx context.Context, address *felt.Felt) (round RoundData, err error) { ops := starknet.CallOps{ ContractAddress: address, - Selector: starknettypes.GetSelectorFromNameFelt("latest_round_data"), + Selector: starknetutils.GetSelectorFromNameFelt("latest_round_data"), } felts, err := c.r.CallContract(ctx, ops) @@ -168,7 +168,7 @@ func (c *Client) LatestRoundData(ctx context.Context, address *felt.Felt) (round func (c *Client) LinkAvailableForPayment(ctx context.Context, address *felt.Felt) (*big.Int, error) { results, err := c.r.CallContract(ctx, starknet.CallOps{ ContractAddress: address, - Selector: starknettypes.GetSelectorFromNameFelt("link_available_for_payment"), + Selector: starknetutils.GetSelectorFromNameFelt("link_available_for_payment"), }) if err != nil { return nil, errors.Wrap(err, "failed to call the contract with selector 'link_available_for_payment'") @@ -182,7 +182,7 @@ func (c *Client) LinkAvailableForPayment(ctx context.Context, address *felt.Felt func (c *Client) fetchEventsFromBlock(ctx context.Context, address *felt.Felt, eventType string, blockNum uint64) (eventsAsFeltArrs [][]*felt.Felt, err error) { block := starknetrpc.WithBlockNumber(blockNum) - eventKey := starknettypes.GetSelectorFromNameFelt(eventType) + eventKey := starknetutils.GetSelectorFromNameFelt(eventType) input := starknetrpc.EventsInput{ EventFilter: starknetrpc.EventFilter{ diff --git a/relayer/pkg/chainlink/ocr2/client_test.go b/relayer/pkg/chainlink/ocr2/client_test.go index a4cb6e528..436fd8bc3 100644 --- a/relayer/pkg/chainlink/ocr2/client_test.go +++ b/relayer/pkg/chainlink/ocr2/client_test.go @@ -11,8 +11,6 @@ import ( "testing" "time" - "github.com/NethermindEth/starknet.go/gateway" - starknettypes "github.com/NethermindEth/starknet.go/types" starknetutils "github.com/NethermindEth/starknet.go/utils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -26,7 +24,7 @@ const BLOCK_OUTPUT = `{"result": {"events": [ {"from_address": "0xd43963a4e875a3 const ocr2ContractAddress = "0xd43963a4e875a361f5d164b2e70953598eb4f45fde86924082d51b4d78e489" // matches BLOCK_OUTPUT event func TestOCR2Client(t *testing.T) { - chainID := gateway.GOERLI_ID + chainID := "SN_GOERLI" lggr := logger.Test(t) mockServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -57,21 +55,21 @@ func TestOCR2Client(t *testing.T) { err := json.Unmarshal([]byte(raw), &reqdata) require.NoError(t, err) - fmt.Printf("%v %v\n", reqdata.Selector, starknettypes.GetSelectorFromNameFelt("latest_transmission_details").String()) + fmt.Printf("%v %v\n", reqdata.Selector, starknetutils.GetSelectorFromNameFelt("latest_transmission_details").String()) switch reqdata.Selector { - case starknettypes.GetSelectorFromNameFelt("billing").String(): + case starknetutils.GetSelectorFromNameFelt("billing").String(): // billing response out = []byte(`{"result":["0x0","0x0","0x0","0x0"]}`) - case starknettypes.GetSelectorFromNameFelt("latest_config_details").String(): + case starknetutils.GetSelectorFromNameFelt("latest_config_details").String(): // latest config details response out = []byte(`{"result":["0x1","0x2","0x4b791b801cf0d7b6a2f9e59daf15ec2dd7d9cdc3bc5e037bada9c86e4821c"]}`) - case starknettypes.GetSelectorFromNameFelt("latest_transmission_details").String(): + case starknetutils.GetSelectorFromNameFelt("latest_transmission_details").String(): // latest transmission details response out = []byte(`{"result":["0x4cfc96325fa7d72e4854420e2d7b0abda72de17d45e4c3c0d9f626016d669","0x0","0x0","0x0"]}`) - case starknettypes.GetSelectorFromNameFelt("latest_round_data").String(): + case starknetutils.GetSelectorFromNameFelt("latest_round_data").String(): // latest transmission details response out = []byte(`{"result":["0x0","0x0","0x0","0x0","0x0"]}`) - case starknettypes.GetSelectorFromNameFelt("link_available_for_payment").String(): + case starknetutils.GetSelectorFromNameFelt("link_available_for_payment").String(): // latest transmission details response out = []byte(`{"result":["0x0"]}`) default: diff --git a/relayer/pkg/chainlink/ocr2/config_digester.go b/relayer/pkg/chainlink/ocr2/config_digester.go index a7f96324a..113a1e84e 100644 --- a/relayer/pkg/chainlink/ocr2/config_digester.go +++ b/relayer/pkg/chainlink/ocr2/config_digester.go @@ -6,7 +6,7 @@ import ( "math/big" "strings" - "github.com/NethermindEth/starknet.go" + "github.com/NethermindEth/starknet.go/curve" "github.com/smartcontractkit/libocr/offchainreporting2/types" @@ -90,7 +90,7 @@ func (d offchainConfigDigester) ConfigDigest(cfg types.ContractConfig) (types.Co ) msg = append(msg, offchainConfig...) // offchain_config - digest, err := starknetgo.Curve.ComputeHashOnElements(msg) + digest, err := curve.Curve.ComputeHashOnElements(msg) if err != nil { return configDigest, err } diff --git a/relayer/pkg/chainlink/ocr2/contract_transmitter.go b/relayer/pkg/chainlink/ocr2/contract_transmitter.go index aa0a323c6..32b7c98a9 100644 --- a/relayer/pkg/chainlink/ocr2/contract_transmitter.go +++ b/relayer/pkg/chainlink/ocr2/contract_transmitter.go @@ -7,7 +7,7 @@ import ( "github.com/pkg/errors" - starknettypes "github.com/NethermindEth/starknet.go/types" + starknetrpc "github.com/NethermindEth/starknet.go/rpc" starknetutils "github.com/NethermindEth/starknet.go/utils" "github.com/NethermindEth/juno/core/felt" @@ -96,9 +96,9 @@ func (c *contractTransmitter) Transmit( return err } - err = c.txm.Enqueue(c.senderAddress, c.accountAddress, starknettypes.FunctionCall{ + err = c.txm.Enqueue(c.senderAddress, c.accountAddress, starknetrpc.FunctionCall{ ContractAddress: c.contractAddress, - EntryPointSelector: starknettypes.GetSelectorFromNameFelt("transmit"), + EntryPointSelector: starknetutils.GetSelectorFromNameFelt("transmit"), Calldata: calldata, }) diff --git a/relayer/pkg/chainlink/ocr2/events_test.go b/relayer/pkg/chainlink/ocr2/events_test.go index 5ea442a22..e0f74fe90 100644 --- a/relayer/pkg/chainlink/ocr2/events_test.go +++ b/relayer/pkg/chainlink/ocr2/events_test.go @@ -9,7 +9,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - starknettypes "github.com/NethermindEth/starknet.go/types" starknetutils "github.com/NethermindEth/starknet.go/utils" "github.com/smartcontractkit/libocr/offchainreporting2/types" @@ -146,7 +145,7 @@ func TestNewTransmissionEventSelector(t *testing.T) { require.NoError(t, err) eventKey := new(big.Int) eventKey.SetBytes(bytes) - assert.Equal(t, starknettypes.GetSelectorFromName("NewTransmission").Cmp(eventKey), 0) + assert.Equal(t, starknetutils.GetSelectorFromName("NewTransmission").Cmp(eventKey), 0) } func TestConfigSetEventSelector(t *testing.T) { @@ -154,5 +153,5 @@ func TestConfigSetEventSelector(t *testing.T) { require.NoError(t, err) eventKey := new(big.Int) eventKey.SetBytes(bytes) - assert.Equal(t, starknettypes.GetSelectorFromName("ConfigSet").Cmp(eventKey), 0) + assert.Equal(t, starknetutils.GetSelectorFromName("ConfigSet").Cmp(eventKey), 0) } diff --git a/relayer/pkg/chainlink/ocr2/medianreport/report.go b/relayer/pkg/chainlink/ocr2/medianreport/report.go index 4edd36b0c..63686d3b4 100644 --- a/relayer/pkg/chainlink/ocr2/medianreport/report.go +++ b/relayer/pkg/chainlink/ocr2/medianreport/report.go @@ -44,37 +44,25 @@ func (c ReportCodec) BuildReport(oo []median.ParsedAttributedObservation) (types // preserve original array oo = append([]median.ParsedAttributedObservation{}, oo...) - numFelt, err := starknetutils.BigIntToFelt(big.NewInt(int64(num))) - if err != nil { - return nil, fmt.Errorf("invalid felt: %v", err) - } + numFelt := starknetutils.BigIntToFelt(big.NewInt(int64(num))) // median timestamp sort.Slice(oo, func(i, j int) bool { return oo[i].Timestamp < oo[j].Timestamp }) timestamp := oo[num/2].Timestamp - timestampFelt, err := starknetutils.BigIntToFelt(big.NewInt(int64(timestamp))) - if err != nil { - return nil, fmt.Errorf("invalid felt: %v", err) - } + timestampFelt := starknetutils.BigIntToFelt(big.NewInt(int64(timestamp))) // median juelsPerFeeCoin sort.Slice(oo, func(i, j int) bool { return oo[i].JuelsPerFeeCoin.Cmp(oo[j].JuelsPerFeeCoin) < 0 }) juelsPerFeeCoin := oo[num/2].JuelsPerFeeCoin - juelsPerFeeCoinFelt, err := starknetutils.BigIntToFelt(juelsPerFeeCoin) - if err != nil { - return nil, fmt.Errorf("invalid felt: %v", err) - } + juelsPerFeeCoinFelt := starknetutils.BigIntToFelt(juelsPerFeeCoin) // TODO: source from observations gasPrice := big.NewInt(1) // := oo[num/2].GasPrice - gasPriceFelt, err := starknetutils.BigIntToFelt(gasPrice) - if err != nil { - return nil, fmt.Errorf("invalid felt: %v", err) - } + gasPriceFelt := starknetutils.BigIntToFelt(gasPrice) // sort by values sort.Slice(oo, func(i, j int) bool { @@ -86,10 +74,7 @@ func (c ReportCodec) BuildReport(oo []median.ParsedAttributedObservation) (types for i, o := range oo { observers[i] = byte(o.Observer) - f, err := starknetutils.BigIntToFelt(o.Value) - if err != nil { - return nil, fmt.Errorf("invalid felt: %v", err) - } + f := starknetutils.BigIntToFelt(o.Value) observations = append(observations, f) } diff --git a/relayer/pkg/chainlink/txm/keystore.go b/relayer/pkg/chainlink/txm/keystore.go index 628f5c49a..4d4741155 100644 --- a/relayer/pkg/chainlink/txm/keystore.go +++ b/relayer/pkg/chainlink/txm/keystore.go @@ -6,7 +6,7 @@ import ( "fmt" "math/big" - "github.com/NethermindEth/starknet.go" + starknetaccount "github.com/NethermindEth/starknet.go/account" "github.com/smartcontractkit/chainlink-common/pkg/loop" adapters "github.com/smartcontractkit/chainlink-common/pkg/loop/adapters/starknet" @@ -15,7 +15,7 @@ import ( // KeystoreAdapter is a starknet-specific adaption layer to translate between the generic Loop Keystore (bytes) and // the type specific caigo Keystore (big.Int) type KeystoreAdapter interface { - starknetgo.Keystore + starknetaccount.Keystore Loopp() loop.Keystore } diff --git a/relayer/pkg/chainlink/txm/mocks/nonce_manager_client.go b/relayer/pkg/chainlink/txm/mocks/nonce_manager_client.go index 076ee279e..e8358121c 100644 --- a/relayer/pkg/chainlink/txm/mocks/nonce_manager_client.go +++ b/relayer/pkg/chainlink/txm/mocks/nonce_manager_client.go @@ -4,10 +4,8 @@ package mocks import ( context "context" - big "math/big" felt "github.com/NethermindEth/juno/core/felt" - mock "github.com/stretchr/testify/mock" ) @@ -17,19 +15,19 @@ type NonceManagerClient struct { } // AccountNonce provides a mock function with given fields: _a0, _a1 -func (_m *NonceManagerClient) AccountNonce(_a0 context.Context, _a1 *felt.Felt) (*big.Int, error) { +func (_m *NonceManagerClient) AccountNonce(_a0 context.Context, _a1 *felt.Felt) (*felt.Felt, error) { ret := _m.Called(_a0, _a1) - var r0 *big.Int + var r0 *felt.Felt var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *felt.Felt) (*big.Int, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, *felt.Felt) (*felt.Felt, error)); ok { return rf(_a0, _a1) } - if rf, ok := ret.Get(0).(func(context.Context, *felt.Felt) *big.Int); ok { + if rf, ok := ret.Get(0).(func(context.Context, *felt.Felt) *felt.Felt); ok { r0 = rf(_a0, _a1) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*big.Int) + r0 = ret.Get(0).(*felt.Felt) } } diff --git a/relayer/pkg/chainlink/txm/nonce.go b/relayer/pkg/chainlink/txm/nonce.go index 1982f6ff9..7d9587548 100644 --- a/relayer/pkg/chainlink/txm/nonce.go +++ b/relayer/pkg/chainlink/txm/nonce.go @@ -3,7 +3,6 @@ package txm import ( "context" "fmt" - "math/big" "sync" "github.com/NethermindEth/juno/core/felt" @@ -16,7 +15,7 @@ import ( //go:generate mockery --name NonceManagerClient --output ./mocks/ --case=underscore --filename nonce_manager_client.go type NonceManagerClient interface { - AccountNonce(context.Context, *felt.Felt) (*big.Int, error) + AccountNonce(context.Context, *felt.Felt) (*felt.Felt, error) } type NonceManager interface { @@ -24,8 +23,8 @@ type NonceManager interface { Register(ctx context.Context, address *felt.Felt, chainId string, client NonceManagerClient) error - NextSequence(address *felt.Felt, chainID string) (*big.Int, error) - IncrementNextSequence(address *felt.Felt, chainID string, currentNonce *big.Int) error + NextSequence(address *felt.Felt, chainID string) (*felt.Felt, error) + IncrementNextSequence(address *felt.Felt, chainID string, currentNonce *felt.Felt) error } var _ NonceManager = (*nonceManager)(nil) @@ -34,14 +33,14 @@ type nonceManager struct { starter utils.StartStopOnce lggr logger.Logger - n map[string]map[string]*big.Int // map address + chain ID to nonce + n map[string]map[string]*felt.Felt // map address + chain ID to nonce lock sync.RWMutex } func NewNonceManager(lggr logger.Logger) *nonceManager { return &nonceManager{ lggr: logger.Named(lggr, "NonceManager"), - n: map[string]map[string]*big.Int{}, + n: map[string]map[string]*felt.Felt{}, } } @@ -71,7 +70,7 @@ func (nm *nonceManager) Register(ctx context.Context, addr *felt.Felt, chainId s defer nm.lock.Unlock() addressNonces, exists := nm.n[addr.String()] if !exists { - nm.n[addr.String()] = map[string]*big.Int{} + nm.n[addr.String()] = map[string]*felt.Felt{} } _, exists = addressNonces[chainId] if !exists { @@ -85,7 +84,7 @@ func (nm *nonceManager) Register(ctx context.Context, addr *felt.Felt, chainId s return nil } -func (nm *nonceManager) NextSequence(addr *felt.Felt, chainId string) (*big.Int, error) { +func (nm *nonceManager) NextSequence(addr *felt.Felt, chainId string) (*felt.Felt, error) { if err := nm.validate(addr, chainId); err != nil { return nil, err } @@ -95,7 +94,7 @@ func (nm *nonceManager) NextSequence(addr *felt.Felt, chainId string) (*big.Int, return nm.n[addr.String()][chainId], nil } -func (nm *nonceManager) IncrementNextSequence(addr *felt.Felt, chainId string, currentNonce *big.Int) error { +func (nm *nonceManager) IncrementNextSequence(addr *felt.Felt, chainId string, currentNonce *felt.Felt) error { if err := nm.validate(addr, chainId); err != nil { return err } @@ -106,7 +105,8 @@ func (nm *nonceManager) IncrementNextSequence(addr *felt.Felt, chainId string, c if n.Cmp(currentNonce) != 0 { return fmt.Errorf("mismatched nonce for %s: %s (expected) != %s (got)", addr, n, currentNonce) } - nm.n[addr.String()][chainId] = big.NewInt(n.Int64() + 1) + one := new(felt.Felt).SetUint64(1) + nm.n[addr.String()][chainId] = new(felt.Felt).Add(n, one) return nil } diff --git a/relayer/pkg/chainlink/txm/nonce_test.go b/relayer/pkg/chainlink/txm/nonce_test.go index 0ad4a01b8..19e321ba5 100644 --- a/relayer/pkg/chainlink/txm/nonce_test.go +++ b/relayer/pkg/chainlink/txm/nonce_test.go @@ -5,8 +5,8 @@ import ( "math/big" "testing" - starknetutils "github.com/NethermindEth/starknet.go/utils" "github.com/NethermindEth/juno/core/felt" + starknetutils "github.com/NethermindEth/starknet.go/utils" "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" @@ -19,7 +19,7 @@ import ( "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/txm/mocks" ) -func newTestNonceManager(t *testing.T, chainID string, initNonce *big.Int) (txm.NonceManager, *felt.Felt, func()) { +func newTestNonceManager(t *testing.T, chainID string, initNonce *felt.Felt) (txm.NonceManager, *felt.Felt, func()) { // setup c := mocks.NewNonceManagerClient(t) lggr := logger.Test(t) @@ -40,7 +40,7 @@ func TestNonceManager_NextSequence(t *testing.T) { t.Parallel() chainId := "test_nextSequence" - initNonce := big.NewInt(10) + initNonce := new(felt.Felt).SetUint64(10) nm, k, stop := newTestNonceManager(t, chainId, initNonce) defer stop() @@ -55,7 +55,7 @@ func TestNonceManager_NextSequence(t *testing.T) { assert.Contains(t, err.Error(), fmt.Sprintf("nonce does not exist for key: %s and chain: %s", k.String(), "invalid_chainId")) // should fail with invalid address - randAddr1, err := starknetutils.BigIntToFelt(big.NewInt(1)) + randAddr1 := starknetutils.BigIntToFelt(big.NewInt(1)) require.NoError(t, err) _, err = nm.NextSequence(randAddr1, chainId) require.Error(t, err) @@ -66,12 +66,13 @@ func TestNonceManager_IncrementNextSequence(t *testing.T) { t.Parallel() chainId := "test_nextSequence" - initNonce := big.NewInt(10) + initNonce := new(felt.Felt).SetUint64(10) nm, k, stop := newTestNonceManager(t, chainId, initNonce) defer stop() - initMinusOne := big.NewInt(initNonce.Int64() - 1) - initPlusOne := big.NewInt(initNonce.Int64() + 1) + one := new(felt.Felt).SetUint64(1) + initMinusOne := new(felt.Felt).Sub(initNonce, one) + initPlusOne := new(felt.Felt).Add(initNonce, one) // should fail if nonce is lower then expected err := nm.IncrementNextSequence(k, chainId, initMinusOne) @@ -91,7 +92,7 @@ func TestNonceManager_IncrementNextSequence(t *testing.T) { assert.Contains(t, err.Error(), fmt.Sprintf("nonce does not exist for key: %s and chain: %s", k.String(), "invalid_chainId")) // should fail with invalid address - randAddr1, err := starknetutils.BigIntToFelt(big.NewInt(1)) + randAddr1 := starknetutils.BigIntToFelt(big.NewInt(1)) require.NoError(t, err) err = nm.IncrementNextSequence(randAddr1, chainId, initPlusOne) require.Error(t, err) diff --git a/relayer/pkg/chainlink/txm/txm.go b/relayer/pkg/chainlink/txm/txm.go index 4372bc88c..152d5d9d2 100644 --- a/relayer/pkg/chainlink/txm/txm.go +++ b/relayer/pkg/chainlink/txm/txm.go @@ -4,15 +4,13 @@ import ( "context" "errors" "fmt" - "math/big" "reflect" "sync" "time" "github.com/NethermindEth/juno/core/felt" - "github.com/NethermindEth/starknet.go" + starknetaccount "github.com/NethermindEth/starknet.go/account" starknetrpc "github.com/NethermindEth/starknet.go/rpc" - starknettypes "github.com/NethermindEth/starknet.go/types" starknetutils "github.com/NethermindEth/starknet.go/utils" "golang.org/x/exp/maps" @@ -29,14 +27,14 @@ const ( ) type TxManager interface { - Enqueue(senderAddress *felt.Felt, accountAddress *felt.Felt, txFn starknettypes.FunctionCall) error + Enqueue(senderAddress *felt.Felt, accountAddress *felt.Felt, txFn starknetrpc.FunctionCall) error InflightCount() (int, int) } type Tx struct { senderAddress *felt.Felt accountAddress *felt.Felt - call starknettypes.FunctionCall + call starknetrpc.FunctionCall } type StarkTXM interface { @@ -128,15 +126,15 @@ func (txm *starktxm) broadcastLoop() { const FEE_MARGIN uint64 = 115 -func (txm *starktxm) broadcast(ctx context.Context, senderAddress *felt.Felt, accountAddress *felt.Felt, tx starknettypes.FunctionCall) (txhash string, err error) { - txs := []starknettypes.FunctionCall{tx} +func (txm *starktxm) broadcast(ctx context.Context, senderAddress *felt.Felt, accountAddress *felt.Felt, call starknetrpc.FunctionCall) (txhash string, err error) { client, err := txm.client.Get() if err != nil { txm.client.Reset() return txhash, fmt.Errorf("broadcast: failed to fetch client: %+w", err) } // create new account - account, err := starknetgo.NewRPCAccount(senderAddress, accountAddress, txm.ks, client.Provider, starknetgo.AccountVersion1) + accountVersion := 0 + account, err := starknetaccount.NewAccount(client.Provider, senderAddress, accountAddress.String(), txm.ks, accountVersion) if err != nil { return txhash, fmt.Errorf("failed to create new account: %+w", err) } @@ -151,31 +149,55 @@ func (txm *starktxm) broadcast(ctx context.Context, senderAddress *felt.Felt, ac return txhash, fmt.Errorf("failed to get nonce: %+w", err) } - // get fee for txm + // TODO: update to v3 + + maxfee, err := starknetutils.HexToFelt("0x95e566845d000") + if err != nil { + return txhash, err + } + + // Building the tx struct + tx := starknetrpc.InvokeTxnV1{ + MaxFee: maxfee, + Version: starknetrpc.TransactionV1, + Nonce: nonce, + Type: starknetrpc.TransactionType_Invoke, + SenderAddress: account.AccountAddress, + } + + // Building the Calldata with the help of FmtCalldata where we pass in the FnCall struct along with the Cairo version + tx.Calldata, err = account.FmtCalldata([]starknetrpc.FunctionCall{call}) + if err != nil { + return txhash, err + } + + // Signing of the transaction that is done by the account + err = account.SignInvokeTransaction(context.Background(), &tx) + if err != nil { + return txhash, err + } + + // get fee for tx // optional - pass nonce to fee estimate (if nonce gets ahead, estimate may fail) // can we estimate fee without calling estimate - tbd with 1.0 - feeEstimate, err := account.EstimateFee(ctx, txs, starknettypes.ExecuteDetails{}) + simFlags := []starknetrpc.SimulationFlag{} + feeEstimate, err := account.EstimateFee(ctx, []starknetrpc.BroadcastTxn{tx}, simFlags, starknetrpc.BlockID{Tag: "latest"}) if err != nil { return txhash, fmt.Errorf("failed to estimate fee: %+w", err) } + // expandedFee := new(felt.Felt).Mul(feeEstimate[0].OverallFee, FEE_MARGIN) + // maxfee = new(felt.Felt).Div(expandedFee, new(felt.Felt).SetUint64(100)) + tx.MaxFee = feeEstimate[0].OverallFee // TODO: mul times margin - fee, _ := big.NewInt(0).SetString(string(feeEstimate.OverallFee), 0) - expandedFee := big.NewInt(0).Mul(fee, big.NewInt(int64(FEE_MARGIN))) - max := big.NewInt(0).Div(expandedFee, big.NewInt(100)) - details := starknettypes.ExecuteDetails{ - MaxFee: max, - Nonce: nonce, - } - - // transmit txs execCtx, execCancel := context.WithTimeout(ctx, txm.cfg.TxTimeout()) defer execCancel() - res, err := account.Execute(execCtx, txs, details) + + // finally, transmit the invoke + res, err := account.AddInvokeTransaction(execCtx, tx) if err != nil { // TODO: handle initial broadcast errors - what kind of errors occur? return txhash, fmt.Errorf("failed to invoke tx: %+w", err) } - // handle nil pointer if res == nil { return txhash, errors.New("execute response and error are nil") @@ -224,20 +246,21 @@ func (txm *starktxm) confirmLoop() { txm.lggr.Errorw("failed to fetch transaction status", "hash", hash, "error", err) continue } + // TODO: there's no more pending status so a txn status is always accepted or rejected receipt, ok := response.(starknetrpc.InvokeTransactionReceipt) if !ok { txm.lggr.Errorw("wrong receipt type", "type", reflect.TypeOf(response)) continue } - status := receipt.Status + status := receipt.GetExecutionStatus() - if status == starknetrpc.TransactionAcceptedOnL1 || status == starknetrpc.TransactionAcceptedOnL2 || status == starknetrpc.TransactionRejected { - txm.lggr.Debugw(fmt.Sprintf("tx confirmed: %s", status), "hash", hash, "status", status) - if err := txm.txStore.Confirm(addr, hash); err != nil { - txm.lggr.Errorw("failed to confirm tx in TxStore", "hash", hash, "sender", addr, "error", err) - } + // if status == starknetrpc.TxnStatus_Accepted_On_L1 || status == starknetrpc.TxnStatus_Accepted_On_L2 || status == starknetrpc.TxnStatus_Rejected { + txm.lggr.Debugw(fmt.Sprintf("tx confirmed: %s", status), "hash", hash, "status", status) + if err := txm.txStore.Confirm(addr, hash); err != nil { + txm.lggr.Errorw("failed to confirm tx in TxStore", "hash", hash, "sender", addr, "error", err) } + // } } } case <-txm.stop: @@ -269,7 +292,7 @@ func (txm *starktxm) HealthReport() map[string]error { return map[string]error{txm.Name(): txm.Healthy()} } -func (txm *starktxm) Enqueue(senderAddress, accountAddress *felt.Felt, tx starknettypes.FunctionCall) error { +func (txm *starktxm) Enqueue(senderAddress, accountAddress *felt.Felt, tx starknetrpc.FunctionCall) error { // validate key exists for sender // use the embedded Loopp Keystore to do this; the spec and design // encourage passing nil data to the loop.Keystore.Sign as way to test diff --git a/relayer/pkg/chainlink/txm/txm_test.go b/relayer/pkg/chainlink/txm/txm_test.go index a6dbc39ca..b365193fd 100644 --- a/relayer/pkg/chainlink/txm/txm_test.go +++ b/relayer/pkg/chainlink/txm/txm_test.go @@ -9,10 +9,9 @@ import ( "testing" "time" - "github.com/NethermindEth/starknet.go" - starknetgw "github.com/NethermindEth/starknet.go/gateway" - "github.com/NethermindEth/starknet.go/test" - starknettypes "github.com/NethermindEth/starknet.go/types" + "github.com/NethermindEth/starknet.go/curve" + "github.com/NethermindEth/starknet.go/devnet" + starknetrpc "github.com/NethermindEth/starknet.go/rpc" starknetutils "github.com/NethermindEth/starknet.go/utils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -28,7 +27,7 @@ import ( func TestIntegration_Txm(t *testing.T) { n := 2 // number of txs per key url := SetupLocalStarknetNode(t) - devnet := test.NewDevNet(url) + devnet := devnet.NewDevNet(url) accounts, err := devnet.Accounts() require.NoError(t, err) @@ -36,11 +35,11 @@ func TestIntegration_Txm(t *testing.T) { localKeys := map[string]*big.Int{} localAccounts := map[string]string{} for i := range accounts { - privKey, err := starknettypes.HexToBytes(accounts[i].PrivateKey) + privKey, err := utils.HexToBytes(accounts[i].PrivateKey) require.NoError(t, err) senderAddress, err := starknetutils.HexToFelt(accounts[i].PublicKey) require.NoError(t, err) - localKeys[senderAddress.String()] = starknettypes.BytesToBig(privKey) + localKeys[senderAddress.String()] = utils.BytesToBig(privKey) localAccounts[senderAddress.String()] = accounts[i].Address } @@ -55,7 +54,7 @@ func TestIntegration_Txm(t *testing.T) { ksAdapter := NewKeystoreAdapter(looppKs) lggr, observer := logger.TestObserved(t, zapcore.DebugLevel) timeout := 10 * time.Second - client, err := starknet.NewClient(starknetgw.GOERLI_ID, url+"/rpc", lggr, &timeout) + client, err := starknet.NewClient("SN_GOERLI", url+"/rpc", lggr, &timeout) require.NoError(t, err) getClient := func() (*starknet.Client, error) { @@ -87,10 +86,10 @@ func TestIntegration_Txm(t *testing.T) { contractAddress, err := starknetutils.HexToFelt("0x49D36570D4E46F48E99674BD3FCC84644DDD6B96F7C741B1562B82F9E004DC7") require.NoError(t, err) - selector := starknettypes.GetSelectorFromNameFelt("totalSupply") + selector := utils.GetSelectorFromNameFelt("totalSupply") for i := 0; i < n; i++ { - require.NoError(t, txm.Enqueue(senderAddress, account, starknettypes.FunctionCall{ + require.NoError(t, txm.Enqueue(senderAddress, account, starknetrpc.FunctionCall{ ContractAddress: contractAddress, // send to ETH token contract EntryPointSelector: selector, })) @@ -147,7 +146,7 @@ func (lk *LooppKeystore) Sign(ctx context.Context, id string, hash []byte) ([]by } starkHash := new(big.Int).SetBytes(hash) - x, y, err := starknetgo.Curve.Sign(starkHash, k) + x, y, err := curve.Curve.Sign(starkHash, k) if err != nil { return nil, fmt.Errorf("error signing data with curve: %w", err) } diff --git a/relayer/pkg/chainlink/txm/txstore.go b/relayer/pkg/chainlink/txm/txstore.go index ce47b9de9..ceb20935b 100644 --- a/relayer/pkg/chainlink/txm/txstore.go +++ b/relayer/pkg/chainlink/txm/txstore.go @@ -2,7 +2,6 @@ package txm import ( "fmt" - "math/big" "sync" "github.com/NethermindEth/juno/core/felt" @@ -12,27 +11,27 @@ import ( // TxStore tracks broadcast & unconfirmed txs type TxStore struct { lock sync.RWMutex - nonceToHash map[int64]string // map nonce to txhash - hashToNonce map[string]int64 // map hash to nonce - currentNonce *big.Int // minimum nonce + nonceToHash map[*felt.Felt]string // map nonce to txhash + hashToNonce map[string]*felt.Felt // map hash to nonce + currentNonce *felt.Felt // minimum nonce } -func NewTxStore(current *big.Int) *TxStore { +func NewTxStore(current *felt.Felt) *TxStore { return &TxStore{ - nonceToHash: map[int64]string{}, - hashToNonce: map[string]int64{}, + nonceToHash: map[*felt.Felt]string{}, + hashToNonce: map[string]*felt.Felt{}, currentNonce: current, } } -func (s *TxStore) Save(nonce *big.Int, hash string) error { +func (s *TxStore) Save(nonce *felt.Felt, hash string) error { s.lock.Lock() defer s.lock.Unlock() if s.currentNonce.Cmp(nonce) == 1 { return fmt.Errorf("nonce too low: %s < %s (lowest)", nonce, s.currentNonce) } - if h, exists := s.nonceToHash[nonce.Int64()]; exists { + if h, exists := s.nonceToHash[nonce]; exists { return fmt.Errorf("nonce used: tried to use nonce (%s) for tx (%s), already used by (%s)", nonce, hash, h) } if n, exists := s.hashToNonce[hash]; exists { @@ -40,14 +39,14 @@ func (s *TxStore) Save(nonce *big.Int, hash string) error { } // store hash - s.nonceToHash[nonce.Int64()] = hash - s.hashToNonce[hash] = nonce.Int64() + s.nonceToHash[nonce] = hash + s.hashToNonce[hash] = nonce // find next unused nonce - _, exists := s.nonceToHash[s.currentNonce.Int64()] + _, exists := s.nonceToHash[s.currentNonce] for exists { - s.currentNonce.Add(s.currentNonce, big.NewInt(1)) - _, exists = s.nonceToHash[s.currentNonce.Int64()] + s.currentNonce.Add(s.currentNonce, new(felt.Felt).SetUint64(1)) + _, exists = s.nonceToHash[s.currentNonce] } return nil } @@ -87,7 +86,7 @@ func NewChainTxStore() *ChainTxStore { } } -func (c *ChainTxStore) Save(from *felt.Felt, nonce *big.Int, hash string) error { +func (c *ChainTxStore) Save(from *felt.Felt, nonce *felt.Felt, hash string) error { // use write lock for methods that modify underlying data c.lock.Lock() defer c.lock.Unlock() diff --git a/relayer/pkg/chainlink/txm/txstore_test.go b/relayer/pkg/chainlink/txm/txstore_test.go index b87eb8243..648996173 100644 --- a/relayer/pkg/chainlink/txm/txstore_test.go +++ b/relayer/pkg/chainlink/txm/txstore_test.go @@ -3,11 +3,10 @@ package txm import ( "errors" "fmt" - "math/big" "sync" "testing" - starknetutils "github.com/NethermindEth/starknet.go/utils" + "github.com/NethermindEth/juno/core/felt" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -18,9 +17,9 @@ func TestTxStore(t *testing.T) { t.Run("happypath", func(t *testing.T) { t.Parallel() - s := NewTxStore(big.NewInt(0)) + s := NewTxStore(&felt.Zero) assert.Equal(t, 0, s.InflightCount()) - require.NoError(t, s.Save(big.NewInt(0), "0x0")) + require.NoError(t, s.Save(&felt.Zero, "0x0")) assert.Equal(t, 1, s.InflightCount()) assert.Equal(t, []string{"0x0"}, s.GetUnconfirmed()) require.NoError(t, s.Confirm("0x0")) @@ -32,38 +31,38 @@ func TestTxStore(t *testing.T) { t.Parallel() // create - s := NewTxStore(big.NewInt(0)) + s := NewTxStore(&felt.Zero) // accepts tx in order - require.NoError(t, s.Save(big.NewInt(0), "0x0")) + require.NoError(t, s.Save(&felt.Zero, "0x0")) assert.Equal(t, 1, s.InflightCount()) - assert.Equal(t, int64(1), s.currentNonce.Int64()) + assert.Equal(t, new(felt.Felt).SetUint64(1), s.currentNonce) // accepts tx that skips a nonce - require.NoError(t, s.Save(big.NewInt(2), "0x2")) + require.NoError(t, s.Save(new(felt.Felt).SetUint64(2), "0x2")) assert.Equal(t, 2, s.InflightCount()) - assert.Equal(t, int64(1), s.currentNonce.Int64()) + assert.Equal(t, new(felt.Felt).SetUint64(1), s.currentNonce) // accepts tx that fills in the missing nonce + fast forwards currentNonce - require.NoError(t, s.Save(big.NewInt(1), "0x1")) + require.NoError(t, s.Save(new(felt.Felt).SetUint64(1), "0x1")) assert.Equal(t, 3, s.InflightCount()) - assert.Equal(t, int64(3), s.currentNonce.Int64()) + assert.Equal(t, new(felt.Felt).SetUint64(3), s.currentNonce) // skip a nonce for later tests - require.NoError(t, s.Save(big.NewInt(4), "0x4")) + require.NoError(t, s.Save(new(felt.Felt).SetUint64(4), "0x4")) assert.Equal(t, 4, s.InflightCount()) - assert.Equal(t, int64(3), s.currentNonce.Int64()) + assert.Equal(t, new(felt.Felt).SetUint64(3), s.currentNonce) // rejects old nonce - require.ErrorContains(t, s.Save(big.NewInt(0), "0xold"), "nonce too low: 0 < 3 (lowest)") + require.ErrorContains(t, s.Save(&felt.Zero, "0xold"), "nonce too low: 0 < 3 (lowest)") assert.Equal(t, 4, s.InflightCount()) // reject already in use nonce - require.ErrorContains(t, s.Save(big.NewInt(4), "0xskip"), "nonce used: tried to use nonce (4) for tx (0xskip), already used by (0x4)") + require.ErrorContains(t, s.Save(new(felt.Felt).SetUint64(4), "0xskip"), "nonce used: tried to use nonce (4) for tx (0xskip), already used by (0x4)") assert.Equal(t, 4, s.InflightCount()) // reject already in use tx hash - require.ErrorContains(t, s.Save(big.NewInt(5), "0x0"), "hash used: tried to use tx (0x0) for nonce (5), already used nonce (0)") + require.ErrorContains(t, s.Save(new(felt.Felt).SetUint64(5), "0x0"), "hash used: tried to use tx (0x0) for nonce (5), already used nonce (0)") assert.Equal(t, 4, s.InflightCount()) // race save @@ -72,11 +71,11 @@ func TestTxStore(t *testing.T) { var wg sync.WaitGroup wg.Add(2) go func() { - err0 = s.Save(big.NewInt(10), "0x10") + err0 = s.Save(new(felt.Felt).SetUint64(10), "0x10") wg.Done() }() go func() { - err1 = s.Save(big.NewInt(10), "0x10") + err1 = s.Save(new(felt.Felt).SetUint64(10), "0x10") wg.Done() }() wg.Wait() @@ -87,9 +86,9 @@ func TestTxStore(t *testing.T) { t.Parallel() // init store - s := NewTxStore(big.NewInt(0)) + s := NewTxStore(&felt.Zero) for i := 0; i < 5; i++ { - require.NoError(t, s.Save(big.NewInt(int64(i)), "0x"+fmt.Sprintf("%d", i))) + require.NoError(t, s.Save(new(felt.Felt).SetUint64(uint64(i)), "0x"+fmt.Sprintf("%d", i))) } // confirm in order @@ -108,7 +107,7 @@ func TestTxStore(t *testing.T) { require.ErrorContains(t, s.Confirm("0xNULL"), "tx hash does not exist - it may already be confirmed") // race confirm - require.NoError(t, s.Save(big.NewInt(10), "0x10")) + require.NoError(t, s.Save(new(felt.Felt).SetUint64(10), "0x10")) var err0 error var err1 error var wg sync.WaitGroup @@ -131,21 +130,19 @@ func TestChainTxStore(t *testing.T) { c := NewChainTxStore() - felt, err := starknetutils.BigIntToFelt(big.NewInt(0)) - require.NoError(t, err) - felt1, err := starknetutils.BigIntToFelt(big.NewInt(1)) - require.NoError(t, err) + felt0 := new(felt.Felt).SetUint64(0) + felt1 := new(felt.Felt).SetUint64(1) // automatically save the from address - require.NoError(t, c.Save(felt, big.NewInt(0), "0x0")) + require.NoError(t, c.Save(felt0, new(felt.Felt).SetUint64(0), "0x0")) // reject saving for existing address and reused hash & nonce // error messages are tested within TestTxStore - assert.Error(t, c.Save(felt, big.NewInt(0), "0x1")) - assert.Error(t, c.Save(felt, big.NewInt(1), "0x0")) + assert.Error(t, c.Save(felt0, new(felt.Felt).SetUint64(0), "0x1")) + assert.Error(t, c.Save(felt0, new(felt.Felt).SetUint64(1), "0x0")) // inflight count - count, exists := c.GetAllInflightCount()[felt] + count, exists := c.GetAllInflightCount()[felt0] require.True(t, exists) assert.Equal(t, 1, count) _, exists = c.GetAllInflightCount()[felt1] @@ -154,18 +151,18 @@ func TestChainTxStore(t *testing.T) { // get unconfirmed list := c.GetAllUnconfirmed() assert.Equal(t, 1, len(list)) - hashes, ok := list[felt] + hashes, ok := list[felt0] assert.True(t, ok) assert.Equal(t, []string{"0x0"}, hashes) // confirm - assert.NoError(t, c.Confirm(felt, "0x0")) + assert.NoError(t, c.Confirm(felt0, "0x0")) assert.ErrorContains(t, c.Confirm(felt1, "0x0"), "from address does not exist") - assert.Error(t, c.Confirm(felt, "0x1")) + assert.Error(t, c.Confirm(felt0, "0x1")) list = c.GetAllUnconfirmed() assert.Equal(t, 1, len(list)) - assert.Equal(t, 0, len(list[felt])) - count, exists = c.GetAllInflightCount()[felt] + assert.Equal(t, 0, len(list[felt0])) + count, exists = c.GetAllInflightCount()[felt0] assert.True(t, exists) assert.Equal(t, 0, count) } diff --git a/relayer/pkg/starknet/client.go b/relayer/pkg/starknet/client.go index 7260fd3f5..e27896a4e 100644 --- a/relayer/pkg/starknet/client.go +++ b/relayer/pkg/starknet/client.go @@ -8,7 +8,7 @@ import ( "github.com/pkg/errors" "github.com/NethermindEth/juno/core/felt" - caigo "github.com/NethermindEth/starknet.go" + starknetaccount "github.com/NethermindEth/starknet.go/account" starknetrpc "github.com/NethermindEth/starknet.go/rpc" starknetutils "github.com/NethermindEth/starknet.go/utils" ethrpc "github.com/ethereum/go-ethereum/rpc" @@ -28,7 +28,7 @@ type Reader interface { Events(ctx context.Context, input starknetrpc.EventsInput) (*starknetrpc.EventChunk, error) TransactionByHash(context.Context, *felt.Felt) (starknetrpc.Transaction, error) TransactionReceipt(context.Context, *felt.Felt) (starknetrpc.TransactionReceipt, error) - AccountNonce(context.Context, *felt.Felt) (*big.Int, error) + AccountNonce(context.Context, *felt.Felt) (*felt.Felt, error) } type Writer interface { @@ -44,7 +44,7 @@ var _ ReaderWriter = (*Client)(nil) // var _ starknettypes.Provider = (*Client)(nil) type Client struct { - Provider *starknetrpc.Provider + Provider starknetrpc.RpcProvider lggr logger.Logger defaultTimeout time.Duration } @@ -192,20 +192,18 @@ func (c *Client) Events(ctx context.Context, input starknetrpc.EventsInput) (*st return out, nil } -func (c *Client) AccountNonce(ctx context.Context, accountAddress *felt.Felt) (*big.Int, error) { +func (c *Client) AccountNonce(ctx context.Context, accountAddress *felt.Felt) (*felt.Felt, error) { if c.defaultTimeout != 0 { var cancel context.CancelFunc ctx, cancel = context.WithTimeout(ctx, c.defaultTimeout) defer cancel() } - sender, err := starknetutils.BigIntToFelt(big.NewInt((0))) // not actually used in account.Nonce() + sender := starknetutils.BigIntToFelt(big.NewInt((0))) // not actually used in account.Nonce() + accountVersion := 0 + account, err := starknetaccount.NewAccount(c.Provider, sender, accountAddress.String(), nil, accountVersion) if err != nil { return nil, errors.Wrap(err, "error in client.AccountNonce") } - account, err := caigo.NewRPCAccount(sender, accountAddress, nil, c.Provider, caigo.AccountVersion1) - if err != nil { - return nil, errors.Wrap(err, "error in client.AccountNonce") - } - return account.Nonce(ctx) + return account.Nonce(ctx, starknetrpc.BlockID{Tag: "latest"}, account.AccountAddress) } diff --git a/relayer/pkg/starknet/client_test.go b/relayer/pkg/starknet/client_test.go index 9d58e69db..e3d88b24a 100644 --- a/relayer/pkg/starknet/client_test.go +++ b/relayer/pkg/starknet/client_test.go @@ -10,8 +10,7 @@ import ( "testing" "time" - "github.com/NethermindEth/starknet.go/gateway" - starknettypes "github.com/NethermindEth/starknet.go/types" + starknetutils "github.com/NethermindEth/starknet.go/utils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -19,7 +18,7 @@ import ( ) var ( - chainID = gateway.GOERLI_ID + chainID = "SN_GOERLI" timeout = 10 * time.Second ) @@ -40,7 +39,7 @@ func TestRPCClient(t *testing.T) { switch call.Method { case "starknet_chainId": - id := starknettypes.BigToHex(starknettypes.UTF8StrToBig(chainID)) + id := starknetutils.BigToHex(starknetutils.UTF8StrToBig(chainID)) out = []byte(fmt.Sprintf(`{"result": "%s"}`, id)) case "starknet_blockNumber": out = []byte(`{"result": 1}`) diff --git a/relayer/pkg/starknet/mocks/Reader.go b/relayer/pkg/starknet/mocks/Reader.go index f5229e04a..cb88175c1 100644 --- a/relayer/pkg/starknet/mocks/Reader.go +++ b/relayer/pkg/starknet/mocks/Reader.go @@ -4,10 +4,8 @@ package mocks import ( context "context" - big "math/big" felt "github.com/NethermindEth/juno/core/felt" - mock "github.com/stretchr/testify/mock" rpc "github.com/NethermindEth/starknet.go/rpc" @@ -21,19 +19,19 @@ type Reader struct { } // AccountNonce provides a mock function with given fields: _a0, _a1 -func (_m *Reader) AccountNonce(_a0 context.Context, _a1 *felt.Felt) (*big.Int, error) { +func (_m *Reader) AccountNonce(_a0 context.Context, _a1 *felt.Felt) (*felt.Felt, error) { ret := _m.Called(_a0, _a1) - var r0 *big.Int + var r0 *felt.Felt var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *felt.Felt) (*big.Int, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, *felt.Felt) (*felt.Felt, error)); ok { return rf(_a0, _a1) } - if rf, ok := ret.Get(0).(func(context.Context, *felt.Felt) *big.Int); ok { + if rf, ok := ret.Get(0).(func(context.Context, *felt.Felt) *felt.Felt); ok { r0 = rf(_a0, _a1) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*big.Int) + r0 = ret.Get(0).(*felt.Felt) } }