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

Chores grooming #11

Merged
merged 53 commits into from
Oct 10, 2023
Merged

Chores grooming #11

merged 53 commits into from
Oct 10, 2023

Conversation

pavelkrolevets
Copy link
Contributor

No description provided.

README.md Outdated
```

Its also possible to use yaml configuration file `./config/initiator.yaml` for parameters. `dkgcli` will be looking for this file at `./config/` folder.
Its also possible to use yaml configuration file `./config/initiator.yaml` for parameters. `dkgcli` will be looking for this file at `./config/` folder at a same root as the binary.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dkgcli -> ssv-dkg

README.md Outdated
```

When using configuration file, run:

```sh
dkgcli init-dkg
ssv-dkg init-dkg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be just ssv-dkg init no need to repeat dkg

README.md Outdated
port: 3030
storeShare: true
```

When using configuration file, run:

```sh
dkgcli start-dkg-server
ssv-dkg start-dkg-operator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

start-dkg-operator -> start-operator

Comment on lines 95 to 108
// t.Run("test 7 operators happy flow", func(t *testing.T) {
// ops := make(map[uint64]initiator.Operator)
// srv1 := CreateOperator(t, 1)
// ops[1] = initiator.Operator{srv1.srv.URL, 1, &srv1.privKey.PublicKey}
// srv2 := CreateOperator(t, 2)
// ops[2] = initiator.Operator{srv2.srv.URL, 2, &srv2.privKey.PublicKey}
// srv3 := CreateOperator(t, 3)
// ops[3] = initiator.Operator{srv3.srv.URL, 3, &srv3.privKey.PublicKey}
// srv4 := CreateOperator(t, 4)
// ops[4] = initiator.Operator{srv4.srv.URL, 4, &srv4.privKey.PublicKey}
// srv5 := CreateOperator(t, 5)
// ops[5] = initiator.Operator{srv5.srv.URL, 5, &srv5.privKey.PublicKey}
// srv6 := CreateOperator(t, 6)
// ops[6] = initiator.Operator{srv6.srv.URL, 6, &srv6.privKey.PublicKey}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this commented? anyway it should be pretty easy to write the functionality to run 4/7/13 tests without copy pasting so much.

Copy link
Contributor Author

@pavelkrolevets pavelkrolevets Sep 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, some leftover I forgot about. Should be uncommented.

Copy link
Contributor

@y0sher y0sher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! please see my comments, also lets fix tests.

@liorrutenberg
Copy link

Lets please remove unused functions such as:

https://github.com/bloxapp/ssv-dkg/blob/ac06e5464f055fb39b5cdd854deba17b81308266/pkgs/load/operators.go
Operators(path string)

OperatorsPubkeys(path string)

@liorrutenberg
Copy link

@pavelkrolevets can we please add lint command to Makefile

@echo "Done building."
@echo "Run dkgcli to launch the tool."
@echo "Run ssv-dkg to launch the tool."

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove tool

Copy link
Contributor

@y0sher y0sher Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@echo "Run ssv-dkg to launch the tool."
@echo "ssv-dkg installed successfully."

README.md Outdated
@@ -1,77 +1,112 @@
# ssv-dkg-tool

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove tool

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# ssv-dkg-tool
# ssv-dkg

@liorrutenberg
Copy link

incorporate logs to file similar to ssv

@liorrutenberg
Copy link

Additional chores:

  • Remove plain text support for operator
  • IMO we should add config example files in one place for both operator & initiator
    and rename files to xx.example.yaml
  • move imgs folder to docs folder
  • Should we restrict operators to use SSL only?
  • add GPL license

@liorrutenberg
Copy link

make docker-build fails after make build (add .dockerignore to exclude bin folder)

Copy link

@liorrutenberg liorrutenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see conversion

@liorrutenberg
Copy link

  • Remove CSV example files, we choose to support only JSON
  • in example there are 4 servers and each has config file, yet for docker we use env params, so IMO it's redundant

@liorrutenberg
Copy link

liorrutenberg commented Sep 18, 2023

image

Failed to save output

@liorrutenberg
Copy link

deposit and payload files should have a prefix (validator pk)

pkgs/dkg/drand.go Outdated Show resolved Hide resolved
pkgs/dkg/drand.go Outdated Show resolved Hide resolved
pkgs/dkg/drand.go Outdated Show resolved Hide resolved
Copy link
Contributor

@y0sher y0sher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my comments

Copy link
Contributor

@y0sher y0sher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!
@moshe-blox @andrew-blox please take final look so we can merge

return nil, err
}
block, _ := pem.Decode(operatorKeyByte)
// TODO: resolve deprecation https://github.com/golang/go/issues/8860

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we resolve this?

b := block.Bytes
if enc {
var err error
// TODO: resolve deprecation https://github.com/golang/go/issues/8860

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we resolve this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well we have the same thing in our node, @MatusKysel mentioned something about the way we do RSA, maybe we should revisit it entirely, for sure it's not the place to do here.

Copy link
Contributor

@moshe-blox moshe-blox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

Left a few comments, although did not finish reviewing yet.

}
nonce := viper.GetUint64("nonce")
withdrawPubKey, err := hex.DecodeString(withdrawAddr)
withdrawPubKey := common.HexToAddress(withdrawAddr).Bytes()
Copy link
Contributor

@moshe-blox moshe-blox Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HexToAddress is dangerous for user input because it fails silently, so you can pass just an "m" (for example) and it would continue without notifying the user of his mistake.

WDYT about making our own address parsing func that would return an error if input is too long, too short or not a valid hex?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added HexToAddress with error handling to utils + unit tests for it

@@ -132,10 +134,14 @@ func New(key *rsa.PrivateKey) *Server {
}

func (s *Server) Start(port uint16) error {
s.Logger.Infof("server listening for incoming requests on port %d", port)
srv := &http.Server{Addr: fmt.Sprintf(":%v", port), Handler: s.Router}
Copy link
Contributor

@moshe-blox moshe-blox Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not part of this PR, but it'd be nice if we can add read/write timeouts to the `http.Server to prevent flooding attacks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have Chi limiting requests to routes, to prevent DDOS, if I understood you correctly

logger.Info("🚀 Initializing DKG instance")
init := &wire.Init{}
if err := init.UnmarshalSSZ(initMsg.Data); err != nil {
return nil, err
Copy link
Contributor

@moshe-blox moshe-blox Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should return error wrappings (as you did below in VerifyRSA) here and in the rest of the returns, so we can tell where exactly things failed in retrospect.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added error wrapps at state. Should we have wrapps everywhere?

@liorrutenberg
Copy link

Merged as part 1 of grooming

@liorrutenberg liorrutenberg merged commit 214ec16 into main Oct 10, 2023
1 check passed
@pavelkrolevets pavelkrolevets deleted the chores_grooming branch November 23, 2023 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants