Compare commits

...

5 Commits

Author SHA1 Message Date
Jim McDonald
58de55b40f Bump version. 2021-11-03 13:32:09 +00:00
Jim McDonald
22dad263db Use faster method to obtain sync committees for future epochs. 2021-11-03 13:31:46 +00:00
Jim McDonald
81fa11ad45 Provide sync committee slots in chain status. 2021-11-03 13:29:26 +00:00
Jim McDonald
f5c4551c0c Clarify use of --connection. 2021-11-02 11:39:00 +00:00
Jim McDonald
a00d09e28f Do not report insecure local connection. 2021-11-01 09:46:53 +00:00
8 changed files with 26 additions and 8 deletions

View File

@@ -1,3 +1,7 @@
1.15.1:
- provide sync committee slots in "chain status"
- clarify that --connection should be a URL
1.15.0:
- add --period to "synccommittee members", can be "current", "next"
- add "validator expectation"

View File

@@ -119,9 +119,11 @@ In quiet mode this will return 0 if the chain status can be obtained, otherwise
if epoch >= chainTime.AltairInitialEpoch() {
period := chainTime.SlotToSyncCommitteePeriod(slot)
periodStartEpoch := chainTime.FirstEpochOfSyncPeriod(period)
periodStartSlot := chainTime.FirstSlotOfEpoch(periodStartEpoch)
nextPeriod := period + 1
nextPeriodStartEpoch := chainTime.FirstEpochOfSyncPeriod(nextPeriod)
periodEndEpoch := nextPeriodStartEpoch - 1
periodEndSlot := chainTime.FirstSlotOfEpoch(periodEndEpoch+1) - 1
nextPeriodTimestamp := chainTime.StartOfEpoch(nextPeriodStartEpoch)
res.WriteString("Sync committee period: ")
@@ -135,6 +137,12 @@ In quiet mode this will return 0 if the chain status can be obtained, otherwise
res.WriteString(fmt.Sprintf("%d", periodEndEpoch))
res.WriteString("\n")
res.WriteString("Sync committee slots: ")
res.WriteString(fmt.Sprintf("%d", periodStartSlot))
res.WriteString("-")
res.WriteString(fmt.Sprintf("%d", periodEndSlot))
res.WriteString("\n")
res.WriteString("Time until next sync committee period: ")
res.WriteString(time.Until(nextPeriodTimestamp).Round(time.Second).String())
res.WriteString("\n")

View File

@@ -201,7 +201,7 @@ func init() {
if err := viper.BindPFlag("debug", RootCmd.PersistentFlags().Lookup("debug")); err != nil {
panic(err)
}
RootCmd.PersistentFlags().String("connection", "localhost:4000", "connection to an Ethereum 2 node")
RootCmd.PersistentFlags().String("connection", "http://localhost:3500", "URL to an Ethereum 2 node's RET API endpoint")
if err := viper.BindPFlag("connection", RootCmd.PersistentFlags().Lookup("connection")); err != nil {
panic(err)
}

View File

@@ -33,7 +33,7 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) {
return nil, err
}
syncCommittee, err := data.eth2Client.(eth2client.SyncCommitteesProvider).SyncCommittee(ctx, fmt.Sprintf("%d", data.chainTime.FirstSlotOfEpoch(epoch)))
syncCommittee, err := data.eth2Client.(eth2client.SyncCommitteesProvider).SyncCommitteeAtEpoch(ctx, "head", epoch)
if err != nil {
return nil, errors.Wrap(err, "failed to obtain sync committee information")
}

View File

@@ -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.15.0)"
var ReleaseVersion = "local build (latest release 1.15.1)"
// versionCmd represents the version command
var versionCmd = &cobra.Command{

4
go.mod
View File

@@ -5,11 +5,11 @@ go 1.16
require (
github.com/OneOfOne/xxhash v1.2.5 // indirect
github.com/attestantio/dirk v1.0.4
github.com/attestantio/go-eth2-client v0.8.0
github.com/attestantio/go-eth2-client v0.8.1
github.com/ferranbt/fastssz v0.0.0-20210905181407-59cf6761a7d5
github.com/gofrs/uuid v4.0.0+incompatible
github.com/google/uuid v1.3.0
github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b // indirect
github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b
github.com/hashicorp/hcl v1.0.1-vault-3 // indirect
github.com/herumi/bls-eth-go-binary v0.0.0-20210902234237-7763804ee078
github.com/minio/highwayhash v1.0.2 // indirect

4
go.sum
View File

@@ -65,8 +65,8 @@ github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj
github.com/attestantio/dirk v1.0.4 h1:e5WFS3RxTvtk3BgLjUACItCcjwer07QiYWXP0pjnbZM=
github.com/attestantio/dirk v1.0.4/go.mod h1:w9QSIVDKMqD7tjK4e5wrTUCyCNlXaDT8U3SfJ+JOsx4=
github.com/attestantio/go-eth2-client v0.7.2/go.mod h1:kEK9iAAOBoADO5wEkd84FEOzjT1zXgVWveQsqn+uBGg=
github.com/attestantio/go-eth2-client v0.8.0 h1:5aUmXOW5vdYxjV0nJpN2qUJlfXbf78266ga2e667Lp4=
github.com/attestantio/go-eth2-client v0.8.0/go.mod h1:kEK9iAAOBoADO5wEkd84FEOzjT1zXgVWveQsqn+uBGg=
github.com/attestantio/go-eth2-client v0.8.1 h1:KR9FVsEr7t/Gr7bmfONI8itYGDrOgnDuyIYFsfwGGdA=
github.com/attestantio/go-eth2-client v0.8.1/go.mod h1:kEK9iAAOBoADO5wEkd84FEOzjT1zXgVWveQsqn+uBGg=
github.com/aws/aws-sdk-go v1.33.17/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go v1.40.41 h1:v/Y4bB8+wHCONtKV+fuHTzLiqC08lk8e9HqYhRB9PBQ=
github.com/aws/aws-sdk-go v1.40.41/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q=

View File

@@ -17,6 +17,7 @@ import (
"context"
"fmt"
"net/url"
"strings"
"time"
eth2client "github.com/attestantio/go-eth2-client"
@@ -31,6 +32,9 @@ func ConnectToBeaconNode(ctx context.Context, address string, timeout time.Durat
return nil, errors.New("no timeout specified")
}
if !strings.HasPrefix(address, "http") {
address = fmt.Sprintf("http://%s", address)
}
if !allowInsecure {
// Ensure the connection is either secure or local.
connectionURL, err := url.Parse(address)
@@ -39,7 +43,9 @@ func ConnectToBeaconNode(ctx context.Context, address string, timeout time.Durat
}
if connectionURL.Scheme == "http" &&
connectionURL.Host != "localhost" &&
connectionURL.Host != "127.0.0.1" {
!strings.HasPrefix(connectionURL.Host, "localhost:") &&
connectionURL.Host != "127.0.0.1" &&
!strings.HasPrefix(connectionURL.Host, "127.0.0.1:") {
fmt.Println("Connections to remote beacon nodes should be secure. This warning can be silenced with --allow-insecure-connections")
}
}