Skip to content

Commit

Permalink
Support for custom spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed May 14, 2024
1 parent 7e09068 commit 083f484
Show file tree
Hide file tree
Showing 51 changed files with 250 additions and 171 deletions.
25 changes: 14 additions & 11 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
# This file is not a configuration example,
# it contains the exhaustive configuration with explanations of the options.

issues:
# Which files to exclude: they will be analyzed, but issues from them won't be reported.
# There is no need to include all autogenerated files,
# we confidently recognize autogenerated files.
# If it's not, please let us know.
# "/" will be replaced by current OS file path separator to properly work on Windows.
# Default: []
exclude-files:
- ".*_ssz\\.go$"

# Options for analysis running.
run:
# The default concurrency value is the number of available CPU.
Expand Down Expand Up @@ -39,15 +49,6 @@ run:
# Default: true
# skip-dirs-use-default: false

# Which files to skip: they will be analyzed, but issues from them won't be reported.
# Default value is empty list,
# but there is no need to include all autogenerated files,
# we confidently recognize autogenerated files.
# If it's not please let us know.
# "/" will be replaced by current OS file path separator to properly work on Windows.
skip-files:
- ".*_ssz\\.go$"

# If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
Expand All @@ -68,7 +69,7 @@ run:
# Define the Go version limit.
# Mainly related to generics support since go1.18.
# Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.18
go: '1.19'
# go: '1.19'


# output configuration options
Expand Down Expand Up @@ -130,7 +131,9 @@ linters:
- deadcode
- depguard
- dupl
- err113
- errorlint
- execinquery
- exhaustive
- exhaustivestruct
- exhaustruct
Expand All @@ -142,7 +145,6 @@ linters:
- gochecknoinits
- gocognit
- goconst
- goerr113
- goheader
- golint
- gomnd
Expand All @@ -152,6 +154,7 @@ linters:
- lll
- maintidx
- maligned
- mnd
- musttag
- nestif
- nilnil
Expand Down
2 changes: 1 addition & 1 deletion cmd/accountimport.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
var accountImportCmd = &cobra.Command{
Use: "import",
Short: "Import an account",
Long: `Import an account from its private key. For example:
Long: `Import an account from its private key or keystore. For example:
ethdo account import --account="primary/testing" --key="0x..." --passphrase="my secret"
Expand Down
9 changes: 5 additions & 4 deletions cmd/attester/duties/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ func input(ctx context.Context) (*dataIn, error) {
// Ethereum 2 client.
var err error
data.eth2Client, err = util.ConnectToBeaconNode(ctx, &util.ConnectOpts{
Address: viper.GetString("connection"),
Timeout: viper.GetDuration("timeout"),
AllowInsecure: viper.GetBool("allow-insecure-connections"),
LogFallback: !data.quiet,
Address: viper.GetString("connection"),
Timeout: viper.GetDuration("timeout"),
AllowInsecure: viper.GetBool("allow-insecure-connections"),
CustomSpecSupport: viper.GetBool("custom-spec"),
LogFallback: !data.quiet,
})
if err != nil {
return nil, err
Expand Down
9 changes: 5 additions & 4 deletions cmd/attester/inclusion/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ func input(ctx context.Context) (*dataIn, error) {
// Ethereum 2 client.
var err error
data.eth2Client, err = util.ConnectToBeaconNode(ctx, &util.ConnectOpts{
Address: viper.GetString("connection"),
Timeout: viper.GetDuration("timeout"),
AllowInsecure: viper.GetBool("allow-insecure-connections"),
LogFallback: !data.quiet,
Address: viper.GetString("connection"),
Timeout: viper.GetDuration("timeout"),
AllowInsecure: viper.GetBool("allow-insecure-connections"),
CustomSpecSupport: viper.GetBool("custom-spec"),
LogFallback: !data.quiet,
})
if err != nil {
return nil, err
Expand Down
2 changes: 2 additions & 0 deletions cmd/block/analyze/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type command struct {
timeout time.Duration
connection string
allowInsecureConnections bool
customSpecSupport bool

// Operation.
blockID string
Expand Down Expand Up @@ -124,6 +125,7 @@ func newCommand(_ context.Context) (*command, error) {

c.connection = viper.GetString("connection")
c.allowInsecureConnections = viper.GetBool("allow-insecure-connections")
c.customSpecSupport = viper.GetBool("custom-spec")

c.blockID = viper.GetString("blockid")
c.stream = viper.GetBool("stream")
Expand Down
9 changes: 5 additions & 4 deletions cmd/block/analyze/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,11 @@ func (c *command) setup(ctx context.Context) error {

// Connect to the client.
c.eth2Client, err = util.ConnectToBeaconNode(ctx, &util.ConnectOpts{
Address: c.connection,
Timeout: c.timeout,
AllowInsecure: c.allowInsecureConnections,
LogFallback: !c.quiet,
Address: c.connection,
Timeout: c.timeout,
AllowInsecure: c.allowInsecureConnections,
CustomSpecSupport: c.customSpecSupport,
LogFallback: !c.quiet,
})
if err != nil {
return errors.Wrap(err, "failed to connect to beacon node")
Expand Down
9 changes: 5 additions & 4 deletions cmd/block/info/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ func input(ctx context.Context) (*dataIn, error) {

var err error
data.eth2Client, err = util.ConnectToBeaconNode(ctx, &util.ConnectOpts{
Address: viper.GetString("connection"),
Timeout: viper.GetDuration("timeout"),
AllowInsecure: viper.GetBool("allow-insecure-connections"),
LogFallback: !data.quiet,
Address: viper.GetString("connection"),
Timeout: viper.GetDuration("timeout"),
AllowInsecure: viper.GetBool("allow-insecure-connections"),
CustomSpecSupport: viper.GetBool("custom-spec"),
LogFallback: !data.quiet,
})
if err != nil {
return nil, err
Expand Down
10 changes: 6 additions & 4 deletions cmd/chain/eth1votes/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type command struct {
timeout time.Duration
connection string
allowInsecureConnections bool
customSpecSupport bool

// Input.
xepoch string
Expand Down Expand Up @@ -64,10 +65,11 @@ type vote struct {

func newCommand(_ context.Context) (*command, error) {
c := &command{
quiet: viper.GetBool("quiet"),
verbose: viper.GetBool("verbose"),
debug: viper.GetBool("debug"),
json: viper.GetBool("json"),
quiet: viper.GetBool("quiet"),
verbose: viper.GetBool("verbose"),
debug: viper.GetBool("debug"),
json: viper.GetBool("json"),
customSpecSupport: viper.GetBool("custom-spec"),
}

// Timeout.
Expand Down
9 changes: 5 additions & 4 deletions cmd/chain/eth1votes/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ func (c *command) setup(ctx context.Context) error {

// Connect to the client.
c.eth2Client, err = util.ConnectToBeaconNode(ctx, &util.ConnectOpts{
Address: c.connection,
Timeout: c.timeout,
AllowInsecure: c.allowInsecureConnections,
LogFallback: !c.quiet,
Address: c.connection,
Timeout: c.timeout,
AllowInsecure: c.allowInsecureConnections,
CustomSpecSupport: c.customSpecSupport,
LogFallback: !c.quiet,
})
if err != nil {
return errors.Wrap(err, "failed to connect to beacon node")
Expand Down
10 changes: 6 additions & 4 deletions cmd/chain/queues/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type command struct {
timeout time.Duration
connection string
allowInsecureConnections bool
customSpecSupport bool

// Input.
epoch string
Expand All @@ -49,10 +50,11 @@ type command struct {

func newCommand(_ context.Context) (*command, error) {
c := &command{
quiet: viper.GetBool("quiet"),
verbose: viper.GetBool("verbose"),
debug: viper.GetBool("debug"),
json: viper.GetBool("json"),
quiet: viper.GetBool("quiet"),
verbose: viper.GetBool("verbose"),
debug: viper.GetBool("debug"),
json: viper.GetBool("json"),
customSpecSupport: viper.GetBool("custom-spec"),
}

// Timeout.
Expand Down
9 changes: 5 additions & 4 deletions cmd/chain/queues/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ func (c *command) setup(ctx context.Context) error {

// Connect to the client.
c.eth2Client, err = util.ConnectToBeaconNode(ctx, &util.ConnectOpts{
Address: c.connection,
Timeout: c.timeout,
AllowInsecure: c.allowInsecureConnections,
LogFallback: !c.quiet,
Address: c.connection,
Timeout: c.timeout,
AllowInsecure: c.allowInsecureConnections,
CustomSpecSupport: c.customSpecSupport,
LogFallback: !c.quiet,
})
if err != nil {
return errors.Wrap(err, "failed to connect to beacon node")
Expand Down
2 changes: 2 additions & 0 deletions cmd/chain/time/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type dataIn struct {
// Input
connection string
allowInsecureConnections bool
customSpecSupport bool
timestamp string
slot string
epoch string
Expand Down Expand Up @@ -73,6 +74,7 @@ func input(_ context.Context) (*dataIn, error) {

data.connection = viper.GetString("connection")
data.allowInsecureConnections = viper.GetBool("allow-insecure-connections")
data.customSpecSupport = viper.GetBool("custom-spec")

return data, nil
}
9 changes: 5 additions & 4 deletions cmd/chain/time/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) {
}

eth2Client, err := util.ConnectToBeaconNode(ctx, &util.ConnectOpts{
Address: data.connection,
Timeout: data.timeout,
AllowInsecure: data.allowInsecureConnections,
LogFallback: !data.quiet,
Address: data.connection,
Timeout: data.timeout,
AllowInsecure: data.allowInsecureConnections,
CustomSpecSupport: data.customSpecSupport,
LogFallback: !data.quiet,
})
if err != nil {
return nil, errors.Wrap(err, "failed to connect to Ethereum 2 beacon node")
Expand Down
8 changes: 5 additions & 3 deletions cmd/chain/verify/signedcontributionandproof/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type command struct {
timeout time.Duration
connection string
allowInsecureConnections bool
customSpecSupport bool

// Input.
data string
Expand Down Expand Up @@ -60,9 +61,10 @@ type command struct {

func newCommand(_ context.Context) (*command, error) {
c := &command{
quiet: viper.GetBool("quiet"),
verbose: viper.GetBool("verbose"),
debug: viper.GetBool("debug"),
quiet: viper.GetBool("quiet"),
verbose: viper.GetBool("verbose"),
debug: viper.GetBool("debug"),
customSpecSupport: viper.GetBool("custom-spec"),
}

// Timeout.
Expand Down
9 changes: 5 additions & 4 deletions cmd/chain/verify/signedcontributionandproof/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@ func (c *command) setup(ctx context.Context) error {

// Connect to the client.
c.eth2Client, err = util.ConnectToBeaconNode(ctx, &util.ConnectOpts{
Address: c.connection,
Timeout: c.timeout,
AllowInsecure: c.allowInsecureConnections,
LogFallback: !c.quiet,
Address: c.connection,
Timeout: c.timeout,
AllowInsecure: c.allowInsecureConnections,
CustomSpecSupport: c.customSpecSupport,
LogFallback: !c.quiet,
})
if err != nil {
return errors.Wrap(err, "failed to connect to beacon node")
Expand Down
9 changes: 5 additions & 4 deletions cmd/chaininfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ In quiet mode this will return 0 if the chain information can be obtained, other
ctx := context.Background()

eth2Client, err := util.ConnectToBeaconNode(ctx, &util.ConnectOpts{
Address: viper.GetString("connection"),
Timeout: viper.GetDuration("timeout"),
AllowInsecure: viper.GetBool("allow-insecure-connections"),
LogFallback: !viper.GetBool("quiet"),
Address: viper.GetString("connection"),
Timeout: viper.GetDuration("timeout"),
AllowInsecure: viper.GetBool("allow-insecure-connections"),
CustomSpecSupport: viper.GetBool("custom-spec"),
LogFallback: !viper.GetBool("quiet"),
})
errCheck(err, "Failed to connect to Ethereum 2 beacon node")

Expand Down
9 changes: 5 additions & 4 deletions cmd/chainspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ In quiet mode this will return 0 if the chain specification can be obtained, oth
ctx := context.Background()

eth2Client, err := util.ConnectToBeaconNode(ctx, &util.ConnectOpts{
Address: viper.GetString("connection"),
Timeout: viper.GetDuration("timeout"),
AllowInsecure: viper.GetBool("allow-insecure-connections"),
LogFallback: !viper.GetBool("quiet"),
Address: viper.GetString("connection"),
Timeout: viper.GetDuration("timeout"),
AllowInsecure: viper.GetBool("allow-insecure-connections"),
CustomSpecSupport: viper.GetBool("custom-spec"),
LogFallback: !viper.GetBool("quiet"),
})
errCheck(err, "Failed to connect to Ethereum consensus node")

Expand Down
9 changes: 5 additions & 4 deletions cmd/chainstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ In quiet mode this will return 0 if the chain status can be obtained, otherwise
ctx := context.Background()

eth2Client, err := util.ConnectToBeaconNode(ctx, &util.ConnectOpts{
Address: viper.GetString("connection"),
Timeout: viper.GetDuration("timeout"),
AllowInsecure: viper.GetBool("allow-insecure-connections"),
LogFallback: !viper.GetBool("quiet"),
Address: viper.GetString("connection"),
Timeout: viper.GetDuration("timeout"),
AllowInsecure: viper.GetBool("allow-insecure-connections"),
CustomSpecSupport: viper.GetBool("custom-spec"),
LogFallback: !viper.GetBool("quiet"),
})
errCheck(err, "Failed to connect to Ethereum 2 beacon node")

Expand Down
2 changes: 2 additions & 0 deletions cmd/epoch/summary/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type command struct {
timeout time.Duration
connection string
allowInsecureConnections bool
customSpecSupport bool

// Operation.
epoch string
Expand Down Expand Up @@ -108,6 +109,7 @@ func newCommand(_ context.Context) (*command, error) {

c.connection = viper.GetString("connection")
c.allowInsecureConnections = viper.GetBool("allow-insecure-connections")
c.customSpecSupport = viper.GetBool("custom-spec")

c.epoch = viper.GetString("epoch")
c.stream = viper.GetBool("stream")
Expand Down
9 changes: 5 additions & 4 deletions cmd/epoch/summary/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,11 @@ func (c *command) setup(ctx context.Context) error {

// Connect to the client.
c.eth2Client, err = util.ConnectToBeaconNode(ctx, &util.ConnectOpts{
Address: c.connection,
Timeout: c.timeout,
AllowInsecure: c.allowInsecureConnections,
LogFallback: !c.quiet,
Address: c.connection,
Timeout: c.timeout,
AllowInsecure: c.allowInsecureConnections,
CustomSpecSupport: c.customSpecSupport,
LogFallback: !c.quiet,
})
if err != nil {
return errors.Wrap(err, "failed to connect to beacon node")
Expand Down
Loading

0 comments on commit 083f484

Please sign in to comment.