From 1d940dd7ebc0702a7c3ada9cf70247080565c13f Mon Sep 17 00:00:00 2001 From: Chris Berry Date: Wed, 11 Sep 2024 13:57:49 +0100 Subject: [PATCH 1/4] Extend multi protected interface to enable generic multi signer --- .gitignore | 3 +++ .golangci.yml | 20 ++++++++++---------- account.go | 2 ++ go.mod | 4 +++- go.sum | 5 +++++ 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 70fa7ec..f74815d 100644 --- a/.gitignore +++ b/.gitignore @@ -18,5 +18,8 @@ coverage.html # Vim *.sw? +# Intellij and friends +.idea/ + # Local TODO TODO.md diff --git a/.golangci.yml b/.golangci.yml index 1fbb83b..005e277 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -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 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. + exclude-files: + - ".*_ssz\\.go$" + # Options for analysis running. run: # The default concurrency value is the number of available CPU. @@ -129,14 +139,4 @@ linters: # Disable specific linter # https://golangci-lint.run/usage/linters/#disabled-by-default disable: - - deadcode - depguard - - exhaustivestruct - - golint - - ifshort - - interfacer - - maligned - - nosnakecase - - scopelint - - structcheck - - varcheck diff --git a/account.go b/account.go index da05117..cdc450e 100644 --- a/account.go +++ b/account.go @@ -107,6 +107,8 @@ type AccountProtectingMultiSigner interface { targetEpoch uint64, targetRoot []byte, domain []byte) ([]e2types.Signature, error) + + SignGenericMulti(ctx context.Context, data []byte, domain []byte, accounts []Account) ([]e2types.Signature, error) } // AccountCompositePublicKeyProvider is the interface for accounts that can provide a composite public key. diff --git a/go.mod b/go.mod index 128d576..ac17be1 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/wealdtech/go-eth2-wallet-types/v2 -go 1.20 +go 1.22 + +toolchain go1.22.4 require ( github.com/google/uuid v1.3.0 diff --git a/go.sum b/go.sum index 9054a44..3a0edfb 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,5 @@ 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/ferranbt/fastssz v0.1.3 h1:ZI+z3JH05h4kgmFXdHuR1aWYsgrg7o+Fw7/NCzM16Mo= github.com/ferranbt/fastssz v0.1.3/go.mod h1:0Y9TEd/9XuFlh7mskMPfXiI2Dkw4Ddg9EyXt1W7MRvE= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= @@ -14,8 +15,11 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/umbracle/gohashtree v0.0.2-alpha.0.20230207094856-5b775a815c10 h1:CQh33pStIp/E30b7TxDlXfM0145bn2e8boI30IxAhTg= +github.com/umbracle/gohashtree v0.0.2-alpha.0.20230207094856-5b775a815c10/go.mod h1:x/Pa0FF5Te9kdrlZKJK82YmAkvL8+f989USgz6Jiw7M= github.com/wealdtech/go-eth2-types/v2 v2.8.2 h1:b5aXlNBLKgjAg/Fft9VvGlqAUCQMP5LzYhlHRrr4yPg= github.com/wealdtech/go-eth2-types/v2 v2.8.2/go.mod h1:IAz9Lz1NVTaHabQa+4zjk2QDKMv8LVYo0n46M9o/TXw= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -26,3 +30,4 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From f51e0c8a2b2427835dddf81db755507f0a297d4b Mon Sep 17 00:00:00 2001 From: Chris Berry Date: Wed, 11 Sep 2024 14:21:48 +0100 Subject: [PATCH 2/4] Update GH actions to match go version --- .github/workflows/golangci-lint.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index e8e16fc..f3f9ee8 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: '1.20' + go-version: "^1.22" - uses: actions/checkout@v3 - name: golangci-lint uses: golangci/golangci-lint-action@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 767a453..e063793 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,6 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: '1.20' + go-version: "^1.22" - uses: actions/checkout@v3 - uses: n8maninger/action-golang-test@v1 From ac80547e141769e67942831e315a10fa0403ad2e Mon Sep 17 00:00:00 2001 From: Chris Berry Date: Thu, 12 Sep 2024 09:43:26 +0100 Subject: [PATCH 3/4] Update interface and add description --- account.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/account.go b/account.go index cdc450e..27b0229 100644 --- a/account.go +++ b/account.go @@ -108,7 +108,8 @@ type AccountProtectingMultiSigner interface { targetRoot []byte, domain []byte) ([]e2types.Signature, error) - SignGenericMulti(ctx context.Context, data []byte, domain []byte, accounts []Account) ([]e2types.Signature, error) + // SignGenericMulti signs multiple accounts with the same generic data root. + SignGenericMulti(ctx context.Context, accounts []Account, data []byte, domain []byte) ([]e2types.Signature, error) } // AccountCompositePublicKeyProvider is the interface for accounts that can provide a composite public key. From 0b597b326c87c9dbd6c04b429d24c37701c5e75f Mon Sep 17 00:00:00 2001 From: Chris Berry Date: Thu, 12 Sep 2024 11:39:21 +0100 Subject: [PATCH 4/4] Update interface from review feedback --- account.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account.go b/account.go index 27b0229..9323959 100644 --- a/account.go +++ b/account.go @@ -108,8 +108,8 @@ type AccountProtectingMultiSigner interface { targetRoot []byte, domain []byte) ([]e2types.Signature, error) - // SignGenericMulti signs multiple accounts with the same generic data root. - SignGenericMulti(ctx context.Context, accounts []Account, data []byte, domain []byte) ([]e2types.Signature, error) + // SignGenericMulti signs multiple generic data roots. + SignGenericMulti(ctx context.Context, accounts []Account, data [][]byte, domain []byte) ([]e2types.Signature, error) } // AccountCompositePublicKeyProvider is the interface for accounts that can provide a composite public key.