Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssv-signer support #2028

Open
wants to merge 172 commits into
base: stage
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
172 commits
Select commit Hold shift + click to select a range
354ed55
ssv-signer: draft implementation
nkryuchkov Feb 7, 2025
12c90cc
draft implementation of IsAttestationSlashable/IsBeaconBlockSlashable
nkryuchkov Feb 7, 2025
25d209f
improve implementation comments in adapters
nkryuchkov Feb 7, 2025
ad9e861
fix adapter methods for attestation and use them
nkryuchkov Feb 8, 2025
4c2e1e8
fix compilation issues
nkryuchkov Feb 8, 2025
1ddc5a0
add key manager fallback
nkryuchkov Feb 8, 2025
baff0cc
change network to holesky
nkryuchkov Feb 10, 2025
a8ec532
add a log
nkryuchkov Feb 11, 2025
3993349
fix go.mod
nkryuchkov Feb 11, 2025
d5d93c2
fix setupOperatorStorage
nkryuchkov Feb 11, 2025
3ffe437
fix setupOperatorStorage [2]
nkryuchkov Feb 11, 2025
339141d
remove ekm fallback
nkryuchkov Feb 11, 2025
250b0d0
fix flow in handleShareCreation
nkryuchkov Feb 11, 2025
a32a64d
update ssv-signer version
nkryuchkov Feb 11, 2025
cf03602
ssv-signer init logs
nkryuchkov Feb 11, 2025
a83b40a
update ssv-signer version
nkryuchkov Feb 11, 2025
922231e
implement BumpSlashingProtection
nkryuchkov Feb 12, 2025
b0b6c47
try to fix panic
nkryuchkov Feb 12, 2025
8b8f0ca
try to fix panic [2]
nkryuchkov Feb 12, 2025
867165a
implement SSVSignerTypesOperatorSignerAdapter
nkryuchkov Feb 12, 2025
8cb2d69
update ssv-signer version
nkryuchkov Feb 12, 2025
dacb027
update ssv-signer version [2]
nkryuchkov Feb 12, 2025
36ba2e4
support signing of all object types
nkryuchkov Feb 15, 2025
172407a
update ssv-signer version
nkryuchkov Feb 15, 2025
fd97e73
fix validator registration typo
nkryuchkov Feb 15, 2025
f734862
continue building post consensus message if signing failed
nkryuchkov Feb 17, 2025
1cfaeb7
attempt to fix SyncAggregatorSelectionData
nkryuchkov Feb 17, 2025
5f2be7b
attempt to fix SyncCommitteeMessage
nkryuchkov Feb 17, 2025
926687b
attempt to fix SyncCommitteeMessage [2]
nkryuchkov Feb 17, 2025
5ac28ed
revert ProcessConsensus logic
nkryuchkov Feb 17, 2025
27743d5
attempt to fix sync committee issue
nkryuchkov Feb 17, 2025
2b17b68
WIP on refactoring/leftovers
nkryuchkov Feb 19, 2025
2e91265
change AddValidator signature
nkryuchkov Feb 19, 2025
458008f
WIP on refactoring
nkryuchkov Feb 21, 2025
9934dc3
disable slashing protection
nkryuchkov Feb 21, 2025
132b91b
fix issues in the last commit
nkryuchkov Feb 21, 2025
6751518
enable slashing protection
nkryuchkov Feb 21, 2025
fae2a06
add a TODO
nkryuchkov Feb 21, 2025
e0b2741
fix panic when genesis is nil
nkryuchkov Feb 21, 2025
29191e8
attempt to fix attestation slashing data update
nkryuchkov Feb 21, 2025
4d23e35
debug logs for slashing protection bump
nkryuchkov Feb 22, 2025
51bb23d
debug logs for slashing protection data removal
nkryuchkov Feb 22, 2025
295ece1
remove debug logs
nkryuchkov Feb 22, 2025
49d5719
enable proposal slashing protection
nkryuchkov Feb 22, 2025
f17b034
move ssv-signer-related code into a separate package
nkryuchkov Feb 24, 2025
6612033
refactor ssv-signer setup process
nkryuchkov Feb 24, 2025
a4cfdec
eventhandler: refactor share addition
nkryuchkov Feb 24, 2025
3f70171
fix setting min participation epoch
nkryuchkov Feb 24, 2025
6467d5b
move eh.operatorDataStore.GetOperatorID()
nkryuchkov Feb 24, 2025
473743f
pass encrypted share to AddShare in ekm
nkryuchkov Feb 24, 2025
6f7e745
Merge branch 'stage' into ssv-signer
nkryuchkov Feb 24, 2025
d37a67d
set encryption key for ssv-signer
nkryuchkov Feb 24, 2025
e1f5819
reduce amount of changes
nkryuchkov Feb 24, 2025
188553b
integrate ssv-signer
nkryuchkov Feb 24, 2025
eddd158
get rid of github.com/protolambda/bls12-381-util
nkryuchkov Feb 24, 2025
d24191c
remove unnecessary packages
nkryuchkov Feb 25, 2025
e09b887
add some TODO's
nkryuchkov Feb 25, 2025
0abcfcc
Merge branch 'refs/heads/stage' into ssv-signer
nkryuchkov Feb 25, 2025
0d0d4bb
resolve remaining TODOs
nkryuchkov Feb 25, 2025
005e877
add a log in retryFunc
nkryuchkov Feb 25, 2025
ec2603a
assertSameGenesisVersion: reorder checks
nkryuchkov Feb 25, 2025
4cfd76a
fix linter
nkryuchkov Feb 25, 2025
4a1a155
fix tests
nkryuchkov Feb 25, 2025
b73afb5
extract slashing protection
nkryuchkov Feb 25, 2025
c076812
add design doc
nkryuchkov Feb 25, 2025
3c6adf0
move some files
nkryuchkov Feb 25, 2025
2b42e67
create go.mod for ssvsigner
nkryuchkov Feb 26, 2025
977c775
remove replace for ssvsigner
nkryuchkov Feb 26, 2025
8ee7e21
go.sum
nkryuchkov Feb 26, 2025
0b89ff6
update ssv version
nkryuchkov Feb 26, 2025
33bfc93
improve docs
nkryuchkov Feb 26, 2025
f9117cc
remove mock NodeStorage TODOs
nkryuchkov Feb 26, 2025
9c3540f
rename Provider interface
nkryuchkov Feb 26, 2025
675214b
rename a variable
nkryuchkov Feb 26, 2025
9a22b41
make logger mandatory in RemoteKeyManager
nkryuchkov Feb 26, 2025
010d55d
fix a typo in design doc
nkryuchkov Feb 26, 2025
19bf388
add empty password file check
nkryuchkov Feb 26, 2025
3365470
ssv-signer: bump ssv version
nkryuchkov Feb 26, 2025
724e7b0
ssv-signer: bump ssv version [2]
nkryuchkov Feb 26, 2025
49cf038
improve error message
nkryuchkov Feb 26, 2025
0c71bbf
add a design link to README.md
nkryuchkov Feb 26, 2025
6ca5ac8
Merge branch 'stage' into ssv-signer
nkryuchkov Feb 27, 2025
0975c0a
move genesis recordRequestDuration into Genesis method
nkryuchkov Feb 27, 2025
a8bf8d8
log operator private key length
nkryuchkov Feb 27, 2025
58c4b26
move nil check
nkryuchkov Feb 27, 2025
3888e7d
add nil check for CurrentFork
nkryuchkov Feb 27, 2025
15ebd85
move log
nkryuchkov Feb 27, 2025
50d595d
add missing log
nkryuchkov Feb 27, 2025
7074671
fix leftovers
nkryuchkov Feb 27, 2025
88393e5
fix method name
nkryuchkov Feb 27, 2025
40cc3d8
fix wrong logs
nkryuchkov Feb 28, 2025
9e41bbb
Merge branch 'stage' into ssv-signer
nkryuchkov Feb 28, 2025
06cde23
use https://github.com/ssvlabs/eth2-key-manager/pull/112
nkryuchkov Feb 28, 2025
e1d3774
fix AggregateAndProof type in ssvsigner
nkryuchkov Feb 28, 2025
e4c6866
add omitempty to CommitteeBits
nkryuchkov Feb 28, 2025
cc3cc6a
fix signed type of AggregateAndProof
nkryuchkov Feb 28, 2025
0f59962
fix linter
nkryuchkov Feb 28, 2025
aad1ae7
return error details when signing fails
nkryuchkov Feb 28, 2025
0833446
fix AggregateAndProofData type
nkryuchkov Feb 28, 2025
ff30572
fix filling AggregateAndProofData
nkryuchkov Feb 28, 2025
3f89bd4
use replace in go.mod
nkryuchkov Mar 3, 2025
7561ae3
check if decoded share private key matches share public key
nkryuchkov Mar 3, 2025
333c6ed
web3signer unit tests
nkryuchkov Mar 3, 2025
683795b
return error on StatusError
nkryuchkov Mar 3, 2025
7432451
fix logger
nkryuchkov Mar 3, 2025
8d9ba8f
simplify response body read calls
nkryuchkov Mar 3, 2025
f268c40
add comments for bumping/removing slashing protection
nkryuchkov Mar 3, 2025
114c6f1
required WEB3SIGNER_ENDPOINT
nkryuchkov Mar 3, 2025
38bfe56
check web3signer URL validity
nkryuchkov Mar 3, 2025
5602394
add ShareDecryptionError error matching test
nkryuchkov Mar 3, 2025
6898dd1
refactor request/response types
nkryuchkov Mar 3, 2025
0afb1ca
add a comment about preventing from running with a different key
nkryuchkov Mar 3, 2025
4402031
Merge branch 'stage' into ssv-signer
nkryuchkov Mar 3, 2025
e0916af
fmt
nkryuchkov Mar 3, 2025
82d10af
return Base64 as string instead of []byte
nkryuchkov Mar 3, 2025
de11c78
go mod tidy
nkryuchkov Mar 3, 2025
9ddb0bd
go mod tidy
nkryuchkov Mar 4, 2025
fdb86cf
signer docker file (#2059)
vaclav-ssvlabs Mar 4, 2025
b01256f
get rid of github.com/pkg/errors
nkryuchkov Mar 4, 2025
c03b4f0
goimports
nkryuchkov Mar 4, 2025
4a3c2ac
various improvements
nkryuchkov Mar 5, 2025
39d62b6
go mod tidy
nkryuchkov Mar 5, 2025
4417d61
add a comment
nkryuchkov Mar 5, 2025
d550444
use hardcoded genesis fork version
nkryuchkov Mar 5, 2025
aab5ad9
Merge branch 'stage' into ssv-signer
nkryuchkov Mar 5, 2025
e630522
delete Events method
nkryuchkov Mar 5, 2025
5869820
simplify ensureNoMissingKeys
nkryuchkov Mar 5, 2025
e725d67
extend web3signer tests
nkryuchkov Mar 5, 2025
1b98383
abstract signer in server
nkryuchkov Mar 5, 2025
1c7cb9f
add some client tests
nkryuchkov Mar 5, 2025
8170343
more client tests
nkryuchkov Mar 5, 2025
5740b0e
add server tests
nkryuchkov Mar 5, 2025
fc227fc
use interfaces for testing
nkryuchkov Mar 5, 2025
034ba94
add remote key manager tests
nkryuchkov Mar 5, 2025
e1bda2c
more tests
nkryuchkov Mar 5, 2025
53915a5
add *electra.BeaconBlock
nkryuchkov Mar 5, 2025
7c345b1
more remote key manager tests
nkryuchkov Mar 6, 2025
04c9922
move Dockerfile
nkryuchkov Mar 6, 2025
532c0fb
fix TestNewRemoteKeyManager
nkryuchkov Mar 6, 2025
000ef67
more remote key manager tests
nkryuchkov Mar 6, 2025
da2cd33
move methods in GoClient
nkryuchkov Mar 6, 2025
225b17b
beacon/goclient: fix bugs and add unit tests
nkryuchkov Mar 6, 2025
3e4a30d
fix linter
nkryuchkov Mar 6, 2025
d53e8f8
kong optimizations
nkryuchkov Mar 6, 2025
77955da
GetOperatorIdentity -> OperatorIdentity
nkryuchkov Mar 6, 2025
297ebbc
delete duplicated Status type
nkryuchkov Mar 6, 2025
57f5453
move client and server to root of ./ssvsigner
nkryuchkov Mar 6, 2025
fec4947
simplify requests to web3signer with github.com/carlmjohnson/requests
nkryuchkov Mar 6, 2025
e413d1f
rewrite routes according to REST:
nkryuchkov Mar 6, 2025
88e8355
simplify requests to ssv signer with github.com/carlmjohnson/requests
nkryuchkov Mar 6, 2025
8acaa1a
update go.mod
nkryuchkov Mar 6, 2025
1d306f6
update go.mod for ssvsigner
nkryuchkov Mar 6, 2025
97e2023
add go.work to .gitignore
nkryuchkov Mar 6, 2025
c70965c
add go.work.sum to .gitignore
nkryuchkov Mar 6, 2025
673fdd0
fix clients tests
nkryuchkov Mar 6, 2025
fb80a8a
revert go.mod changes
nkryuchkov Mar 6, 2025
f5b3e24
cleanup go.mod
nkryuchkov Mar 6, 2025
63d3db6
update ssv and ssvsigner version in go.mod
nkryuchkov Mar 6, 2025
5d462f2
fix a typo
nkryuchkov Mar 7, 2025
5da0e89
make remoteSigner interface unexported
nkryuchkov Mar 7, 2025
6a6017d
fix build by bumping libp2p version to v0.37.2
nkryuchkov Mar 7, 2025
1be0425
remove AddValidator retries
nkryuchkov Mar 7, 2025
313df1d
remove retryFunc
nkryuchkov Mar 7, 2025
39e6da5
avoid using version string constants
nkryuchkov Mar 7, 2025
563d714
add TestSpec
nkryuchkov Mar 7, 2025
134df8d
add Test_computeVoluntaryExitDomain
nkryuchkov Mar 8, 2025
bc960fe
tests for ssv-signer main
nkryuchkov Mar 8, 2025
7a8a832
more remote key manager tests
nkryuchkov Mar 8, 2025
eb39285
more remote key manager tests [2]
nkryuchkov Mar 8, 2025
5bb8e23
more remote key manager tests [3]
nkryuchkov Mar 8, 2025
e5a7f45
more remote key manager tests [4]
nkryuchkov Mar 8, 2025
d2441cd
fix test name
nkryuchkov Mar 8, 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ bin/
/scripts/spec_align_report/ssv-spec
.vscode/
patches/

go.work
go.work.sum
45 changes: 45 additions & 0 deletions beacon/goclient/current_fork.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package goclient

import (
"context"
"fmt"
"net/http"
"time"

"github.com/attestantio/go-eth2-client/api"
"github.com/attestantio/go-eth2-client/spec/phase0"
"go.uber.org/zap"
)

func (gc *GoClient) CurrentFork(ctx context.Context) (*phase0.Fork, error) {
start := time.Now()
schedule, err := gc.multiClient.ForkSchedule(ctx, &api.ForkScheduleOpts{})
recordRequestDuration(gc.ctx, "ForkSchedule", gc.multiClient.Address(), http.MethodGet, time.Since(start), err)
if err != nil {
gc.log.Error(clResponseErrMsg,
zap.String("api", "ForkSchedule"),
zap.Error(err),
)
return nil, err
}

Check warning on line 24 in beacon/goclient/current_fork.go

View check run for this annotation

Codecov / codecov/patch

beacon/goclient/current_fork.go#L19-L24

Added lines #L19 - L24 were not covered by tests
if schedule.Data == nil {
gc.log.Error(clNilResponseForkDataErrMsg,
zap.String("api", "ForkSchedule"),
)
return nil, fmt.Errorf("fork schedule response data is nil")
}

currentEpoch := gc.network.EstimatedCurrentEpoch()
var currentFork *phase0.Fork
for _, fork := range schedule.Data {
if fork.Epoch <= currentEpoch && (currentFork == nil || fork.Epoch > currentFork.Epoch) {
currentFork = fork
}
}

if currentFork == nil {
return nil, fmt.Errorf("could not find current fork")
}

return currentFork, nil
}
147 changes: 147 additions & 0 deletions beacon/goclient/current_fork_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
package goclient

import (
"context"
"encoding/json"
"fmt"
"net/http"
"testing"
"time"

"github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/stretchr/testify/require"
"go.uber.org/zap"

"github.com/ssvlabs/ssv-spec/types"

"github.com/ssvlabs/ssv/beacon/goclient/tests"
"github.com/ssvlabs/ssv/protocol/v2/blockchain/beacon"
)

const forkSchedulePath = "/eth/v1/config/fork_schedule"

func TestCurrentFork(t *testing.T) {
ctx := context.Background()

network := beacon.NewNetwork(types.MainNetwork)
currentEpoch := network.EstimatedCurrentEpoch()

t.Run("success", func(t *testing.T) {
mockServer := tests.MockServer(t, func(r *http.Request, resp json.RawMessage) (json.RawMessage, error) {
if r.URL.Path == forkSchedulePath {
return json.RawMessage(`{
"data": [
{
"previous_version": "0x00010203",
"current_version": "0x04050607",
"epoch": "` + fmt.Sprint(currentEpoch-100) + `"
},
{
"previous_version": "0x04050607",
"current_version": "0x08090a0b",
"epoch": "` + fmt.Sprint(currentEpoch-50) + `"
},
{
"previous_version": "0x08090a0b",
"current_version": "0x0c0d0e0f",
"epoch": "` + fmt.Sprint(currentEpoch+100) + `"
}
]
}`), nil
}
return resp, nil
})
defer mockServer.Close()

client, err := New(
zap.NewNop(),
beacon.Options{
Context: ctx,
Network: network,
BeaconNodeAddr: mockServer.URL,
CommonTimeout: 100 * time.Millisecond,
LongTimeout: 500 * time.Millisecond,
},
tests.MockDataStore{},
tests.MockSlotTickerProvider,
)
require.NoError(t, err)

currentFork, err := client.CurrentFork(ctx)
require.NoError(t, err)
require.NotNil(t, currentFork)

require.Equal(t, currentEpoch-50, currentFork.Epoch)
require.Equal(t, phase0.Version{0x04, 0x05, 0x06, 0x07}, currentFork.PreviousVersion)
require.Equal(t, phase0.Version{0x08, 0x09, 0x0a, 0x0b}, currentFork.CurrentVersion)
})

t.Run("nil_data", func(t *testing.T) {
mockServer := tests.MockServer(t, func(r *http.Request, resp json.RawMessage) (json.RawMessage, error) {
if r.URL.Path == forkSchedulePath {
return json.RawMessage(`{"data": null}`), nil
}
return resp, nil
})
defer mockServer.Close()

client, err := New(
zap.NewNop(),
beacon.Options{
Context: ctx,
Network: network,
BeaconNodeAddr: mockServer.URL,
CommonTimeout: 100 * time.Millisecond,
LongTimeout: 500 * time.Millisecond,
},
tests.MockDataStore{},
tests.MockSlotTickerProvider,
)
require.NoError(t, err)

_, err = client.CurrentFork(ctx)
require.Error(t, err)
require.Contains(t, err.Error(), "fork schedule response data is nil")
})

t.Run("no_current_fork", func(t *testing.T) {
mockServer := tests.MockServer(t, func(r *http.Request, resp json.RawMessage) (json.RawMessage, error) {
if r.URL.Path == forkSchedulePath {
return json.RawMessage(`{
"data": [
{
"previous_version": "0x00010203",
"current_version": "0x04050607",
"epoch": "` + fmt.Sprint(currentEpoch+100) + `"
},
{
"previous_version": "0x04050607",
"current_version": "0x08090a0b",
"epoch": "` + fmt.Sprint(currentEpoch+200) + `"
}
]
}`), nil
}
return resp, nil
})
defer mockServer.Close()

client, err := New(
zap.NewNop(),
beacon.Options{
Context: ctx,
Network: network,
BeaconNodeAddr: mockServer.URL,
CommonTimeout: 100 * time.Millisecond,
LongTimeout: 500 * time.Millisecond,
},
tests.MockDataStore{},
tests.MockSlotTickerProvider,
)
require.NoError(t, err)

_, err = client.CurrentFork(ctx)
require.Error(t, err)
require.Contains(t, err.Error(), "could not find current fork")
})
}
8 changes: 2 additions & 6 deletions beacon/goclient/dataversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package goclient
import (
"fmt"

"github.com/attestantio/go-eth2-client/api"
"github.com/attestantio/go-eth2-client/spec"
"github.com/attestantio/go-eth2-client/spec/phase0"
)
Expand All @@ -25,14 +24,11 @@ func (gc *GoClient) DataVersion(epoch phase0.Epoch) spec.DataVersion {
return spec.DataVersionElectra
}

func (gc *GoClient) checkForkValues(specResponse *api.Response[map[string]any]) error {
func (gc *GoClient) checkForkValues(specResponse map[string]any) error {
// Validate the response.
if specResponse == nil {
return fmt.Errorf("spec response is nil")
}
if specResponse.Data == nil {
return fmt.Errorf("spec response data is nil")
}

// Lock the fork values to ensure atomic read and update.
gc.ForkLock.Lock()
Expand All @@ -47,7 +43,7 @@ func (gc *GoClient) checkForkValues(specResponse *api.Response[map[string]any])
// If the candidate is greater than the current value, that's an error.
// Otherwise, it returns the lower value (or the candidate if the current value is zero).
processFork := func(forkName, key string, current phase0.Epoch, required bool) (phase0.Epoch, error) {
raw, ok := specResponse.Data[key]
raw, ok := specResponse[key]
if !ok {
if required {
return 0, fmt.Errorf("%s fork epoch not known by chain", forkName)
Expand Down
87 changes: 36 additions & 51 deletions beacon/goclient/dataversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"strings"
"testing"

"github.com/attestantio/go-eth2-client/api"
"github.com/attestantio/go-eth2-client/spec"
"github.com/attestantio/go-eth2-client/spec/phase0"
)
Expand Down Expand Up @@ -54,7 +53,7 @@ func TestCheckForkValues(t *testing.T) {
initialAltair, initialBellatrix, initialCapella,
initialDeneb, initialElectra phase0.Epoch
// input response and expected outcomes
response *api.Response[map[string]any]
response map[string]any
expectedErr string
expectedAltair, expectedBellatrix, expectedCapella,
expectedDeneb, expectedElectra phase0.Epoch
Expand All @@ -65,11 +64,9 @@ func TestCheckForkValues(t *testing.T) {
expectedErr: "spec response is nil",
},
{
name: "nil data",
response: &api.Response[map[string]any]{
Data: nil,
},
expectedErr: "spec response data is nil",
name: "nil data",
response: nil,
expectedErr: "spec response is nil",
},
{
name: "missing ALTAIR",
Expand All @@ -78,12 +75,10 @@ func TestCheckForkValues(t *testing.T) {
initialCapella: FarFutureEpoch,
initialDeneb: FarFutureEpoch,
initialElectra: FarFutureEpoch,
response: &api.Response[map[string]any]{
Data: map[string]any{
"BELLATRIX_FORK_EPOCH": uint64(20),
"CAPELLA_FORK_EPOCH": uint64(30),
"DENEB_FORK_EPOCH": uint64(40),
},
response: map[string]any{
"BELLATRIX_FORK_EPOCH": uint64(20),
"CAPELLA_FORK_EPOCH": uint64(30),
"DENEB_FORK_EPOCH": uint64(40),
},
expectedErr: "ALTAIR fork epoch not known by chain",
},
Expand All @@ -94,13 +89,11 @@ func TestCheckForkValues(t *testing.T) {
initialCapella: FarFutureEpoch,
initialDeneb: FarFutureEpoch,
initialElectra: FarFutureEpoch,
response: &api.Response[map[string]any]{
Data: map[string]any{
"ALTAIR_FORK_EPOCH": "not a uint",
"BELLATRIX_FORK_EPOCH": uint64(20),
"CAPELLA_FORK_EPOCH": uint64(30),
"DENEB_FORK_EPOCH": uint64(40),
},
response: map[string]any{
"ALTAIR_FORK_EPOCH": "not a uint",
"BELLATRIX_FORK_EPOCH": uint64(20),
"CAPELLA_FORK_EPOCH": uint64(30),
"DENEB_FORK_EPOCH": uint64(40),
},
expectedErr: "failed to decode ALTAIR fork epoch",
},
Expand All @@ -111,14 +104,12 @@ func TestCheckForkValues(t *testing.T) {
initialCapella: FarFutureEpoch,
initialDeneb: FarFutureEpoch,
initialElectra: FarFutureEpoch,
response: &api.Response[map[string]any]{
Data: map[string]any{
"ALTAIR_FORK_EPOCH": uint64(10),
"BELLATRIX_FORK_EPOCH": uint64(20),
"CAPELLA_FORK_EPOCH": uint64(30),
"DENEB_FORK_EPOCH": uint64(40),
"ELECTRA_FORK_EPOCH": uint64(50),
},
response: map[string]any{
"ALTAIR_FORK_EPOCH": uint64(10),
"BELLATRIX_FORK_EPOCH": uint64(20),
"CAPELLA_FORK_EPOCH": uint64(30),
"DENEB_FORK_EPOCH": uint64(40),
"ELECTRA_FORK_EPOCH": uint64(50),
},
expectedAltair: phase0.Epoch(10),
expectedBellatrix: phase0.Epoch(20),
Expand All @@ -133,13 +124,11 @@ func TestCheckForkValues(t *testing.T) {
initialCapella: FarFutureEpoch,
initialDeneb: FarFutureEpoch,
initialElectra: FarFutureEpoch,
response: &api.Response[map[string]any]{
Data: map[string]any{
"ALTAIR_FORK_EPOCH": uint64(10),
"BELLATRIX_FORK_EPOCH": uint64(20),
"CAPELLA_FORK_EPOCH": uint64(30),
"DENEB_FORK_EPOCH": uint64(40),
},
response: map[string]any{
"ALTAIR_FORK_EPOCH": uint64(10),
"BELLATRIX_FORK_EPOCH": uint64(20),
"CAPELLA_FORK_EPOCH": uint64(30),
"DENEB_FORK_EPOCH": uint64(40),
},
expectedAltair: phase0.Epoch(10),
expectedBellatrix: phase0.Epoch(20),
Expand All @@ -154,14 +143,12 @@ func TestCheckForkValues(t *testing.T) {
initialCapella: 30,
initialDeneb: 40,
initialElectra: 99,
response: &api.Response[map[string]any]{
Data: map[string]any{
"ALTAIR_FORK_EPOCH": uint64(10),
"BELLATRIX_FORK_EPOCH": uint64(20),
"CAPELLA_FORK_EPOCH": uint64(30),
"DENEB_FORK_EPOCH": uint64(40),
"ELECTRA_FORK_EPOCH": uint64(50),
},
response: map[string]any{
"ALTAIR_FORK_EPOCH": uint64(10),
"BELLATRIX_FORK_EPOCH": uint64(20),
"CAPELLA_FORK_EPOCH": uint64(30),
"DENEB_FORK_EPOCH": uint64(40),
"ELECTRA_FORK_EPOCH": uint64(50),
},
expectedAltair: phase0.Epoch(10),
expectedBellatrix: phase0.Epoch(20),
Expand All @@ -177,14 +164,12 @@ func TestCheckForkValues(t *testing.T) {
initialCapella: 30,
initialDeneb: 40,
initialElectra: 50,
response: &api.Response[map[string]any]{
Data: map[string]any{
"ALTAIR_FORK_EPOCH": uint64(10),
"BELLATRIX_FORK_EPOCH": uint64(20),
"CAPELLA_FORK_EPOCH": uint64(30),
"DENEB_FORK_EPOCH": uint64(40),
"ELECTRA_FORK_EPOCH": uint64(60),
},
response: map[string]any{
"ALTAIR_FORK_EPOCH": uint64(10),
"BELLATRIX_FORK_EPOCH": uint64(20),
"CAPELLA_FORK_EPOCH": uint64(30),
"DENEB_FORK_EPOCH": uint64(40),
"ELECTRA_FORK_EPOCH": uint64(60),
},
expectedErr: "new ELECTRA fork epoch (60) doesn't match current value (50)",
},
Expand Down
Loading
Loading