Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dfss
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mpcs
dfss
Commits
d4de2685
Commit
d4de2685
authored
May 20, 2016
by
Loïck Bonniot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[c] Add slowdown flag
parent
fd636e3f
Pipeline
#1862
passed with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
dfssc/cmd/root.go
dfssc/cmd/root.go
+3
-2
dfssc/cmd/sign.go
dfssc/cmd/sign.go
+3
-0
dfssc/sign/protocol.go
dfssc/sign/protocol.go
+2
-0
No files found.
dfssc/cmd/root.go
View file @
d4de2685
...
@@ -3,7 +3,6 @@ package cmd
...
@@ -3,7 +3,6 @@ package cmd
import
(
import
(
"dfss"
"dfss"
dapi
"dfss/dfssd/api"
dapi
"dfss/dfssd/api"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/spf13/viper"
...
@@ -31,7 +30,7 @@ A tool to sign multiparty contract using a secure cryptographic protocol`,
...
@@ -31,7 +30,7 @@ A tool to sign multiparty contract using a secure cryptographic protocol`,
// All of the flags will be gathered by viper, this is why
// All of the flags will be gathered by viper, this is why
// we do not store their values
// we do not store their values
func
init
()
{
func
init
()
{
// Bind flags to the dfss
t
command
// Bind flags to the dfss
c
command
RootCmd
.
PersistentFlags
()
.
BoolP
(
"verbose"
,
"v"
,
false
,
"print verbose messages"
)
RootCmd
.
PersistentFlags
()
.
BoolP
(
"verbose"
,
"v"
,
false
,
"print verbose messages"
)
RootCmd
.
PersistentFlags
()
.
String
(
"ca"
,
"ca.pem"
,
"path to the root certificate"
)
RootCmd
.
PersistentFlags
()
.
String
(
"ca"
,
"ca.pem"
,
"path to the root certificate"
)
RootCmd
.
PersistentFlags
()
.
String
(
"cert"
,
"cert.pem"
,
"path to the user's certificate"
)
RootCmd
.
PersistentFlags
()
.
String
(
"cert"
,
"cert.pem"
,
"path to the user's certificate"
)
...
@@ -40,6 +39,8 @@ func init() {
...
@@ -40,6 +39,8 @@ func init() {
RootCmd
.
PersistentFlags
()
.
String
(
"host"
,
"localhost:9000"
,
"host of the dfss platform"
)
RootCmd
.
PersistentFlags
()
.
String
(
"host"
,
"localhost:9000"
,
"host of the dfss platform"
)
RootCmd
.
PersistentFlags
()
.
IntP
(
"port"
,
"p"
,
9005
,
"port to use for P2P communication between clients"
)
RootCmd
.
PersistentFlags
()
.
IntP
(
"port"
,
"p"
,
9005
,
"port to use for P2P communication between clients"
)
signCmd
.
Flags
()
.
Duration
(
"slowdown"
,
0
,
"Delay between each promises round"
)
// Store flag values into viper
// Store flag values into viper
_
=
viper
.
BindPFlag
(
"verbose"
,
RootCmd
.
PersistentFlags
()
.
Lookup
(
"verbose"
))
_
=
viper
.
BindPFlag
(
"verbose"
,
RootCmd
.
PersistentFlags
()
.
Lookup
(
"verbose"
))
_
=
viper
.
BindPFlag
(
"file_ca"
,
RootCmd
.
PersistentFlags
()
.
Lookup
(
"ca"
))
_
=
viper
.
BindPFlag
(
"file_ca"
,
RootCmd
.
PersistentFlags
()
.
Lookup
(
"ca"
))
...
...
dfssc/cmd/sign.go
View file @
d4de2685
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
"dfss/dfssc/sign"
"dfss/dfssc/sign"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
)
var
signCmd
=
&
cobra
.
Command
{
var
signCmd
=
&
cobra
.
Command
{
...
@@ -17,6 +18,8 @@ var signCmd = &cobra.Command{
...
@@ -17,6 +18,8 @@ var signCmd = &cobra.Command{
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
_
=
viper
.
BindPFlag
(
"slowdown"
,
cmd
.
Flags
()
.
Lookup
(
"slowdown"
))
filename
:=
args
[
0
]
filename
:=
args
[
0
]
fmt
.
Println
(
"You are going to sign the following contract:"
)
fmt
.
Println
(
"You are going to sign the following contract:"
)
showContract
(
cmd
,
args
)
showContract
(
cmd
,
args
)
...
...
dfssc/sign/protocol.go
View file @
d4de2685
...
@@ -8,6 +8,7 @@ import (
...
@@ -8,6 +8,7 @@ import (
cAPI
"dfss/dfssc/api"
cAPI
"dfss/dfssc/api"
"dfss/dfssc/common"
"dfss/dfssc/common"
dAPI
"dfss/dfssd/api"
dAPI
"dfss/dfssd/api"
"github.com/spf13/viper"
)
)
// Sign performs all the message exchanges for the contract to be signed
// Sign performs all the message exchanges for the contract to be signed
...
@@ -42,6 +43,7 @@ func (m *SignatureManager) Sign() error {
...
@@ -42,6 +43,7 @@ func (m *SignatureManager) Sign() error {
// Follow the sequence until there is no next occurence of me
// Follow the sequence until there is no next occurence of me
for
m
.
currentIndex
>=
0
{
for
m
.
currentIndex
>=
0
{
m
.
OnProgressUpdate
(
m
.
currentIndex
,
seqLen
+
1
)
m
.
OnProgressUpdate
(
m
.
currentIndex
,
seqLen
+
1
)
time
.
Sleep
(
viper
.
GetDuration
(
"slowdown"
))
dAPI
.
DLog
(
"starting round at index ["
+
fmt
.
Sprintf
(
"%d"
,
m
.
currentIndex
)
+
"] with nextIndex="
+
fmt
.
Sprintf
(
"%d"
,
nextIndex
))
dAPI
.
DLog
(
"starting round at index ["
+
fmt
.
Sprintf
(
"%d"
,
m
.
currentIndex
)
+
"] with nextIndex="
+
fmt
.
Sprintf
(
"%d"
,
nextIndex
))
// Set of promises we are waiting for
// Set of promises we are waiting for
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment