Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monitoring #103

Merged
merged 36 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3228908
add method to fetch latest RoundData in the ocr2#Client
topliceanu Sep 5, 2022
22bd535
add method to fetch a new_transmissions event from a block
topliceanu Sep 5, 2022
3230a62
add chain, feed and node configuration parsers
topliceanu Sep 5, 2022
bf9447a
add Envelope source
topliceanu Sep 5, 2022
937614a
add source for transaction results
topliceanu Sep 5, 2022
838b867
add proxy monitoring source, metrics and prom exporter
topliceanu Sep 5, 2022
4078987
add boilerplate to run and build the monitor
topliceanu Sep 5, 2022
b23272e
move LinkAvailableForPayment to ocr2.Client
topliceanu Sep 12, 2022
8a5e95e
fix fields length check in ocr2.NewRoundData
topliceanu Sep 12, 2022
6bb9d03
rename utility in ocr2.Client from fetchEventsAt to fetchEventsFromBl…
topliceanu Sep 16, 2022
9901fc7
fields in ChainConfig are now private with public getters
topliceanu Sep 16, 2022
8d98feb
fix main after changes to Starknet ChainConfig
topliceanu Sep 16, 2022
f82e08e
correctly set the agg contract method to link_available_for_payment
topliceanu Sep 23, 2022
2a6eb99
add Proxy address to the feed configuration
topliceanu Sep 23, 2022
b7ba4ca
add README with instruction on running the monitor on localhost
topliceanu Sep 23, 2022
e512cc1
move the dockerfile to ops/monitoring
topliceanu Sep 23, 2022
93985cb
fixes for felt transformations inside sources
topliceanu Sep 26, 2022
13b1a2f
add integration tests for new methods added to ocr2.Client
topliceanu Sep 27, 2022
1d4d5c2
add mocks for starknet.Reader and ocr2.OCR2Reader
topliceanu Sep 27, 2022
cc7f250
add test for the txresults source
topliceanu Sep 27, 2022
8285ad6
add test for the proxy source
topliceanu Sep 27, 2022
132d258
add regression test for the Envelope source
topliceanu Sep 27, 2022
c44cb8f
add test for NewRoundData and fix latest transmission timestamp in the
topliceanu Sep 27, 2022
33bde04
appease the linter
topliceanu Sep 27, 2022
d00fb60
move monitoring into a separate module along with the dockerfile
topliceanu Sep 27, 2022
b004eee
fix bug where multiply was not correctly populated
topliceanu Sep 27, 2022
6e194cf
fix broken transmitter address in Envelope source test
topliceanu Sep 27, 2022
5439e69
remove markdown and fix unit test for NewRoundData
topliceanu Sep 27, 2022
a8e54e0
support multiple new_transmission events in a single block in the ocr…
topliceanu Sep 29, 2022
d561a42
fix in ocr2.Client#NewTransmissionsFromEventsAt now returns multiple
topliceanu Sep 29, 2022
39e10c7
upgrade to the latest version of chainlink-relay
topliceanu Sep 29, 2022
99519c2
make the e2e test pass
topliceanu Sep 30, 2022
1b80974
make the ocr2.Client tests pass
topliceanu Sep 30, 2022
32f73fa
bump the testing framework
topliceanu Sep 30, 2022
b90403e
move utility to relayer/pkg/starknet and rename to StringsToJunoFelts
topliceanu Oct 3, 2022
9126230
updated starknet relayer to a commit in this PR
topliceanu Oct 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/e2e_custom_cl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:
contents: read
steps:
- name: Build Image
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/build-image@1f3c81b148e53caaa0563f8963f884f0e5a4f82d # v2.0.15
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/build-image@f70ebbe4a912eb25783498c88268001e6931f99f # v2.0.15
with:
cl_repo: smartcontractkit/chainlink
# By default we are integrating with CL develop
# cl_ref: ${{ github.event.inputs.cl_branch_ref }}
cl_ref: 22c6ac0237a85010b91154277533dfd6acc8912c # https://github.com/smartcontractkit/chainlink/pull/7366
cl_ref: ${{ github.event.inputs.cl_branch_ref }}
#cl_ref: 22c6ac0237a85010b91154277533dfd6acc8912c # https://github.com/smartcontractkit/chainlink/pull/7366
# commit of the caller branch
dep_starknet_sha: ${{ github.event.pull_request.head.sha || github.sha }}
push_tag: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink:custom.${{ github.sha }}
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run Tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@1f3c81b148e53caaa0563f8963f884f0e5a4f82d # v2.0.15
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@a7d97aae34922fa7bc04f8083fe4e4b37947a1df # v2.0.15
with:
test_command_to_run: nix develop -c make test-integration-smoke
test_download_vendor_packages_command: cd integration-tests && go mod download
Expand Down
80 changes: 80 additions & 0 deletions monitoring/cmd/monitoring/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package main

import (
"context"
"fmt"

"github.com/smartcontractkit/chainlink-relay/pkg/logger"
relayMonitoring "github.com/smartcontractkit/chainlink-relay/pkg/monitoring"

"github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/ocr2"
"github.com/smartcontractkit/chainlink-starknet/relayer/pkg/starknet"

"github.com/smartcontractkit/chainlink-starknet/monitoring/pkg/monitoring"
)

func main() {
ctx := context.Background()

log, err := logger.New()
if err != nil {
log.Fatal(err)
}
defer func() {
if serr := log.Sync(); serr != nil {
fmt.Printf("Error while closing Logger: %v\n", serr)
}
}()

starknetConfig, err := monitoring.ParseStarknetConfig()
if err != nil {
log.Fatalw("failed to parse starknet specific configuration", "error", err)
return
}

readTimeout := starknetConfig.GetReadTimeout()
starknetClient, err := starknet.NewClient(
starknetConfig.GetChainID(),
starknetConfig.GetRPCEndpoint(),
logger.With(log, "component", "starknet-client"),
&readTimeout,
)
if err != nil {
log.Fatalw("failed to build a starknet.Client", "error", err)
}
ocr2Client, err := ocr2.NewClient(
starknetClient,
logger.With(log, "component", "ocr2-client"),
)
if err != nil {
log.Fatalw("failed to build a ocr2.Client", "error", err)
}

envelopeSourceFactory := monitoring.NewEnvelopeSourceFactory(ocr2Client)
txResultsFactory := monitoring.NewTxResultsSourceFactory(ocr2Client)

monitor, err := relayMonitoring.NewMonitor(
ctx,
logger.With(log, "component", "monitor"),
starknetConfig,
envelopeSourceFactory,
txResultsFactory,
monitoring.StarknetFeedsParser,
monitoring.StarknetNodesParser,
)
if err != nil {
log.Fatalw("failed to build monitor", "error", err)
return
}

proxySourceFactory := monitoring.NewProxySourceFactory(ocr2Client)
monitor.SourceFactories = append(monitor.SourceFactories, proxySourceFactory)

prometheusExporterFactory := monitoring.NewPrometheusExporterFactory(
monitoring.NewMetrics(logger.With(log, "component", "starknet-metrics")),
)
monitor.ExporterFactories = append(monitor.ExporterFactories, prometheusExporterFactory)

monitor.Run()
log.Info("monitor stopped")
}
59 changes: 59 additions & 0 deletions monitoring/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
module github.com/smartcontractkit/chainlink-starknet/monitoring

go 1.18

require (
github.com/NethermindEth/juno v0.0.0-20220630151419-cbd368b222ac
github.com/dontpanicdao/caigo v0.3.1-0.20220812122711-b855f2b57bb5
github.com/prometheus/client_golang v1.12.2
github.com/smartcontractkit/chainlink-relay v0.1.6-0.20220929092150-827776af9911
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.0-20221003161435-b90403e247af
github.com/smartcontractkit/libocr v0.0.0-20220812191430-db92a9fdaa52
github.com/stretchr/testify v1.8.0
go.uber.org/multierr v1.8.0
)

require (
github.com/benbjohnson/clock v1.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/confluentinc/confluent-kafka-go v1.8.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/ethereum/go-ethereum v1.10.21 // 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.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/linkedin/goavro/v2 v2.12.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/riferrei/srclient v0.4.1-0.20211229125508-8edc580da179 // indirect
github.com/rjeczalik/notify v0.9.2 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.0.0 // indirect
github.com/satori/go.uuid v1.2.0 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/stretchr/objx v0.4.0 // indirect
github.com/tklauser/go-sysconf v0.3.9 // indirect
github.com/tklauser/numcpus v0.3.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
golang.org/x/exp v0.0.0-20220608143224-64259d1afd70 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading