Skip to content

Commit

Permalink
ignore system files on verify (#90)
Browse files Browse the repository at this point in the history
* ignore system files on verify

* add info log of complition
  • Loading branch information
MatusKysel committed Apr 2, 2024
1 parent 379fa22 commit b8dc7c3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions cli/initiator/initiator.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ var StartDKG = &cobra.Command{
); err != nil {
logger.Fatal("Could not save results", zap.Error(err))
}
logger.Info("🚀 DKG ceremony completed")
return nil
},
}
Expand Down
21 changes: 21 additions & 0 deletions pkgs/validator/directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"reflect"
"regexp"
"strconv"
"strings"

"github.com/bloxapp/ssv-dkg/pkgs/wire"
"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -115,6 +116,9 @@ func ValidateResultsDir(dir string, validatorCount int, ownerAddress common.Addr
dirs := 0
for _, entry := range entries {
if !entry.IsDir() {
if isSystemFile(entry.Name()) {
continue
}
if entry.Name() == "deposit_data.json" || entry.Name() == "keyshares.json" || entry.Name() == "proofs.json" {
continue
}
Expand Down Expand Up @@ -155,6 +159,9 @@ func OpenResultsDir(dir string) (*ResultsDir, error) {
foundAggregations := false
for _, file := range files {
if !file.IsDir() {
if isSystemFile(file.Name()) {
continue
}
if file.Name() == "deposit_data.json" || file.Name() == "keyshares.json" || file.Name() == "proofs.json" {
foundAggregations = true
continue
Expand Down Expand Up @@ -229,3 +236,17 @@ func jsonEqual(a, b any) error {
}
return nil
}

// isSystemFile determines if the filename corresponds to a system file
// that should be ignored.
func isSystemFile(filename string) bool {
// List of system files to ignore
ignoreFiles := []string{".DS_Store", "Thumbs.db"}

for _, ignore := range ignoreFiles {
if strings.HasSuffix(filename, ignore) {
return true
}
}
return false
}

0 comments on commit b8dc7c3

Please sign in to comment.