Skip to content

Commit b810f4d

Browse files
authored
Include execution rewards (#54)
* Create BlockData, move getWithdrawals and start getProposerTip * Add proposer tips * Update dockerfile go version * Fix decode transaction * Fix tip calc for non legacy transactions, refactor relay retry * Parallelize get block tip * Separate receipts req and process, add tests * Fix relay retry, skip proposer tip if mev rewards
1 parent c98852b commit b810f4d

File tree

14 files changed

+7184
-125
lines changed

14 files changed

+7184
-125
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.24-alpine AS build
1+
FROM golang:1.25-alpine AS build
22

33
WORKDIR /app
44

@@ -8,7 +8,7 @@ RUN apk add --update gcc g++
88
RUN go mod download
99
RUN go build -o /eth-metrics
1010

11-
FROM golang:1.24-alpine
11+
FROM golang:1.25-alpine
1212

1313
WORKDIR /
1414

db/db.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ CREATE TABLE IF NOT EXISTS t_pools_metrics_summary (
3232
f_epoch_lost_balace_gwei BIGINT,
3333
f_epoch_effective_balance_gwei BIGINT,
3434
f_mev_rewards_wei BIGINT,
35+
f_proposer_tips_wei BIGINT,
3536
3637
f_n_scheduled_blocks BIGINT,
3738
f_n_proposed_blocks BIGINT,
@@ -98,8 +99,9 @@ INSERT INTO t_pools_metrics_summary(
9899
f_epoch_effective_balance_gwei,
99100
f_epoch_earned_balance_gwei,
100101
f_epoch_lost_balace_gwei,
101-
f_mev_rewards_wei)
102-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
102+
f_mev_rewards_wei,
103+
f_proposer_tips_wei)
104+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
103105
ON CONFLICT (f_epoch, f_pool)
104106
DO UPDATE SET
105107
f_timestamp=EXCLUDED.f_timestamp,
@@ -115,7 +117,8 @@ DO UPDATE SET
115117
f_epoch_effective_balance_gwei=EXCLUDED.f_epoch_effective_balance_gwei,
116118
f_epoch_earned_balance_gwei=EXCLUDED.f_epoch_earned_balance_gwei,
117119
f_epoch_lost_balace_gwei=EXCLUDED.f_epoch_lost_balace_gwei,
118-
f_mev_rewards_wei=EXCLUDED.f_mev_rewards_wei
120+
f_mev_rewards_wei=EXCLUDED.f_mev_rewards_wei,
121+
f_proposer_tips_wei=EXCLUDED.f_proposer_tips_wei
119122
`
120123

121124
// TODO: Add f_epoch_timestamp
@@ -236,6 +239,7 @@ func (a *Database) StoreValidatorPerformance(validatorPerformance schemas.Valida
236239
validatorPerformance.EarnedBalance.Int64(),
237240
validatorPerformance.LosedBalance.Int64(),
238241
validatorPerformance.MEVRewards.Int64(),
242+
validatorPerformance.ProposerTips.Int64(),
239243
)
240244

241245
if err != nil {

db/db_test.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,27 @@ func Test_GetMissingEpochs(t *testing.T) {
1616
db.CreateTables()
1717

1818
db.StoreValidatorPerformance(schemas.ValidatorPerformanceMetrics{
19-
Time: time.Now(),
20-
Epoch: 100,
21-
EarnedBalance: big.NewInt(100),
22-
LosedBalance: big.NewInt(100),
23-
MEVRewards: big.NewInt(100),
19+
Time: time.Now(),
20+
Epoch: 100,
21+
EarnedBalance: big.NewInt(100),
22+
LosedBalance: big.NewInt(100),
23+
EffectiveBalance: big.NewInt(100),
24+
MEVRewards: big.NewInt(100),
25+
ProposerTips: big.NewInt(100),
2426
})
2527

2628
epochs, err := db.GetMissingEpochs(200, 4)
2729
require.NoError(t, err)
2830
require.Equal(t, []uint64{197, 198, 199, 200}, epochs)
2931

3032
db.StoreValidatorPerformance(schemas.ValidatorPerformanceMetrics{
31-
Time: time.Now(),
32-
Epoch: 197,
33-
EarnedBalance: big.NewInt(100),
34-
LosedBalance: big.NewInt(100),
35-
MEVRewards: big.NewInt(100),
33+
Time: time.Now(),
34+
Epoch: 197,
35+
EarnedBalance: big.NewInt(100),
36+
LosedBalance: big.NewInt(100),
37+
EffectiveBalance: big.NewInt(100),
38+
MEVRewards: big.NewInt(100),
39+
ProposerTips: big.NewInt(100),
3640
})
3741

3842
epochs, err = db.GetMissingEpochs(200, 4)

go.mod

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,26 @@ go 1.25
44

55
require (
66
github.com/attestantio/go-eth2-client v0.27.2
7-
github.com/ethereum/go-ethereum v1.16.1
7+
github.com/ethereum/go-ethereum v1.16.7
88
github.com/gin-contrib/cors v1.7.6
99
github.com/gin-gonic/gin v1.10.1
1010
github.com/mattn/go-sqlite3 v1.14.28
1111
github.com/pkg/errors v0.9.1
1212
github.com/prometheus/client_golang v1.21.0
1313
github.com/rs/zerolog v1.33.0
1414
github.com/sirupsen/logrus v1.9.3
15-
github.com/stretchr/testify v1.10.0
15+
github.com/stretchr/testify v1.11.1
1616
github.com/superoo7/go-gecko v1.0.0
1717
modernc.org/sqlite v1.38.0
1818
)
1919

2020
require (
21+
github.com/Microsoft/go-winio v0.6.2 // indirect
2122
github.com/NYTimes/gziphandler v1.1.1 // indirect
23+
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20251001021608-1fe7b43fc4d6 // indirect
2224
github.com/aohorodnyk/mimeheader v0.0.6 // indirect
2325
github.com/attestantio/go-builder-client v0.7.2 // indirect
26+
github.com/avast/retry-go/v4 v4.7.0
2427
github.com/beorn7/perks v1.0.1 // indirect
2528
github.com/bits-and-blooms/bitset v1.22.0 // indirect
2629
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 // indirect
@@ -30,14 +33,15 @@ require (
3033
github.com/cespare/xxhash/v2 v2.3.0 // indirect
3134
github.com/cloudwego/base64x v0.1.5 // indirect
3235
github.com/consensys/gnark-crypto v0.18.0 // indirect
33-
github.com/crate-crypto/go-eth-kzg v1.3.0 // indirect
36+
github.com/crate-crypto/go-eth-kzg v1.4.0 // indirect
3437
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
3538
github.com/davecgh/go-spew v1.1.1 // indirect
39+
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
3640
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
3741
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
3842
github.com/dustin/go-humanize v1.0.1 // indirect
3943
github.com/emicklei/dot v1.8.0 // indirect
40-
github.com/ethereum/c-kzg-4844/v2 v2.1.0 // indirect
44+
github.com/ethereum/c-kzg-4844/v2 v2.1.5 // indirect
4145
github.com/ethereum/go-verkle v0.2.2 // indirect
4246
github.com/fatih/color v1.18.0 // indirect
4347
github.com/ferranbt/fastssz v0.1.4 // indirect
@@ -57,9 +61,10 @@ require (
5761
github.com/goccy/go-yaml v1.17.1 // indirect
5862
github.com/gofrs/flock v0.12.1 // indirect
5963
github.com/golang/protobuf v1.5.4 // indirect
60-
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
64+
github.com/golang/snappy v1.0.0 // indirect
6165
github.com/google/uuid v1.6.0 // indirect
6266
github.com/gorilla/mux v1.8.1 // indirect
67+
github.com/gorilla/websocket v1.4.2 // indirect
6368
github.com/holiman/uint256 v1.3.2 // indirect
6469
github.com/huandu/go-clone v1.7.2 // indirect
6570
github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -95,7 +100,7 @@ require (
95100
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
96101
github.com/spf13/cobra v1.9.1 // indirect
97102
github.com/spf13/pflag v1.0.6 // indirect
98-
github.com/supranational/blst v0.3.14 // indirect
103+
github.com/supranational/blst v0.3.16-0.20250831170142-f48500c1fdbe // indirect
99104
github.com/tdewolff/minify v2.3.6+incompatible // indirect
100105
github.com/tdewolff/parse v2.3.4+incompatible // indirect
101106
github.com/tidwall/gjson v1.18.0 // indirect
@@ -121,7 +126,7 @@ require (
121126
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
122127
golang.org/x/net v0.41.0 // indirect
123128
golang.org/x/sync v0.15.0 // indirect
124-
golang.org/x/sys v0.33.0 // indirect
129+
golang.org/x/sys v0.36.0 // indirect
125130
golang.org/x/text v0.26.0 // indirect
126131
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
127132
google.golang.org/protobuf v1.36.6 // indirect

go.sum

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
2+
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
3+
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
24
github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=
35
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
6+
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20251001021608-1fe7b43fc4d6 h1:1zYrtlhrZ6/b6SAjLSfKzWtdgqK0U+HtH/VcBWh1BaU=
7+
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20251001021608-1fe7b43fc4d6/go.mod h1:ioLG6R+5bUSO1oeGSDxOV3FADARuMoytZCSX6MEMQkI=
48
github.com/aohorodnyk/mimeheader v0.0.6 h1:WCV4NQjtbqnd2N3FT5MEPesan/lfvaLYmt5v4xSaX/M=
59
github.com/aohorodnyk/mimeheader v0.0.6/go.mod h1:/Gd3t3vszyZYwjNJo2qDxoftZjjVzMdkQZxkiINp3vM=
610
github.com/attestantio/go-builder-client v0.7.2 h1:bOrtysEIZd9bEM+mAeT6OtAo6LSAft/qylBLwFoFwZ0=
@@ -11,6 +15,8 @@ github.com/attestantio/go-eth2-client v0.27.1 h1:g7bm+gG/p+gfzYdEuxuAepVWYb8EO+2
1115
github.com/attestantio/go-eth2-client v0.27.1/go.mod h1:fvULSL9WtNskkOB4i+Yyr6BKpNHXvmpGZj9969fCrfY=
1216
github.com/attestantio/go-eth2-client v0.27.2 h1:VjA9R39ovy8ryb7IpFfD5eLYBg/20biztxh6fKZ7/K0=
1317
github.com/attestantio/go-eth2-client v0.27.2/go.mod h1:i56XBegxVt7wXupnLBOj9IyGwy5cqaoTsCSKlwTubEU=
18+
github.com/avast/retry-go/v4 v4.7.0 h1:yjDs35SlGvKwRNSykujfjdMxMhMQQM0TnIjJaHB+Zio=
19+
github.com/avast/retry-go/v4 v4.7.0/go.mod h1:ZMPDa3sY2bKgpLtap9JRUgk2yTAba7cgiFhqxY2Sg6Q=
1420
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
1521
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
1622
github.com/bits-and-blooms/bitset v1.22.0 h1:Tquv9S8+SGaS3EhyA+up3FXzmkhxPGjQQCkcs2uw7w4=
@@ -35,11 +41,15 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV
3541
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
3642
github.com/crate-crypto/go-eth-kzg v1.3.0 h1:05GrhASN9kDAidaFJOda6A4BEvgvuXbazXg/0E3OOdI=
3743
github.com/crate-crypto/go-eth-kzg v1.3.0/go.mod h1:J9/u5sWfznSObptgfa92Jq8rTswn6ahQWEuiLHOjCUI=
44+
github.com/crate-crypto/go-eth-kzg v1.4.0 h1:WzDGjHk4gFg6YzV0rJOAsTK4z3Qkz5jd4RE3DAvPFkg=
45+
github.com/crate-crypto/go-eth-kzg v1.4.0/go.mod h1:J9/u5sWfznSObptgfa92Jq8rTswn6ahQWEuiLHOjCUI=
3846
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a h1:W8mUrRp6NOVl3J+MYp5kPMoUZPp7aOYHtaua31lwRHg=
3947
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a/go.mod h1:sTwzHBvIzm2RfVCGNEBZgRyjwK40bVoun3ZnGOCafNM=
4048
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4149
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
4250
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
51+
github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80NsVHagjM=
52+
github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
4353
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc=
4454
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40=
4555
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
@@ -53,8 +63,12 @@ github.com/emicklei/dot v1.8.0/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6
5363
github.com/ethereum/c-kzg-4844 v1.0.3 h1:IEnbOHwjixW2cTvKRUlAAUOeleV7nNM/umJR+qy4WDs=
5464
github.com/ethereum/c-kzg-4844/v2 v2.1.0 h1:gQropX9YFBhl3g4HYhwE70zq3IHFRgbbNPw0Shwzf5w=
5565
github.com/ethereum/c-kzg-4844/v2 v2.1.0/go.mod h1:TC48kOKjJKPbN7C++qIgt0TJzZ70QznYR7Ob+WXl57E=
66+
github.com/ethereum/c-kzg-4844/v2 v2.1.5 h1:aVtoLK5xwJ6c5RiqO8g8ptJ5KU+2Hdquf6G3aXiHh5s=
67+
github.com/ethereum/c-kzg-4844/v2 v2.1.5/go.mod h1:u59hRTTah4Co6i9fDWtiCjTrblJv0UwsqZKCc0GfgUs=
5668
github.com/ethereum/go-ethereum v1.16.1 h1:7684NfKCb1+IChudzdKyZJ12l1Tq4ybPZOITiCDXqCk=
5769
github.com/ethereum/go-ethereum v1.16.1/go.mod h1:ngYIvmMAYdo4sGW9cGzLvSsPGhDOOzL0jK5S5iXpj0g=
70+
github.com/ethereum/go-ethereum v1.16.7 h1:qeM4TvbrWK0UC0tgkZ7NiRsmBGwsjqc64BHo20U59UQ=
71+
github.com/ethereum/go-ethereum v1.16.7/go.mod h1:Fs6QebQbavneQTYcA39PEKv2+zIjX7rPUZ14DER46wk=
5872
github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8=
5973
github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
6074
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
@@ -117,6 +131,8 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek
117131
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
118132
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk=
119133
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
134+
github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs=
135+
github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
120136
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
121137
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
122138
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
@@ -127,6 +143,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
127143
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
128144
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
129145
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
146+
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
147+
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
130148
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
131149
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
132150
github.com/holiman/uint256 v1.3.2 h1:a9EgMPSC1AAaj1SZL5zIQD3WbwTuHrMGOerLjGmM/TA=
@@ -262,10 +280,14 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
262280
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
263281
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
264282
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
283+
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
284+
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
265285
github.com/superoo7/go-gecko v1.0.0 h1:Xa1hZu2AYSA20eVMEd4etY0fcJoEI5deja1mdRmqlpI=
266286
github.com/superoo7/go-gecko v1.0.0/go.mod h1:6AMYHL2wP2EN8AB9msPM76Lbo8L/MQOknYjvak5coaY=
267287
github.com/supranational/blst v0.3.14 h1:xNMoHRJOTwMn63ip6qoWJ2Ymgvj7E2b9jY2FAwY+qRo=
268288
github.com/supranational/blst v0.3.14/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
289+
github.com/supranational/blst v0.3.16-0.20250831170142-f48500c1fdbe h1:nbdqkIGOGfUAD54q1s2YBcBz/WcsxCO9HUQ4aGV5hUw=
290+
github.com/supranational/blst v0.3.16-0.20250831170142-f48500c1fdbe/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
269291
github.com/tdewolff/minify v2.3.6+incompatible h1:2hw5/9ZvxhWLvBUnHE06gElGYz+Jv9R4Eys0XUzItYo=
270292
github.com/tdewolff/minify v2.3.6+incompatible/go.mod h1:9Ov578KJUmAWpS6NeZwRZyT56Uf6o3Mcz9CEsg8USYs=
271293
github.com/tdewolff/parse v2.3.4+incompatible h1:x05/cnGwIMf4ceLuDMBOdQ1qGniMoxpP46ghf0Qzh38=
@@ -343,6 +365,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
343365
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
344366
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
345367
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
368+
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
369+
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
346370
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
347371
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
348372
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=

metrics/beaconstate.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ func (p *BeaconState) Run(
5454
prevBeaconState *spec.VersionedBeaconState,
5555
valKeyToIndex map[string]uint64,
5656
relayRewards *big.Int,
57-
validatorIndexToWithdrawalAmount map[uint64]*big.Int) error {
57+
validatorIndexToWithdrawalAmount map[uint64]*big.Int,
58+
proposerTips map[uint64]*big.Int) error {
5859

5960
if currentBeaconState == nil || prevBeaconState == nil {
6061
return errors.New("current or previous beacon state is nil")
@@ -97,6 +98,14 @@ func (p *BeaconState) Run(
9798
metrics.NOfActiveValidators = uint64(len(activeValidatorIndexes))
9899
metrics.MEVRewards = relayRewards
99100

101+
aggregatedProposerTips := big.NewInt(0)
102+
for _, activeValidatorIndex := range activeValidatorIndexes {
103+
if tip, ok := proposerTips[activeValidatorIndex]; ok {
104+
aggregatedProposerTips.Add(aggregatedProposerTips, tip)
105+
}
106+
}
107+
metrics.ProposerTips = aggregatedProposerTips
108+
100109
syncCommitteeKeys := BLSPubKeyToByte(GetCurrentSyncCommittee(currentBeaconState))
101110
syncCommitteeIndexes := GetIndexesFromKeys(syncCommitteeKeys, valKeyToIndex)
102111
poolSyncIndexes := GetValidatorsIn(syncCommitteeIndexes, activeValidatorIndexes)

0 commit comments

Comments
 (0)