Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

DKG v3.0.0 #158

Merged
merged 41 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4d18fa2
Spec align (#97)
MatusKysel Apr 17, 2024
e9a6439
add message explanations for errors (#101)
pavelkrolevets Apr 26, 2024
ace61ed
Merge pull request #112 from ssvlabs/main
MatusKysel Sep 2, 2024
8d55ffd
Re-sign and re-share using proofs and EIP1271 signature (#100)
pavelkrolevets Sep 3, 2024
454b91c
Bugfixes (#107)
MatusKysel Sep 3, 2024
5950782
add refactor from past (#113)
MatusKysel Sep 3, 2024
0798529
Rename imports (#108)
MatusKysel Sep 3, 2024
157411e
fix amount marshaling and keyshare version
MatusKysel Sep 4, 2024
1e2797d
fix tests
MatusKysel Sep 4, 2024
807e6f4
Minimum requirements (#40)
pavelkrolevets Sep 5, 2024
f4f24db
change spec repo (temporary)
pavelkrolevets Sep 5, 2024
a12a06a
fix encrypted share
pavelkrolevets Sep 9, 2024
f486ca2
fix tests
pavelkrolevets Sep 10, 2024
055d766
Merge pull request #117 from ssvlabs/bugfixes
pavelkrolevets Sep 16, 2024
6fd2fac
verify dkg results (#125)
MatusKysel Sep 30, 2024
08c434e
4.1 Arbitrary Path Access (#132)
pavelkrolevets Oct 1, 2024
7d5902f
Supports multisig wallets and bulk resign/reshare operations (#135)
alan-ssvlabs Oct 3, 2024
31e1f0d
re-enable tests (#136)
MatusKysel Oct 3, 2024
c1036e1
Ping multisig (#137)
pavelkrolevets Oct 4, 2024
691df4f
3.1 Denial of Service by Malicious Initiator (#130)
pavelkrolevets Oct 4, 2024
cd72b7d
Pectra ready: update accordning to EIP-7251: Increase the MAX_EFFECTI…
pavelkrolevets Oct 7, 2024
f6c9d0c
fix json marshal/unmarshal for resign/reshare json (#141)
pavelkrolevets Oct 10, 2024
b247425
Resign reshare add `0x` (#142)
pavelkrolevets Oct 13, 2024
c55878f
fix generation command (#143)
MatusKysel Oct 15, 2024
9ca6c05
Change message hash to align with Gnosis SDK for multisig (#144)
pavelkrolevets Oct 18, 2024
559ddf0
Fix amount check at deposit validate lost after merges (#145)
pavelkrolevets Oct 22, 2024
b2c6480
add more verbose error (#146)
MatusKysel Oct 24, 2024
1a56594
Audit fix: Insecure TLS Default Configuration (#147)
pavelkrolevets Oct 25, 2024
859e050
Better logs (#139)
pavelkrolevets Oct 31, 2024
581fb7f
fix audit issue 5.2 Missing Signature Check (#149)
pavelkrolevets Nov 7, 2024
baeb031
Fix audit issue 5.3 Crash by Malicious Operator (#150)
pavelkrolevets Nov 7, 2024
b6cdb90
update dkg-spec hash at go.mod (#151)
pavelkrolevets Nov 7, 2024
dcd95be
add support for owner change (#153)
MatusKysel Nov 7, 2024
abbc1fa
Fix for 5.10 reshare denial of service via predicable instance ids (#…
pavelkrolevets Nov 11, 2024
8786474
update to support eip155 (#156)
MatusKysel Nov 11, 2024
0ddb2aa
update kyber + remove voulnarable package use (#157)
pavelkrolevets Nov 11, 2024
e402b9f
5.9-Ignored-DKG-Phases (#154)
pavelkrolevets Nov 11, 2024
53c853f
fixed critics
MatusKysel Nov 11, 2024
bf4be23
return fix for Arbitrary Path Access (#159)
MatusKysel Nov 19, 2024
6a670fa
point to dkg spec with license
MatusKysel Nov 19, 2024
a00890a
Complete fix of 5.4 Reshare Denial-of-Service via Predicable Instance…
pavelkrolevets Nov 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/go-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.20"
go-version: "1.23"

- name: Build
run: go build -v ./...

- name: Test
run: go test ./... -timeout 3600s
run: go run gotest.tools/gotestsum@latest --format pkgname -- -timeout=7200s ./...

- name: Critic
run: go install -v github.com/go-critic/go-critic/cmd/gocritic@latest && gocritic check ./...
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
bin/
.vscode/
examples/*/output/*
integration_test/output

######## Node
# Logs
Expand Down
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use golang base image
FROM golang:1.20-alpine3.18 as build
FROM golang:1.23.0-alpine3.20 AS build

WORKDIR /ssv-dkg

Expand Down Expand Up @@ -27,11 +27,12 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
./cmd/ssv-dkg

# Final stage
FROM alpine:3.18
FROM alpine:3.20
WORKDIR /ssv-dkg

# Install openssl
RUN apk add --no-cache openssl
RUN apk add --no-cache openssl
RUN apk add --no-cache ca-certificates && update-ca-certificates

# Copy the built binary and entry-point script from the previous stage/build context
COPY --from=build /bin/ssv-dkg /bin/ssv-dkg
Expand Down
24 changes: 22 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ build:
# Recipe to run tests
test:
@echo "running tests"
go run gotest.tools/gotestsum@latest --format testname
go run gotest.tools/gotestsum@latest --format pkgname --jsonfile test-output.log -- -timeout=3600s ./...

# Recipe to build the Docker image
docker-build-image:
Expand All @@ -40,16 +40,36 @@ docker-build-image:

docker-demo-operators:
@echo "Running operators in docker demo"
docker-compose up --build operator1 operator2 operator3 operator4 operator5 operator6 operator7 operator8
docker-compose up --build operator1 operator2 operator3 operator4 operator5 operator6 operator7 operator8 operator9 operator10 operator11 operator12 operator13

docker-demo-initiator:
@echo "Running initiator in docker demo"
docker-compose up --build initiator

docker-demo-generate-resign-msg:
@echo "Running generate re-sign message in docker demo"
docker-compose up --build generate-resign-msg

docker-demo-resign:
@echo "Running re-sign ceremony in docker demo"
docker-compose up --build resign

docker-demo-generate-reshare-msg:
@echo "Running generate re-share message in docker demo"
docker-compose up --build generate-reshare-msg

docker-demo-reshare:
@echo "Running re-share ceremony in docker demo"
docker-compose up --build reshare

docker-demo-ping:
@echo "Running ping operators in docker demo"
docker-compose up --build ping

docker-demo-ethnode:
@echo "Running ethereum node in docker demo"
docker-compose up --build ethnode

docker-operator:
@echo "Running operator docker, make sure to update ./examples/operator1/congig/config.yaml"
docker run \
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- [DKG](#dkg)
- [DKG tool by SSV](#dkg-tool-by-ssv)
- [Overview](#overview)
- [Minimum requirements](#minimum-requirements)
- [Initiator Quick start](#initiator-quick-start)
- [Check operators health](#healthcheck)
- [Obtaining Operators data](#obtaining-operators-data)
Expand Down Expand Up @@ -56,6 +57,26 @@ In order for the DKG protocol to execute successfully:
For details on how to run the tool as an Operator, please head over [to this section containing the related instructions](#operator-quick-start).
Similarly, head over to [this other section](#initiator-quick-start) for instructions on how to launch the tool as the Initiator of the DKG ceremony.

## Minimum requirements

The tool is heavily reliant on cryptography, therefore computational power has a major impact on its performance.

The minimum requirement is an AWS t3.medium or equivalent machine dedicated to run DKG (https://aws.amazon.com/ec2/instance-types/).

The recommend requirement is an AWS t3.large or higher tier machine.

Please note: computational demands are raising depending on amount validators being created at once.

Minimum docker resource allocations:

```
deploy:
resources:
limits:
cpus: "1"
memory: 500M
```

## Initiator Quick start

### Obtaining Operators data
Expand Down
14 changes: 11 additions & 3 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ import (
"github.com/spf13/cobra"
"go.uber.org/zap"

"github.com/bloxapp/ssv-dkg/cli/initiator"
"github.com/bloxapp/ssv-dkg/cli/operator"
"github.com/bloxapp/ssv-dkg/cli/verify"
"github.com/ssvlabs/ssv-dkg/cli/initiator"
"github.com/ssvlabs/ssv-dkg/cli/operator"
"github.com/ssvlabs/ssv-dkg/cli/verify"
)

func init() {
RootCmd.AddCommand(initiator.StartDKG)
RootCmd.AddCommand(operator.StartDKGOperator)
RootCmd.AddCommand(initiator.HealthCheck)
RootCmd.AddCommand(verify.Verify)
RootCmd.AddCommand(initiator.GenerateResignMsg)
RootCmd.AddCommand(initiator.StartResigning)
RootCmd.AddCommand(initiator.GenerateReshareMsg)
RootCmd.AddCommand(initiator.StartReshare)
}

// RootCmd represents the root command of DKG-tool CLI
Expand All @@ -32,6 +36,10 @@ func Execute(appName, version string) {
RootCmd.Version = version
initiator.HealthCheck.Version = version
initiator.StartDKG.Version = version
initiator.GenerateResignMsg.Version = version
initiator.StartResigning.Version = version
initiator.GenerateReshareMsg.Version = version
initiator.StartReshare.Version = version
operator.StartDKGOperator.Version = version
if err := RootCmd.Execute(); err != nil {
log.Fatal("failed to execute root command", zap.Error(err))
Expand Down
110 changes: 110 additions & 0 deletions cli/flags/base.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package flags

import (
"fmt"
"path/filepath"

"github.com/spf13/cobra"
"github.com/spf13/viper"

cli_utils "github.com/ssvlabs/ssv-dkg/cli/utils"
)

// Flag names.
const (
logLevel = "logLevel"
logFormat = "logFormat"
logLevelFormat = "logLevelFormat"
logFilePath = "logFilePath"
configPath = "configPath"
outputPath = "outputPath"
)

// global base flags
var (
ConfigPath string
OutputPath string
LogLevel string
LogFormat string
LogLevelFormat string
LogFilePath string
)

func SetBaseFlags(cmd *cobra.Command) {
OutputPathFlag(cmd)
ConfigPathFlag(cmd)
LogLevelFlag(cmd)
LogFormatFlag(cmd)
LogLevelFormatFlag(cmd)
LogFilePathFlag(cmd)
}

// BindFlags binds flags to yaml config parameters
func BindBaseFlags(cmd *cobra.Command) error {
if err := viper.BindPFlag("outputPath", cmd.PersistentFlags().Lookup("outputPath")); err != nil {
return err
}
if err := viper.BindPFlag("configPath", cmd.PersistentFlags().Lookup("configPath")); err != nil {
return err
}
if err := viper.BindPFlag("logLevel", cmd.PersistentFlags().Lookup("logLevel")); err != nil {
return err
}
if err := viper.BindPFlag("logFormat", cmd.PersistentFlags().Lookup("logFormat")); err != nil {
return err
}
if err := viper.BindPFlag("logLevelFormat", cmd.PersistentFlags().Lookup("logLevelFormat")); err != nil {
return err
}
if err := viper.BindPFlag("logFilePath", cmd.PersistentFlags().Lookup("logFilePath")); err != nil {
return err
}
OutputPath = viper.GetString("outputPath")
if OutputPath != "" {
OutputPath = filepath.Clean(OutputPath)
}
if !filepath.IsLocal(OutputPath) {
return fmt.Errorf("😥 wrong OutputPath flag, should be local")
}
if err := cli_utils.CreateDirIfNotExist(OutputPath); err != nil {
return err
}
LogLevel = viper.GetString("logLevel")
LogFormat = viper.GetString("logFormat")
LogLevelFormat = viper.GetString("logLevelFormat")
LogFilePath = viper.GetString("logFilePath")
if !filepath.IsLocal(LogFilePath) {
return fmt.Errorf("😥 wrong logFilePath flag, should be local")
}
return nil
}

// LogLevelFlag logger's log level flag to the command
func LogLevelFlag(c *cobra.Command) {
AddPersistentStringFlag(c, logLevel, "debug", "Defines logger's log level", false)
}

// LogFormatFlag logger's logger's encoding flag to the command
func LogFormatFlag(c *cobra.Command) {
AddPersistentStringFlag(c, logFormat, "json", "Defines logger's encoding, valid values are 'json' (default) and 'console'", false)
}

// LogLevelFormatFlag logger's level format flag to the command
func LogLevelFormatFlag(c *cobra.Command) {
AddPersistentStringFlag(c, logLevelFormat, "capitalColor", "Defines logger's level format, valid values are 'capitalColor' (default), 'capital' or 'lowercase'", false)
}

// LogFilePathFlag file path to write logs into
func LogFilePathFlag(c *cobra.Command) {
AddPersistentStringFlag(c, logFilePath, "debug.log", "Defines a file path to write logs into", false)
}

// ConfigPathFlag config path flag to the command
func ConfigPathFlag(c *cobra.Command) {
AddPersistentStringFlag(c, configPath, "", "Path to config file", false)
}

// OutputPathFlag sets the path to store resulting files
func OutputPathFlag(c *cobra.Command) {
AddPersistentStringFlag(c, outputPath, "./output", "Path to store results", false)
}
Loading
Loading