Skip to content

Commit 875b8bf

Browse files
authored
Various updates (#149)
* multi-bn log cleanup * common/types cleanup * proposer api: don't count builder stats on getHeader * dependency updates * fix lint & test
1 parent 7b8878e commit 875b8bf

File tree

11 files changed

+57
-73
lines changed

11 files changed

+57
-73
lines changed

.github/workflows/checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
run: go install mvdan.cc/gofumpt@latest
5050

5151
- name: Install staticcheck
52-
run: go install honnef.co/go/tools/cmd/[email protected].1
52+
run: go install honnef.co/go/tools/cmd/[email protected].3
5353

5454
- name: Install golangci-lint
5555
run: go install github.com/golangci/golangci-lint/cmd/[email protected]

beaconclient/multi_beacon_client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ func (c *MultiBeaconClient) FetchValidators(headSlot uint64) (map[types.PubkeyHe
132132

133133
validators, err := client.FetchValidators(headSlot)
134134
if err != nil {
135-
c.log.WithError(err).Error("failed to fetch validators")
135+
log.WithError(err).Error("failed to fetch validators")
136136
continue
137137
}
138138

@@ -156,7 +156,7 @@ func (c *MultiBeaconClient) GetProposerDuties(epoch uint64) (*ProposerDutiesResp
156156

157157
duties, err := client.GetProposerDuties(epoch)
158158
if err != nil {
159-
c.log.WithError(err).Error("failed to get proposer duties")
159+
log.WithError(err).Error("failed to get proposer duties")
160160
continue
161161
}
162162

common/types.go

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,6 @@ var (
6161
EthNetworkSepolia = "sepolia"
6262
EthNetworkGoerli = "goerli"
6363
EthNetworkMainnet = "mainnet"
64-
65-
GenesisValidatorsRootGoerli = "0x043db0d9a83813551ee2f33450d23797757d430911a9320530ad8a0eabc43efb"
66-
GenesisForkVersionGoerli = "0x00001020"
67-
BellatrixForkVersionGoerli = "0x02001020"
68-
69-
// https://github.com/eth-clients/eth2-networks/blob/f3ccbe0cf5798d5cd23e4e6e7119aefa043c0935/shared/mainnet/config.yaml
70-
GenesisValidatorsRootMainnet = "0x4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95"
71-
GenesisForkVersionMainnet = "0x00000000"
72-
BellatrixForkVersionMainnet = "0x02000000"
7364
)
7465

7566
func NewEthNetworkDetails(networkName string) (ret *EthNetworkDetails, err error) {
@@ -93,13 +84,13 @@ func NewEthNetworkDetails(networkName string) (ret *EthNetworkDetails, err error
9384
genesisValidatorsRoot = types.GenesisValidatorsRootSepolia
9485
bellatrixForkVersion = types.BellatrixForkVersionSepolia
9586
case EthNetworkGoerli:
96-
genesisForkVersion = GenesisForkVersionGoerli
97-
genesisValidatorsRoot = GenesisValidatorsRootGoerli
98-
bellatrixForkVersion = BellatrixForkVersionGoerli
87+
genesisForkVersion = types.GenesisForkVersionGoerli
88+
genesisValidatorsRoot = types.GenesisValidatorsRootGoerli
89+
bellatrixForkVersion = types.BellatrixForkVersionGoerli
9990
case EthNetworkMainnet:
100-
genesisForkVersion = GenesisForkVersionMainnet
101-
genesisValidatorsRoot = GenesisValidatorsRootMainnet
102-
bellatrixForkVersion = BellatrixForkVersionMainnet
91+
genesisForkVersion = types.GenesisForkVersionMainnet
92+
genesisValidatorsRoot = types.GenesisValidatorsRootMainnet
93+
bellatrixForkVersion = types.BellatrixForkVersionMainnet
10394
default:
10495
return nil, fmt.Errorf("%w: %s", ErrUnknownNetwork, networkName)
10596
}

database/database.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ type IDatabaseService interface {
3030
GetBlockBuilderByPubkey(pubkey string) (*BlockBuilderEntry, error)
3131
SetBlockBuilderStatus(pubkey string, isHighPrio, isBlacklisted bool) error
3232
UpsertBlockBuilderEntryAfterSubmission(lastSubmission *BuilderBlockSubmissionEntry, isError, isTopbid bool) error
33-
IncBlockBuilderStatsAfterGetHeader(slot uint64, blockhash string) error
3433
IncBlockBuilderStatsAfterGetPayload(slot uint64, blockhash string) error
3534
}
3635

@@ -355,14 +354,14 @@ func (s *DatabaseService) UpsertBlockBuilderEntryAfterSubmission(lastSubmission
355354
}
356355

357356
func (s *DatabaseService) GetBlockBuilders() ([]*BlockBuilderEntry, error) {
358-
query := `SELECT id, inserted_at, builder_pubkey, description, is_high_prio, is_blacklisted, last_submission_id, last_submission_slot, num_submissions_total, num_submissions_simerror, num_submissions_topbid, num_sent_getheader, num_sent_getpayload FROM ` + TableBlockBuilder + ` ORDER BY id ASC;`
357+
query := `SELECT id, inserted_at, builder_pubkey, description, is_high_prio, is_blacklisted, last_submission_id, last_submission_slot, num_submissions_total, num_submissions_simerror, num_submissions_topbid, num_sent_getpayload FROM ` + TableBlockBuilder + ` ORDER BY id ASC;`
359358
entries := []*BlockBuilderEntry{}
360359
err := s.DB.Select(entries, query)
361360
return entries, err
362361
}
363362

364363
func (s *DatabaseService) GetBlockBuilderByPubkey(pubkey string) (*BlockBuilderEntry, error) {
365-
query := `SELECT id, inserted_at, builder_pubkey, description, is_high_prio, is_blacklisted, last_submission_id, last_submission_slot, num_submissions_total, num_submissions_simerror, num_submissions_topbid, num_sent_getheader, num_sent_getpayload FROM ` + TableBlockBuilder + ` WHERE builder_pubkey=$1;`
364+
query := `SELECT id, inserted_at, builder_pubkey, description, is_high_prio, is_blacklisted, last_submission_id, last_submission_slot, num_submissions_total, num_submissions_simerror, num_submissions_topbid, num_sent_getpayload FROM ` + TableBlockBuilder + ` WHERE builder_pubkey=$1;`
366365
entry := &BlockBuilderEntry{}
367366
err := s.DB.Get(entry, query, pubkey)
368367
return entry, err
@@ -374,17 +373,6 @@ func (s *DatabaseService) SetBlockBuilderStatus(pubkey string, isHighPrio, isBla
374373
return err
375374
}
376375

377-
func (s *DatabaseService) IncBlockBuilderStatsAfterGetHeader(slot uint64, blockhash string) error {
378-
query := `UPDATE ` + TableBlockBuilder + `
379-
SET num_sent_getheader=num_sent_getheader+1
380-
FROM (
381-
SELECT builder_pubkey FROM ` + TableBuilderBlockSubmission + ` WHERE slot=$1 AND block_hash=$2
382-
) AS sub
383-
WHERE ` + TableBlockBuilder + `.builder_pubkey=sub.builder_pubkey;`
384-
_, err := s.DB.Exec(query, slot, blockhash)
385-
return err
386-
}
387-
388376
func (s *DatabaseService) IncBlockBuilderStatsAfterGetPayload(slot uint64, blockhash string) error {
389377
query := `UPDATE ` + TableBlockBuilder + `
390378
SET num_sent_getpayload=num_sent_getpayload+1

database/schema.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ CREATE TABLE IF NOT EXISTS ` + TableBlockBuilder + ` (
139139
num_submissions_simerror bigint NOT NULL,
140140
num_submissions_topbid bigint NOT NULL,
141141
142-
num_sent_getheader bigint NOT NULL DEFAULT 0,
143142
num_sent_getpayload bigint NOT NULL DEFAULT 0,
144143
145144
UNIQUE (builder_pubkey)

database/types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,5 @@ type BlockBuilderEntry struct {
138138
NumSubmissionsSimError uint64 `db:"num_submissions_simerror" json:"num_submissions_simerror"`
139139
NumSubmissionsTopBid uint64 `db:"num_submissions_topbid" json:"num_submissions_topbid"`
140140

141-
NumSentGetHeader uint64 `db:"num_sent_getheader" json:"num_sent_getheader"`
142141
NumSentGetPayload uint64 `db:"num_sent_getpayload" json:"num_sent_getpayload"`
143142
}

go.mod

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ go 1.18
44

55
require (
66
github.com/alicebob/miniredis/v2 v2.23.0
7-
github.com/ethereum/go-ethereum v1.10.23
8-
github.com/flashbots/go-boost-utils v1.1.1
9-
github.com/flashbots/go-utils v0.4.7
7+
github.com/ethereum/go-ethereum v1.10.25
8+
github.com/flashbots/go-boost-utils v1.2.0
9+
github.com/flashbots/go-utils v0.4.8
1010
github.com/go-redis/redis/v9 v9.0.0-beta.2
1111
github.com/gorilla/mux v1.8.0
1212
github.com/jinzhu/copier v0.3.5
@@ -16,7 +16,7 @@ require (
1616
github.com/sirupsen/logrus v1.9.0
1717
github.com/spf13/cobra v1.5.0
1818
github.com/stretchr/testify v1.8.0
19-
go.uber.org/atomic v1.9.0
19+
go.uber.org/atomic v1.10.0
2020
golang.org/x/text v0.3.7
2121

2222
)
@@ -26,10 +26,10 @@ require (
2626
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
2727
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect
2828
github.com/btcsuite/btcd v0.22.0-beta // indirect
29-
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
29+
github.com/btcsuite/btcd/btcec/v2 v2.2.1 // indirect
3030
github.com/cespare/xxhash/v2 v2.1.2 // indirect
3131
github.com/davecgh/go-spew v1.1.1 // indirect
32-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
32+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
3333
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
3434
github.com/ferranbt/fastssz v0.1.2-0.20220723134332-b3d3034a4575 // indirect
3535
github.com/go-ole/go-ole v1.2.1 // indirect
@@ -51,9 +51,11 @@ require (
5151
github.com/tklauser/go-sysconf v0.3.5 // indirect
5252
github.com/tklauser/numcpus v0.2.2 // indirect
5353
github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9 // indirect
54-
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
54+
go.uber.org/multierr v1.6.0 // indirect
55+
go.uber.org/zap v1.23.0 // indirect
56+
golang.org/x/crypto v0.0.0-20220919173607-35f4265a4bc0 // indirect
5557
golang.org/x/net v0.0.0-20220708220712-1185a9018129 // indirect
56-
golang.org/x/sys v0.0.0-20220731174439-a90be440212d // indirect
58+
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect
5759
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect
5860
gopkg.in/yaml.v2 v2.4.0 // indirect
5961
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ github.com/alicebob/miniredis/v2 v2.23.0 h1:+lwAJYjvvdIVg6doFHuotFjueJ/7KY10xo/v
1212
github.com/alicebob/miniredis/v2 v2.23.0/go.mod h1:XNqvJdQJv5mSuVMc0ynneafpnL/zv52acZ6kqeS0t88=
1313
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8=
1414
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
15+
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
1516
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
1617
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
1718
github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo=
1819
github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA=
19-
github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k=
20-
github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU=
20+
github.com/btcsuite/btcd/btcec/v2 v2.2.1 h1:xP60mv8fvp+0khmrN0zTdPC3cNm24rfeE6lh2R/Yv3E=
21+
github.com/btcsuite/btcd/btcec/v2 v2.2.1/go.mod h1:9/CSmJxmuvqzX9Wh2fXMWToLOHhPd11lSPuIupwTkI8=
2122
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
2223
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
2324
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o=
@@ -41,21 +42,20 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
4142
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
4243
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4344
github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=
44-
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
45-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc=
46-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
45+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4=
46+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc=
4747
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
4848
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
4949
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
5050
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
51-
github.com/ethereum/go-ethereum v1.10.23 h1:Xk8XAT4/UuqcjMLIMF+7imjkg32kfVFKoeyQDaO2yWM=
52-
github.com/ethereum/go-ethereum v1.10.23/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg=
51+
github.com/ethereum/go-ethereum v1.10.25 h1:5dFrKJDnYf8L6/5o42abCE6a9yJm9cs4EJVRyYMr55s=
52+
github.com/ethereum/go-ethereum v1.10.25/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg=
5353
github.com/ferranbt/fastssz v0.1.2-0.20220723134332-b3d3034a4575 h1:56lKKtcqQZ5sGjeuyBAeFwzcYuk32d8oqDvxQ9FUERA=
5454
github.com/ferranbt/fastssz v0.1.2-0.20220723134332-b3d3034a4575/go.mod h1:U2ZsxlYyvGeQGmadhz8PlEqwkBzDIhHwd3xuKrg2JIs=
55-
github.com/flashbots/go-boost-utils v1.1.1 h1:PLrpjSx4YcDWjY2/I7T6QcMRrla+BN4ufjCXXlSEHS0=
56-
github.com/flashbots/go-boost-utils v1.1.1/go.mod h1:n1l19EIadU8mNshTdz75qfa2Ld613b/FdzTHorkIqbM=
57-
github.com/flashbots/go-utils v0.4.7 h1:Xxx8OgjUeSOZqQ0peazBRNDy3OAshCtJmxb54+/9YRI=
58-
github.com/flashbots/go-utils v0.4.7/go.mod h1:AGyHG5g3nEFzRp5rqSZzzxMmMsGlPsRRka3kJ+hg49w=
55+
github.com/flashbots/go-boost-utils v1.2.0 h1:sd++5dckD6WKKCsPTp/ixLZninQ6gZbfYqMdTJC/Z20=
56+
github.com/flashbots/go-boost-utils v1.2.0/go.mod h1:n1l19EIadU8mNshTdz75qfa2Ld613b/FdzTHorkIqbM=
57+
github.com/flashbots/go-utils v0.4.8 h1:WDJXryrqShGq4HFe+p1kGjObXSqzT7Sy/+9YvFpr5tM=
58+
github.com/flashbots/go-utils v0.4.8/go.mod h1:dBmSv4Cpqij4xKP50bdisAvFIo4/EgsY97BMpVjPzr0=
5959
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
6060
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
6161
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
@@ -172,15 +172,21 @@ github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZF
172172
github.com/trailofbits/go-fuzz-utils v0.0.0-20210901195358-9657fcfd256c h1:4WU+p200eLYtBsx3M5CKXvkjVdf5SC3W9nMg37y0TFI=
173173
github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9 h1:k/gmLsJDWwWqbLCur2yWnJzwQEKRcAHXo6seXGuSwWw=
174174
github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA=
175-
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
176-
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
175+
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
176+
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
177+
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
178+
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
179+
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
180+
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
181+
go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY=
182+
go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY=
177183
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
178184
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
179185
golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
180186
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
181187
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
182-
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY=
183-
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
188+
golang.org/x/crypto v0.0.0-20220919173607-35f4265a4bc0 h1:a5Yg6ylndHHYJqIPrdq0AhvR6KTvDTAvgBtaidhEevY=
189+
golang.org/x/crypto v0.0.0-20220919173607-35f4265a4bc0/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
184190
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
185191
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
186192
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@@ -206,8 +212,8 @@ golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7w
206212
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
207213
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
208214
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
209-
golang.org/x/sys v0.0.0-20220731174439-a90be440212d h1:Sv5ogFZatcgIMMtBSTTAgMYsicp25MXBubjXNDKwm80=
210-
golang.org/x/sys v0.0.0-20220731174439-a90be440212d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
215+
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc=
216+
golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
211217
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
212218
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
213219
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=

scripts/create-bls-keypair/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ func main() {
1414
log.Fatal(err.Error())
1515
}
1616

17-
pubkey := types.BlsPublicKeyToPublicKey(bls.PublicKeyFromSecretKey(sk))
17+
pubkey, err := types.BlsPublicKeyToPublicKey(bls.PublicKeyFromSecretKey(sk))
18+
if err != nil {
19+
log.Fatal(err.Error())
20+
}
1821

1922
fmt.Printf("secret key: 0x%x\n", sk.Serialize())
2023
fmt.Printf("public key: %s\n", pubkey.String())

services/api/service.go

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ type RelayAPI struct {
113113
}
114114

115115
// NewRelayAPI creates a new service. if builders is nil, allow any builder
116-
func NewRelayAPI(opts RelayAPIOpts) (*RelayAPI, error) {
116+
func NewRelayAPI(opts RelayAPIOpts) (api *RelayAPI, err error) {
117117
if opts.Log == nil {
118118
return nil, ErrMissingLogOpt
119119
}
@@ -134,7 +134,10 @@ func NewRelayAPI(opts RelayAPIOpts) (*RelayAPI, error) {
134134
}
135135

136136
// If using a secret key, ensure it's the correct one
137-
publicKey = types.BlsPublicKeyToPublicKey(bls.PublicKeyFromSecretKey(opts.SecretKey))
137+
publicKey, err = types.BlsPublicKeyToPublicKey(bls.PublicKeyFromSecretKey(opts.SecretKey))
138+
if err != nil {
139+
return nil, err
140+
}
138141
opts.Log.Infof("Using BLS key: %s", publicKey.String())
139142

140143
// ensure pubkey is same across all relay instances
@@ -151,7 +154,7 @@ func NewRelayAPI(opts RelayAPIOpts) (*RelayAPI, error) {
151154
}
152155
}
153156

154-
api := RelayAPI{
157+
api = &RelayAPI{
155158
opts: opts,
156159
log: opts.Log,
157160
blsSk: opts.SecretKey,
@@ -179,7 +182,7 @@ func NewRelayAPI(opts RelayAPIOpts) (*RelayAPI, error) {
179182
api.ffDisableLowPrioBuilders = true
180183
}
181184

182-
return &api, nil
185+
return api, nil
183186
}
184187

185188
func (api *RelayAPI) getRouter() http.Handler {
@@ -551,14 +554,6 @@ func (api *RelayAPI) handleGetHeader(w http.ResponseWriter, req *http.Request) {
551554
"blockHash": bid.Data.Message.Header.BlockHash.String(),
552555
}).Info("bid delivered")
553556
api.RespondOK(w, bid)
554-
555-
// Increment builder stats
556-
go func() {
557-
err := api.db.IncBlockBuilderStatsAfterGetHeader(slot, bid.Data.Message.Header.BlockHash.String())
558-
if err != nil {
559-
log.WithError(err).Error("could not increment builder-stats after getHeader")
560-
}
561-
}()
562557
}
563558

564559
func (api *RelayAPI) handleGetPayload(w http.ResponseWriter, req *http.Request) {

0 commit comments

Comments
 (0)