From 4f119d7b74e17874e187314337321ac2554433e5 Mon Sep 17 00:00:00 2001 From: Lesterpig Date: Thu, 26 May 2016 23:03:43 +0200 Subject: [PATCH 1/3] Now working on v0.4.0-dev --- CHANGELOG.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ version.go | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cf3430..e2fef82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,52 @@ CHANGELOG ========= +v0.3.0 +------ +> 26/05/2016 + +#### CLI Client + +- Log more information during signature (!69) +- Add an optional local file check before signature (!74) +- Add a slowdown flag for tests (!78) +- Add a stopbefore flag for tests (!79) +- Add TTP resolution (!80) +- Add timeout flag (!81) +- Add unregister command (!85) + +#### GUI Client + +- Improve contract display (!70) +- Fix crash when the dfss file is corrupted (!71) +- Add an optional local file check before signature (!74) +- Add a cancel button before signature (!75) +- Add TTP resolution (!80) +- Add timeout configuration option (!81) + +#### Platform + +- Support different subnets between signers (!73) +- Add TTP listing support (!80) +- Disable case sensitivity in mails (!86) +- Add unregister API (!85) +- Fix timeout issues during ready sign (!89) +- Add contract UUID in invitation mails (!90) + +#### TTP + +- Add TTP resolution (!80) +- Fix concurrency problems (!82) + +#### Demonstrator + +- Add a step-by-step speed (!76) +- Add communication visualization for TTP and platform (!83) + +#### Misc + +- Fix the verbose flag, now displays messages sent to demonstrator (!88) + v0.2.0 ------ > 25/04/2016 diff --git a/version.go b/version.go index 8aa105d..043906d 100644 --- a/version.go +++ b/version.go @@ -9,7 +9,7 @@ import ( ) // Version represents the current version of the DFSS software suite -const Version = "0.3.0-dev" +const Version = "0.4.0-dev" // VersionCmd is the cobra command common to all dfss modules var VersionCmd = &cobra.Command{ From e8a9cc1244ac75c3ca1ab32fb3a6f96fd3d9b6a8 Mon Sep 17 00:00:00 2001 From: Lesterpig Date: Fri, 27 May 2016 14:50:07 +0200 Subject: [PATCH 2/3] [p] Try to fix hanged rooms --- dfssp/contract/ready.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dfssp/contract/ready.go b/dfssp/contract/ready.go index 8cb64e0..ad7bc25 100644 --- a/dfssp/contract/ready.go +++ b/dfssp/contract/ready.go @@ -33,8 +33,9 @@ var ReadySignTimeout = time.Minute func ReadySign(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, ctx *context.Context, in *api.ReadySignRequest) *api.LaunchSignature { roomID := "ready_" + in.ContractUuid channel, _, first := rooms.Join(roomID) - cn := net.GetCN(ctx) + defer rooms.Unjoin(roomID, channel) + cn := net.GetCN(ctx) // Check UUID if !bson.IsObjectIdHex(in.ContractUuid) { return &api.LaunchSignature{ErrorCode: &api.ErrorCode{Code: api.ErrorCode_INVARG}} @@ -71,10 +72,8 @@ func ReadySign(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, ctx *contex return &api.LaunchSignature{ErrorCode: &api.ErrorCode{Code: api.ErrorCode_INVARG}} } case <-(*ctx).Done(): // Client's disconnection - rooms.Unjoin(roomID, channel) return &api.LaunchSignature{ErrorCode: &api.ErrorCode{Code: api.ErrorCode_INVARG}} case <-timeout: // Someone has not confirmed the signature within the delay - rooms.Unjoin(roomID, channel) return &api.LaunchSignature{ErrorCode: &api.ErrorCode{Code: api.ErrorCode_TIMEOUT, Message: "timeout for ready signal"}} } } @@ -86,6 +85,7 @@ func ReadySign(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, ctx *contex func masterReadyRoutine(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, contractUUID string) { roomID := "ready_" + contractUUID channel, oldMessages, _ := rooms.Join(roomID) + defer rooms.Unjoin(roomID, channel) // Push oldMessages into the channel. // It is safe as this sould be a very small slice (the room is just created). @@ -102,7 +102,6 @@ func masterReadyRoutine(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, co ready: true, data: "", }) // This represents a "error" response - rooms.Unjoin(roomID, channel) return } @@ -132,7 +131,6 @@ func masterReadyRoutine(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, co } } - rooms.Unjoin(roomID, channel) } // FindAndUpdatePendingSigner is a utility function to return the state of current signers readiness. From 65558011b5d957a9af03f4e18306bf0625c28804 Mon Sep 17 00:00:00 2001 From: Lesterpig Date: Fri, 27 May 2016 17:08:14 +0200 Subject: [PATCH 3/3] [c] Fix unregister command --- dfssc/cmd/unregister.go | 5 +++-- dfssc/user/unregister.go | 30 +++++++++++++++++------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/dfssc/cmd/unregister.go b/dfssc/cmd/unregister.go index 32a05cc..97e9054 100644 --- a/dfssc/cmd/unregister.go +++ b/dfssc/cmd/unregister.go @@ -22,14 +22,15 @@ var unregisterCmd = &cobra.Command{ } // Confirmation - var ready string + var passphrase, ready string + _ = readPassword(&passphrase, false) readStringParam("Do you REALLY want to delete "+cert.Subject.CommonName+"? Type 'yes' to confirm", "", &ready) if ready != "yes" { fmt.Fprintln(os.Stderr, "Unregistering aborted!") os.Exit(1) } - err = user.Unregister() + err = user.Unregister(passphrase) if err != nil { fmt.Fprintln(os.Stderr, "Cannot unregister:", err.Error()) os.Exit(2) diff --git a/dfssc/user/unregister.go b/dfssc/user/unregister.go index 428922e..a218b1d 100644 --- a/dfssc/user/unregister.go +++ b/dfssc/user/unregister.go @@ -1,31 +1,35 @@ package user import ( - "errors" - - pb "dfss/dfssp/api" + "dfss/dfssc/common" + "dfss/dfssc/security" + "dfss/dfssp/api" "dfss/net" + "github.com/spf13/viper" "golang.org/x/net/context" - "google.golang.org/grpc" ) // Unregister a user from the platform -func Unregister() error { - client, err := connect() +func Unregister(passphrase string) error { + auth := security.NewAuthContainer(passphrase) + ca, cert, key, err := auth.LoadFiles() + if err != nil { + return err + } + + conn, err := net.Connect(viper.GetString("platform_addrport"), cert, key, ca, nil) if err != nil { return err } - // Stop the context if it takes too long for the platform to answer + client := api.NewPlatformClient(conn) ctx, cancel := context.WithTimeout(context.Background(), net.DefaultTimeout) defer cancel() - response, err := client.Unregister(ctx, &pb.Empty{}) + response, err := client.Unregister(ctx, &api.Empty{}) + if err != nil { - return errors.New(grpc.ErrorDesc(err)) - } - if response.Code != pb.ErrorCode_SUCCESS { - return errors.New(response.Message) + return err } - return nil + return common.EvaluateErrorCodeResponse(response) }