From e356e9e1b783c0e991114f024eff165d01f8c8e6 Mon Sep 17 00:00:00 2001 From: Jim McDonald Date: Tue, 31 Oct 2023 13:17:44 +0000 Subject: [PATCH] Update dependencies. --- CHANGELOG.md | 3 + beacon/chaininfo.go | 27 ++-- cmd/account/derive/output.go | 3 +- cmd/attester/duties/process.go | 11 +- cmd/attester/inclusion/output.go | 3 +- cmd/attester/inclusion/process.go | 42 +++-- cmd/block/analyze/output.go | 15 +- cmd/block/analyze/process.go | 94 ++++++++--- cmd/block/info/output.go | 39 +++-- cmd/block/info/process.go | 78 +++++---- cmd/chain/eth1votes/process.go | 12 +- cmd/chain/queues/process.go | 7 +- cmd/chain/time/output.go | 15 +- .../signedcontributionandproof/process.go | 31 ++-- cmd/chaininfo.go | 27 ++-- cmd/chainspec.go | 25 +-- cmd/chainstatus.go | 13 +- cmd/epoch/summary/process.go | 33 ++-- cmd/exitverify.go | 10 +- cmd/nodeinfo.go | 8 +- cmd/proposer/duties/process.go | 12 +- cmd/slot/time/process.go | 7 +- cmd/synccommittee/inclusion/output.go | 9 +- cmd/synccommittee/inclusion/process.go | 12 +- cmd/synccommittee/members/process.go | 7 +- cmd/validator/credentials/get/output.go | 3 +- cmd/validator/credentials/set/process.go | 2 +- cmd/validator/depositdata/process.go | 2 +- cmd/validator/duties/process.go | 44 ++--- cmd/validator/expectation/command.go | 8 +- cmd/validator/expectation/process.go | 21 +-- cmd/validator/summary/process.go | 30 ++-- cmd/validator/withdrawal/process.go | 20 ++- cmd/validator/yield/process.go | 11 +- cmd/version.go | 2 +- cmd/wallet/sharedexport/output.go | 4 +- go.mod | 69 ++++---- go.sum | 151 ++++++++++-------- services/chaintime/standard/parameters.go | 2 +- services/chaintime/standard/service.go | 24 +-- testing/mock/eth2client.go | 23 ++- util/beaconheadercache.go | 7 +- util/networks.go | 11 +- util/networks_test.go | 10 +- util/validator.go | 8 +- util/validators.go | 20 ++- 46 files changed, 614 insertions(+), 401 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b538aa6..ae9b02e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +1.34.0: + - update dependencies + 1.33.2: - fix windows build diff --git a/beacon/chaininfo.go b/beacon/chaininfo.go index 7f96179..af544f4 100644 --- a/beacon/chaininfo.go +++ b/beacon/chaininfo.go @@ -22,6 +22,7 @@ import ( "strings" consensusclient "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" "github.com/wealdtech/ethdo/services/chaintime" @@ -57,7 +58,7 @@ type chainInfoVersionJSON struct { // MarshalJSON implements json.Marshaler. func (c *ChainInfo) MarshalJSON() ([]byte, error) { return json.Marshal(&chainInfoJSON{ - Version: fmt.Sprintf("%d", c.Version), + Version: strconv.FormatUint(c.Version, 10), Validators: c.Validators, GenesisValidatorsRoot: fmt.Sprintf("%#x", c.GenesisValidatorsRoot), Epoch: fmt.Sprintf("%d", c.Epoch), @@ -241,12 +242,12 @@ func ObtainChainInfoFromNode(ctx context.Context, } // Obtain validators. - validators, err := consensusClient.(consensusclient.ValidatorsProvider).Validators(ctx, "head", nil) + validatorsResponse, err := consensusClient.(consensusclient.ValidatorsProvider).Validators(ctx, &api.ValidatorsOpts{State: "head"}) if err != nil { return nil, errors.Wrap(err, "failed to obtain validators") } - for _, validator := range validators { + for _, validator := range validatorsResponse.Data { res.Validators = append(res.Validators, &ValidatorInfo{ Index: validator.Index, Pubkey: validator.Validator.PublicKey, @@ -256,18 +257,18 @@ func ObtainChainInfoFromNode(ctx context.Context, } // Genesis validators root obtained from beacon node. - genesis, err := consensusClient.(consensusclient.GenesisProvider).Genesis(ctx) + genesisResponse, err := consensusClient.(consensusclient.GenesisProvider).Genesis(ctx) if err != nil { return nil, errors.Wrap(err, "failed to obtain genesis information") } - res.GenesisValidatorsRoot = genesis.GenesisValidatorsRoot + res.GenesisValidatorsRoot = genesisResponse.Data.GenesisValidatorsRoot // Fetch the genesis fork version from the specification. - spec, err := consensusClient.(consensusclient.SpecProvider).Spec(ctx) + specResponse, err := consensusClient.(consensusclient.SpecProvider).Spec(ctx) if err != nil { return nil, errors.Wrap(err, "failed to obtain spec") } - tmp, exists := spec["GENESIS_FORK_VERSION"] + tmp, exists := specResponse.Data["GENESIS_FORK_VERSION"] if !exists { return nil, errors.New("genesis fork version not known by chain") } @@ -278,23 +279,23 @@ func ObtainChainInfoFromNode(ctx context.Context, } // Fetch the current fork version from the fork schedule. - forkSchedule, err := consensusClient.(consensusclient.ForkScheduleProvider).ForkSchedule(ctx) + forkScheduleResponse, err := consensusClient.(consensusclient.ForkScheduleProvider).ForkSchedule(ctx) if err != nil { return nil, errors.Wrap(err, "failed to obtain fork schedule") } - for i := range forkSchedule { - if forkSchedule[i].Epoch <= res.Epoch { - res.CurrentForkVersion = forkSchedule[i].CurrentVersion + for i := range forkScheduleResponse.Data { + if forkScheduleResponse.Data[i].Epoch <= res.Epoch { + res.CurrentForkVersion = forkScheduleResponse.Data[i].CurrentVersion } } - blsToExecutionChangeDomainType, exists := spec["DOMAIN_BLS_TO_EXECUTION_CHANGE"].(phase0.DomainType) + blsToExecutionChangeDomainType, exists := specResponse.Data["DOMAIN_BLS_TO_EXECUTION_CHANGE"].(phase0.DomainType) if !exists { return nil, errors.New("failed to obtain DOMAIN_BLS_TO_EXECUTION_CHANGE") } copy(res.BLSToExecutionChangeDomainType[:], blsToExecutionChangeDomainType[:]) - voluntaryExitDomainType, exists := spec["DOMAIN_VOLUNTARY_EXIT"].(phase0.DomainType) + voluntaryExitDomainType, exists := specResponse.Data["DOMAIN_VOLUNTARY_EXIT"].(phase0.DomainType) if !exists { return nil, errors.New("failed to obtain DOMAIN_VOLUNTARY_EXIT") } diff --git a/cmd/account/derive/output.go b/cmd/account/derive/output.go index b6ecf84..3a835d8 100644 --- a/cmd/account/derive/output.go +++ b/cmd/account/derive/output.go @@ -15,6 +15,7 @@ package accountderive import ( "context" + "encoding/hex" "encoding/json" "fmt" "os" @@ -84,7 +85,7 @@ func outputKeystore(_ context.Context, data *dataOut) (string, error) { } ks := make(map[string]interface{}) ks["uuid"] = uuid.String() - ks["pubkey"] = fmt.Sprintf("%x", data.key.PublicKey().Marshal()) + ks["pubkey"] = hex.EncodeToString(data.key.PublicKey().Marshal()) ks["version"] = 4 ks["path"] = data.path ks["crypto"] = crypto diff --git a/cmd/attester/duties/process.go b/cmd/attester/duties/process.go index 1549cf0..6919e45 100644 --- a/cmd/attester/duties/process.go +++ b/cmd/attester/duties/process.go @@ -17,7 +17,8 @@ import ( "context" eth2client "github.com/attestantio/go-eth2-client" - api "github.com/attestantio/go-eth2-client/api/v1" + "github.com/attestantio/go-eth2-client/api" + apiv1 "github.com/attestantio/go-eth2-client/api/v1" spec "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" "github.com/wealdtech/ethdo/util" @@ -49,12 +50,16 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) { return results, nil } -func duty(ctx context.Context, eth2Client eth2client.Service, validator *api.Validator, epoch spec.Epoch) (*api.AttesterDuty, error) { +func duty(ctx context.Context, eth2Client eth2client.Service, validator *apiv1.Validator, epoch spec.Epoch) (*apiv1.AttesterDuty, error) { // Find the attesting slot for the given epoch. - duties, err := eth2Client.(eth2client.AttesterDutiesProvider).AttesterDuties(ctx, epoch, []spec.ValidatorIndex{validator.Index}) + dutiesResponse, err := eth2Client.(eth2client.AttesterDutiesProvider).AttesterDuties(ctx, &api.AttesterDutiesOpts{ + Epoch: epoch, + Indices: []spec.ValidatorIndex{validator.Index}, + }) if err != nil { return nil, errors.Wrap(err, "failed to obtain attester duties") } + duties := dutiesResponse.Data if len(duties) == 0 { return nil, errors.New("validator does not have duty for that epoch") diff --git a/cmd/attester/inclusion/output.go b/cmd/attester/inclusion/output.go index 64c7380..c81aa76 100644 --- a/cmd/attester/inclusion/output.go +++ b/cmd/attester/inclusion/output.go @@ -16,6 +16,7 @@ package attesterinclusion import ( "context" "fmt" + "strconv" "strings" "github.com/attestantio/go-eth2-client/spec/phase0" @@ -49,7 +50,7 @@ func output(_ context.Context, data *dataOut) (string, error) { buf.WriteString("Attestation included in block ") buf.WriteString(fmt.Sprintf("%d", data.slot)) buf.WriteString(", index ") - buf.WriteString(fmt.Sprintf("%d", data.attestationIndex)) + buf.WriteString(strconv.FormatUint(data.attestationIndex, 10)) if data.verbose { buf.WriteString("\nInclusion delay: ") buf.WriteString(fmt.Sprintf("%d", data.inclusionDelay)) diff --git a/cmd/attester/inclusion/process.go b/cmd/attester/inclusion/process.go index 3ddc0de..308fcfa 100644 --- a/cmd/attester/inclusion/process.go +++ b/cmd/attester/inclusion/process.go @@ -19,7 +19,8 @@ import ( "fmt" eth2client "github.com/attestantio/go-eth2-client" - api "github.com/attestantio/go-eth2-client/api/v1" + "github.com/attestantio/go-eth2-client/api" + apiv1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" standardchaintime "github.com/wealdtech/ethdo/services/chaintime/standard" @@ -61,14 +62,17 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) { startSlot := duty.Slot + 1 endSlot := startSlot + 32 for slot := startSlot; slot < endSlot; slot++ { - signedBlock, err := data.eth2Client.(eth2client.SignedBeaconBlockProvider).SignedBeaconBlock(ctx, fmt.Sprintf("%d", slot)) + blockResponse, err := data.eth2Client.(eth2client.SignedBeaconBlockProvider).SignedBeaconBlock(ctx, &api.SignedBeaconBlockOpts{ + Block: fmt.Sprintf("%d", slot), + }) if err != nil { return nil, errors.Wrap(err, "failed to obtain block") } - if signedBlock == nil { + block := blockResponse.Data + if block == nil { continue } - blockSlot, err := signedBlock.Slot() + blockSlot, err := block.Slot() if err != nil { return nil, errors.Wrap(err, "failed to obtain block slot") } @@ -78,7 +82,7 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) { if data.debug { fmt.Printf("Fetched block for slot %d\n", slot) } - attestations, err := signedBlock.Attestations() + attestations, err := block.Attestations() if err != nil { return nil, errors.Wrap(err, "failed to obtain block attestations") } @@ -121,21 +125,23 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) { func calcHeadCorrect(ctx context.Context, data *dataIn, attestation *phase0.Attestation) (bool, error) { slot := attestation.Data.Slot for { - header, err := data.eth2Client.(eth2client.BeaconBlockHeadersProvider).BeaconBlockHeader(ctx, fmt.Sprintf("%d", slot)) + response, err := data.eth2Client.(eth2client.BeaconBlockHeadersProvider).BeaconBlockHeader(ctx, &api.BeaconBlockHeaderOpts{ + Block: fmt.Sprintf("%d", slot), + }) if err != nil { return false, err } - if header == nil { + if response.Data == nil { // No block. slot-- continue } - if !header.Canonical { + if !response.Data.Canonical { // Not canonical. slot-- continue } - return bytes.Equal(header.Root[:], attestation.Data.BeaconBlockRoot[:]), nil + return bytes.Equal(response.Data.Root[:], attestation.Data.BeaconBlockRoot[:]), nil } } @@ -143,30 +149,36 @@ func calcTargetCorrect(ctx context.Context, data *dataIn, attestation *phase0.At // Start with first slot of the target epoch. slot := data.chainTime.FirstSlotOfEpoch(attestation.Data.Target.Epoch) for { - header, err := data.eth2Client.(eth2client.BeaconBlockHeadersProvider).BeaconBlockHeader(ctx, fmt.Sprintf("%d", slot)) + response, err := data.eth2Client.(eth2client.BeaconBlockHeadersProvider).BeaconBlockHeader(ctx, &api.BeaconBlockHeaderOpts{ + Block: fmt.Sprintf("%d", slot), + }) if err != nil { return false, err } - if header == nil { + if response.Data == nil { // No block. slot-- continue } - if !header.Canonical { + if !response.Data.Canonical { // Not canonical. slot-- continue } - return bytes.Equal(header.Root[:], attestation.Data.Target.Root[:]), nil + return bytes.Equal(response.Data.Root[:], attestation.Data.Target.Root[:]), nil } } -func duty(ctx context.Context, eth2Client eth2client.Service, validator *api.Validator, epoch phase0.Epoch) (*api.AttesterDuty, error) { +func duty(ctx context.Context, eth2Client eth2client.Service, validator *apiv1.Validator, epoch phase0.Epoch) (*apiv1.AttesterDuty, error) { // Find the attesting slot for the given epoch. - duties, err := eth2Client.(eth2client.AttesterDutiesProvider).AttesterDuties(ctx, epoch, []phase0.ValidatorIndex{validator.Index}) + dutiesResponse, err := eth2Client.(eth2client.AttesterDutiesProvider).AttesterDuties(ctx, &api.AttesterDutiesOpts{ + Epoch: epoch, + Indices: []phase0.ValidatorIndex{validator.Index}, + }) if err != nil { return nil, errors.Wrap(err, "failed to obtain attester duties") } + duties := dutiesResponse.Data if len(duties) == 0 { return nil, errors.New("validator does not have duty for that epoch") diff --git a/cmd/block/analyze/output.go b/cmd/block/analyze/output.go index 048016c..96e06c2 100644 --- a/cmd/block/analyze/output.go +++ b/cmd/block/analyze/output.go @@ -17,6 +17,7 @@ import ( "context" "encoding/json" "fmt" + "strconv" "strings" ) @@ -82,26 +83,26 @@ func (c *command) outputTxt(_ context.Context) (string, error) { for i, attestation := range c.analysis.Attestations { if c.verbose { builder.WriteString("Attestation ") - builder.WriteString(fmt.Sprintf("%d", i)) + builder.WriteString(strconv.Itoa(i)) builder.WriteString(": ") builder.WriteString("distance ") - builder.WriteString(fmt.Sprintf("%d", attestation.Distance)) + builder.WriteString(strconv.Itoa(attestation.Distance)) builder.WriteString(", ") if attestation.Duplicate != nil { builder.WriteString("duplicate of attestation ") - builder.WriteString(fmt.Sprintf("%d", attestation.Duplicate.Index)) + builder.WriteString(strconv.Itoa(attestation.Duplicate.Index)) builder.WriteString(" in block ") builder.WriteString(fmt.Sprintf("%d", attestation.Duplicate.Block)) builder.WriteString("\n") continue } - builder.WriteString(fmt.Sprintf("%d", attestation.NewVotes)) + builder.WriteString(strconv.Itoa(attestation.NewVotes)) builder.WriteString("/") - builder.WriteString(fmt.Sprintf("%d", attestation.Votes)) + builder.WriteString(strconv.Itoa(attestation.Votes)) builder.WriteString("/") - builder.WriteString(fmt.Sprintf("%d", attestation.PossibleVotes)) + builder.WriteString(strconv.Itoa(attestation.PossibleVotes)) builder.WriteString(" new/total/possible votes") if attestation.NewVotes == 0 { builder.WriteString("\n") @@ -137,7 +138,7 @@ func (c *command) outputTxt(_ context.Context) (string, error) { if c.analysis.SyncCommitee.Contributions > 0 { if c.verbose { builder.WriteString("Sync committee contributions: ") - builder.WriteString(fmt.Sprintf("%d", c.analysis.SyncCommitee.Contributions)) + builder.WriteString(strconv.Itoa(c.analysis.SyncCommitee.Contributions)) builder.WriteString(" contributions, score ") builder.WriteString(fmt.Sprintf("%0.3f", c.analysis.SyncCommitee.Score)) builder.WriteString(", value ") diff --git a/cmd/block/analyze/process.go b/cmd/block/analyze/process.go index 00af8a0..41a4d21 100644 --- a/cmd/block/analyze/process.go +++ b/cmd/block/analyze/process.go @@ -19,6 +19,7 @@ import ( "fmt" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" "github.com/attestantio/go-eth2-client/spec" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" @@ -33,13 +34,17 @@ func (c *command) process(ctx context.Context) error { return err } - block, err := c.blocksProvider.SignedBeaconBlock(ctx, c.blockID) + blockResponse, err := c.blocksProvider.SignedBeaconBlock(ctx, &api.SignedBeaconBlockOpts{ + Block: c.blockID, + }) if err != nil { + var apiError *api.Error + if errors.As(err, &apiError) && apiError.StatusCode == 404 { + return errors.New("empty beacon block") + } return errors.Wrap(err, "failed to obtain beacon block") } - if block == nil { - return errors.New("empty beacon block") - } + block := blockResponse.Data slot, err := block.Slot() if err != nil { @@ -145,7 +150,7 @@ func (c *command) analyzeAttestations(ctx context.Context, block *spec.Versioned } // Calculate head timely. - analysis.HeadTimely = attestation.Data.Slot == slot-1 + analysis.HeadTimely = analysis.HeadCorrect && attestation.Data.Slot == slot-1 // Calculate source timely. analysis.SourceTimely = attestation.Data.Slot >= slot-5 @@ -157,7 +162,11 @@ func (c *command) analyzeAttestations(ctx context.Context, block *spec.Versioned } // Calculate target timely. - analysis.TargetTimely = attestation.Data.Slot >= slot-32 + if block.Version < spec.DataVersionDeneb { + analysis.TargetTimely = attestation.Data.Slot >= slot-32 + } else { + analysis.TargetTimely = true + } } // Calculate score and value. @@ -184,12 +193,30 @@ func (c *command) fetchParents(ctx context.Context, block *spec.VersionedSignedB if err != nil { return err } + root, err := block.Deneb.HashTreeRoot() + if err != nil { + panic(err) + } + slot, err := block.Slot() + if err != nil { + panic(err) + } + if c.debug { + fmt.Printf("Parent root of %#x@%d is %#x\n", root, slot, parentRoot) + } // Obtain the parent block. - parentBlock, err := c.blocksProvider.SignedBeaconBlock(ctx, fmt.Sprintf("%#x", parentRoot)) + parentBlockResponse, err := c.blocksProvider.SignedBeaconBlock(ctx, &api.SignedBeaconBlockOpts{ + Block: fmt.Sprintf("%#x", parentRoot), + }) if err != nil { + var apiError *api.Error + if errors.As(err, &apiError) && apiError.StatusCode == 404 { + return errors.New("empty beacon block") + } return err } + parentBlock := parentBlockResponse.Data if parentBlock == nil { return fmt.Errorf("unable to obtain parent block %s", parentBlock) } @@ -289,12 +316,12 @@ func (c *command) setup(ctx context.Context) error { return errors.New("connection does not provide spec information") } - spec, err := specProvider.Spec(ctx) + specResponse, err := specProvider.Spec(ctx) if err != nil { return errors.Wrap(err, "failed to obtain spec") } - tmp, exists := spec["TIMELY_SOURCE_WEIGHT"] + tmp, exists := specResponse.Data["TIMELY_SOURCE_WEIGHT"] if !exists { // Set a default value based on the Altair spec. tmp = uint64(14) @@ -305,7 +332,7 @@ func (c *command) setup(ctx context.Context) error { return errors.New("TIMELY_SOURCE_WEIGHT of unexpected type") } - tmp, exists = spec["TIMELY_TARGET_WEIGHT"] + tmp, exists = specResponse.Data["TIMELY_TARGET_WEIGHT"] if !exists { // Set a default value based on the Altair spec. tmp = uint64(26) @@ -315,7 +342,7 @@ func (c *command) setup(ctx context.Context) error { return errors.New("TIMELY_TARGET_WEIGHT of unexpected type") } - tmp, exists = spec["TIMELY_HEAD_WEIGHT"] + tmp, exists = specResponse.Data["TIMELY_HEAD_WEIGHT"] if !exists { // Set a default value based on the Altair spec. tmp = uint64(14) @@ -325,7 +352,7 @@ func (c *command) setup(ctx context.Context) error { return errors.New("TIMELY_HEAD_WEIGHT of unexpected type") } - tmp, exists = spec["SYNC_REWARD_WEIGHT"] + tmp, exists = specResponse.Data["SYNC_REWARD_WEIGHT"] if !exists { // Set a default value based on the Altair spec. tmp = uint64(2) @@ -335,7 +362,7 @@ func (c *command) setup(ctx context.Context) error { return errors.New("SYNC_REWARD_WEIGHT of unexpected type") } - tmp, exists = spec["PROPOSER_WEIGHT"] + tmp, exists = specResponse.Data["PROPOSER_WEIGHT"] if !exists { // Set a default value based on the Altair spec. tmp = uint64(8) @@ -345,7 +372,7 @@ func (c *command) setup(ctx context.Context) error { return errors.New("PROPOSER_WEIGHT of unexpected type") } - tmp, exists = spec["WEIGHT_DENOMINATOR"] + tmp, exists = specResponse.Data["WEIGHT_DENOMINATOR"] if !exists { // Set a default value based on the Altair spec. tmp = uint64(64) @@ -362,22 +389,31 @@ func (c *command) calcHeadCorrect(ctx context.Context, attestation *phase0.Attes root, exists := c.headRoots[slot] if !exists { for { - header, err := c.blockHeadersProvider.BeaconBlockHeader(ctx, fmt.Sprintf("%d", slot)) + response, err := c.blockHeadersProvider.BeaconBlockHeader(ctx, &api.BeaconBlockHeaderOpts{ + Block: fmt.Sprintf("%d", slot), + }) if err != nil { + var apiError *api.Error + if errors.As(err, &apiError) && apiError.StatusCode == 404 { + if c.debug { + fmt.Printf("No block available for slot %d, assuming not in canonical chain", slot) + } + return false, nil + } return false, err } - if header == nil { + if response.Data == nil { // No block. slot-- continue } - if !header.Canonical { + if !response.Data.Canonical { // Not canonical. slot-- continue } - c.headRoots[attestation.Data.Slot] = header.Root - root = header.Root + c.headRoots[attestation.Data.Slot] = response.Data.Root + root = response.Data.Root break } } @@ -391,22 +427,30 @@ func (c *command) calcTargetCorrect(ctx context.Context, attestation *phase0.Att // Start with first slot of the target epoch. slot := c.chainTime.FirstSlotOfEpoch(attestation.Data.Target.Epoch) for { - header, err := c.blockHeadersProvider.BeaconBlockHeader(ctx, fmt.Sprintf("%d", slot)) + response, err := c.blockHeadersProvider.BeaconBlockHeader(ctx, &api.BeaconBlockHeaderOpts{ + Block: fmt.Sprintf("%d", slot), + }) if err != nil { - return false, err + var apiError *api.Error + if errors.As(err, &apiError) && apiError.StatusCode == 404 { + if c.debug { + fmt.Printf("No block available for slot %d, assuming not in canonical chain", slot) + } + return false, nil + } } - if header == nil { + if response.Data == nil { // No block. slot-- continue } - if !header.Canonical { + if !response.Data.Canonical { // Not canonical. slot-- continue } - c.targetRoots[attestation.Data.Slot] = header.Root - root = header.Root + c.targetRoots[attestation.Data.Slot] = response.Data.Root + root = response.Data.Root break } } diff --git a/cmd/block/info/output.go b/cmd/block/info/output.go index 3592b9e..3f95be9 100644 --- a/cmd/block/info/output.go +++ b/cmd/block/info/output.go @@ -20,11 +20,13 @@ import ( "fmt" "math/big" "sort" + "strconv" "strings" "time" "unicode/utf8" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" "github.com/attestantio/go-eth2-client/spec/altair" "github.com/attestantio/go-eth2-client/spec/bellatrix" "github.com/attestantio/go-eth2-client/spec/capella" @@ -116,12 +118,14 @@ func outputBlockAttestations(ctx context.Context, eth2Client eth2client.Service, // Fetch committees for this epoch if not already obtained. committees, exists := validatorCommittees[att.Data.Slot] if !exists { - beaconCommittees, err := beaconCommitteesProvider.BeaconCommittees(ctx, fmt.Sprintf("%d", att.Data.Slot)) + response, err := beaconCommitteesProvider.BeaconCommittees(ctx, &api.BeaconCommitteesOpts{ + State: fmt.Sprintf("%d", att.Data.Slot), + }) if err != nil { // Failed to get it; create an empty committee to stop us continually attempting to re-fetch. validatorCommittees[att.Data.Slot] = make(map[phase0.CommitteeIndex][]phase0.ValidatorIndex) } else { - for _, beaconCommittee := range beaconCommittees { + for _, beaconCommittee := range response.Data { if _, exists := validatorCommittees[beaconCommittee.Slot]; !exists { validatorCommittees[beaconCommittee.Slot] = make(map[phase0.CommitteeIndex][]phase0.ValidatorIndex) } @@ -166,11 +170,14 @@ func outputBlockAttesterSlashings(ctx context.Context, eth2Client eth2client.Ser res.WriteString(fmt.Sprintf(" %d:\n", i)) res.WriteString(fmt.Sprintln(" Slashed validators:")) - validators, err := eth2Client.(eth2client.ValidatorsProvider).Validators(ctx, "head", slashedIndices) + response, err := eth2Client.(eth2client.ValidatorsProvider).Validators(ctx, &api.ValidatorsOpts{ + State: "head", + Indices: slashedIndices, + }) if err != nil { return "", errors.Wrap(err, "failed to obtain beacon committees") } - for k, v := range validators { + for k, v := range response.Data { res.WriteString(fmt.Sprintf(" %#x (%d)\n", v.Validator.PublicKey[:], k)) } @@ -223,11 +230,14 @@ func outputBlockVoluntaryExits(ctx context.Context, eth2Client eth2client.Servic if verbose { for i, voluntaryExit := range voluntaryExits { res.WriteString(fmt.Sprintf(" %d:\n", i)) - validators, err := eth2Client.(eth2client.ValidatorsProvider).Validators(ctx, "head", []phase0.ValidatorIndex{voluntaryExit.Message.ValidatorIndex}) + response, err := eth2Client.(eth2client.ValidatorsProvider).Validators(ctx, &api.ValidatorsOpts{ + State: "head", + Indices: []phase0.ValidatorIndex{voluntaryExit.Message.ValidatorIndex}, + }) if err != nil { res.WriteString(fmt.Sprintf(" Error: failed to obtain validators: %v\n", err)) } else { - res.WriteString(fmt.Sprintf(" Validator: %#x (%d)\n", validators[voluntaryExit.Message.ValidatorIndex].Validator.PublicKey, voluntaryExit.Message.ValidatorIndex)) + res.WriteString(fmt.Sprintf(" Validator: %#x (%d)\n", response.Data[voluntaryExit.Message.ValidatorIndex].Validator.PublicKey, voluntaryExit.Message.ValidatorIndex)) res.WriteString(fmt.Sprintf(" Epoch: %d\n", voluntaryExit.Message.Epoch)) } } @@ -243,11 +253,14 @@ func outputBlockBLSToExecutionChanges(ctx context.Context, eth2Client eth2client if verbose { for i, op := range ops { res.WriteString(fmt.Sprintf(" %d:\n", i)) - validators, err := eth2Client.(eth2client.ValidatorsProvider).Validators(ctx, "head", []phase0.ValidatorIndex{op.Message.ValidatorIndex}) + response, err := eth2Client.(eth2client.ValidatorsProvider).Validators(ctx, &api.ValidatorsOpts{ + State: "head", + Indices: []phase0.ValidatorIndex{op.Message.ValidatorIndex}, + }) if err != nil { res.WriteString(fmt.Sprintf(" Error: failed to obtain validators: %v\n", err)) } else { - res.WriteString(fmt.Sprintf(" Validator: %#x (%d)\n", validators[op.Message.ValidatorIndex].Validator.PublicKey, op.Message.ValidatorIndex)) + res.WriteString(fmt.Sprintf(" Validator: %#x (%d)\n", response.Data[op.Message.ValidatorIndex].Validator.PublicKey, op.Message.ValidatorIndex)) res.WriteString(fmt.Sprintf(" BLS public key: %#x\n", op.Message.FromBLSPubkey)) res.WriteString(fmt.Sprintf(" Execution address: %s\n", op.Message.ToExecutionAddress.String())) } @@ -265,9 +278,9 @@ func outputBlockSyncAggregate(ctx context.Context, eth2Client eth2client.Service if verbose { specProvider, isProvider := eth2Client.(eth2client.SpecProvider) if isProvider { - config, err := specProvider.Spec(ctx) + specResponse, err := specProvider.Spec(ctx) if err == nil { - slotsPerEpoch := config["SLOTS_PER_EPOCH"].(uint64) + slotsPerEpoch := specResponse.Data["SLOTS_PER_EPOCH"].(uint64) res.WriteString(" Contributions: ") res.WriteString(bitvectorToString(syncAggregate.SyncCommitteeBits)) @@ -275,14 +288,16 @@ func outputBlockSyncAggregate(ctx context.Context, eth2Client eth2client.Service syncCommitteesProvider, isProvider := eth2Client.(eth2client.SyncCommitteesProvider) if isProvider { - syncCommittee, err := syncCommitteesProvider.SyncCommittee(ctx, fmt.Sprintf("%d", uint64(epoch)*slotsPerEpoch)) + syncCommitteeResponse, err := syncCommitteesProvider.SyncCommittee(ctx, &api.SyncCommitteeOpts{ + State: strconv.FormatUint(uint64(epoch)*slotsPerEpoch, 10), + }) if err != nil { res.WriteString(fmt.Sprintf(" Error: failed to obtain sync committee: %v\n", err)) } else { res.WriteString(" Contributing validators:") for i := uint64(0); i < syncAggregate.SyncCommitteeBits.Len(); i++ { if syncAggregate.SyncCommitteeBits.BitAt(i) { - res.WriteString(fmt.Sprintf(" %d", syncCommittee.Validators[i])) + res.WriteString(fmt.Sprintf(" %d", syncCommitteeResponse.Data.Validators[i])) } } res.WriteString("\n") diff --git a/cmd/block/info/process.go b/cmd/block/info/process.go index 92c57e2..989ab2b 100644 --- a/cmd/block/info/process.go +++ b/cmd/block/info/process.go @@ -23,7 +23,8 @@ import ( "time" eth2client "github.com/attestantio/go-eth2-client" - api "github.com/attestantio/go-eth2-client/api/v1" + "github.com/attestantio/go-eth2-client/api" + apiv1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec" "github.com/attestantio/go-eth2-client/spec/altair" "github.com/attestantio/go-eth2-client/spec/bellatrix" @@ -54,17 +55,18 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) { eth2Client: data.eth2Client, } - config, err := results.eth2Client.(eth2client.SpecProvider).Spec(ctx) + specResponse, err := results.eth2Client.(eth2client.SpecProvider).Spec(ctx) if err != nil { return nil, errors.Wrap(err, "failed to connect to obtain configuration information") } - genesis, err := results.eth2Client.(eth2client.GenesisProvider).Genesis(ctx) + genesisResponse, err := results.eth2Client.(eth2client.GenesisProvider).Genesis(ctx) if err != nil { return nil, errors.Wrap(err, "failed to connect to obtain genesis information") } + genesis := genesisResponse.Data results.genesisTime = genesis.GenesisTime - results.slotDuration = config["SECONDS_PER_SLOT"].(time.Duration) - results.slotsPerEpoch = config["SLOTS_PER_EPOCH"].(uint64) + results.slotDuration = specResponse.Data["SECONDS_PER_SLOT"].(time.Duration) + results.slotsPerEpoch = specResponse.Data["SLOTS_PER_EPOCH"].(uint64) if data.blockTime != "" { data.blockID, err = timeToBlockID(ctx, data.eth2Client, data.blockTime) @@ -73,43 +75,50 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) { } } - signedBlock, err := results.eth2Client.(eth2client.SignedBeaconBlockProvider).SignedBeaconBlock(ctx, data.blockID) + blockResponse, err := results.eth2Client.(eth2client.SignedBeaconBlockProvider).SignedBeaconBlock(ctx, &api.SignedBeaconBlockOpts{ + Block: data.blockID, + }) if err != nil { + var apiErr *api.Error + if errors.As(err, &apiErr) && apiErr.StatusCode == 404 { + if data.quiet { + os.Exit(1) + } + return nil, errors.New("empty beacon block") + } return nil, errors.Wrap(err, "failed to obtain beacon block") } - if signedBlock == nil { - if data.quiet { - os.Exit(1) - } - return nil, errors.New("empty beacon block") - } + block := blockResponse.Data if data.quiet { os.Exit(0) } - switch signedBlock.Version { + switch block.Version { case spec.DataVersionPhase0: - if err := outputPhase0Block(ctx, data.jsonOutput, signedBlock.Phase0); err != nil { + if err := outputPhase0Block(ctx, data.jsonOutput, block.Phase0); err != nil { return nil, errors.Wrap(err, "failed to output block") } case spec.DataVersionAltair: - if err := outputAltairBlock(ctx, data.jsonOutput, data.sszOutput, signedBlock.Altair); err != nil { + if err := outputAltairBlock(ctx, data.jsonOutput, data.sszOutput, block.Altair); err != nil { return nil, errors.Wrap(err, "failed to output block") } case spec.DataVersionBellatrix: - if err := outputBellatrixBlock(ctx, data.jsonOutput, data.sszOutput, signedBlock.Bellatrix); err != nil { + if err := outputBellatrixBlock(ctx, data.jsonOutput, data.sszOutput, block.Bellatrix); err != nil { return nil, errors.Wrap(err, "failed to output block") } case spec.DataVersionCapella: - if err := outputCapellaBlock(ctx, data.jsonOutput, data.sszOutput, signedBlock.Capella); err != nil { + if err := outputCapellaBlock(ctx, data.jsonOutput, data.sszOutput, block.Capella); err != nil { return nil, errors.Wrap(err, "failed to output block") } case spec.DataVersionDeneb: - blobs, err := results.eth2Client.(eth2client.BeaconBlockBlobsProvider).BeaconBlockBlobs(ctx, data.blockID) + blobSidecarsResponse, err := results.eth2Client.(eth2client.BlobSidecarsProvider).BlobSidecars(ctx, &api.BlobSidecarsOpts{ + Block: data.blockID, + }) if err != nil { - return nil, errors.Wrap(err, "failed to obtain blobs") + return nil, errors.Wrap(err, "failed to obtain blob sidecars") } - if err := outputDenebBlock(ctx, data.jsonOutput, data.sszOutput, signedBlock.Deneb, blobs); err != nil { + blobSidecars := blobSidecarsResponse.Data + if err := outputDenebBlock(ctx, data.jsonOutput, data.sszOutput, block.Deneb, blobSidecars); err != nil { return nil, errors.Wrap(err, "failed to output block") } default: @@ -132,7 +141,7 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) { return &dataOut{}, nil } -func headEventHandler(event *api.Event) { +func headEventHandler(event *apiv1.Event) { ctx := context.Background() // Only interested in head events. @@ -140,35 +149,40 @@ func headEventHandler(event *api.Event) { return } - blockID := fmt.Sprintf("%#x", event.Data.(*api.HeadEvent).Block[:]) - signedBlock, err := results.eth2Client.(eth2client.SignedBeaconBlockProvider).SignedBeaconBlock(ctx, blockID) + blockID := fmt.Sprintf("%#x", event.Data.(*apiv1.HeadEvent).Block[:]) + blockResponse, err := results.eth2Client.(eth2client.SignedBeaconBlockProvider).SignedBeaconBlock(ctx, &api.SignedBeaconBlockOpts{ + Block: blockID, + }) if err != nil { if !jsonOutput && !sszOutput { fmt.Printf("Failed to obtain block: %v\n", err) } return } - if signedBlock == nil { + block := blockResponse.Data + if block == nil { if !jsonOutput && !sszOutput { fmt.Println("Empty beacon block") } return } - switch signedBlock.Version { + switch block.Version { case spec.DataVersionPhase0: - err = outputPhase0Block(ctx, jsonOutput, signedBlock.Phase0) + err = outputPhase0Block(ctx, jsonOutput, block.Phase0) case spec.DataVersionAltair: - err = outputAltairBlock(ctx, jsonOutput, sszOutput, signedBlock.Altair) + err = outputAltairBlock(ctx, jsonOutput, sszOutput, block.Altair) case spec.DataVersionBellatrix: - err = outputBellatrixBlock(ctx, jsonOutput, sszOutput, signedBlock.Bellatrix) + err = outputBellatrixBlock(ctx, jsonOutput, sszOutput, block.Bellatrix) case spec.DataVersionCapella: - err = outputCapellaBlock(ctx, jsonOutput, sszOutput, signedBlock.Capella) + err = outputCapellaBlock(ctx, jsonOutput, sszOutput, block.Capella) case spec.DataVersionDeneb: - var blobs []*deneb.BlobSidecar - blobs, err = results.eth2Client.(eth2client.BeaconBlockBlobsProvider).BeaconBlockBlobs(ctx, blockID) + var blobSidecarsResponse *api.Response[[]*deneb.BlobSidecar] + blobSidecarsResponse, err = results.eth2Client.(eth2client.BlobSidecarsProvider).BlobSidecars(ctx, &api.BlobSidecarsOpts{ + Block: blockID, + }) if err == nil { - err = outputDenebBlock(context.Background(), jsonOutput, sszOutput, signedBlock.Deneb, blobs) + err = outputDenebBlock(context.Background(), jsonOutput, sszOutput, block.Deneb, blobSidecarsResponse.Data) } default: err = errors.New("unknown block version") diff --git a/cmd/chain/eth1votes/process.go b/cmd/chain/eth1votes/process.go index 88882a4..9599931 100644 --- a/cmd/chain/eth1votes/process.go +++ b/cmd/chain/eth1votes/process.go @@ -20,6 +20,7 @@ import ( "strconv" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" "github.com/attestantio/go-eth2-client/spec" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" @@ -58,10 +59,13 @@ func (c *command) process(ctx context.Context) error { if fetchSlot > c.chainTime.CurrentSlot() { fetchSlot = c.chainTime.CurrentSlot() } - state, err := c.beaconStateProvider.BeaconState(ctx, fmt.Sprintf("%d", fetchSlot)) + stateResponse, err := c.beaconStateProvider.BeaconState(ctx, &api.BeaconStateOpts{ + State: fmt.Sprintf("%d", fetchSlot), + }) if err != nil { return errors.Wrap(err, "failed to obtain state") } + state := stateResponse.Data if state == nil { return errors.New("state not returned by beacon node") } @@ -146,12 +150,12 @@ func (c *command) setup(ctx context.Context) error { return errors.New("connection does not provide spec information") } - spec, err := specProvider.Spec(ctx) + specResponse, err := specProvider.Spec(ctx) if err != nil { return errors.Wrap(err, "failed to obtain spec") } - tmp, exists := spec["SLOTS_PER_EPOCH"] + tmp, exists := specResponse.Data["SLOTS_PER_EPOCH"] if !exists { return errors.New("spec did not contain SLOTS_PER_EPOCH") } @@ -160,7 +164,7 @@ func (c *command) setup(ctx context.Context) error { if !good { return errors.New("SLOTS_PER_EPOCH value invalid") } - tmp, exists = spec["EPOCHS_PER_ETH1_VOTING_PERIOD"] + tmp, exists = specResponse.Data["EPOCHS_PER_ETH1_VOTING_PERIOD"] if !exists { return errors.New("spec did not contain EPOCHS_PER_ETH1_VOTING_PERIOD") } diff --git a/cmd/chain/queues/process.go b/cmd/chain/queues/process.go index 30b22a3..4d2e2cd 100644 --- a/cmd/chain/queues/process.go +++ b/cmd/chain/queues/process.go @@ -18,6 +18,7 @@ import ( "fmt" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" "github.com/pkg/errors" standardchaintime "github.com/wealdtech/ethdo/services/chaintime/standard" "github.com/wealdtech/ethdo/util" @@ -34,12 +35,14 @@ func (c *command) process(ctx context.Context) error { return err } - validators, err := c.validatorsProvider.Validators(ctx, fmt.Sprintf("%d", c.chainTime.FirstSlotOfEpoch(epoch)), nil) + response, err := c.validatorsProvider.Validators(ctx, &api.ValidatorsOpts{ + State: fmt.Sprintf("%d", c.chainTime.FirstSlotOfEpoch(epoch)), + }) if err != nil { return errors.Wrap(err, "failed to obtain validators") } - for _, validator := range validators { + for _, validator := range response.Data { if validator.Validator == nil { continue } diff --git a/cmd/chain/time/output.go b/cmd/chain/time/output.go index 2753eb0..d850a40 100644 --- a/cmd/chain/time/output.go +++ b/cmd/chain/time/output.go @@ -16,6 +16,7 @@ package chaintime import ( "context" "fmt" + "strconv" "strings" "time" @@ -59,14 +60,14 @@ func output(_ context.Context, data *dataOut) (string, error) { builder.WriteString(data.epochStart.Format("2006-01-02 15:04:05")) if data.verbose { builder.WriteString(" (") - builder.WriteString(fmt.Sprintf("%d", data.epochStart.Unix())) + builder.WriteString(strconv.FormatInt(data.epochStart.Unix(), 10)) builder.WriteString(")") } builder.WriteString("\n Epoch end ") builder.WriteString(data.epochEnd.Format("2006-01-02 15:04:05")) if data.verbose { builder.WriteString(" (") - builder.WriteString(fmt.Sprintf("%d", data.epochEnd.Unix())) + builder.WriteString(strconv.FormatInt(data.epochEnd.Unix(), 10)) builder.WriteString(")") } @@ -76,27 +77,27 @@ func output(_ context.Context, data *dataOut) (string, error) { builder.WriteString(data.slotStart.Format("2006-01-02 15:04:05")) if data.verbose { builder.WriteString(" (") - builder.WriteString(fmt.Sprintf("%d", data.slotStart.Unix())) + builder.WriteString(strconv.FormatInt(data.slotStart.Unix(), 10)) builder.WriteString(")") } builder.WriteString("\n Slot end ") builder.WriteString(data.slotEnd.Format("2006-01-02 15:04:05")) if data.verbose { builder.WriteString(" (") - builder.WriteString(fmt.Sprintf("%d", data.slotEnd.Unix())) + builder.WriteString(strconv.FormatInt(data.slotEnd.Unix(), 10)) builder.WriteString(")") } if data.hasSyncCommittees { builder.WriteString("\nSync committee period ") - builder.WriteString(fmt.Sprintf("%d", data.syncCommitteePeriod)) + builder.WriteString(strconv.FormatUint(data.syncCommitteePeriod, 10)) builder.WriteString("\n Sync committee period start ") builder.WriteString(data.syncCommitteePeriodStart.Format("2006-01-02 15:04:05")) builder.WriteString(" (epoch ") builder.WriteString(fmt.Sprintf("%d", data.syncCommitteePeriodEpochStart)) if data.verbose { builder.WriteString(", ") - builder.WriteString(fmt.Sprintf("%d", data.syncCommitteePeriodStart.Unix())) + builder.WriteString(strconv.FormatInt(data.syncCommitteePeriodStart.Unix(), 10)) } builder.WriteString(")\n Sync committee period end ") builder.WriteString(data.syncCommitteePeriodEnd.Format("2006-01-02 15:04:05")) @@ -104,7 +105,7 @@ func output(_ context.Context, data *dataOut) (string, error) { builder.WriteString(fmt.Sprintf("%d", data.syncCommitteePeriodEpochEnd)) if data.verbose { builder.WriteString(", ") - builder.WriteString(fmt.Sprintf("%d", data.syncCommitteePeriodEnd.Unix())) + builder.WriteString(strconv.FormatInt(data.syncCommitteePeriodEnd.Unix(), 10)) } builder.WriteString(")") } diff --git a/cmd/chain/verify/signedcontributionandproof/process.go b/cmd/chain/verify/signedcontributionandproof/process.go index c6b9cae..e9ecd8f 100644 --- a/cmd/chain/verify/signedcontributionandproof/process.go +++ b/cmd/chain/verify/signedcontributionandproof/process.go @@ -22,6 +22,7 @@ import ( "os" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" "github.com/attestantio/go-eth2-client/spec/altair" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" @@ -103,29 +104,32 @@ func (c *command) setup(ctx context.Context) error { } stateID := fmt.Sprintf("%d", c.item.Message.Contribution.Slot) - validators, err := c.validatorsProvider.Validators(ctx, - stateID, - []phase0.ValidatorIndex{c.item.Message.AggregatorIndex}, - ) + response, err := c.validatorsProvider.Validators(ctx, &api.ValidatorsOpts{ + State: stateID, + Indices: []phase0.ValidatorIndex{c.item.Message.AggregatorIndex}, + }) if err != nil { return errors.Wrap(err, "failed to obtain validator information") } - if len(validators) == 0 || validators[c.item.Message.AggregatorIndex] == nil { + if len(response.Data) == 0 || response.Data[c.item.Message.AggregatorIndex] == nil { return nil } c.validatorKnown = true - c.validator = validators[c.item.Message.AggregatorIndex] + c.validator = response.Data[c.item.Message.AggregatorIndex] // Obtain the sync committee syncCommitteesProvider, isProvider := c.eth2Client.(eth2client.SyncCommitteesProvider) if !isProvider { return errors.New("connection does not provide sync committee information") } - c.syncCommittee, err = syncCommitteesProvider.SyncCommittee(ctx, stateID) + syncCommitteeResponse, err := syncCommitteesProvider.SyncCommittee(ctx, &api.SyncCommitteeOpts{ + State: stateID, + }) if err != nil { return errors.Wrap(err, "failed to obtain sync committee information") } + c.syncCommittee = syncCommitteeResponse.Data return nil } @@ -137,11 +141,11 @@ func (c *command) isAggregator(ctx context.Context) (bool, error) { if !isProvider { return false, errors.New("connection does not provide spec information") } - var err error - c.spec, err = specProvider.Spec(ctx) + specResponse, err := specProvider.Spec(ctx) if err != nil { return false, errors.Wrap(err, "failed to obtain spec information") } + c.spec = specResponse.Data tmp, exists := c.spec["SYNC_COMMITTEE_SIZE"] if !exists { @@ -226,16 +230,19 @@ func (c *command) confirmContributionSignature(ctx context.Context) error { fmt.Fprintf(os.Stderr, "Contribution validator indices: %v (%d)\n", includedIndices, len(includedIndices)) } - includedValidators, err := c.validatorsProvider.Validators(ctx, "head", includedIndices) + response, err := c.validatorsProvider.Validators(ctx, &api.ValidatorsOpts{ + State: "head", + Indices: includedIndices, + }) if err != nil { return errors.Wrap(err, "failed to obtain subcommittee validators") } - if len(includedValidators) == 0 { + if len(response.Data) == 0 { return errors.New("obtained empty subcommittee validator list") } var aggregatePubKey *e2types.BLSPublicKey - for _, v := range includedValidators { + for _, v := range response.Data { pubKeyBytes := make([]byte, 48) copy(pubKeyBytes, v.Validator.PublicKey[:]) pubKey, err := e2types.BLSPublicKeyFromBytes(pubKeyBytes) diff --git a/cmd/chaininfo.go b/cmd/chaininfo.go index 149b51f..2e1e177 100644 --- a/cmd/chaininfo.go +++ b/cmd/chaininfo.go @@ -20,6 +20,7 @@ import ( "time" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" spec "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -45,32 +46,32 @@ In quiet mode this will return 0 if the chain information can be obtained, other }) errCheck(err, "Failed to connect to Ethereum 2 beacon node") - config, err := eth2Client.(eth2client.SpecProvider).Spec(ctx) + specResponse, err := eth2Client.(eth2client.SpecProvider).Spec(ctx) errCheck(err, "Failed to obtain beacon chain specification") - genesis, err := eth2Client.(eth2client.GenesisProvider).Genesis(ctx) + genesisResponse, err := eth2Client.(eth2client.GenesisProvider).Genesis(ctx) errCheck(err, "Failed to obtain beacon chain genesis") - fork, err := eth2Client.(eth2client.ForkProvider).Fork(ctx, "head") + forkResponse, err := eth2Client.(eth2client.ForkProvider).Fork(ctx, &api.ForkOpts{State: "head"}) errCheck(err, "Failed to obtain current fork") if viper.GetBool("quiet") { os.Exit(_exitSuccess) } - if genesis.GenesisTime.Unix() == 0 { + if genesisResponse.Data.GenesisTime.Unix() == 0 { fmt.Println("Genesis time: undefined") } else { - fmt.Printf("Genesis time: %s\n", genesis.GenesisTime.Format(time.UnixDate)) - outputIf(viper.GetBool("verbose"), fmt.Sprintf("Genesis timestamp: %v", genesis.GenesisTime.Unix())) + fmt.Printf("Genesis time: %s\n", genesisResponse.Data.GenesisTime.Format(time.UnixDate)) + outputIf(viper.GetBool("verbose"), fmt.Sprintf("Genesis timestamp: %v", genesisResponse.Data.GenesisTime.Unix())) } - fmt.Printf("Genesis validators root: %#x\n", genesis.GenesisValidatorsRoot) - fmt.Printf("Genesis fork version: %#x\n", config["GENESIS_FORK_VERSION"].(spec.Version)) - fmt.Printf("Current fork version: %#x\n", fork.CurrentVersion) + fmt.Printf("Genesis validators root: %#x\n", genesisResponse.Data.GenesisValidatorsRoot) + fmt.Printf("Genesis fork version: %#x\n", specResponse.Data["GENESIS_FORK_VERSION"].(spec.Version)) + fmt.Printf("Current fork version: %#x\n", forkResponse.Data.CurrentVersion) if viper.GetBool("verbose") { forkData := &spec.ForkData{ - CurrentVersion: fork.CurrentVersion, - GenesisValidatorsRoot: genesis.GenesisValidatorsRoot, + CurrentVersion: forkResponse.Data.CurrentVersion, + GenesisValidatorsRoot: genesisResponse.Data.GenesisValidatorsRoot, } forkDataRoot, err := forkData.HashTreeRoot() if err == nil { @@ -79,8 +80,8 @@ In quiet mode this will return 0 if the chain information can be obtained, other fmt.Printf("Fork digest: %#x\n", forkDigest) } } - fmt.Printf("Seconds per slot: %d\n", int(config["SECONDS_PER_SLOT"].(time.Duration).Seconds())) - fmt.Printf("Slots per epoch: %d\n", config["SLOTS_PER_EPOCH"].(uint64)) + fmt.Printf("Seconds per slot: %d\n", int(specResponse.Data["SECONDS_PER_SLOT"].(time.Duration).Seconds())) + fmt.Printf("Slots per epoch: %d\n", specResponse.Data["SLOTS_PER_EPOCH"].(uint64)) os.Exit(_exitSuccess) }, diff --git a/cmd/chainspec.go b/cmd/chainspec.go index 40f85d2..b365c99 100644 --- a/cmd/chainspec.go +++ b/cmd/chainspec.go @@ -18,6 +18,7 @@ import ( "encoding/json" "fmt" "sort" + "strconv" "time" eth2client "github.com/attestantio/go-eth2-client" @@ -46,7 +47,7 @@ In quiet mode this will return 0 if the chain specification can be obtained, oth }) errCheck(err, "Failed to connect to Ethereum consensus node") - spec, err := eth2Client.(eth2client.SpecProvider).Spec(ctx) + specResponse, err := eth2Client.(eth2client.SpecProvider).Spec(ctx) errCheck(err, "Failed to obtain chain specification") if viper.GetBool("quiet") { @@ -54,35 +55,35 @@ In quiet mode this will return 0 if the chain specification can be obtained, oth } // Tweak the spec for output. - for k, v := range spec { + for k, v := range specResponse.Data { switch t := v.(type) { case phase0.Version: - spec[k] = fmt.Sprintf("%#x", t) + specResponse.Data[k] = fmt.Sprintf("%#x", t) case phase0.DomainType: - spec[k] = fmt.Sprintf("%#x", t) + specResponse.Data[k] = fmt.Sprintf("%#x", t) case time.Time: - spec[k] = fmt.Sprintf("%d", t.Unix()) + specResponse.Data[k] = strconv.FormatInt(t.Unix(), 10) case time.Duration: - spec[k] = fmt.Sprintf("%d", uint64(t.Seconds())) + specResponse.Data[k] = strconv.FormatUint(uint64(t.Seconds()), 10) case []byte: - spec[k] = fmt.Sprintf("%#x", t) + specResponse.Data[k] = fmt.Sprintf("%#x", t) case uint64: - spec[k] = fmt.Sprintf("%d", t) + specResponse.Data[k] = strconv.FormatUint(t, 10) } } if viper.GetBool("json") { - data, err := json.Marshal(spec) + data, err := json.Marshal(specResponse.Data) errCheck(err, "Failed to marshal JSON") fmt.Printf("%s\n", string(data)) } else { - keys := make([]string, 0, len(spec)) - for k := range spec { + keys := make([]string, 0, len(specResponse.Data)) + for k := range specResponse.Data { keys = append(keys, k) } sort.Strings(keys) for _, key := range keys { - fmt.Printf("%s: %v\n", key, spec[key]) + fmt.Printf("%s: %v\n", key, specResponse.Data[key]) } } }, diff --git a/cmd/chainstatus.go b/cmd/chainstatus.go index 4cc1a59..eea6a3c 100644 --- a/cmd/chainstatus.go +++ b/cmd/chainstatus.go @@ -17,10 +17,12 @@ import ( "context" "fmt" "os" + "strconv" "strings" "time" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" apiv1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/spf13/cobra" @@ -57,8 +59,11 @@ In quiet mode this will return 0 if the chain status can be obtained, otherwise finalityProvider, isProvider := eth2Client.(eth2client.FinalityProvider) assert(isProvider, "beacon node does not provide finality; cannot report on chain status") - finality, err := finalityProvider.Finality(ctx, "head") + finalityResponse, err := finalityProvider.Finality(ctx, &api.FinalityOpts{ + State: "head", + }) errCheck(err, "Failed to obtain finality information") + finality := finalityResponse.Data slot := chainTime.CurrentSlot() @@ -126,13 +131,13 @@ In quiet mode this will return 0 if the chain status can be obtained, otherwise if viper.GetBool("verbose") { validatorsProvider, isProvider := eth2Client.(eth2client.ValidatorsProvider) if isProvider { - validators, err := validatorsProvider.Validators(ctx, "head", nil) + validatorsResponse, err := validatorsProvider.Validators(ctx, &api.ValidatorsOpts{State: "head"}) errCheck(err, "Failed to obtain validators information") // Stats of inteest. totalBalance := phase0.Gwei(0) activeEffectiveBalance := phase0.Gwei(0) validatorCount := make(map[apiv1.ValidatorState]int) - for _, validator := range validators { + for _, validator := range validatorsResponse.Data { validatorCount[validator.Status]++ totalBalance += validator.Balance if validator.Status.IsActive() { @@ -162,7 +167,7 @@ In quiet mode this will return 0 if the chain status can be obtained, otherwise nextPeriodTimestamp := chainTime.StartOfEpoch(nextPeriodStartEpoch) res.WriteString("Sync committee period: ") - res.WriteString(fmt.Sprintf("%d", period)) + res.WriteString(strconv.FormatUint(period, 10)) res.WriteString("\n") if viper.GetBool("verbose") { diff --git a/cmd/epoch/summary/process.go b/cmd/epoch/summary/process.go index 1b62080..da3376d 100644 --- a/cmd/epoch/summary/process.go +++ b/cmd/epoch/summary/process.go @@ -19,6 +19,7 @@ import ( "sort" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" apiv1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec" "github.com/attestantio/go-eth2-client/spec/altair" @@ -55,14 +56,14 @@ func (c *command) process(ctx context.Context) error { } func (c *command) processProposerDuties(ctx context.Context) error { - duties, err := c.proposerDutiesProvider.ProposerDuties(ctx, c.summary.Epoch, nil) + response, err := c.proposerDutiesProvider.ProposerDuties(ctx, &api.ProposerDutiesOpts{ + Epoch: c.summary.Epoch, + }) if err != nil { return errors.Wrap(err, "failed to obtain proposer duties") } - if duties == nil { - return errors.New("empty proposer duties") - } - for _, duty := range duties { + + for _, duty := range response.Data { block, err := c.fetchBlock(ctx, fmt.Sprintf("%d", duty.Slot)) if err != nil { return errors.Wrap(err, fmt.Sprintf("failed to obtain block for slot %d", duty.Slot)) @@ -79,12 +80,14 @@ func (c *command) processProposerDuties(ctx context.Context) error { } func (c *command) activeValidators(ctx context.Context) (map[phase0.ValidatorIndex]*apiv1.Validator, error) { - validators, err := c.validatorsProvider.Validators(ctx, fmt.Sprintf("%d", c.chainTime.FirstSlotOfEpoch(c.summary.Epoch)), nil) + response, err := c.validatorsProvider.Validators(ctx, &api.ValidatorsOpts{ + State: fmt.Sprintf("%d", c.chainTime.FirstSlotOfEpoch(c.summary.Epoch)), + }) if err != nil { return nil, errors.Wrap(err, "failed to obtain validators for epoch") } activeValidators := make(map[phase0.ValidatorIndex]*apiv1.Validator) - for _, validator := range validators { + for _, validator := range response.Data { if validator.Validator.ActivationEpoch <= c.summary.Epoch && validator.Validator.ExitEpoch > c.summary.Epoch { activeValidators[validator.Index] = validator } @@ -187,11 +190,13 @@ func (c *command) processSlots(ctx context.Context, } slotCommittees, exists := allCommittees[attestation.Data.Slot] if !exists { - beaconCommittees, err := c.beaconCommitteesProvider.BeaconCommittees(ctx, fmt.Sprintf("%d", attestation.Data.Slot)) + response, err := c.beaconCommitteesProvider.BeaconCommittees(ctx, &api.BeaconCommitteesOpts{ + State: fmt.Sprintf("%d", attestation.Data.Slot), + }) if err != nil { return 0, 0, 0, 0, 0, 0, nil, nil, errors.Wrap(err, fmt.Sprintf("failed to obtain committees for slot %d", attestation.Data.Slot)) } - for _, beaconCommittee := range beaconCommittees { + for _, beaconCommittee := range response.Data { if _, exists := allCommittees[beaconCommittee.Slot]; !exists { allCommittees[beaconCommittee.Slot] = make(map[phase0.CommitteeIndex][]phase0.ValidatorIndex) } @@ -257,10 +262,13 @@ func (c *command) processSyncCommitteeDuties(ctx context.Context) error { return nil } - committee, err := c.syncCommitteesProvider.SyncCommittee(ctx, fmt.Sprintf("%d", c.summary.FirstSlot)) + committeeResponse, err := c.syncCommitteesProvider.SyncCommittee(ctx, &api.SyncCommitteeOpts{ + State: fmt.Sprintf("%d", c.summary.FirstSlot), + }) if err != nil { return errors.Wrap(err, "failed to obtain sync committee") } + committee := committeeResponse.Data if len(committee.Validators) == 0 { return errors.Wrap(err, "empty sync committee") } @@ -407,10 +415,13 @@ func (c *command) fetchBlock(ctx context.Context, block, exists := c.blocksCache[blockID] if !exists { var err error - block, err = c.blocksProvider.SignedBeaconBlock(ctx, blockID) + blockResponse, err := c.blocksProvider.SignedBeaconBlock(ctx, &api.SignedBeaconBlockOpts{ + Block: blockID, + }) if err != nil { return nil, errors.Wrap(err, "failed to fetch block") } + block = blockResponse.Data c.blocksCache[blockID] = block } return block, nil diff --git a/cmd/exitverify.go b/cmd/exitverify.go index 79b5787..1cedfee 100644 --- a/cmd/exitverify.go +++ b/cmd/exitverify.go @@ -21,6 +21,7 @@ import ( "strings" consensusclient "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" v1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" @@ -67,10 +68,11 @@ In quiet mode this will return 0 if the exit is verified correctly, otherwise 1. opRoot, err := signedOp.Message.HashTreeRoot() errCheck(err, "Failed to obtain exit hash tree root") - genesis, err := eth2Client.(consensusclient.GenesisProvider).Genesis(ctx) + genesisResponse, err := eth2Client.(consensusclient.GenesisProvider).Genesis(ctx) errCheck(err, "Failed to obtain beacon chain genesis") + genesis := genesisResponse.Data - fork, err := eth2Client.(consensusclient.ForkProvider).Fork(ctx, "head") + response, err := eth2Client.(consensusclient.ForkProvider).Fork(ctx, &api.ForkOpts{State: "head"}) errCheck(err, "Failed to obtain fork information") // Check against current and prior fork versions. @@ -83,14 +85,14 @@ In quiet mode this will return 0 if the exit is verified correctly, otherwise 1. // Try with the current fork. domain := phase0.Domain{} - currentExitDomain, err := e2types.ComputeDomain(e2types.DomainVoluntaryExit, fork.CurrentVersion[:], genesis.GenesisValidatorsRoot[:]) + currentExitDomain, err := e2types.ComputeDomain(e2types.DomainVoluntaryExit, response.Data.CurrentVersion[:], genesis.GenesisValidatorsRoot[:]) errCheck(err, "Failed to compute domain") copy(domain[:], currentExitDomain) verified, err = util.VerifyRoot(account, opRoot, domain, sig) errCheck(err, "Failed to verify voluntary exit") if !verified { // Try again with the previous fork. - previousExitDomain, err := e2types.ComputeDomain(e2types.DomainVoluntaryExit, fork.PreviousVersion[:], genesis.GenesisValidatorsRoot[:]) + previousExitDomain, err := e2types.ComputeDomain(e2types.DomainVoluntaryExit, response.Data.PreviousVersion[:], genesis.GenesisValidatorsRoot[:]) copy(domain[:], previousExitDomain) errCheck(err, "Failed to compute domain") verified, err = util.VerifyRoot(account, opRoot, domain, sig) diff --git a/cmd/nodeinfo.go b/cmd/nodeinfo.go index 283ed4f..c545825 100644 --- a/cmd/nodeinfo.go +++ b/cmd/nodeinfo.go @@ -48,14 +48,14 @@ In quiet mode this will return 0 if the node information can be obtained, otherw } if viper.GetBool("verbose") { - version, err := eth2Client.(eth2client.NodeVersionProvider).NodeVersion(ctx) + versionResponse, err := eth2Client.(eth2client.NodeVersionProvider).NodeVersion(ctx) errCheck(err, "Failed to obtain node version") - fmt.Printf("Version: %s\n", version) + fmt.Printf("Version: %s\n", versionResponse.Data) } - syncState, err := eth2Client.(eth2client.NodeSyncingProvider).NodeSyncing(ctx) + syncStateResponse, err := eth2Client.(eth2client.NodeSyncingProvider).NodeSyncing(ctx) errCheck(err, "failed to obtain node sync state") - fmt.Printf("Syncing: %t\n", syncState.SyncDistance != 0) + fmt.Printf("Syncing: %t\n", syncStateResponse.Data.SyncDistance != 0) os.Exit(_exitSuccess) }, diff --git a/cmd/proposer/duties/process.go b/cmd/proposer/duties/process.go index fba523d..ab8f925 100644 --- a/cmd/proposer/duties/process.go +++ b/cmd/proposer/duties/process.go @@ -17,6 +17,7 @@ import ( "context" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" apiv1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/pkg/errors" standardchaintime "github.com/wealdtech/ethdo/services/chaintime/standard" @@ -45,14 +46,16 @@ func (c *command) processSlot(ctx context.Context) error { c.results.Epoch = c.chainTime.SlotToEpoch(slot) - duties, err := c.proposerDutiesProvider.ProposerDuties(ctx, c.results.Epoch, nil) + response, err := c.proposerDutiesProvider.ProposerDuties(ctx, &api.ProposerDutiesOpts{ + Epoch: c.results.Epoch, + }) if err != nil { return errors.Wrap(err, "failed to obtain proposer duties") } c.results.Duties = make([]*apiv1.ProposerDuty, 0, 1) - for _, duty := range duties { + for _, duty := range response.Data { if duty.Slot == slot { c.results.Duties = append(c.results.Duties, duty) break @@ -69,10 +72,13 @@ func (c *command) processEpoch(ctx context.Context) error { return errors.Wrap(err, "failed to parse epoch") } - c.results.Duties, err = c.proposerDutiesProvider.ProposerDuties(ctx, c.results.Epoch, nil) + dutiesResponse, err := c.proposerDutiesProvider.ProposerDuties(ctx, &api.ProposerDutiesOpts{ + Epoch: c.results.Epoch, + }) if err != nil { return errors.Wrap(err, "failed to obtain proposer duties") } + c.results.Duties = dutiesResponse.Data return nil } diff --git a/cmd/slot/time/process.go b/cmd/slot/time/process.go index c3c20b0..ee5e9bc 100644 --- a/cmd/slot/time/process.go +++ b/cmd/slot/time/process.go @@ -41,17 +41,18 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) { return nil, errors.New("slot must be a positive integer") } - genesis, err := data.eth2Client.(eth2client.GenesisProvider).Genesis(ctx) + genesisResponse, err := data.eth2Client.(eth2client.GenesisProvider).Genesis(ctx) if err != nil { return nil, errors.Wrap(err, "failed to obtain genesis information") } + genesis := genesisResponse.Data - config, err := data.eth2Client.(eth2client.SpecProvider).Spec(ctx) + specResponse, err := data.eth2Client.(eth2client.SpecProvider).Spec(ctx) if err != nil { return nil, errors.Wrap(err, "failed to obtain chain specifications") } - slotDuration := config["SECONDS_PER_SLOT"].(time.Duration) + slotDuration := specResponse.Data["SECONDS_PER_SLOT"].(time.Duration) results.startTime = genesis.GenesisTime.Add((time.Duration(slot*int64(slotDuration.Seconds())) * time.Second)) results.endTime = results.startTime.Add(slotDuration) diff --git a/cmd/synccommittee/inclusion/output.go b/cmd/synccommittee/inclusion/output.go index 26bf111..3732643 100644 --- a/cmd/synccommittee/inclusion/output.go +++ b/cmd/synccommittee/inclusion/output.go @@ -16,6 +16,7 @@ package inclusion import ( "context" "fmt" + "strconv" "strings" ) @@ -53,13 +54,13 @@ func (c *command) output(_ context.Context) (string, error) { } } builder.WriteString("Expected: ") - builder.WriteString(fmt.Sprintf("%d", len(c.inclusions))) + builder.WriteString(strconv.Itoa(len(c.inclusions))) builder.WriteString("\nIncluded: ") - builder.WriteString(fmt.Sprintf("%d", included)) + builder.WriteString(strconv.Itoa(included)) builder.WriteString("\nMissed: ") - builder.WriteString(fmt.Sprintf("%d", missed)) + builder.WriteString(strconv.Itoa(missed)) builder.WriteString("\nNo block: ") - builder.WriteString(fmt.Sprintf("%d", noBlock)) + builder.WriteString(strconv.Itoa(noBlock)) builder.WriteString("\nPer-slot result: ") for i, inclusion := range c.inclusions { diff --git a/cmd/synccommittee/inclusion/process.go b/cmd/synccommittee/inclusion/process.go index 6b01511..f9b5440 100644 --- a/cmd/synccommittee/inclusion/process.go +++ b/cmd/synccommittee/inclusion/process.go @@ -18,6 +18,7 @@ import ( "fmt" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" "github.com/attestantio/go-eth2-client/spec" "github.com/attestantio/go-eth2-client/spec/altair" "github.com/pkg/errors" @@ -41,10 +42,14 @@ func (c *command) process(ctx context.Context) error { return err } - syncCommittee, err := c.eth2Client.(eth2client.SyncCommitteesProvider).SyncCommitteeAtEpoch(ctx, "head", c.epoch) + syncCommitteeResponse, err := c.eth2Client.(eth2client.SyncCommitteesProvider).SyncCommittee(ctx, &api.SyncCommitteeOpts{ + State: "head", + Epoch: &c.epoch, + }) if err != nil { return errors.Wrap(err, "failed to obtain sync committee information") } + syncCommittee := syncCommitteeResponse.Data if syncCommittee == nil { return errors.New("no sync committee returned") @@ -67,10 +72,13 @@ func (c *command) process(ctx context.Context) error { lastSlot = c.chainTime.CurrentSlot() } for slot := firstSlot; slot <= lastSlot; slot++ { - block, err := c.eth2Client.(eth2client.SignedBeaconBlockProvider).SignedBeaconBlock(ctx, fmt.Sprintf("%d", slot)) + blockResponse, err := c.eth2Client.(eth2client.SignedBeaconBlockProvider).SignedBeaconBlock(ctx, &api.SignedBeaconBlockOpts{ + Block: fmt.Sprintf("%d", slot), + }) if err != nil { return err } + block := blockResponse.Data if block == nil { c.inclusions = append(c.inclusions, 0) continue diff --git a/cmd/synccommittee/members/process.go b/cmd/synccommittee/members/process.go index 7d942d8..06fc0bf 100644 --- a/cmd/synccommittee/members/process.go +++ b/cmd/synccommittee/members/process.go @@ -19,6 +19,7 @@ import ( "strings" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" "github.com/wealdtech/ethdo/util" @@ -34,10 +35,14 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) { return nil, err } - syncCommittee, err := data.eth2Client.(eth2client.SyncCommitteesProvider).SyncCommitteeAtEpoch(ctx, "head", epoch) + syncCommitteeResponse, err := data.eth2Client.(eth2client.SyncCommitteesProvider).SyncCommittee(ctx, &api.SyncCommitteeOpts{ + State: "head", + Epoch: &epoch, + }) if err != nil { return nil, errors.Wrap(err, "failed to obtain sync committee information") } + syncCommittee := syncCommitteeResponse.Data if syncCommittee == nil { return nil, errors.New("no sync committee returned") diff --git a/cmd/validator/credentials/get/output.go b/cmd/validator/credentials/get/output.go index 0e51707..afdc2d9 100644 --- a/cmd/validator/credentials/get/output.go +++ b/cmd/validator/credentials/get/output.go @@ -15,6 +15,7 @@ package validatorcredentialsget import ( "context" + "encoding/hex" "fmt" "strings" @@ -47,7 +48,7 @@ func (c *command) output(_ context.Context) (string, error) { // addressBytesToEIP55 converts a byte array in to an EIP-55 string format. func addressBytesToEIP55(address []byte) string { - bytes := []byte(fmt.Sprintf("%x", address)) + bytes := []byte(hex.EncodeToString(address)) hash := ethutil.Keccak256(bytes) for i := 0; i < len(bytes); i++ { hashByte := hash[i/2] diff --git a/cmd/validator/credentials/set/process.go b/cmd/validator/credentials/set/process.go index 42762b4..c1bf93e 100644 --- a/cmd/validator/credentials/set/process.go +++ b/cmd/validator/credentials/set/process.go @@ -828,7 +828,7 @@ func (c *command) obtainForkVersion(_ context.Context) (phase0.Version, error) { // addressBytesToEIP55 converts a byte array in to an EIP-55 string format. func addressBytesToEIP55(address []byte) string { - bytes := []byte(fmt.Sprintf("%x", address)) + bytes := []byte(hex.EncodeToString(address)) hash := ethutil.Keccak256(bytes) for i := 0; i < len(bytes); i++ { hashByte := hash[i/2] diff --git a/cmd/validator/depositdata/process.go b/cmd/validator/depositdata/process.go index 23b6241..dd29776 100644 --- a/cmd/validator/depositdata/process.go +++ b/cmd/validator/depositdata/process.go @@ -155,7 +155,7 @@ func createWithdrawalCredentials(data *dataIn) ([]byte, error) { // addressBytesToEIP55 converts a byte array in to an EIP-55 string format. func addressBytesToEIP55(address []byte) string { - bytes := []byte(fmt.Sprintf("%x", address)) + bytes := []byte(hex.EncodeToString(address)) hash := util.Keccak256(bytes) for i := 0; i < len(bytes); i++ { hashByte := hash[i/2] diff --git a/cmd/validator/duties/process.go b/cmd/validator/duties/process.go index ecbed80..bd2276d 100644 --- a/cmd/validator/duties/process.go +++ b/cmd/validator/duties/process.go @@ -18,7 +18,8 @@ import ( "time" eth2client "github.com/attestantio/go-eth2-client" - api "github.com/attestantio/go-eth2-client/api/v1" + "github.com/attestantio/go-eth2-client/api" + apiv1 "github.com/attestantio/go-eth2-client/api/v1" spec "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" "github.com/wealdtech/ethdo/util" @@ -75,28 +76,32 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) { } results.nextEpochAttesterDuty = nextEpochAttesterDuty - genesis, err := eth2Client.(eth2client.GenesisProvider).Genesis(ctx) + genesisResponse, err := eth2Client.(eth2client.GenesisProvider).Genesis(ctx) if err != nil { return nil, errors.Wrap(err, "failed to obtain genesis data") } - results.genesisTime = genesis.GenesisTime + results.genesisTime = genesisResponse.Data.GenesisTime - config, err := eth2Client.(eth2client.SpecProvider).Spec(ctx) + specResponse, err := eth2Client.(eth2client.SpecProvider).Spec(ctx) if err != nil { return nil, errors.Wrap(err, "failed to obtain beacon chain configuration") } - results.slotsPerEpoch = config["SLOTS_PER_EPOCH"].(uint64) - results.slotDuration = config["SECONDS_PER_SLOT"].(time.Duration) + results.slotsPerEpoch = specResponse.Data["SLOTS_PER_EPOCH"].(uint64) + results.slotDuration = specResponse.Data["SECONDS_PER_SLOT"].(time.Duration) return results, nil } -func attesterDuty(ctx context.Context, eth2Client eth2client.Service, validatorIndex spec.ValidatorIndex, epoch spec.Epoch) (*api.AttesterDuty, error) { +func attesterDuty(ctx context.Context, eth2Client eth2client.Service, validatorIndex spec.ValidatorIndex, epoch spec.Epoch) (*apiv1.AttesterDuty, error) { // Find the attesting slot for the given epoch. - duties, err := eth2Client.(eth2client.AttesterDutiesProvider).AttesterDuties(ctx, epoch, []spec.ValidatorIndex{validatorIndex}) + dutiesResponse, err := eth2Client.(eth2client.AttesterDutiesProvider).AttesterDuties(ctx, &api.AttesterDutiesOpts{ + Epoch: epoch, + Indices: []spec.ValidatorIndex{validatorIndex}, + }) if err != nil { return nil, errors.Wrap(err, "failed to obtain attester duties") } + duties := dutiesResponse.Data if len(duties) == 0 { return nil, errors.New("validator does not have duty for that epoch") @@ -105,30 +110,33 @@ func attesterDuty(ctx context.Context, eth2Client eth2client.Service, validatorI return duties[0], nil } -func proposerDuties(ctx context.Context, eth2Client eth2client.Service, validatorIndex spec.ValidatorIndex, epoch spec.Epoch) ([]*api.ProposerDuty, error) { +func proposerDuties(ctx context.Context, eth2Client eth2client.Service, validatorIndex spec.ValidatorIndex, epoch spec.Epoch) ([]*apiv1.ProposerDuty, error) { // Fetch the proposer duties for this epoch. - proposerDuties, err := eth2Client.(eth2client.ProposerDutiesProvider).ProposerDuties(ctx, epoch, []spec.ValidatorIndex{validatorIndex}) + proposerDuties, err := eth2Client.(eth2client.ProposerDutiesProvider).ProposerDuties(ctx, &api.ProposerDutiesOpts{ + Epoch: epoch, + Indices: []spec.ValidatorIndex{validatorIndex}, + }) if err != nil { return nil, errors.Wrap(err, "failed to obtain proposer duties") } - return proposerDuties, nil + return proposerDuties.Data, nil } func currentEpoch(ctx context.Context, eth2Client eth2client.Service) (spec.Epoch, error) { - config, err := eth2Client.(eth2client.SpecProvider).Spec(ctx) + specResponse, err := eth2Client.(eth2client.SpecProvider).Spec(ctx) if err != nil { return 0, errors.Wrap(err, "failed to obtain beacon chain configuration") } - slotsPerEpoch := config["SLOTS_PER_EPOCH"].(uint64) - slotDuration := config["SECONDS_PER_SLOT"].(time.Duration) - genesis, err := eth2Client.(eth2client.GenesisProvider).Genesis(ctx) + slotsPerEpoch := specResponse.Data["SLOTS_PER_EPOCH"].(uint64) + slotDuration := specResponse.Data["SECONDS_PER_SLOT"].(time.Duration) + + genesisResponse, err := eth2Client.(eth2client.GenesisProvider).Genesis(ctx) if err != nil { return 0, errors.Wrap(err, "failed to obtain genesis data") } - - if genesis.GenesisTime.After(time.Now()) { + if genesisResponse.Data.GenesisTime.After(time.Now()) { return spec.Epoch(0), nil } - return spec.Epoch(uint64(time.Since(genesis.GenesisTime).Seconds()) / (uint64(slotDuration.Seconds()) * slotsPerEpoch)), nil + return spec.Epoch(uint64(time.Since(genesisResponse.Data.GenesisTime).Seconds()) / (uint64(slotDuration.Seconds()) * slotsPerEpoch)), nil } diff --git a/cmd/validator/expectation/command.go b/cmd/validator/expectation/command.go index c8ddf67..e7e688a 100644 --- a/cmd/validator/expectation/command.go +++ b/cmd/validator/expectation/command.go @@ -16,7 +16,7 @@ package validatorexpectation import ( "context" "encoding/json" - "fmt" + "strconv" "time" eth2client "github.com/attestantio/go-eth2-client" @@ -63,11 +63,11 @@ type resultsJSON struct { func (r *results) MarshalJSON() ([]byte, error) { data := &resultsJSON{ - ActiveValidators: fmt.Sprintf("%d", r.activeValidators), + ActiveValidators: strconv.FormatUint(r.activeValidators, 10), TimeBetweenProposals: durafmt.Parse(r.timeBetweenProposals).LimitFirstN(2).String(), - SecsBetweenProposals: fmt.Sprintf("%d", int64(r.timeBetweenProposals.Seconds())), + SecsBetweenProposals: strconv.FormatInt(int64(r.timeBetweenProposals.Seconds()), 10), TimeBetweenSyncCommittees: durafmt.Parse(r.timeBetweenSyncCommittees).LimitFirstN(2).String(), - SecsBetweenSyncCommittees: fmt.Sprintf("%d", int64(r.timeBetweenSyncCommittees.Seconds())), + SecsBetweenSyncCommittees: strconv.FormatInt(int64(r.timeBetweenSyncCommittees.Seconds()), 10), } return json.Marshal(data) } diff --git a/cmd/validator/expectation/process.go b/cmd/validator/expectation/process.go index c4df022..a24ef0b 100644 --- a/cmd/validator/expectation/process.go +++ b/cmd/validator/expectation/process.go @@ -19,6 +19,7 @@ import ( "time" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" "github.com/pkg/errors" standardchaintime "github.com/wealdtech/ethdo/services/chaintime/standard" "github.com/wealdtech/ethdo/util" @@ -45,12 +46,12 @@ func (c *command) calculateProposalChance(ctx context.Context) error { // Chance of proposing a block is 1/activeValidators. // Expectation of number of slots before proposing a block is 1/p, == activeValidators slots. - spec, err := c.eth2Client.(eth2client.SpecProvider).Spec(ctx) + specResponse, err := c.eth2Client.(eth2client.SpecProvider).Spec(ctx) if err != nil { return err } - tmp, exists := spec["SECONDS_PER_SLOT"] + tmp, exists := specResponse.Data["SECONDS_PER_SLOT"] if !exists { return errors.New("spec missing SECONDS_PER_SLOT") } @@ -68,12 +69,12 @@ func (c *command) calculateSyncCommitteeChance(ctx context.Context) error { // Chance of being in a sync committee is SYNC_COMMITTEE_SIZE/activeValidators. // Expectation of number of periods before being in a sync committee is 1/p, activeValidators/SYNC_COMMITTEE_SIZE periods. - spec, err := c.eth2Client.(eth2client.SpecProvider).Spec(ctx) + specResponse, err := c.eth2Client.(eth2client.SpecProvider).Spec(ctx) if err != nil { return err } - tmp, exists := spec["SECONDS_PER_SLOT"] + tmp, exists := specResponse.Data["SECONDS_PER_SLOT"] if !exists { return errors.New("spec missing SECONDS_PER_SLOT") } @@ -82,7 +83,7 @@ func (c *command) calculateSyncCommitteeChance(ctx context.Context) error { return errors.New("SECONDS_PER_SLOT of incorrect type") } - tmp, exists = spec["SYNC_COMMITTEE_SIZE"] + tmp, exists = specResponse.Data["SYNC_COMMITTEE_SIZE"] if !exists { return errors.New("spec missing SYNC_COMMITTEE_SIZE") } @@ -91,7 +92,7 @@ func (c *command) calculateSyncCommitteeChance(ctx context.Context) error { return errors.New("SYNC_COMMITTEE_SIZE of incorrect type") } - tmp, exists = spec["SLOTS_PER_EPOCH"] + tmp, exists = specResponse.Data["SLOTS_PER_EPOCH"] if !exists { return errors.New("spec missing SLOTS_PER_EPOCH") } @@ -100,7 +101,7 @@ func (c *command) calculateSyncCommitteeChance(ctx context.Context) error { return errors.New("SLOTS_PER_EPOCH of incorrect type") } - tmp, exists = spec["EPOCHS_PER_SYNC_COMMITTEE_PERIOD"] + tmp, exists = specResponse.Data["EPOCHS_PER_SYNC_COMMITTEE_PERIOD"] if !exists { return errors.New("spec missing EPOCHS_PER_SYNC_COMMITTEE_PERIOD") } @@ -148,13 +149,15 @@ func (c *command) setup(ctx context.Context) error { return errors.New("connection does not provide validator information") } - validators, err := c.validatorsProvider.Validators(ctx, "head", nil) + response, err := c.validatorsProvider.Validators(ctx, &api.ValidatorsOpts{ + State: "head", + }) if err != nil { return errors.Wrap(err, "failed to obtain validators") } currentEpoch := chainTime.CurrentEpoch() - for _, validator := range validators { + for _, validator := range response.Data { if validator.Validator.ActivationEpoch <= currentEpoch && validator.Validator.ExitEpoch > currentEpoch { c.res.activeValidators++ diff --git a/cmd/validator/summary/process.go b/cmd/validator/summary/process.go index aca89e8..b446f8b 100644 --- a/cmd/validator/summary/process.go +++ b/cmd/validator/summary/process.go @@ -19,6 +19,7 @@ import ( "sort" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" apiv1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" @@ -81,21 +82,23 @@ func (c *command) process(ctx context.Context) error { } func (c *command) processProposerDuties(ctx context.Context) error { - duties, err := c.proposerDutiesProvider.ProposerDuties(ctx, c.summary.Epoch, nil) + response, err := c.proposerDutiesProvider.ProposerDuties(ctx, &api.ProposerDutiesOpts{ + Epoch: c.summary.Epoch, + }) if err != nil { return errors.Wrap(err, "failed to obtain proposer duties") } - if duties == nil { - return errors.New("empty proposer duties") - } - for _, duty := range duties { + for _, duty := range response.Data { if _, exists := c.validatorsByIndex[duty.ValidatorIndex]; !exists { continue } - block, err := c.blocksProvider.SignedBeaconBlock(ctx, fmt.Sprintf("%d", duty.Slot)) + blockResponse, err := c.blocksProvider.SignedBeaconBlock(ctx, &api.SignedBeaconBlockOpts{ + Block: fmt.Sprintf("%d", duty.Slot), + }) if err != nil { return errors.Wrap(err, fmt.Sprintf("failed to obtain block for slot %d", duty.Slot)) } + block := blockResponse.Data present := block != nil c.summary.Proposals = append(c.summary.Proposals, &epochProposal{ Slot: duty.Slot, @@ -133,10 +136,14 @@ func (c *command) processAttesterDuties(ctx context.Context) error { } // Obtain the duties for the validators to know where they should be attesting. - duties, err := c.attesterDutiesProvider.AttesterDuties(ctx, c.summary.Epoch, activeValidatorIndices) + dutiesResponse, err := c.attesterDutiesProvider.AttesterDuties(ctx, &api.AttesterDutiesOpts{ + Epoch: c.summary.Epoch, + Indices: activeValidatorIndices, + }) if err != nil { return errors.Wrap(err, "failed to obtain attester duties") } + duties := dutiesResponse.Data for slot := c.chainTime.FirstSlotOfEpoch(c.summary.Epoch); slot < c.chainTime.FirstSlotOfEpoch(c.summary.Epoch+1); slot++ { index := int(slot - c.chainTime.FirstSlotOfEpoch(c.summary.Epoch)) c.summary.Slots[index].Attestations = &slotAttestations{} @@ -213,14 +220,13 @@ func (c *command) processAttesterDutiesSlot(ctx context.Context, headersCache *util.BeaconBlockHeaderCache, activeValidatorIndices []phase0.ValidatorIndex, ) error { - block, err := c.blocksProvider.SignedBeaconBlock(ctx, fmt.Sprintf("%d", slot)) + blockResponse, err := c.blocksProvider.SignedBeaconBlock(ctx, &api.SignedBeaconBlockOpts{ + Block: fmt.Sprintf("%d", slot), + }) if err != nil { return errors.Wrap(err, fmt.Sprintf("failed to obtain block for slot %d", slot)) } - if block == nil { - // No block at this slot; that's fine. - return nil - } + block := blockResponse.Data attestations, err := block.Attestations() if err != nil { return err diff --git a/cmd/validator/withdrawal/process.go b/cmd/validator/withdrawal/process.go index 6b8e3ea..fc3f3c8 100644 --- a/cmd/validator/withdrawal/process.go +++ b/cmd/validator/withdrawal/process.go @@ -20,6 +20,7 @@ import ( "time" consensusclient "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" apiv1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec" "github.com/attestantio/go-eth2-client/spec/phase0" @@ -49,10 +50,13 @@ func (c *command) process(ctx context.Context) error { return errors.New("validator has nothing to withdraw") } - block, err := c.consensusClient.(consensusclient.SignedBeaconBlockProvider).SignedBeaconBlock(ctx, "head") + blockResponse, err := c.consensusClient.(consensusclient.SignedBeaconBlockProvider).SignedBeaconBlock(ctx, &api.SignedBeaconBlockOpts{ + Block: "head", + }) if err != nil { return errors.Wrap(err, "failed to obtain block") } + block := blockResponse.Data slot, err := block.Slot() if err != nil { return errors.Wrap(err, "failed to obtain block slot") @@ -61,12 +65,14 @@ func (c *command) process(ctx context.Context) error { fmt.Fprintf(os.Stderr, "Slot is %d\n", slot) } - validatorsMap, err := c.consensusClient.(consensusclient.ValidatorsProvider).Validators(ctx, fmt.Sprintf("%d", slot), nil) + response, err := c.consensusClient.(consensusclient.ValidatorsProvider).Validators(ctx, &api.ValidatorsOpts{ + State: fmt.Sprintf("%d", slot), + }) if err != nil { return errors.Wrap(err, "failed to obtain validators") } - validators := make([]*apiv1.Validator, len(validatorsMap)) - for _, validator := range validatorsMap { + validators := make([]*apiv1.Validator, len(response.Data)) + for _, validator := range response.Data { validators[validator.Index] = validator } @@ -140,18 +146,18 @@ func (c *command) setup(ctx context.Context) error { return errors.Wrap(err, "failed to create chaintime service") } - spec, err := c.consensusClient.(consensusclient.SpecProvider).Spec(ctx) + specResponse, err := c.consensusClient.(consensusclient.SpecProvider).Spec(ctx) if err != nil { return errors.Wrap(err, "failed to obtain spec") } - if val, exists := spec["MAX_WITHDRAWALS_PER_PAYLOAD"]; !exists { + if val, exists := specResponse.Data["MAX_WITHDRAWALS_PER_PAYLOAD"]; !exists { c.maxWithdrawalsPerPayload = 16 } else { c.maxWithdrawalsPerPayload = val.(uint64) } - if val, exists := spec["MAX_EFFECTIVE_BALANCE"]; !exists { + if val, exists := specResponse.Data["MAX_EFFECTIVE_BALANCE"]; !exists { c.maxEffectiveBalance = 32000000000 } else { c.maxEffectiveBalance = phase0.Gwei(val.(uint64)) diff --git a/cmd/validator/yield/process.go b/cmd/validator/yield/process.go index c992bbe..037840e 100644 --- a/cmd/validator/yield/process.go +++ b/cmd/validator/yield/process.go @@ -20,6 +20,7 @@ import ( "strconv" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" "github.com/pkg/errors" "github.com/shopspring/decimal" standardchaintime "github.com/wealdtech/ethdo/services/chaintime/standard" @@ -48,12 +49,12 @@ var ( // calculateYield calculates yield from the number of active validators. func (c *command) calculateYield(ctx context.Context) error { - spec, err := c.eth2Client.(eth2client.SpecProvider).Spec(ctx) + specResponse, err := c.eth2Client.(eth2client.SpecProvider).Spec(ctx) if err != nil { return err } - tmp, exists := spec["BASE_REWARD_FACTOR"] + tmp, exists := specResponse.Data["BASE_REWARD_FACTOR"] if !exists { return errors.New("spec missing BASE_REWARD_FACTOR") } @@ -143,14 +144,16 @@ func (c *command) setup(ctx context.Context) error { return errors.Wrap(err, "failed to parse epoch") } - validators, err := validatorsProvider.Validators(ctx, fmt.Sprintf("%d", chainTime.FirstSlotOfEpoch(epoch)), nil) + response, err := validatorsProvider.Validators(ctx, &api.ValidatorsOpts{ + State: fmt.Sprintf("%d", chainTime.FirstSlotOfEpoch(epoch)), + }) if err != nil { return err } activeValidators := decimal.Zero activeValidatorBalance := decimal.Zero - for _, validator := range validators { + for _, validator := range response.Data { if validator.Validator.ActivationEpoch <= epoch && validator.Validator.ExitEpoch > epoch { activeValidators = activeValidators.Add(one) diff --git a/cmd/version.go b/cmd/version.go index 95e94ae..d52f4c5 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -24,7 +24,7 @@ import ( // ReleaseVersion is the release version of the codebase. // Usually overridden by tag names when building binaries. -var ReleaseVersion = "local build (latest release 1.33.2)" +var ReleaseVersion = "local build (latest release 1.34.0)" // versionCmd represents the version command. var versionCmd = &cobra.Command{ diff --git a/cmd/wallet/sharedexport/output.go b/cmd/wallet/sharedexport/output.go index 00658a0..57c2993 100644 --- a/cmd/wallet/sharedexport/output.go +++ b/cmd/wallet/sharedexport/output.go @@ -15,7 +15,7 @@ package walletsharedexport import ( "context" - "fmt" + "encoding/hex" "strings" "github.com/pkg/errors" @@ -32,7 +32,7 @@ func output(_ context.Context, data *dataOut) (string, error) { builder := strings.Builder{} for i := range data.shares { - builder.WriteString(fmt.Sprintf("%x", data.shares[i])) + builder.WriteString(hex.EncodeToString(data.shares[i])) if i != len(data.shares)-1 { builder.WriteString("\n") } diff --git a/go.mod b/go.mod index c99ccbe..12c7d81 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,10 @@ module github.com/wealdtech/ethdo go 1.20 require ( - github.com/attestantio/go-eth2-client v0.18.3 + github.com/attestantio/go-eth2-client v0.19.4 github.com/ferranbt/fastssz v0.1.3 github.com/gofrs/uuid v4.4.0+incompatible - github.com/google/uuid v1.3.0 + github.com/google/uuid v1.4.0 github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b github.com/herumi/bls-eth-go-binary v1.32.1 github.com/mitchellh/go-homedir v1.1.0 @@ -14,11 +14,11 @@ require ( github.com/pkg/errors v0.9.1 github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 github.com/prysmaticlabs/go-ssz v0.0.0-20210121151755-f6208871c388 - github.com/rs/zerolog v1.30.0 + github.com/rs/zerolog v1.31.0 github.com/shopspring/decimal v1.3.1 github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.16.0 + github.com/spf13/viper v1.17.0 github.com/stretchr/testify v1.8.4 github.com/tyler-smith/go-bip39 v1.1.0 github.com/wealdtech/go-bytesutil v1.2.1 @@ -26,7 +26,7 @@ require ( github.com/wealdtech/go-eth2-types/v2 v2.8.2 github.com/wealdtech/go-eth2-util v1.8.2 github.com/wealdtech/go-eth2-wallet v1.16.0 - github.com/wealdtech/go-eth2-wallet-dirk v1.4.4 + github.com/wealdtech/go-eth2-wallet-dirk v1.4.5 github.com/wealdtech/go-eth2-wallet-distributed v1.2.1 github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.4.1 github.com/wealdtech/go-eth2-wallet-hd/v2 v2.7.0 @@ -40,60 +40,65 @@ require ( ) require ( - github.com/aws/aws-sdk-go v1.44.317 // indirect + github.com/aws/aws-sdk-go v1.46.7 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/fatih/color v1.15.0 // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/goccy/go-yaml v1.11.0 // indirect - github.com/golang/glog v1.1.1 // indirect + github.com/goccy/go-yaml v1.11.2 // indirect + github.com/golang/glog v1.1.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/holiman/uint256 v1.2.3 // indirect + github.com/huandu/go-clone v1.6.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jackc/puddle v1.3.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/minio/highwayhash v1.0.2 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/pelletier/go-toml/v2 v2.0.9 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.16.0 // indirect - github.com/prometheus/client_model v0.4.0 // indirect - github.com/prometheus/common v0.44.0 // indirect - github.com/prometheus/procfs v0.11.1 // indirect + github.com/pelletier/go-toml/v2 v2.1.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/prometheus/client_golang v1.17.0 // indirect + github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/common v0.45.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect github.com/protolambda/zssz v0.1.5 // indirect github.com/r3labs/sse/v2 v2.10.0 // indirect + github.com/sagikazarmark/locafero v0.3.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 // indirect - github.com/spf13/afero v1.9.5 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.10.0 // indirect github.com/spf13/cast v1.5.1 // indirect - github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/subosito/gotenv v1.4.2 // indirect + github.com/subosito/gotenv v1.6.0 // indirect github.com/wealdtech/eth2-signer-api v1.7.1 // indirect github.com/wealdtech/go-indexer v1.1.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0 // indirect - go.opentelemetry.io/otel v1.16.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0 // indirect + go.opentelemetry.io/otel v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.14.0 // indirect + golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sync v0.3.0 // indirect + golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.13.0 // indirect - golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5 // indirect - google.golang.org/grpc v1.57.0 // indirect + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect + google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20231030173426-d783a09b4405 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect + google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index 8a57c3b..0942590 100644 --- a/go.sum +++ b/go.sum @@ -17,14 +17,14 @@ cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHOb cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go v0.110.6 h1:8uYAkj3YHTP/1iwReuHPxLSbdcyc+dSBbzFMrVwDR6Q= +cloud.google.com/go v0.110.9 h1:e7ITSqGFFk4rbz/JFIqZh3G4VEHguhAL4BQcFlWtU68= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= +cloud.google.com/go/compute v1.23.2 h1:nWEMDhgbBkBJjfpVySqU4jgWdc22PLR0o4vEexZHers= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= @@ -43,10 +43,10 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/attestantio/go-eth2-client v0.18.3 h1:hUSYh+uMLyw4mJcXWcvrPLd8ozJl61aWMdx5Cpq9hxk= -github.com/attestantio/go-eth2-client v0.18.3/go.mod h1:KSVlZSW1A3jUg5H8O89DLtqxgJprRfTtI7k89fLdhu0= -github.com/aws/aws-sdk-go v1.44.317 h1:+8XWrLmGMwPPXSRSLPzhgcGnzJ2mYkgkrcB9C/GnSOU= -github.com/aws/aws-sdk-go v1.44.317/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/attestantio/go-eth2-client v0.19.4 h1:SiiqYqx1EhIgdaToer4FrUuiyG3wnTR4Xwb7/YkbGxA= +github.com/attestantio/go-eth2-client v0.19.4/go.mod h1:mZve1kV9Ctj0I1HH9gdg+MnI8lZ+Cb2EktEtOYrBlsM= +github.com/aws/aws-sdk-go v1.46.7 h1:IjvAWeiJZlbETOemOwvheN5L17CvKvKW0T1xOC6d3Sc= +github.com/aws/aws-sdk-go v1.46.7/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -67,8 +67,9 @@ github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+g github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= @@ -84,34 +85,34 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.10.1 h1:c0g45+xCJhdgFGw7a5QAfdS4byAbud7miNWJ1WwEVf8= +github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/ferranbt/fastssz v0.1.3 h1:ZI+z3JH05h4kgmFXdHuR1aWYsgrg7o+Fw7/NCzM16Mo= github.com/ferranbt/fastssz v0.1.3/go.mod h1:0Y9TEd/9XuFlh7mskMPfXiI2Dkw4Ddg9EyXt1W7MRvE= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= -github.com/goccy/go-yaml v1.11.0 h1:n7Z+zx8S9f9KgzG6KtQKf+kwqXZlLNR2F6018Dgau54= -github.com/goccy/go-yaml v1.11.0/go.mod h1:H+mJrWtjPTJAHvRbV09MCK9xYwODM+wRTVFFTWckfng= +github.com/goccy/go-yaml v1.11.2 h1:joq77SxuyIs9zzxEjgyLBugMQ9NEgTWxXfz2wVqwAaQ= +github.com/goccy/go-yaml v1.11.2/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.1 h1:jxpi2eWoU84wbX9iIEyAeeoac3FLuifZpY9tcNUD9kw= -github.com/golang/glog v1.1.1/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= +github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -169,8 +170,8 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= @@ -185,7 +186,10 @@ github.com/herumi/bls-eth-go-binary v1.32.1 h1:FbSbbNiWmuR9CWkMzFQWT5yujSn4wof48 github.com/herumi/bls-eth-go-binary v1.32.1/go.mod h1:luAnRm3OsMQeokhGzpYmc0ZKwawY7o87PUEP11Z7r7U= github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= +github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= +github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= github.com/huandu/go-clone v1.6.0 h1:HMo5uvg4wgfiy5FoGOqlFLQED/VGRm2D9Pi8g1FXPGc= +github.com/huandu/go-clone v1.6.0/go.mod h1:ReGivhG6op3GYr+UY3lS6mxjKp7MIGTknuU5TbTVaXE= github.com/huandu/go-clone/generic v1.6.0 h1:Wgmt/fUZ28r16F2Y3APotFD59sHk1p78K0XLdbUYN5U= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -211,15 +215,14 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= @@ -230,22 +233,23 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 h1:4kuARK6Y6FxaNu/BnU2OAaLF86eTVhP2hjTB6iMvItA= github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8= -github.com/pelletier/go-toml/v2 v2.0.9 h1:uH2qQXheeefCCkuBBSLi7jCiSmj3VRh2+Goq2N7Xxu0= -github.com/pelletier/go-toml/v2 v2.0.9/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= +github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= +github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= -github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= -github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= -github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/protolambda/zssz v0.1.5 h1:7fjJjissZIIaa2QcvmhS/pZISMX21zVITt49sW1ouek= github.com/protolambda/zssz v0.1.5/go.mod h1:a4iwOX5FE7/JkKA+J/PH0Mjo9oXftN6P8NZyL28gpag= github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 h1:0tVE4tdWQK9ZpYygoV7+vS6QkDvQVySboMVEIxBJmXw= @@ -258,31 +262,34 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.30.0 h1:SymVODrcRsaRaSInD9yQtKbtWqwsfoPcRff/oRXLj4c= -github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w= +github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= +github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ= +github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 h1:Xuk8ma/ibJ1fOy4Ee11vHhUFHQNpHhrBneOCNHVXS5w= github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0/go.mod h1:7AwjWCpdPhkSmNAgUv5C7EJ4AbmjEB3r047r3DXWu3Y= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM= -github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= +github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= +github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= -github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= -github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= +github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= +github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= @@ -291,8 +298,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= -github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/umbracle/gohashtree v0.0.2-alpha.0.20230207094856-5b775a815c10 h1:CQh33pStIp/E30b7TxDlXfM0145bn2e8boI30IxAhTg= @@ -308,8 +315,8 @@ github.com/wealdtech/go-eth2-util v1.8.2 h1:gq+JMrnadifyKadUr75wmfP7+usiqMu9t3VV github.com/wealdtech/go-eth2-util v1.8.2/go.mod h1:/80GAK0K/3+PqUBZHvaOPd3b1sjHeimxQh1nrJzgaPk= github.com/wealdtech/go-eth2-wallet v1.16.0 h1:syD1xDYB7emk4x+6bTYm5VZp9nx5FLab5Fgm09Eq1Kg= github.com/wealdtech/go-eth2-wallet v1.16.0/go.mod h1:JFA2P7PpPR8quQ/T6Gsr/4VLj5sQVnyzKgfPA+eqmYE= -github.com/wealdtech/go-eth2-wallet-dirk v1.4.4 h1:zPhDCJJvDn98/psfOwtlyDa0r+8c6u8MgXrOnMmcAtA= -github.com/wealdtech/go-eth2-wallet-dirk v1.4.4/go.mod h1:f5CupAod/d5xa0yOQlfxonpkqsh5XJG38RTkZJBKDiA= +github.com/wealdtech/go-eth2-wallet-dirk v1.4.5 h1:DXCgvGoA69rMLXSBsoAo4OreanQmgmEjMCf1GviuJhk= +github.com/wealdtech/go-eth2-wallet-dirk v1.4.5/go.mod h1:z1unDfX2/P4b26WfpMB2toHZ9EyVQtVtaSEz87eFavA= github.com/wealdtech/go-eth2-wallet-distributed v1.2.1 h1:+pbG9i9b5TrWd7GDRX8yq4FKA+D7k7aI6uySEvAZ+Kk= github.com/wealdtech/go-eth2-wallet-distributed v1.2.1/go.mod h1:jYkDax2VhUNKIct6TVlgxAagvR56/eg7y7J+JFq+gDo= github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.4.1 h1:9j7bpwjT9wmwBb54ZkBhTm1uNIlFFcCJXefd/YskZPw= @@ -342,15 +349,17 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0 h1:ZOLJc06r4CB42laIXg/7udr0pbZyuAihN10A/XuiQRY= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0/go.mod h1:5z+/ZWJQKXa9YT34fQNx5K8Hd1EoIhvtUygUQPqEOgQ= -go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= -go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= -go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo= -go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4= -go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= -go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0 h1:RsQi0qJ2imFfCvZabqzM9cNXBG8k6gXMv1A0cXRmH6A= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0/go.mod h1:vsh3ySueQCiKPxFLvjWC4Z135gIa34TQ/NSqkDTZYUM= +go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= +go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= +go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= +go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= +go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= +go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -371,6 +380,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= +golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -443,7 +454,7 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8= +golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -455,8 +466,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -495,17 +506,15 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -578,8 +587,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -645,12 +654,12 @@ google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211027162914-98a5263abeca/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 h1:L6iMMGrtzgHsWofoFcihmDEMYeDR9KN/ThbPWGrh++g= -google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= -google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 h1:nIgk/EEq3/YlnmVVXVnm14rC2oxgs1o0ong4sD/rd44= -google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5 h1:eSaPbMR4T7WfH9FvABk36NBMacoTUKdWCvV0dx+KfOg= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5/go.mod h1:zBEcrKX2ZOcEkHWxBPAIvYUWOKKMIhYcmNiUIu2ji3I= +google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 h1:I6WNifs6pF9tNdSob2W24JtyxIYjzFB9qDlpUC76q+U= +google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405/go.mod h1:3WDQMjmJk36UQhjQ89emUzb1mdaHcPeeAh4SCBKznB4= +google.golang.org/genproto/googleapis/api v0.0.0-20231030173426-d783a09b4405 h1:HJMDndgxest5n2y77fnErkM62iUsptE/H8p0dC2Huo4= +google.golang.org/genproto/googleapis/api v0.0.0-20231030173426-d783a09b4405/go.mod h1:oT32Z4o8Zv2xPQTg0pbVaPr0MPOH6f14RgXt7zfIpwg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 h1:AB/lmRny7e2pLhFEYIbl5qkDAUt2h0ZRO4wGPhZf+ik= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405/go.mod h1:67X1fPuzjcrkymZzZV1vvkFeTn2Rvc6lYF9MYFGCcwE= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -671,8 +680,8 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/services/chaintime/standard/parameters.go b/services/chaintime/standard/parameters.go index 6118f30..cf22d84 100644 --- a/services/chaintime/standard/parameters.go +++ b/services/chaintime/standard/parameters.go @@ -27,7 +27,7 @@ type parameters struct { // Parameter is the interface for service parameters. type Parameter interface { - apply(*parameters) + apply(p *parameters) } type parameterFunc func(*parameters) diff --git a/services/chaintime/standard/service.go b/services/chaintime/standard/service.go index 8ef6dde..47da015 100644 --- a/services/chaintime/standard/service.go +++ b/services/chaintime/standard/service.go @@ -55,12 +55,12 @@ func New(ctx context.Context, params ...Parameter) (*Service, error) { } log.Trace().Time("genesis_time", genesisTime).Msg("Obtained genesis time") - spec, err := parameters.specProvider.Spec(ctx) + specResponse, err := parameters.specProvider.Spec(ctx) if err != nil { return nil, errors.Wrap(err, "failed to obtain spec") } - tmp, exists := spec["SECONDS_PER_SLOT"] + tmp, exists := specResponse.Data["SECONDS_PER_SLOT"] if !exists { return nil, errors.New("SECONDS_PER_SLOT not found in spec") } @@ -69,7 +69,7 @@ func New(ctx context.Context, params ...Parameter) (*Service, error) { return nil, errors.New("SECONDS_PER_SLOT of unexpected type") } - tmp, exists = spec["SLOTS_PER_EPOCH"] + tmp, exists = specResponse.Data["SLOTS_PER_EPOCH"] if !exists { return nil, errors.New("SLOTS_PER_EPOCH not found in spec") } @@ -79,7 +79,7 @@ func New(ctx context.Context, params ...Parameter) (*Service, error) { } var epochsPerSyncCommitteePeriod uint64 - if tmp, exists := spec["EPOCHS_PER_SYNC_COMMITTEE_PERIOD"]; exists { + if tmp, exists := specResponse.Data["EPOCHS_PER_SYNC_COMMITTEE_PERIOD"]; exists { tmp2, ok := tmp.(uint64) if !ok { return nil, errors.New("EPOCHS_PER_SYNC_COMMITTEE_PERIOD of unexpected type") @@ -237,11 +237,11 @@ func fetchAltairForkEpoch(ctx context.Context, error, ) { // Fetch the fork version. - spec, err := specProvider.Spec(ctx) + specResponse, err := specProvider.Spec(ctx) if err != nil { return 0, errors.Wrap(err, "failed to obtain spec") } - tmp, exists := spec["ALTAIR_FORK_EPOCH"] + tmp, exists := specResponse.Data["ALTAIR_FORK_EPOCH"] if !exists { return 0, errors.New("altair fork version not known by chain") } @@ -266,11 +266,11 @@ func fetchBellatrixForkEpoch(ctx context.Context, error, ) { // Fetch the fork version. - spec, err := specProvider.Spec(ctx) + specResponse, err := specProvider.Spec(ctx) if err != nil { return 0, errors.Wrap(err, "failed to obtain spec") } - tmp, exists := spec["BELLATRIX_FORK_EPOCH"] + tmp, exists := specResponse.Data["BELLATRIX_FORK_EPOCH"] if !exists { return 0, errors.New("bellatrix fork version not known by chain") } @@ -295,11 +295,11 @@ func fetchCapellaForkEpoch(ctx context.Context, error, ) { // Fetch the fork version. - spec, err := specProvider.Spec(ctx) + specResponse, err := specProvider.Spec(ctx) if err != nil { return 0, errors.Wrap(err, "failed to obtain spec") } - tmp, exists := spec["CAPELLA_FORK_EPOCH"] + tmp, exists := specResponse.Data["CAPELLA_FORK_EPOCH"] if !exists { return 0, errors.New("capella fork version not known by chain") } @@ -324,11 +324,11 @@ func fetchDenebForkEpoch(ctx context.Context, error, ) { // Fetch the fork version. - spec, err := specProvider.Spec(ctx) + specResponse, err := specProvider.Spec(ctx) if err != nil { return 0, errors.Wrap(err, "failed to obtain spec") } - tmp, exists := spec["DENEB_FORK_EPOCH"] + tmp, exists := specResponse.Data["DENEB_FORK_EPOCH"] if !exists { return 0, errors.New("deneb fork version not known by chain") } diff --git a/testing/mock/eth2client.go b/testing/mock/eth2client.go index 68fa3dd..e01107e 100644 --- a/testing/mock/eth2client.go +++ b/testing/mock/eth2client.go @@ -18,7 +18,8 @@ import ( "time" eth2client "github.com/attestantio/go-eth2-client" - api "github.com/attestantio/go-eth2-client/api/v1" + "github.com/attestantio/go-eth2-client/api" + apiv1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec" "github.com/attestantio/go-eth2-client/spec/phase0" ) @@ -42,7 +43,7 @@ func (m *GenesisTimeProvider) GenesisTime(_ context.Context) (time.Time, error) // SpecProvider is a mock for eth2client.SpecProvider. type SpecProvider struct { - spec map[string]interface{} + spec map[string]any } // NewSpecProvider returns a mock spec provider with the provided values. @@ -51,7 +52,7 @@ func NewSpecProvider(slotDuration time.Duration, epochsPerSyncCommitteePeriod uint64, ) eth2client.SpecProvider { return &SpecProvider{ - spec: map[string]interface{}{ + spec: map[string]any{ "SECONDS_PER_SLOT": slotDuration, "SLOTS_PER_EPOCH": slotsPerEpoch, "EPOCHS_PER_SYNC_COMMITTEE_PERIOD": epochsPerSyncCommitteePeriod, @@ -60,8 +61,11 @@ func NewSpecProvider(slotDuration time.Duration, } // Spec is a mock. -func (m *SpecProvider) Spec(_ context.Context) (map[string]interface{}, error) { - return m.spec, nil +func (m *SpecProvider) Spec(_ context.Context) (*api.Response[map[string]any], error) { + return &api.Response[map[string]any]{ + Data: m.spec, + Metadata: make(map[string]any), + }, nil } // ForkScheduleProvider is a mock for eth2client.ForkScheduleProvider. @@ -77,8 +81,11 @@ func NewForkScheduleProvider(schedule []*phase0.Fork) eth2client.ForkSchedulePro } // ForkSchedule is a mock. -func (m *ForkScheduleProvider) ForkSchedule(_ context.Context) ([]*phase0.Fork, error) { - return m.schedule, nil +func (m *ForkScheduleProvider) ForkSchedule(_ context.Context) (*api.Response[[]*phase0.Fork], error) { + return &api.Response[[]*phase0.Fork]{ + Data: m.schedule, + Metadata: make(map[string]any), + }, nil } // SlotsPerEpochProvider is a mock for eth2client.SlotsPerEpochProvider. @@ -146,6 +153,6 @@ func NewBeaconCommitteeSubscriptionsSubmitter() eth2client.BeaconCommitteeSubscr } // SubmitBeaconCommitteeSubscriptions is a mock. -func (m *BeaconCommitteeSubscriptionsSubmitter) SubmitBeaconCommitteeSubscriptions(_ context.Context, _ []*api.BeaconCommitteeSubscription) error { +func (m *BeaconCommitteeSubscriptionsSubmitter) SubmitBeaconCommitteeSubscriptions(_ context.Context, _ []*apiv1.BeaconCommitteeSubscription) error { return nil } diff --git a/util/beaconheadercache.go b/util/beaconheadercache.go index e8e3793..db8f03c 100644 --- a/util/beaconheadercache.go +++ b/util/beaconheadercache.go @@ -18,6 +18,7 @@ import ( "fmt" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" apiv1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec/phase0" ) @@ -50,18 +51,18 @@ func (b *BeaconBlockHeaderCache) Fetch(ctx context.Context, ) { entry, exists := b.entries[slot] if !exists { - header, err := b.beaconBlockHeadersProvider.BeaconBlockHeader(ctx, fmt.Sprintf("%d", slot)) + response, err := b.beaconBlockHeadersProvider.BeaconBlockHeader(ctx, &api.BeaconBlockHeaderOpts{Block: fmt.Sprintf("%d", slot)}) if err != nil { return nil, err } - if header == nil { + if response.Data == nil { entry = &beaconBlockHeaderEntry{ present: false, } } else { entry = &beaconBlockHeaderEntry{ present: true, - value: header, + value: response.Data, } } b.entries[slot] = entry diff --git a/util/networks.go b/util/networks.go index cfab4ca..145fd99 100644 --- a/util/networks.go +++ b/util/networks.go @@ -15,7 +15,7 @@ package util import ( "context" - "fmt" + "encoding/hex" eth2client "github.com/attestantio/go-eth2-client" "github.com/pkg/errors" @@ -45,14 +45,11 @@ func Network(ctx context.Context, eth2Client eth2client.Service) (string, error) if !isProvider { return "", errors.New("client does not provide deposit contract address") } - config, err := provider.Spec(ctx) + specResponse, err := provider.Spec(ctx) if err != nil { return "", errors.Wrap(err, "failed to obtain chain specification") } - if config == nil { - return "", errors.New("failed to return chain specification") - } - depositContractAddress, exists := config["DEPOSIT_CONTRACT_ADDRESS"] + depositContractAddress, exists := specResponse.Data["DEPOSIT_CONTRACT_ADDRESS"] if exists { address = depositContractAddress.([]byte) } @@ -62,7 +59,7 @@ func Network(ctx context.Context, eth2Client eth2client.Service) (string, error) // network returns a network given an Ethereum 1 contract address. func network(address []byte) string { - if network, exists := networks[fmt.Sprintf("%x", address)]; exists { + if network, exists := networks[hex.EncodeToString(address)]; exists { return network } return "Unknown" diff --git a/util/networks_test.go b/util/networks_test.go index 02eeceb..9a0c3de 100644 --- a/util/networks_test.go +++ b/util/networks_test.go @@ -18,6 +18,7 @@ import ( "testing" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" "github.com/stretchr/testify/require" "github.com/wealdtech/ethdo/testutil" "github.com/wealdtech/ethdo/util" @@ -39,9 +40,12 @@ func (c *specETH2Client) Address() string { } // Spec provides the spec information of the chain. -func (c *specETH2Client) Spec(ctx context.Context) (map[string]interface{}, error) { - return map[string]interface{}{ - "DEPOSIT_CONTRACT_ADDRESS": c.address, +func (c *specETH2Client) Spec(ctx context.Context) (*api.Response[map[string]any], error) { + return &api.Response[map[string]any]{ + Data: map[string]any{ + "DEPOSIT_CONTRACT_ADDRESS": c.address, + }, + Metadata: make(map[string]any), }, nil } diff --git a/util/validator.go b/util/validator.go index e368f71..355effa 100644 --- a/util/validator.go +++ b/util/validator.go @@ -22,6 +22,7 @@ import ( "time" consensusclient "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" e2wtypes "github.com/wealdtech/go-eth2-wallet-types/v2" @@ -67,12 +68,15 @@ func accountToIndex(ctx context.Context, account e2wtypes.Account, client consen pubKeys := make([]phase0.BLSPubKey, 1) copy(pubKeys[0][:], pubKey.Marshal()) - validators, err := client.(consensusclient.ValidatorsProvider).ValidatorsByPubKey(ctx, "head", pubKeys) + validatorsResponse, err := client.(consensusclient.ValidatorsProvider).Validators(ctx, &api.ValidatorsOpts{ + State: "head", + PubKeys: pubKeys, + }) if err != nil { return 0, err } - for index := range validators { + for index := range validatorsResponse.Data { return index, nil } return 0, errors.New("validator not found") diff --git a/util/validators.go b/util/validators.go index 1f153ba..76a53a7 100644 --- a/util/validators.go +++ b/util/validators.go @@ -20,6 +20,7 @@ import ( "strings" eth2client "github.com/attestantio/go-eth2-client" + "github.com/attestantio/go-eth2-client/api" apiv1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" @@ -47,11 +48,11 @@ func ParseValidators(ctx context.Context, validatorsProvider eth2client.Validato for index := low; index <= high; index++ { indices = append(indices, phase0.ValidatorIndex(index)) } - rangeValidators, err := validatorsProvider.Validators(ctx, stateID, indices) + response, err := validatorsProvider.Validators(ctx, &api.ValidatorsOpts{State: stateID, Indices: indices}) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("failed to obtain validators %s", validatorsStr[i])) } - for _, validator := range rangeValidators { + for _, validator := range response.Data { validators = append(validators, validator) } } else { @@ -79,10 +80,14 @@ func ParseValidator(ctx context.Context, // Could be a simple index. index, err := strconv.ParseUint(validatorStr, 10, 64) if err == nil { - validators, err = validatorsProvider.Validators(ctx, stateID, []phase0.ValidatorIndex{phase0.ValidatorIndex(index)}) + response, err := validatorsProvider.Validators(ctx, &api.ValidatorsOpts{ + State: stateID, + Indices: []phase0.ValidatorIndex{phase0.ValidatorIndex(index)}, + }) if err != nil { return nil, errors.Wrap(err, "failed to obtain validator information") } + validators = response.Data } else { // Some sort of specifier. account, err := ParseAccount(ctx, validatorStr, nil, false) @@ -96,13 +101,14 @@ func ParseValidator(ctx context.Context, } pubKey := phase0.BLSPubKey{} copy(pubKey[:], accPubKey.Marshal()) - validators, err = validatorsProvider.ValidatorsByPubKey(ctx, - stateID, - []phase0.BLSPubKey{pubKey}, - ) + validatorsResponse, err := validatorsProvider.Validators(ctx, &api.ValidatorsOpts{ + State: stateID, + PubKeys: []phase0.BLSPubKey{pubKey}, + }) if err != nil { return nil, errors.Wrap(err, "failed to obtain validator information") } + validators = validatorsResponse.Data } // Validator is first and only entry in the map.