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

Merge cosi into cothority #665

Merged
merged 22 commits into from
Nov 9, 2016
Merged

Merge cosi into cothority #665

merged 22 commits into from
Nov 9, 2016

Conversation

liamsi
Copy link
Member

@liamsi liamsi commented Nov 3, 2016

Early pull request to see if all the tests pass (currently, they do :-)
Resolves #650

Coding-wise this done (besides some nice-to-have things)

Open tasks for this pull:

  • remove duplicate code (reuse the methods in app/lib)
  • Search for references to the cosi repo in documentation
  • update documentation here and in the cosi repository accordingly
  • manually test how installing & deploying cosi changed due to merging the repo

os.Exit(1)
}

func getDefaultConfigFile() string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Many of these functions are already implemented in app/lib/{client,server} if I remember correctly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! Added to the TODO list ...

@liamsi
Copy link
Member Author

liamsi commented Nov 8, 2016

There seem to be different issues like deadlocks, timeouts, and data races. They seem unrelated to this pull. Although this pull is still marked as WIP, it can already be reviewed. What is left to do is only documentation and testing.

return err
}

if c.responseHook != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

@ineiti could you push your changes that you did in #664 (snp17) here so it's compatible with randhound ?

Copy link
Member

Choose a reason for hiding this comment

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

What I did in snp17 for cosi.go is quite hackish. I wouldn't want to include that as-is here. Anyway, look at it and tell me if you want me to propose it:

https://github.com/dedis/cosi/blob/randhoundco/protocol/cosi.go#L275

Copy link
Member Author

Choose a reason for hiding this comment

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

Together with https://github.com/dedis/cosi/blob/randhoundco/protocol/cosi.go#L346-L354 I find it rather clear and not so hackish. But I also think, this is out-of scope of this pull. Let's see if @nikkolasg insists on pushing the changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah Ok let's not do that :D

Copy link
Member

Choose a reason for hiding this comment

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

@liamsi liamsi changed the title WIP: Merge cosi into cothority Merge cosi into cothority Nov 8, 2016
@liamsi
Copy link
Member Author

liamsi commented Nov 9, 2016

I tested this manually:
Doing go get -u github.com/cothority/app/cosiand running
$GOPATH/bin/cosi sign -g /Users/khoffi/Library/cosi/group.toml -o README.sig README.md
and $GOPATH/bin/cosi verify -g /Users/khoffi/Library/cosi/group.toml -s README.sig README.md still works as expected (OK, instead of go get -u I did go install ./app/cosi/ ... because the code necessary isn't in master, yet).

@liamsi liamsi mentioned this pull request Nov 9, 2016
@liamsi
Copy link
Member Author

liamsi commented Nov 9, 2016

Should be reviewed together with dedis/cosi#68

@nikkolasg
Copy link
Contributor

From discussion with @liamsi there's still one refactoring to do regarding the "runServer" method which should be in app/lib/server. After that I'm OK to merge.

@nikkolasg nikkolasg closed this Nov 9, 2016
@nikkolasg nikkolasg reopened this Nov 9, 2016
@@ -4,7 +4,7 @@ go:
- 1.7

install:
- ./install.sh
- go get -t ./...
Copy link
Member

Choose a reason for hiding this comment

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

You finally got rid of install.sh? Great!

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah :-) I think it was mostly there to get right branch in the other repo, which isn't necessary anymore.

Copy link
Contributor

Choose a reason for hiding this comment

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

Riiighhttt . that's so nice.

Copy link
Member

Choose a reason for hiding this comment

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

So coveralls.sh takes care of any dependencies with dedis/crypto?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, only with cosi, which

  1. should not be needed anymore
    OR
  2. should be used with crypto as @ineiti suggests

Copy link
Member

Choose a reason for hiding this comment

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

Let's keep it clean for now and say that if we want to do a R4M, we need to have crypto updated first...

@nikkolasg
Copy link
Contributor

I'm OK to merge.

Copy link
Member

@ineiti ineiti left a comment

Choose a reason for hiding this comment

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

README.md comments

@@ -66,23 +66,21 @@ from time to time, as all dedis-dependencies change quite often.
There are three apps available:

* [cothorityd](https://github.com/dedis/cothority/app/cothorityd) - which is the server-part that you can run to add a node
* [cosi](https://github.com/dedis/cosi) - the cosi-protocol, service, and app,
in its own repository
* [cosi](https://github.com/dedis/cothority/app/cosi) - the cosi-app
Copy link
Member

Choose a reason for hiding this comment

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

I propose we keep CoSi capitalisation.

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean not keep but instead change to CoSi, right?

@@ -0,0 +1,338 @@
[![Build Status](https://travis-ci.org/dedis/cothority.svg?branch=master)](https://travis-ci.org/dedis/cothority)
Copy link
Member

Choose a reason for hiding this comment

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

I started to update the wiki on a non-regular basis - should this be kept as a README or kept only in the wiki at https://github.com/dedis/cothority/wiki/CoSi ?

Copy link
Member Author

@liamsi liamsi Nov 9, 2016

Choose a reason for hiding this comment

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

The Readme is the first thing people see (not the Wiki). I propose to keep this information in the Readme. OK, I see what you mean now. The other packages also contain Readmes like this... I'm OK with both options but it should be consistent.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm OK with having the instructions in the Wiki and a link pointing to the wiki in the app/cosi/README.md. We could do that for all apps, so we have a central place where all instructions / docs can be read.

Copy link
Member

Choose a reason for hiding this comment

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

Or having the wiki point to the README for specific instructions? Anyway, that's probably also a later issue.

The signatures that CoSi produces convey the same information
as a list of conventional signatures from all participants,
but CoSi signatures are far more compact and efficient for clients to verify.
In practice, a CoSi collective signature is close to the same size as —
Copy link
Member

Choose a reason for hiding this comment

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

can we replace — with -?

Copy link
Member Author

Choose a reason for hiding this comment

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

Of course, I don't know where this came from (must have been already there)

## Installing from Source

To build and run CoSi from source code you will need to install
[Go](https://golang.org/) version 1.5.2 or later.
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure it compiles with 1.5.2 due to the Context. Did you verify that?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I don't have 1.5.2 installed anymore. We could let travis do runs with every version we support, or I can simply change it to 1.7 instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for 1.6 or 1.7 (there's a PR for going to 1.7 that @liamsi started, I dont know what's the status of it)

Copy link
Member Author

Choose a reason for hiding this comment

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

I dont know what's the status of it

There were problems in medco with 1.7. But medco was delelted, so ... It should be fine!


For convenience we provide self-contained x86-64 binaries
for Linux and Mac OS X.
[Download the latest release](https://github.com/dedis/cosi/releases/latest),
Copy link
Member

Choose a reason for hiding this comment

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

I'd remove the binary-release for the moment and only keep this section in the v0-branch at dedis/cosi.

Copy link
Member Author

@liamsi liamsi Nov 9, 2016

Choose a reason for hiding this comment

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

OK! Makes sense (as the binaries are referenced in the cosi-repo Readme)

mac systems. If CoSi did not find anything, the default mechanism is to search in the current
directory.

Once you have a valid group definition, you can sign a file using the `cosi sign’
Copy link
Member

Choose a reason for hiding this comment

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

Wrong backtick after cosi sign

Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting, I didn't even change that. Fixed in next commit.

before signing off on them,
e.g., to validate a [collectively signed blockchain](http://arxiv.org/abs/1602.06997).

## Running Your Own CoSi Witness Server
Copy link
Member

Choose a reason for hiding this comment

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

This can reference to a more general How to run a cothorityd.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Again, is there already a wiki page for that ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the decision where we will put all current and future documentation is orthogonal to this pull. Let's discuss this in a separate issue (if we want to remove all Readme files from sub-packages and use the wiki instead).

Copy link
Member

Choose a reason for hiding this comment

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

yes, but you can remove information that is found elsewhere.

you can concatenate their individual `group.toml` outputs
to define your own cosigning group.
You may optionally use any or all of our experimental
[default CoSi servers](https://github.com/dedis/cosi/blob/master/dedis_group.toml)
Copy link
Member

Choose a reason for hiding this comment

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

Again - this should reference our new (not yet existing) group.toml.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe this can wait until it actually exists?

Copy link
Contributor

Choose a reason for hiding this comment

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

So we should remove them (the links) for the time being then, since it does not exists yet.

Description = "My Test group"

[[servers]]
Addresses = ["127.0.0.1:2000"]
Copy link
Member

Choose a reason for hiding this comment

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

I think the default-ports are different from 2000, can you take those?

Copy link
Member Author

Choose a reason for hiding this comment

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

Why? 2000 also works (locally) without a problem and we use it all over the place. But yes, I can do it (DefaultPort is 6879).

Copy link
Member Author

Choose a reason for hiding this comment

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

This isn't related to this pull but I would like to keep it consistent: In the cothorityd package the ports in the Readme are the same.

Copy link
Member

Choose a reason for hiding this comment

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

OK, I'll change those later.

```bash
cat > servers.toml <<EOF

[[servers]]
Copy link
Member

Choose a reason for hiding this comment

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

Take the new, not-yet-existing, group.toml.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe this can wait until it actually exists?

Copy link
Member

@ineiti ineiti left a comment

Choose a reason for hiding this comment

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

Not all relevant, but nice to have any way...

// it always returns nil as an error
func signFile(c *cli.Context) error {
if c.Args().First() == "" {
printErrAndExit("Please give the file to sign", 1)
Copy link
Member

Choose a reason for hiding this comment

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

log.Fatal

groupToml := c.String(optionGroup)
file, err := os.Open(fileName)
if err != nil {
printErrAndExit("Couldn't read file to be signed: %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

and all further references to printErrAndExit: log.Fatal

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in next commit

printErrAndExit("Couldn't read file to be signed: %v", err)
}
sig, err := sign(file, groupToml)
printErrAndExit("Couldn't create signature: %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

log.ErrFatal

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in next commit

if len(c.Args().First()) == 0 {
printErrAndExit("Please give the 'msgFile'", 1)
}
log.SetDebugVisible(c.GlobalInt("debug"))
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't that go somewhere in the initialisation, like in https://github.com/dedis/cothority/blob/master/app/cisc/cisc.go#L57

Copy link
Member

Choose a reason for hiding this comment

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

There is already an app.Before, so you can delete this line.

Copy link
Member Author

Choose a reason for hiding this comment

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

Didn't add that ... Deleted in next commit

// verifyPrintResult prints out OK or what failed.
func verifyPrintResult(err error) {
if err == nil {
fmt.Println("[+] OK: Signature is valid.")
Copy link
Member

Choose a reason for hiding this comment

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

log.Print

@@ -53,7 +53,7 @@ build(){
cd $DIR
echo "Building in $DIR"

for appdir in $BUILDDIR/cothorityd $GOPATH/src/github.com/dedis/cosi; do
for appdir in $BUILDDIR/cothorityd $GOPATH/src/github.com/dedis/cothority/app/cosi; do
Copy link
Member

Choose a reason for hiding this comment

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

for appdir in $BUILDDIR/cothorityd $BUILDDIR/cosi; do

@@ -7,16 +7,6 @@ DIR_SOURCE="$(find . -maxdepth 10 -type f -not -path '*/vendor*' -name '*.go' |
BRANCH=$TRAVIS_PULL_REQUEST_BRANCH
echo "Using branch $BRANCH"

pattern="refactor_*"
Copy link
Member

Choose a reason for hiding this comment

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

Would we want to do this to crypto anyway?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought we only use this for cosi & cothority; was there a case where I missed that ( cc @nikkolasg )

Copy link
Member

Choose a reason for hiding this comment

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

As I wrote earlier, we can say that any R4M into master that touches crypto needs to get the crypto-part merged first.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes more sense to me.


// Dispatch will listen on the four channels we use (i.e. four steps)
func (c *CoSi) Dispatch() error {
for {
Copy link
Member

Choose a reason for hiding this comment

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

Probably for later: this should be more something like in https://github.com/dedis/cothority/blob/master/protocols/bftcosi/bftcosi.go#L182 where the non-for-loop channels impose an order on the messages. As this is a protocol that is looked at by grad students, it'll be nice to have it somewhat canonical.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, we should open an issue (or add it to some refactoring issue)

Copy link
Member

Choose a reason for hiding this comment

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

out := &Challenge{
Chall: challenge,
}
log.Lvl3(c.Name(), "Starting Chal=", fmt.Sprintf("%+v", challenge), " (message =", string(c.Message))
Copy link
Member

Choose a reason for hiding this comment

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

log.Lvlf3("%s Starting Chal=%+v (message =%x)", c.Name(), challenge, string(c.Message))

Copy link
Member Author

Choose a reason for hiding this comment

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

done

// handleChallenge dispatch the challenge to the round and then dispatch the
// results down the tree.
func (c *CoSi) handleChallenge(in *Challenge) error {
log.Lvl3(c.Name(), "chal=", fmt.Sprintf("%+v", in.Chall))
Copy link
Member

Choose a reason for hiding this comment

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

log.Lvl3("%s chal=%+v", c.Name(), in.Chall)

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess you mean log.Lvlf3 -> done

@ineiti ineiti merged commit 2603180 into master Nov 9, 2016
@ineiti ineiti deleted the merge_cosi branch November 9, 2016 15:30
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.

3 participants