Skip to content

Commit

Permalink
Merge pull request #38 from ldsec/timeout
Browse files Browse the repository at this point in the history
Timeout
  • Loading branch information
JoaoAndreSa committed Mar 18, 2020
2 parents a8fe516 + e5509ba commit 6372d0e
Show file tree
Hide file tree
Showing 41 changed files with 479 additions and 315 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test_lint:
}

test_local:
go test -v -race -short -p=1 ./...
go test -v -short -race -p=1 ./...

test_codecov:
./coveralls.sh
Expand Down
24 changes: 12 additions & 12 deletions cmd/unlynx/client.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"errors"
"fmt"
"os"
"regexp"
"strconv"
Expand Down Expand Up @@ -32,7 +32,7 @@ func startQuery(el *onet.Roster, proofs bool, sum []string, count bool, whereQue

grp, aggr, err := client.SendSurveyResultsQuery(*surveyID)
if err != nil {
return errors.New("service could not output the results: " + err.Error())
return fmt.Errorf("service could not output the results: %v", err)
}

// Print Output
Expand Down Expand Up @@ -77,7 +77,7 @@ func openGroupToml(tomlFileName string) (*onet.Roster, error) {
}

if len(el.Roster.List) <= 0 {
return nil, errors.New("empty or invalid unlynx group file:" + tomlFileName)
return nil, fmt.Errorf("empty or invalid unlynx group file: %v", tomlFileName)
}

return el.Roster, nil
Expand All @@ -91,15 +91,15 @@ func checkRegex(input, expression string) bool {
func parseQuery(el *onet.Roster, sum string, count bool, where, predicate, groupBy string) ([]string, bool, []libunlynx.WhereQueryAttribute, string, []string, error) {

if sum == "" || (where != "" && predicate == "") || (where == "" && predicate != "") {
return nil, false, nil, "", nil, errors.New("wrong query! please check the sum, where and the predicate parameters")
return nil, false, nil, "", nil, fmt.Errorf("wrong query! please check the sum, where and the predicate parameters")
}

sumRegex := "{s[0-9]+(,\\s*s[0-9]+)*}"
whereRegex := "{(w[0-9]+(,\\s*[0-9]+))*(,\\s*w[0-9]+(,\\s*[0-9]+))*}"
groupByRegex := "{g[0-9]+(,\\s*g[0-9]+)*}"

if !checkRegex(sum, sumRegex) {
return nil, false, nil, "", nil, errors.New("error parsing the sum parameter(s)")
return nil, false, nil, "", nil, fmt.Errorf("error parsing the sum parameter(s)")
}
sum = strings.Replace(sum, " ", "", -1)
sum = strings.Replace(sum, "{", "", -1)
Expand All @@ -115,27 +115,27 @@ func parseQuery(el *onet.Roster, sum string, count bool, where, predicate, group
}

if !check {
return nil, false, nil, "", nil, errors.New("no 'count' attribute in the sum variables")
return nil, false, nil, "", nil, fmt.Errorf("no 'count' attribute in the sum variables")
}
}

if !checkRegex(where, whereRegex) {
return nil, false, nil, "", nil, errors.New("error parsing the where parameter(s)")
return nil, false, nil, "", nil, fmt.Errorf("error parsing the where parameter(s)")
}
where = strings.Replace(where, " ", "", -1)
where = strings.Replace(where, "{", "", -1)
where = strings.Replace(where, "}", "", -1)
tmp := strings.Split(where, ",")
whereTokens := strings.Split(where, ",")

whereFinal := make([]libunlynx.WhereQueryAttribute, 0)

var variable string
for i := range tmp {
for i := range whereTokens {
// if is a variable (w1, w2...)
if i%2 == 0 {
variable = tmp[i]
variable = whereTokens[i]
} else { // if it is a value
value, err := strconv.Atoi(tmp[i])
value, err := strconv.Atoi(whereTokens[i])
if err != nil {
return nil, false, nil, "", nil, err
}
Expand All @@ -145,7 +145,7 @@ func parseQuery(el *onet.Roster, sum string, count bool, where, predicate, group
}

if !checkRegex(groupBy, groupByRegex) {
return nil, false, nil, "", nil, errors.New("error parsing the groupBy parameter(s)")
return nil, false, nil, "", nil, fmt.Errorf("error parsing the groupBy parameter(s)")
}
groupBy = strings.Replace(groupBy, " ", "", -1)
groupBy = strings.Replace(groupBy, "{", "", -1)
Expand Down
8 changes: 4 additions & 4 deletions cmd/unlynx/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"errors"
"fmt"
"os"

"github.com/ldsec/unlynx/lib"
Expand Down Expand Up @@ -123,7 +123,7 @@ func main() {
Usage: "Start unlynx server",
Action: func(c *cli.Context) error {
if err := runServer(c); err != nil {
return errors.New("error during runServer(): " + err.Error())
return fmt.Errorf("error during runServer(): %v", err)
}
return nil
},
Expand All @@ -135,10 +135,10 @@ func main() {
Usage: "Setup server configuration (interactive)",
Action: func(c *cli.Context) error {
if c.String(optionConfig) != "" {
return errors.New("[-] Configuration file option cannot be used for the 'setup' command")
return fmt.Errorf("[-] configuration file option cannot be used for the 'setup' command")
}
if c.GlobalIsSet("debug") {
return errors.New("[-] Debug option cannot be used for the 'setup' command")
return fmt.Errorf("[-] debug option cannot be used for the 'setup' command")
}
app.InteractiveConfig(libunlynx.SuiTe, BinaryName)
return nil
Expand Down
5 changes: 2 additions & 3 deletions data/handle_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dataunlynx

import (
"bufio"
"errors"
"fmt"
"math"
"math/rand"
Expand Down Expand Up @@ -78,7 +77,7 @@ func GenerateData(numDPs, numEntries, numEntriesFiltered, numGroupsClear, numGro
numWhereClear, numWhereEnc, numAggrClear, numAggrEnc int64, numType []int64, randomGroups bool) (map[string][]libunlynx.DpClearResponse, error) {

if int64(len(numType)) != (numGroupsClear + numGroupsEnc) {
return nil, errors.New("specify the correct number of group types for each grouping attribute")
return nil, fmt.Errorf("specify the correct number of group types for each grouping attribute")
}

testData := make(map[string][]libunlynx.DpClearResponse)
Expand All @@ -94,7 +93,7 @@ func GenerateData(numDPs, numEntries, numEntriesFiltered, numGroupsClear, numGro
group := make([]int64, 0)
AllPossibleGroups(numType[:], group, 0, &groups)
} else {
return nil, errors.New("the number of groups is different from the number of entries")
return nil, fmt.Errorf("the number of groups is different from the number of entries")
}
}

Expand Down
16 changes: 12 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
module github.com/ldsec/unlynx

go 1.14

require (
github.com/BurntSushi/toml v0.3.1
github.com/Knetic/govaluate v3.0.0+incompatible
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/fanliao/go-concurrentMap v0.0.0-20141114143905-7d2d7a5ea67b
github.com/gorilla/websocket v1.4.1 // indirect
github.com/montanaflynn/stats v0.6.3 // indirect
github.com/r0fls/gostats v0.0.0-20180711082619-e793b1fda35c
github.com/satori/go.uuid v1.2.0
github.com/stretchr/testify v1.3.0
github.com/urfave/cli v1.22.1
go.dedis.ch/kyber/v3 v3.0.5
go.dedis.ch/onet/v3 v3.0.24
github.com/stretchr/testify v1.4.0
github.com/urfave/cli v1.22.3
go.dedis.ch/kyber/v3 v3.0.12
go.dedis.ch/onet/v3 v3.1.1
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 // indirect
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 // indirect
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
)

//replace go.dedis.ch/onet/v3 => ../../../go.dedis.ch/onet
32 changes: 32 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8L
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand All @@ -18,11 +20,15 @@ github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995/go.mod h1:lJgMEyOkY
github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/montanaflynn/stats v0.5.0 h1:2EkzeTSqBB4V4bJwWrt5gIIrZmpJBcoIRGS2kWLgzmk=
github.com/montanaflynn/stats v0.5.0/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
github.com/montanaflynn/stats v0.6.3 h1:F8446DrvIF5V5smZfZ8K9nrmmix0AFgevPdLruGOmzk=
github.com/montanaflynn/stats v0.6.3/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand All @@ -39,8 +45,13 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v0.0.0-20190311161405-34c6fa2dc709/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli v1.22.3 h1:FpNT6zq26xNpHZy08emi755QwzLPs6Pukqjlc7RfOMU=
github.com/urfave/cli v1.22.3/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
go.dedis.ch/fixbuf v1.0.3 h1:hGcV9Cd/znUxlusJ64eAlExS+5cJDIyTyEG+otu5wQs=
go.dedis.ch/fixbuf v1.0.3/go.mod h1:yzJMt34Wa5xD37V5RTdmp38cz3QhMagdGoem9anUalw=
go.dedis.ch/kyber/v3 v3.0.0-pre2/go.mod h1:OzvaEnPvKlyrWyp3kGXlFdp7ap1VC6RkZDTaPikqhsQ=
Expand All @@ -51,18 +62,27 @@ go.dedis.ch/kyber/v3 v3.0.2/go.mod h1:OzvaEnPvKlyrWyp3kGXlFdp7ap1VC6RkZDTaPikqhs
go.dedis.ch/kyber/v3 v3.0.4/go.mod h1:OzvaEnPvKlyrWyp3kGXlFdp7ap1VC6RkZDTaPikqhsQ=
go.dedis.ch/kyber/v3 v3.0.5 h1:BpjX6vY1R3b7TnJ0mUnCFRVXEJThSAj1zQzmNh4v+70=
go.dedis.ch/kyber/v3 v3.0.5/go.mod h1:V1z0JihG9+dUEUCKLI9j9tjnlIflBw3wx8UOg0g3Pnk=
go.dedis.ch/kyber/v3 v3.0.9/go.mod h1:rhNjUUg6ahf8HEg5HUvVBYoWY4boAafX8tYxX+PS+qg=
go.dedis.ch/kyber/v3 v3.0.12 h1:15d61EyBcBoFIS97kS2c/Vz4o3FR8ALnZ2ck9J/ebYM=
go.dedis.ch/kyber/v3 v3.0.12/go.mod h1:kXy7p3STAurkADD+/aZcsznZGKVHEqbtmdIzvPfrs1U=
go.dedis.ch/onet/v3 v3.0.0 h1:haBqkwkNNu/jHz7+PoZJS+xbtA5JheQvt0SSIjGyk5I=
go.dedis.ch/onet/v3 v3.0.0/go.mod h1:xqmP2+NvxeNzgmNj/4hf56EZm3KT0Qksz98miZw5G3A=
go.dedis.ch/onet/v3 v3.0.4 h1:sIHdiuhg5LMVVDAKQbSiBZsQnJGP2EDxImcp12OnWKo=
go.dedis.ch/onet/v3 v3.0.24 h1:DjPcMDgQgQdxi6Z6vHt3BSuKtZioDUHpIUEC9wQ9NmI=
go.dedis.ch/onet/v3 v3.0.24/go.mod h1:JhOZn9nJgpvxQWiY7Uebjj1AdXTW0ksQyq8RocRhwPk=
go.dedis.ch/onet/v3 v3.1.0 h1:KwofJGuw9T+051ejuWWxA6K1N6blNvhuwz5neasWg8Y=
go.dedis.ch/onet/v3 v3.1.0/go.mod h1:dDV7bRKbT3LJ7enHBcys2O0jXEY2jTUB4dq8HtekGbA=
go.dedis.ch/onet/v3 v3.1.1 h1:DN0t3Qj611kUrdmNn5quhWDdite1bxhoqoPna8IAWS0=
go.dedis.ch/onet/v3 v3.1.1/go.mod h1:dDV7bRKbT3LJ7enHBcys2O0jXEY2jTUB4dq8HtekGbA=
go.dedis.ch/protobuf v1.0.5/go.mod h1:eIV4wicvi6JK0q/QnfIEGeSFNG0ZeB24kzut5+HaRLo=
go.dedis.ch/protobuf v1.0.6 h1:E61p2XjYbYrTf3WeXE8M8Ui5WA3hX/NgbHHi5D0FLxI=
go.dedis.ch/protobuf v1.0.6/go.mod h1:YHYXW6dQ9p2iJ3f+2fxKnOpjGx0MvL4cwpg1RVNXaV8=
go.dedis.ch/protobuf v1.0.7 h1:wRUEiq3u0/vBhLjcw9CmAVrol+BnDyq2M0XLukdphyI=
go.dedis.ch/protobuf v1.0.7/go.mod h1:pv5ysfkDX/EawiPqcW3ikOxsL5t+BqnV6xHSmE79KI4=
go.dedis.ch/protobuf v1.0.8 h1:lmyHigYqVxoTN1V0adoGPvqSdjycAMK0XmTFjP893mA=
go.dedis.ch/protobuf v1.0.8/go.mod h1:pv5ysfkDX/EawiPqcW3ikOxsL5t+BqnV6xHSmE79KI4=
go.dedis.ch/protobuf v1.0.11 h1:FTYVIEzY/bfl37lu3pR4lIj+F9Vp1jE8oh91VmxKgLo=
go.dedis.ch/protobuf v1.0.11/go.mod h1:97QR256dnkimeNdfmURz0wAMNVbd1VmLXhG1CrTYrJ4=
go.etcd.io/bbolt v1.3.0 h1:oY10fI923Q5pVCVt1GBTZMn8LHo5M+RCInFpeMnV4QI=
go.etcd.io/bbolt v1.3.0/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk=
Expand All @@ -71,25 +91,36 @@ golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b h1:Elez2XeF2p9uyVj0yEUDqQ
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 h1:xMPOj6Pz6UipU1wXLkrtqpHbR0AVFnyPEQq/wRWz9lM=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f h1:hX65Cu3JDlGH3uEdK7I99Ii+9kjD6mvnnpfLdEAH0x4=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20191021144547-ec77196f6094/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sys v0.0.0-20190124100055-b90733256f2e h1:3GIlrlVLfkoipSReOMNAgApI0ajnalyLa/EZHHca/XI=
golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So=
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5 h1:ZcPpqKMdoZeNQ/4GHlyY4COf8n8SmpPv6mcqF1+VPSM=
golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/satori/go.uuid.v1 v1.2.0 h1:AH9uksa7bGe9rluapecRKBCpZvxaBEyu0RepitcD0Hw=
Expand All @@ -99,6 +130,7 @@ gopkg.in/tylerb/graceful.v1 v1.2.15/go.mod h1:yBhekWvR20ACXVObSSdD3u6S9DeSylanL2
gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0=
gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
rsc.io/goversion v1.2.0 h1:SPn+NLTiAG7w30IRK/DKp1BjvpWabYgxlLp/+kx5J8w=
rsc.io/goversion v1.2.0/go.mod h1:Eih9y/uIBS3ulggl7KNJ09xGSLcuNaLgmvvqa07sgfo=
4 changes: 2 additions & 2 deletions lib/add_rm/add_rm_proofs.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package libunlynxaddrm

import (
"errors"
"fmt"
"math"
"sync"

Expand Down Expand Up @@ -65,7 +65,7 @@ func AddRmProofCreation(cBef, cAft libunlynx.CipherText, K kyber.Point, k kyber.
proofTmp, err := proof.HashProve(libunlynx.SuiTe, "proofTest", prover)

if err != nil {
return PublishedAddRmProof{}, errors.New("---------Prover:" + err.Error())
return PublishedAddRmProof{}, fmt.Errorf("---------prover: %v", err)
}

return PublishedAddRmProof{Proof: proofTmp, CtBef: cBef, CtAft: cAft, RB: rB}, nil
Expand Down
6 changes: 3 additions & 3 deletions lib/aggregation/aggregation_proofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ func (palp *PublishedAggregationListProof) FromBytes(palpb PublishedAggregationL
for i, papb := range palpb.List {
go func(index int, papb PublishedAggregationProofBytes) {
defer wg.Done()
tmp := PublishedAggregationProof{}
tmpErr := tmp.FromBytes(papb)
pap := PublishedAggregationProof{}
tmpErr := pap.FromBytes(papb)
if tmpErr != nil {
mutex.Lock()
err = tmpErr
mutex.Unlock()
return
}
palp.List[index] = tmp
palp.List[index] = pap
}(i, papb)
}
libunlynx.EndParallelize(wg)
Expand Down
22 changes: 18 additions & 4 deletions lib/constants.go
Original file line number Diff line number Diff line change
@@ -1,30 +1,44 @@
package libunlynx

import (
"go.dedis.ch/onet/v3/log"
"os"
"sync"
"time"

"go.dedis.ch/onet/v3/simul/monitor"
)

func init() {
timeout, err := time.ParseDuration(os.Getenv("MEDCO_TIMEOUT"))
if err == nil {
TIMEOUT = timeout
} else {
log.Warn("Couldn't parse MEDCO_TIMEOUT, using default value: ", TIMEOUT.String())
}
}

// Global Variables
//______________________________________________________________________________________________________________________

// TIME is true if we use protocols with time measurements of computations.
const TIME = false
var TIME = false

// VPARALLELIZE allows to choose the level of parallelization in the vector computations
const VPARALLELIZE = 100

// DIFFPRI enables the DRO protocol (Distributed Results Obfuscation)
const DIFFPRI = false

// TIMEOUT ddefines the default channel timeout
var TIMEOUT = 10 * time.Minute

// StartTimer starts measurement of time
func StartTimer(name string) *monitor.TimeMeasure {
var timer *monitor.TimeMeasure
if TIME {
timer = monitor.NewTimeMeasure(name)
return monitor.NewTimeMeasure(name)
}
return timer
return nil
}

// EndTimer finishes measurement of time
Expand Down
Loading

0 comments on commit 6372d0e

Please sign in to comment.