Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
ca8d35a
networkconfig: split beacon and ssv configs
nkryuchkov Apr 12, 2025
4a7b18f
move most parameters outside of BeaconNetwork interface
nkryuchkov Apr 12, 2025
5847a35
get rid of BeaconNetwork interface
nkryuchkov Apr 16, 2025
1f30b56
some leftovers
nkryuchkov Apr 16, 2025
e94b394
fix linter
nkryuchkov Apr 16, 2025
927b30f
fix message validation tests
nkryuchkov Apr 16, 2025
59d18d5
fix linter again
nkryuchkov Apr 16, 2025
66f0743
Merge branch 'stage' into networkconfig-split-ssv-beacon
nkryuchkov Apr 16, 2025
ee81f74
leftovers after merging
nkryuchkov Apr 16, 2025
1faaa2a
Merge branch 'networkconfig-split-ssv-beacon' into networkconfig-extr…
nkryuchkov Apr 16, 2025
eb6f245
Merge branch 'stage' into networkconfig-extract-beacon-params
nkryuchkov Apr 17, 2025
5d86317
fix issues after merging
nkryuchkov Apr 17, 2025
4f72bd9
fix network name bug
nkryuchkov Apr 17, 2025
ccbb20e
code review comments
nkryuchkov Apr 17, 2025
053f8ef
Merge branch 'stage' into networkconfig-extract-beacon-params
nkryuchkov Apr 23, 2025
3aa5db2
fix issues after merging
nkryuchkov Apr 23, 2025
3781bf9
update go.mod
nkryuchkov Apr 23, 2025
193cf2b
Merge branch 'stage' into networkconfig-extract-beacon-params
nkryuchkov Apr 25, 2025
8a79160
fix ekm tests
nkryuchkov Apr 25, 2025
def906b
remove unused import
nkryuchkov Apr 25, 2025
54f7f9a
update go.mod
nkryuchkov Apr 25, 2025
0c779ff
Merge branch 'stage' into networkconfig-extract-beacon-params
nkryuchkov Apr 28, 2025
fafa336
Merge branch 'stage' into networkconfig-extract-beacon-params
nkryuchkov Apr 30, 2025
555b78c
Merge branch 'stage' into networkconfig-extract-beacon-params
nkryuchkov May 12, 2025
04b36a6
fix issues after merging
nkryuchkov May 12, 2025
35de703
Merge branch 'stage' into networkconfig-extract-beacon-params
nkryuchkov May 20, 2025
ffd78bf
format/imports
nkryuchkov May 20, 2025
46eb61c
revert preparationSlots type change
nkryuchkov May 20, 2025
6adb4d5
use uint64 for amount of slots and epochs
nkryuchkov May 20, 2025
86b4d4b
Merge branch 'stage' into networkconfig-extract-beacon-params
nkryuchkov May 22, 2025
7274f17
use github.com/ssvlabs/eth2-key-manager@v1.5.5
nkryuchkov May 26, 2025
b244241
spec-alignment
y0sher May 26, 2025
3c9b3b6
Merge branch 'stage' into networkconfig-extract-beacon-params
nkryuchkov May 26, 2025
992906b
feat(networkconfig,beacon/goclient): get beacon config from beacon no…
nkryuchkov May 27, 2025
4546486
Merge branch 'stage' into networkconfig-extract-beacon-params
nkryuchkov May 27, 2025
7ce717a
update go.mod
nkryuchkov May 27, 2025
21e346c
networkconfig: make hardcoded values configurable (#2164)
nkryuchkov May 27, 2025
6bfa93b
networkconfig: narrow config usage (#2172)
nkryuchkov May 27, 2025
411a3a1
fix issues after merging
nkryuchkov May 27, 2025
2fdf4db
beacon,networkconfig: move fork handling from beacon to networkconfig…
nkryuchkov May 27, 2025
15278de
networkconfig: delete hardcoded beacon configs (#2183)
nkryuchkov May 27, 2025
00af14d
rename BeaconName to NetworkName
nkryuchkov May 27, 2025
8fc6fde
refactor getting spec parameters
nkryuchkov May 27, 2025
4810da8
update go.mod
nkryuchkov May 27, 2025
2d09e23
fix type assertion
nkryuchkov May 27, 2025
4d0175a
fix spec align
MatusKysel May 28, 2025
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
16 changes: 9 additions & 7 deletions beacon/goclient/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (gc *GoClient) SubmitAggregateSelectionProof(
gc.waitToSlotTwoThirds(slot)

// differ from spec because we need to subscribe to subnet
isAggregator := isAggregator(committeeLength, slotSig)
isAggregator := gc.isAggregator(committeeLength, slotSig)
if !isAggregator {
return nil, DataVersionNil, fmt.Errorf("validator is not an aggregator")
}
Expand All @@ -39,7 +39,9 @@ func (gc *GoClient) SubmitAggregateSelectionProof(
if err != nil {
return nil, DataVersionNil, fmt.Errorf("failed to get attestation data: %w", err)
}
if gc.DataVersion(gc.network.EstimatedEpochAtSlot(attData.Slot)) < spec.DataVersionElectra {

dataVersion, _ := gc.beaconConfig.ForkAtEpoch(gc.getBeaconConfig().EstimatedEpochAtSlot(attData.Slot))
if dataVersion < spec.DataVersionElectra {
attData.Index = committeeIndex
}

Expand Down Expand Up @@ -188,8 +190,8 @@ func (gc *GoClient) SubmitSignedAggregateSelectionProof(
// committee = get_beacon_committee(state, slot, index)
// modulo = max(1, len(committee) // TARGET_AGGREGATORS_PER_COMMITTEE)
// return bytes_to_uint64(hash(slot_signature)[0:8]) % modulo == 0
func isAggregator(committeeCount uint64, slotSig []byte) bool {
modulo := committeeCount / TargetAggregatorsPerCommittee
func (gc *GoClient) isAggregator(committeeCount uint64, slotSig []byte) bool {
modulo := committeeCount / gc.beaconConfig.TargetAggregatorsPerCommittee
if modulo == 0 {
// Modulo must be at least 1.
modulo = 1
Expand All @@ -201,9 +203,9 @@ func isAggregator(committeeCount uint64, slotSig []byte) bool {

// waitToSlotTwoThirds waits until two-third of the slot has transpired (SECONDS_PER_SLOT * 2 / 3 seconds after slot start time)
func (gc *GoClient) waitToSlotTwoThirds(slot phase0.Slot) {
oneThird := gc.network.SlotDurationSec() / 3 /* one third of slot duration */

finalTime := gc.slotStartTime(slot).Add(2 * oneThird)
config := gc.getBeaconConfig()
oneInterval := config.IntervalDuration()
finalTime := config.GetSlotStartTime(slot).Add(2 * oneInterval)
wait := time.Until(finalTime)
if wait <= 0 {
return
Expand Down
45 changes: 17 additions & 28 deletions beacon/goclient/attest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ import (
"github.com/attestantio/go-eth2-client/spec"
"github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/sourcegraph/conc/pool"
"github.com/ssvlabs/ssv-spec/types"
"github.com/stretchr/testify/require"
"go.uber.org/zap"

"github.com/ssvlabs/ssv/operator/slotticker"
"github.com/ssvlabs/ssv/protocol/v2/blockchain/beacon"
"github.com/ssvlabs/ssv/utils/hashmap"
)

Expand Down Expand Up @@ -61,30 +58,36 @@ var (
}`),
"/eth/v1/beacon/genesis": []byte(`{
"data": {
"genesis_time": "1695902400",
"genesis_validators_root": "0x9143aa7c615a7f7115e2b6aac319c03529df8242ae705fba9df39b79c59fa8b1",
"genesis_time": "1606824023",
"genesis_validators_root": "0x4b363db94e28612020049ce3795b0252c16c4241df2bc9ef221abde47527c0d0",
"genesis_fork_version": "0x00000000"
}
}`),
"/eth/v1/config/spec": []byte(`{
"data": {
"CONFIG_NAME": "holesky",
"CONFIG_NAME": "mainnet",
"GENESIS_FORK_VERSION": "0x00000000",
"CAPELLA_FORK_VERSION": "0x04017000",
"MIN_GENESIS_TIME": "1695902100",
"ALTAIR_FORK_VERSION": "0x01000000",
"ALTAIR_FORK_EPOCH": "74240",
"BELLATRIX_FORK_VERSION": "0x02000000",
"BELLATRIX_FORK_EPOCH": "144896",
"CAPELLA_FORK_VERSION": "0x03000000",
"CAPELLA_FORK_EPOCH": "194048",
"DENEB_FORK_VERSION": "0x04000000",
"DENEB_FORK_EPOCH": "269568",
"ELECTRA_FORK_VERSION": "0x05000000",
"ELECTRA_FORK_EPOCH": "364032",
"FULU_FORK_VERSION": "0x06000000",
"FULU_FORK_EPOCH": "18446744073709551615",
"MIN_GENESIS_TIME": "1606824000",
"SECONDS_PER_SLOT": "12",
"SLOTS_PER_EPOCH": "32",
"EPOCHS_PER_SYNC_COMMITTEE_PERIOD": "256",
"SYNC_COMMITTEE_SIZE": "512",
"SYNC_COMMITTEE_SUBNET_COUNT": "4",
"TARGET_AGGREGATORS_PER_COMMITTEE": "16",
"TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE": "16",
"INTERVALS_PER_SLOT": "3",
"ALTAIR_FORK_EPOCH": "74240",
"BELLATRIX_FORK_EPOCH": "144896",
"CAPELLA_FORK_EPOCH": "194048",
"DENEB_FORK_EPOCH": "269568",
"ELECTRA_FORK_EPOCH": "18446744073709551615"
"INTERVALS_PER_SLOT": "3"
}
}`),
}
Expand Down Expand Up @@ -205,17 +208,10 @@ func TestGoClient_GetAttestationData_Simple(t *testing.T) {
t.Context(),
zap.NewNop(),
Options{
Network: beacon.NewNetwork(types.MainNetwork),
BeaconNodeAddr: server.URL,
CommonTimeout: 1 * time.Second,
LongTimeout: 1 * time.Second,
},
func() slotticker.SlotTicker {
return slotticker.New(zap.NewNop(), slotticker.Config{
SlotDuration: 12 * time.Second,
GenesisTime: time.Now(),
})
},
)
require.NoError(t, err)

Expand Down Expand Up @@ -501,18 +497,11 @@ func createClient(
ctx,
zap.NewNop(),
Options{
Network: beacon.NewNetwork(types.MainNetwork),
BeaconNodeAddr: beaconServerURL,
CommonTimeout: defaultHardTimeout,
LongTimeout: time.Second,
WithWeightedAttestationData: withWeightedAttestationData,
},
func() slotticker.SlotTicker {
return slotticker.New(zap.NewNop(), slotticker.Config{
SlotDuration: 12 * time.Second,
GenesisTime: time.Now(),
})
},
)
return client, err
}
Expand Down
46 changes: 0 additions & 46 deletions beacon/goclient/current_fork.go

This file was deleted.

139 changes: 0 additions & 139 deletions beacon/goclient/current_fork_test.go

This file was deleted.

Loading