Skip to content

Commit 3ddf664

Browse files
guybrushpeterbitflyinvis-bitflyremoteramienzo-bitfly
authored
feat: implement pectra (#1359)
* wip: add pectra support * xxx * xxx * update spec parsing * updates * updates * updates * updates * update migrations * work * fix(migrations): pectra tables * fix(migrations): dont fail if consensus_layer_events table exists * ops: add staging-3 to gh-workflows * fix: added pectra configs (cherry picked from commit a17f8f8) * refactor(api): validator addition * fix(api): correct mainnet limits, returning dashboard eb sum (cherry picked from commit cb05f80) * feat: added gnosis premium perks (cherry picked from commit fa6bcd9) * feat: added pectra-devnet-6 configs (cherry picked from commit 300f299) * feat: basic apr calc (cherry picked from commit 8a33529) * feat: withdrawal credential handling (cherry picked from commit c90fe0c) * feat: deposits total * feat: more spec config * fix: backwards compatible deposits * refactor: remove hotfixes * fix(frontend, network): outdated devnet entries * fix(db): do not fatal if goose fails to retrieve version * BEDS-140: feat(exporter): clickhouse cl dashboard data exporter * fix(network): support httpClient = nil * fix(migrations): fix pectra-tables migrations * fix(migrations): fix network data types * fix(migrations): change order * add(migrations): add eth1indexer el requests migration * fix(slot_exporter): add workaround for holesky issues * fix(slot_exporter): make cl events being present mandatory again * add(slot_exporter): transform RemovedExcessBalance events * feat(exporter): improve validator status update query * fix(db): TransformRemovedExcessBalanceEvents * fix: make linter happy about frontend-types * fix(slot_exporter): disable late-slot-proposal only for holesky * ops: add deploy-v2-staging-sepolia * fix(slot_expotrer): TransformRemovedExcessBalanceEvents syntax * feat: adapt pricing page to charge by `effective balance` See: BEDS-1257 - these changes are caused by the Pectra hardfork - refactor `PremiumAddonBox` * chore(eslint): apply `sort-modules` rule * chore(git-blame-ignore): add `styling` commit * chore(deps): update `typescript & vue-tsc` Conditional props did not fail for `ariaLabel` See: 7474faa * refactor: make usage of `locale` typesafe * fix: added pectra configs (cherry picked from commit a17f8f8) (cherry picked from commit 2450ba3) * refactor: clarified variable names & logic flow * feat: eb-based vdb limits * feat: clarified validator addition logic * refactor: split user dashboards function * refactor: move validators eb info to own file * refactor: moved validator slice eb checks to handler * refactor: removed dead code * feat: eb-based vdb limits * feat: stat calculation based on EB * refactor: improved code style * fix: handle `effective balance` values as big numbers See: BEDS-1257 * feat: add banner if `max stake limit` exceeded See: BEDS-1258 * refactor: cleanup code * refactor: split validator addition logic * fix: handle empty dashboard eb calculation * refactor: calculating EBs from validator list * feat: show `effective balance` as limit in `DashboardValidatorManagementModal.vue` See: BEDS-1271 * refactor(dashboard): use `overview` to get `balance` for `banner` --------- Co-authored-by: peter <1674920+peterbitfly@users.noreply.github.com> Co-authored-by: invis-bitfly <162128378+invis-bitfly@users.noreply.github.com> Co-authored-by: remoterami <142154971+remoterami@users.noreply.github.com> Co-authored-by: Patrick Pfeiffer <306324+guybrush@users.noreply.github.com> Co-authored-by: enzo-bitfly <194075446+enzo-bitfly@users.noreply.github.com> Co-authored-by: marcel-bitfly <174338434+marcel-bitfly@users.noreply.github.com>
1 parent a83aa3a commit 3ddf664

File tree

106 files changed

+7295
-3570
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+7295
-3570
lines changed

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# in order to work execute once:
55
# git config blame.ignoreRevsFile .git-blame-ignore-revs
66

7+
# chore(eslint): apply `sort-modules` rule
8+
7816ff9215db01151d0f498b454319949f063e7e
79
#chore(eslint): add `newline` rule for `destructured object properties`
810
00f3ddc552d796c72860a4892f5084aa54dc396d
911
# chore(eslint): add rule to enforce indentation of 4 spaces for json

.github/workflows/backend-publish-docker-deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- deploy-v2-pectra-devnet-5
1111
- deploy-v2-pectra-devnet-6
1212
- deploy-v2-staging-holesky
13+
- deploy-v2-staging-sepolia
1314

1415
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
1516
env:

.github/workflows/frontend-publish-docker-deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- deploy-v2-pectra-devnet-5
1111
- deploy-v2-pectra-devnet-6
1212
- deploy-v2-staging-holesky
13+
- deploy-v2-staging-sepolia
1314

1415
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
1516
env:

backend/cmd/exporter/main.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ func Run() {
5454
}
5555

5656
wg := &sync.WaitGroup{}
57+
wg.Add(1)
58+
go func() {
59+
defer wg.Done()
60+
db.WriterDb, db.ReaderDb = db.MustInitDB(&cfg.WriterDatabase, &cfg.ReaderDatabase, "pgx", "postgres")
61+
}()
5762
if !cfg.JustV2 {
58-
wg.Add(1)
59-
go func() {
60-
defer wg.Done()
61-
db.WriterDb, db.ReaderDb = db.MustInitDB(&cfg.WriterDatabase, &cfg.ReaderDatabase, "pgx", "postgres")
62-
}()
6363
wg.Add(1)
6464
go func() {
6565
defer wg.Done()
@@ -152,12 +152,12 @@ func Run() {
152152
monitoring.Start()
153153

154154
if !cfg.JustV2 {
155-
defer db.ReaderDb.Close()
156-
defer db.WriterDb.Close()
157155
defer db.AlloyReader.Close()
158156
defer db.AlloyWriter.Close()
159157
defer db.BigtableClient.Close()
160158
}
159+
defer db.ReaderDb.Close() // we need it to get the pectra workaround events
160+
defer db.WriterDb.Close()
161161
defer db.ClickHouseReader.Close()
162162
defer db.ClickHouseWriter.Close()
163163
defer db.ClickHouseNativeWriter.Close()

backend/cmd/misc/main.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,13 @@ func Run() {
142142
requires, ok := REQUIRES_LIST[opts.Command]
143143
if !ok {
144144
requires = misctypes.Requires{
145-
Bigtable: true,
146-
Redis: true,
147-
ClNode: true,
148-
ElNode: true,
149-
UserDBs: true,
150-
NetworkDBs: true,
145+
Bigtable: true,
146+
Redis: true,
147+
ClNode: true,
148+
ElNode: true,
149+
UserDBs: true,
150+
NetworkDBs: true,
151+
ClickhouseDBs: true,
151152
}
152153
}
153154

@@ -199,9 +200,11 @@ func Run() {
199200
}
200201

201202
// clickhouse
202-
db.ClickHouseWriter, db.ClickHouseReader = db.MustInitDB(&cfg.ClickHouse.WriterDatabase, &cfg.ClickHouse.ReaderDatabase, "clickhouse", "clickhouse")
203-
defer db.ClickHouseReader.Close()
204-
defer db.ClickHouseWriter.Close()
203+
if requires.ClickhouseDBs {
204+
db.ClickHouseWriter, db.ClickHouseReader = db.MustInitDB(&cfg.ClickHouse.WriterDatabase, &cfg.ClickHouse.ReaderDatabase, "clickhouse", "clickhouse")
205+
defer db.ClickHouseReader.Close()
206+
defer db.ClickHouseWriter.Close()
207+
}
205208

206209
// Initialize the persistent redis client
207210
if requires.Redis {
@@ -1146,7 +1149,7 @@ func debugBlocks(clClient *rpc.LighthouseClient) error {
11461149
} else if clBlock.ExecutionPayload.BlockNumber != i {
11471150
log.Warnf("clBlock.ExecutionPayload.BlockNumber != i: %v != %v", clBlock.ExecutionPayload.BlockNumber, i)
11481151
} else {
1149-
logFields["cl.txs"] = len(clBlock.ExecutionPayload.Transactions)
1152+
logFields["cl.txs"] = clBlock.ExecutionPayload.TransactionsCount
11501153
}
11511154

11521155
log.InfoWithFields(logFields, "debug block")
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package misctypes
22

33
type Requires struct {
4-
Bigtable bool
5-
Redis bool
6-
ClNode bool
7-
ElNode bool
8-
NetworkDBs bool
9-
UserDBs bool
4+
Bigtable bool
5+
Redis bool
6+
ClNode bool
7+
ElNode bool
8+
NetworkDBs bool
9+
UserDBs bool
10+
ClickhouseDBs bool
1011
}

backend/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
cloud.google.com/go/bigtable v1.31.0
77
cloud.google.com/go/secretmanager v1.14.1
88
firebase.google.com/go/v4 v4.14.1
9-
github.com/ClickHouse/clickhouse-go/v2 v2.30.3
9+
github.com/ClickHouse/clickhouse-go/v2 v2.30.0
1010
github.com/DATA-DOG/go-sqlmock v1.5.0
1111
github.com/Gurpartap/storekit-go v0.0.0-20201205024111-36b6cd5c6a21
1212
github.com/Tangui-Bitfly/ethsimtracer v0.0.0-20241031103622-e76546c3d9c1

backend/go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8
3232
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
3333
github.com/ClickHouse/ch-go v0.64.1 h1:FWpP+QU4KchgzpEekuv8YoI/fUc4H2r6Bwc5WwrzvcI=
3434
github.com/ClickHouse/ch-go v0.64.1/go.mod h1:RBUynvczWwVzhS6Up9lPKlH1mrk4UAmle6uzCiW4Pkc=
35-
github.com/ClickHouse/clickhouse-go/v2 v2.30.3 h1:m0VZqUNCJ7lOmZfmOE3HZUMixZHftKmZLqcrz2+UVHk=
36-
github.com/ClickHouse/clickhouse-go/v2 v2.30.3/go.mod h1:V1aZaG0ctMbd8KVi+D4loXi97duWYtHiQHMCgipKJcI=
35+
github.com/ClickHouse/clickhouse-go/v2 v2.30.0 h1:AG4D/hW39qa58+JHQIFOSnxyL46H6h2lrmGGk17dhFo=
36+
github.com/ClickHouse/clickhouse-go/v2 v2.30.0/go.mod h1:i9ZQAojcayW3RsdCb3YR+n+wC2h65eJsZCscZ1Z1wyo=
3737
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
3838
github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
3939
github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ=
@@ -222,8 +222,8 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r
222222
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
223223
github.com/docker/cli v24.0.7+incompatible h1:wa/nIwYFW7BVTGa7SWPVyyXU9lgORqUb1xfI36MSkFg=
224224
github.com/docker/cli v24.0.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
225-
github.com/docker/docker v27.4.1+incompatible h1:ZJvcY7gfwHn1JF48PfbyXg7Jyt9ZCWDW+GGXOIxEwp4=
226-
github.com/docker/docker v27.4.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
225+
github.com/docker/docker v27.3.0+incompatible h1:BNb1QY6o4JdKpqwi9IB+HUYcRRrVN4aGFUTvDmWYK1A=
226+
github.com/docker/docker v27.3.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
227227
github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c=
228228
github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc=
229229
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=

backend/pkg/api/data_access/data_access.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818

1919
type DataAccessor interface {
2020
ValidatorDashboardRepository
21+
ValidatorRepository
2122
SearchRepository
2223
NetworkRepository
2324
ClientRepository

backend/pkg/api/data_access/dummy.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ func (d *DummyService) GetValidatorsFromSlices(ctx context.Context, indices []ui
213213
return getDummyData[[]t.VDBValidator](ctx)
214214
}
215215

216+
func (d *DummyService) GetValidatorsEffectiveBalanceTotal(ctx context.Context, indices []uint64) (uint64, error) {
217+
return getDummyData[uint64](ctx)
218+
}
219+
216220
func (d *DummyService) GetUserDashboards(ctx context.Context, userId uint64) (*t.UserDashboardsData, error) {
217221
return getDummyStruct[t.UserDashboardsData](ctx)
218222
}
@@ -269,16 +273,16 @@ func (d *DummyService) AddValidatorDashboardValidators(ctx context.Context, dash
269273
return getDummyData[[]t.VDBPostValidatorsData](ctx)
270274
}
271275

272-
func (d *DummyService) AddValidatorDashboardValidatorsByDepositAddress(ctx context.Context, dashboardId t.VDBIdPrimary, groupId uint64, address string, limit uint64) ([]t.VDBPostValidatorsData, error) {
273-
return getDummyData[[]t.VDBPostValidatorsData](ctx)
276+
func (d *DummyService) GetValidatorsByDepositAddress(ctx context.Context, depositAddress string) ([]t.VDBValidator, error) {
277+
return getDummyData[[]t.VDBValidator](ctx)
274278
}
275279

276-
func (d *DummyService) AddValidatorDashboardValidatorsByWithdrawalCredential(ctx context.Context, dashboardId t.VDBIdPrimary, groupId uint64, address string, limit uint64) ([]t.VDBPostValidatorsData, error) {
277-
return getDummyData[[]t.VDBPostValidatorsData](ctx)
280+
func (d *DummyService) GetValidatorsByWithdrawalCredentials(ctx context.Context, withdrawalCredentials string) ([]t.VDBValidator, error) {
281+
return getDummyData[[]t.VDBValidator](ctx)
278282
}
279283

280-
func (d *DummyService) AddValidatorDashboardValidatorsByGraffiti(ctx context.Context, dashboardId t.VDBIdPrimary, groupId uint64, graffiti string, limit uint64) ([]t.VDBPostValidatorsData, error) {
281-
return getDummyData[[]t.VDBPostValidatorsData](ctx)
284+
func (d *DummyService) GetValidatorsByGraffiti(ctx context.Context, graffiti string) ([]t.VDBValidator, error) {
285+
return getDummyData[[]t.VDBValidator](ctx)
282286
}
283287

284288
func (d *DummyService) GetValidatorDashboardValidators(ctx context.Context, dashboardId t.VDBId, groupId int64, cursor string, colSort t.Sort[enums.VDBManageValidatorsColumn], search string, limit uint64) ([]t.VDBManageValidatorsTableRow, *t.Paging, error) {
@@ -541,10 +545,14 @@ func (d *DummyService) GetValidatorDashboardGroupCount(ctx context.Context, dash
541545
return getDummyData[uint64](ctx)
542546
}
543547

544-
func (d *DummyService) GetValidatorDashboardValidatorsCount(ctx context.Context, dashboardId t.VDBIdPrimary) (uint64, error) {
548+
func (d *DummyService) GetValidatorDashboardEffectiveBalanceTotal(ctx context.Context, dashboardId t.VDBId, onlyActive bool) (uint64, error) {
545549
return getDummyData[uint64](ctx)
546550
}
547551

552+
func (d *DummyService) GetValidatorsEffectiveBalances(ctx context.Context, validators []t.VDBValidator, onlyActive bool) (map[t.VDBValidator]uint64, error) {
553+
return map[t.VDBValidator]uint64{}, nil
554+
}
555+
548556
func (d *DummyService) GetValidatorDashboardPublicIdCount(ctx context.Context, dashboardId t.VDBIdPrimary) (uint64, error) {
549557
return getDummyData[uint64](ctx)
550558
}

0 commit comments

Comments
 (0)