Skip to content

Commit 9c99cf6

Browse files
feat: log last verified batch number (same PR as #324) (#335)
- Logs last verified batch number periodically for logging / monitoring purposes. - zkevm_ethtx_manager to v0.2.11: - add curl logs before sending tx to RPC #123 - increase go_signer version to 0.0.6 to fix KMS configuration issue and suport GCP KMS - feat: integrate with go_signer library to sign transactions by @joanestebanr in #109 --------- Co-authored-by: Toni Ramírez <toni@polygon.technology>
1 parent b0bd30a commit 9c99cf6

File tree

8 files changed

+278
-55
lines changed

8 files changed

+278
-55
lines changed

.github/workflows/codeql.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,17 @@ jobs:
2929

3030
# Initializes the CodeQL tools for scanning.
3131
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@v2
32+
uses: github/codeql-action/init@v3
3333
with:
3434
languages: ${{ matrix.language }}
3535

3636
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
3737
# If this step fails, then you should remove it and run the build manually (see below)
3838
- name: Autobuild
39-
uses: github/codeql-action/autobuild@v2
39+
uses: github/codeql-action/autobuild@v3
4040

4141
- name: Perform CodeQL Analysis
42-
uses: github/codeql-action/analyze@v2
42+
uses: github/codeql-action/analyze@v3
4343
with:
4444
category: "/language:${{ matrix.language }}"
45+

aggregator/aggregator.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ func (a *Aggregator) Start() error {
352352
go a.cleanupLockedProofs()
353353
go a.sendFinalProof()
354354
go a.ethTxManager.Start()
355+
go a.logLastVerifiedBatchNumber()
355356

356357
// A this point everything is ready, so start serving
357358
go func() {
@@ -374,6 +375,24 @@ func (a *Aggregator) Stop() {
374375
a.srv.Stop()
375376
}
376377

378+
func (a *Aggregator) logLastVerifiedBatchNumber() {
379+
for {
380+
select {
381+
case <-a.ctx.Done():
382+
return
383+
default:
384+
time.Sleep(a.cfg.RetryTime.Duration * 20) //nolint:mnd
385+
lastVerifiedBatchNumber, err := a.etherman.GetLatestVerifiedBatchNum()
386+
if err != nil {
387+
a.logger.Errorf("Error getting last verified batch number: %v", err)
388+
} else {
389+
tmpLogger := a.logger.WithFields("batch", lastVerifiedBatchNumber)
390+
tmpLogger.Infof("Last Verified Batch Number:%v", lastVerifiedBatchNumber)
391+
}
392+
}
393+
}
394+
}
395+
377396
// Channel implements the bi-directional communication channel between the
378397
// Prover client and the Aggregator server.
379398
func (a *Aggregator) Channel(stream prover.AggregatorService_ChannelServer) error {

aggregator/aggregator_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func Test_Start(t *testing.T) {
8484
mockEthTxManager := new(mocks.EthTxManagerClientMock)
8585

8686
mockL1Syncr.On("Sync", mock.Anything).Return(nil)
87-
mockEtherman.On("GetLatestVerifiedBatchNum").Return(uint64(90), nil).Once()
87+
mockEtherman.On("GetLatestVerifiedBatchNum").Return(uint64(90), nil)
8888
mockEtherman.On("GetBatchAccInputHash", mock.Anything, uint64(90)).Return(common.Hash{}, nil).Once()
8989
mockStorage.On("DeleteGeneratedProofs", mock.Anything, uint64(90), mock.Anything, nil).Return(nil).Once()
9090
mockStorage.On("CleanupLockedProofs", mock.Anything, "", nil).Return(int64(0), nil)
@@ -110,6 +110,7 @@ func Test_Start(t *testing.T) {
110110
err := a.Start()
111111
require.NoError(t, err)
112112
}()
113+
go a.logLastVerifiedBatchNumber()
113114
time.Sleep(time.Second)
114115
a.ctx.Done()
115116
time.Sleep(time.Second)

go.mod

Lines changed: 58 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/0xPolygon/cdk-contracts-tooling v0.0.2-0.20241225094934-1d381f5703ef
77
github.com/0xPolygon/cdk-data-availability v0.0.12
88
github.com/0xPolygon/cdk-rpc v0.0.0-20241004114257-6c3cb6eebfb6
9-
github.com/0xPolygon/zkevm-ethtx-manager v0.2.7
9+
github.com/0xPolygon/zkevm-ethtx-manager v0.2.11
1010
github.com/0xPolygonHermez/zkevm-synchronizer-l1 v1.0.7
1111
github.com/ethereum/go-ethereum v1.15.5
1212
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
@@ -30,32 +30,50 @@ require (
3030
go.opentelemetry.io/otel v1.24.0
3131
go.opentelemetry.io/otel/metric v1.24.0
3232
go.uber.org/zap v1.27.0
33-
golang.org/x/crypto v0.33.0
34-
golang.org/x/net v0.35.0
33+
golang.org/x/crypto v0.35.0
34+
golang.org/x/net v0.36.0
3535
golang.org/x/sync v0.11.0
3636
google.golang.org/grpc v1.64.0
3737
google.golang.org/protobuf v1.36.5
3838
modernc.org/sqlite v1.32.0
3939
)
4040

4141
require (
42+
cloud.google.com/go/compute/metadata v0.3.0 // indirect
43+
cloud.google.com/go/iam v1.1.6 // indirect
44+
cloud.google.com/go/kms v1.15.7 // indirect
45+
github.com/BurntSushi/toml v1.4.0 // indirect
4246
github.com/DataDog/zstd v1.5.6 // indirect
4347
github.com/Microsoft/go-winio v0.6.2 // indirect
44-
github.com/StackExchange/wmi v1.2.1 // indirect
4548
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
49+
github.com/agglayer/go_signer v0.0.6 // indirect
50+
github.com/aws/aws-sdk-go-v2 v1.32.8 // indirect
51+
github.com/aws/aws-sdk-go-v2/config v1.28.11 // indirect
52+
github.com/aws/aws-sdk-go-v2/credentials v1.17.52 // indirect
53+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.23 // indirect
54+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.27 // indirect
55+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.27 // indirect
56+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
57+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect
58+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.8 // indirect
59+
github.com/aws/aws-sdk-go-v2/service/kms v1.37.11 // indirect
60+
github.com/aws/aws-sdk-go-v2/service/sso v1.24.9 // indirect
61+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.8 // indirect
62+
github.com/aws/aws-sdk-go-v2/service/sts v1.33.7 // indirect
63+
github.com/aws/smithy-go v1.22.1 // indirect
4664
github.com/bahlo/generic-list-go v0.2.0 // indirect
4765
github.com/beorn7/perks v1.0.1 // indirect
48-
github.com/bits-and-blooms/bitset v1.17.0 // indirect
66+
github.com/bits-and-blooms/bitset v1.20.0 // indirect
4967
github.com/buger/jsonparser v1.1.1 // indirect
5068
github.com/cespare/xxhash/v2 v2.3.0 // indirect
5169
github.com/cockroachdb/errors v1.11.3 // indirect
5270
github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0 // indirect
5371
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
54-
github.com/cockroachdb/pebble v1.1.2 // indirect
72+
github.com/cockroachdb/pebble v1.1.4 // indirect
5573
github.com/cockroachdb/redact v1.1.5 // indirect
5674
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
57-
github.com/consensys/bavard v0.1.22 // indirect
58-
github.com/consensys/gnark-crypto v0.14.0 // indirect
75+
github.com/consensys/bavard v0.1.27 // indirect
76+
github.com/consensys/gnark-crypto v0.16.0 // indirect
5977
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
6078
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
6179
github.com/crate-crypto/go-kzg-4844 v1.1.0 // indirect
@@ -64,9 +82,11 @@ require (
6482
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
6583
github.com/didip/tollbooth/v6 v6.1.2 // indirect
6684
github.com/dustin/go-humanize v1.0.1 // indirect
85+
github.com/ethereum-optimism/infra/op-signer v1.4.1 // indirect
6786
github.com/ethereum/c-kzg-4844 v1.0.3 // indirect
6887
github.com/ethereum/go-verkle v0.2.2 // indirect
69-
github.com/fsnotify/fsnotify v1.7.0 // indirect
88+
github.com/felixge/httpsnoop v1.0.4 // indirect
89+
github.com/fsnotify/fsnotify v1.8.0 // indirect
7090
github.com/getsentry/sentry-go v0.28.1 // indirect
7191
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
7292
github.com/go-logr/logr v1.4.1 // indirect
@@ -77,10 +97,17 @@ require (
7797
github.com/gofrs/flock v0.12.1 // indirect
7898
github.com/gogo/protobuf v1.3.2 // indirect
7999
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
100+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
101+
github.com/golang/mock v1.6.0 // indirect
102+
github.com/golang/protobuf v1.5.4 // indirect
80103
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
104+
github.com/google/s2a-go v0.1.7 // indirect
81105
github.com/google/uuid v1.6.0 // indirect
106+
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
107+
github.com/googleapis/gax-go v1.0.3 // indirect
108+
github.com/googleapis/gax-go/v2 v2.12.3 // indirect
82109
github.com/gorilla/websocket v1.5.3 // indirect
83-
github.com/hashicorp/go-bexpr v0.1.10 // indirect
110+
github.com/hashicorp/go-bexpr v0.1.11 // indirect
84111
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
85112
github.com/hashicorp/hcl v1.0.1-0.20180906183839-65a6292f0157 // indirect
86113
github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 // indirect
@@ -109,33 +136,33 @@ require (
109136
github.com/mattn/go-runewidth v0.0.16 // indirect
110137
github.com/miguelmota/go-solidity-sha3 v0.1.1 // indirect
111138
github.com/mitchellh/copystructure v1.2.0 // indirect
112-
github.com/mitchellh/pointerstructure v1.2.0 // indirect
139+
github.com/mitchellh/pointerstructure v1.2.1 // indirect
113140
github.com/mitchellh/reflectwalk v1.0.2 // indirect
114141
github.com/mmcloughlin/addchain v0.4.0 // indirect
115142
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
116143
github.com/ncruces/go-strftime v0.1.9 // indirect
117144
github.com/olekukonko/tablewriter v0.0.5 // indirect
118145
github.com/onsi/gomega v1.27.10 // indirect
119146
github.com/pelletier/go-toml v1.9.5 // indirect
120-
github.com/pion/dtls/v2 v2.2.7 // indirect
147+
github.com/pion/dtls/v2 v2.2.12 // indirect
121148
github.com/pion/logging v0.2.2 // indirect
122149
github.com/pion/stun/v2 v2.0.0 // indirect
123-
github.com/pion/transport/v2 v2.2.1 // indirect
124-
github.com/pion/transport/v3 v3.0.1 // indirect
150+
github.com/pion/transport/v2 v2.2.10 // indirect
151+
github.com/pion/transport/v3 v3.0.7 // indirect
125152
github.com/pkg/errors v0.9.1 // indirect
126153
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
127154
github.com/prometheus/client_golang v1.21.0 // indirect
128155
github.com/prometheus/client_model v0.6.1 // indirect
129156
github.com/prometheus/common v0.62.0 // indirect
130157
github.com/prometheus/procfs v0.15.1 // indirect
131158
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
132-
github.com/rivo/uniseg v0.2.0 // indirect
159+
github.com/rivo/uniseg v0.4.7 // indirect
133160
github.com/rogpeppe/go-internal v1.13.1 // indirect
134-
github.com/rs/cors v1.7.0 // indirect
161+
github.com/rs/cors v1.11.0 // indirect
135162
github.com/russross/blackfriday/v2 v2.1.0 // indirect
136163
github.com/sagikazarmark/locafero v0.4.0 // indirect
137164
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
138-
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
165+
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
139166
github.com/sourcegraph/conc v0.3.0 // indirect
140167
github.com/spf13/afero v1.11.0 // indirect
141168
github.com/spf13/cast v1.6.0 // indirect
@@ -148,17 +175,30 @@ require (
148175
github.com/tklauser/numcpus v0.6.1 // indirect
149176
github.com/valyala/bytebufferpool v1.0.0 // indirect
150177
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
178+
github.com/wlynxg/anet v0.0.4 // indirect
151179
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
180+
github.com/yusufpapurcu/wmi v1.2.3 // indirect
181+
go.opencensus.io v0.24.0 // indirect
182+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
183+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
152184
go.opentelemetry.io/otel/trace v1.24.0 // indirect
153185
go.uber.org/multierr v1.10.0 // indirect
154186
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
187+
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
188+
golang.org/x/mod v0.22.0 // indirect
189+
golang.org/x/oauth2 v0.24.0 // indirect
155190
golang.org/x/sys v0.30.0 // indirect
156191
golang.org/x/text v0.22.0 // indirect
157-
golang.org/x/time v0.9.0 // indirect
192+
golang.org/x/time v0.10.0 // indirect
193+
golang.org/x/tools v0.29.0 // indirect
194+
google.golang.org/api v0.171.0 // indirect
195+
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
196+
google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect
158197
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
159198
gopkg.in/ini.v1 v1.67.0 // indirect
160199
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
161200
gopkg.in/yaml.v3 v3.0.1 // indirect
201+
honnef.co/go/tools v0.0.1-2020.1.4 // indirect
162202
modernc.org/gc/v3 v3.0.0-20240801135723-a856999a2e4a // indirect
163203
modernc.org/libc v1.60.0 // indirect
164204
modernc.org/mathutil v1.6.0 // indirect

0 commit comments

Comments
 (0)