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

Timeout #38

Merged
merged 23 commits into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ec63e48
Added select timeouts for unlynx protocols
JoaoAndreSa Mar 10, 2020
b0d3547
Added select timeouts for unlynx protocols/utils
JoaoAndreSa Mar 10, 2020
66925ca
Added select timeouts for unlynx services and simulations
JoaoAndreSa Mar 10, 2020
17479ba
Updated libraries except Onet
JoaoAndreSa Mar 10, 2020
2c8b8bd
Removed break and re-adding race flag
JoaoAndreSa Mar 11, 2020
3281921
Re-added simulation tests
JoaoAndreSa Mar 11, 2020
3dcc5b4
Changed timeouts to use os.Getenv
JoaoAndreSa Mar 11, 2020
abbe277
Added init() for timeout
JoaoAndreSa Mar 11, 2020
3a7f339
Fixed init() in constants.go mistake in condition
JoaoAndreSa Mar 11, 2020
5564657
Added warning while parsing timeout
JoaoAndreSa Mar 11, 2020
3031cda
Removed error condition around tn.SetConfig
JoaoAndreSa Mar 11, 2020
31c25d5
Removed unecessary if condition when sending empty structs
JoaoAndreSa Mar 11, 2020
8861342
Switched from errors.new to fmt.Errorf
JoaoAndreSa Mar 11, 2020
f3812c3
Remove the isLeaf condition for the SendToChildren call
JoaoAndreSa Mar 11, 2020
5bc1e5d
Changed TIMEOUT constant to DEFAULT_TIMEOUT
JoaoAndreSa Mar 12, 2020
186b6f4
Fixed go lint warning
JoaoAndreSa Mar 12, 2020
8563eee
Revert name to TIMEOUT because of golang naming convention (to avoid …
JoaoAndreSa Mar 12, 2020
a4d36eb
Cleaned some of the tmp variables
JoaoAndreSa Mar 12, 2020
c5dddb8
Corrected if negative conditions
JoaoAndreSa Mar 12, 2020
7f37465
Added error condition of tn.SetConfig for debug
JoaoAndreSa Mar 12, 2020
6340084
Fixed tn.SetConfig bug
JoaoAndreSa Mar 12, 2020
e9c05b5
Merge branch 'dev' of https://github.com/ldsec/unlynx into timeout
JoaoAndreSa Mar 12, 2020
e5509ba
Reverted if conditions to the correct way
JoaoAndreSa Mar 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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.0
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 // indirect
)

//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=
11 changes: 7 additions & 4 deletions lib/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package libunlynx

import (
"sync"
"time"

"go.dedis.ch/onet/v3/simul/monitor"
)
Expand All @@ -10,21 +11,23 @@ import (
//______________________________________________________________________________________________________________________

// 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
19 changes: 15 additions & 4 deletions protocols/collective_aggregation_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ package protocolsunlynx

import (
"errors"
"os"
"sync"
"time"

"github.com/ldsec/unlynx/lib"
"github.com/ldsec/unlynx/lib/aggregation"
Expand Down Expand Up @@ -195,11 +197,20 @@ func (p *CollectiveAggregationProtocol) Dispatch() error {

// Announce forwarding down the tree.
func (p *CollectiveAggregationProtocol) aggregationAnnouncementPhase() error {
dataReferenceMessage := <-p.DataReferenceChannel
if !p.IsLeaf() {
if err := p.SendToChildren(&dataReferenceMessage.DataReferenceMessage); err != nil {
return errors.New("Error sending <DataReferenceMessage>:" + err.Error())
timeout, err := time.ParseDuration(os.Getenv("MEDCO_TIMEOUT"))
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be enough to put this in afunc init() at the beginning of the file constants.go. Then you can remove it from all the methods you're calling it...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done abbe277

if err != nil {
timeout = libunlynx.TIMEOUT
}

select {
case dataReferenceMessage := <-p.DataReferenceChannel:
if !p.IsLeaf() {
Copy link

Choose a reason for hiding this comment

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

Unneded if, SendToChildren when having none should work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

Arf, I misexplained it; the if !p.IsLeaf() is unnecessary, as a Leaf sending to it's children is a NOP.
And you're droping the error here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ahh I did not get it :P
Ok it's fixed: f3812c3

if err := p.SendToChildren(&dataReferenceMessage.DataReferenceMessage); err != nil {
return errors.New("Error sending <DataReferenceMessage>:" + err.Error())
Copy link

Choose a reason for hiding this comment

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

You can use the new fmt.Errorf when returning error (it will also keep the stacktrace).

Suggested change
return errors.New("Error sending <DataReferenceMessage>:" + err.Error())
return fmt.Errorf("Error sending <DataReferenceMessage>: %v", err)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

switched everywhere to fmt.Errorf: 8861342

}
}
case <-time.After(timeout):
return errors.New(p.ServerIdentity().String() + "didn't get the <dataReferenceMessage> on time.")
}
return nil
}
Expand Down
1 change: 0 additions & 1 deletion protocols/collective_aggregation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ func TestCollectiveAggregationGroup(t *testing.T) {
resultData := make(map[libunlynx.GroupingKey][]int64)
for k, v := range encryptedResult.GroupedData {
resultData[k] = libunlynx.DecryptIntVector(clientPrivate, &v.AggregatingAttributes)

log.Lvl1(k, resultData[k])
}
for k, v1 := range expectedGroups {
Expand Down
25 changes: 21 additions & 4 deletions protocols/deterministic_tagging_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package protocolsunlynx

import (
"errors"
"os"
"sync"
"time"

Expand Down Expand Up @@ -116,7 +117,6 @@ func NewDeterministicTaggingProtocol(n *onet.TreeNodeInstance) (onet.ProtocolIns
break
}
}

return dsp, nil
}

Expand Down Expand Up @@ -155,10 +155,21 @@ func (p *DeterministicTaggingProtocol) Start() error {
func (p *DeterministicTaggingProtocol) Dispatch() error {
defer p.Done()

timeout, err := time.ParseDuration(os.Getenv("MEDCO_TIMEOUT"))
if err != nil {
timeout = libunlynx.TIMEOUT
}

//************ ----- first round, add value derivated from ephemeral secret to message ---- ********************
deterministicTaggingTargetBytesBef := <-p.PreviousNodeInPathChannel
var deterministicTaggingTargetBytesBef deterministicTaggingBytesStruct
select {
case deterministicTaggingTargetBytesBef = <-p.PreviousNodeInPathChannel:
case <-time.After(timeout):
return errors.New(p.ServerIdentity().String() + "didn't get the <deterministicTaggingTargetBytesBef> (first round) on time.")
}

deterministicTaggingTargetBef := DeterministicTaggingMessage{Data: make([]libunlynx.CipherText, 0)}
err := deterministicTaggingTargetBef.FromBytes(deterministicTaggingTargetBytesBef.Data)
err = deterministicTaggingTargetBef.FromBytes(deterministicTaggingTargetBytesBef.Data)
if err != nil {
return err
}
Expand Down Expand Up @@ -203,7 +214,13 @@ func (p *DeterministicTaggingProtocol) Dispatch() error {
}

//************ ----- second round, deterministic tag creation ---- ********************
deterministicTaggingTargetBytes := <-p.PreviousNodeInPathChannel
var deterministicTaggingTargetBytes deterministicTaggingBytesStruct
select {
case deterministicTaggingTargetBytes = <-p.PreviousNodeInPathChannel:
case <-time.After(timeout):
return errors.New(p.ServerIdentity().String() + "didn't get the <deterministicTaggingTargetBytes> (second round) on time.")
}

deterministicTaggingTarget := DeterministicTaggingMessage{Data: make([]libunlynx.CipherText, 0)}
err = deterministicTaggingTarget.FromBytes(deterministicTaggingTargetBytes.Data)
if err != nil {
Expand Down
14 changes: 13 additions & 1 deletion protocols/key_switching_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package protocolsunlynx

import (
"errors"
"os"
"time"

"github.com/ldsec/unlynx/lib"
Expand Down Expand Up @@ -230,7 +231,18 @@ func (p *KeySwitchingProtocol) Dispatch() error {

// Announce forwarding down the tree.
func (p *KeySwitchingProtocol) announcementKSPhase() (kyber.Point, []kyber.Point, error) {
dataReferenceMessage := <-p.DownChannel
timeout, err := time.ParseDuration(os.Getenv("MEDCO_TIMEOUT"))
if err != nil {
timeout = libunlynx.TIMEOUT
}

var dataReferenceMessage DownBytesStruct
select {
case dataReferenceMessage = <-p.DownChannel:
case <-time.After(timeout):
return nil, nil, errors.New(p.ServerIdentity().String() + "didn't get the <dataReferenceMessage> on time.")
}

if !p.IsLeaf() {
if err := p.SendToChildren(&dataReferenceMessage.DownMessageBytes); err != nil {
return nil, nil, errors.New("Node " + p.ServerIdentity().String() + " failed to broadcast DownMessageBytes: " + err.Error())
Expand Down
24 changes: 21 additions & 3 deletions protocols/shuffling+ddt_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package protocolsunlynx

import (
"errors"
"os"
"sync"
"time"

"github.com/ldsec/unlynx/lib"
"github.com/ldsec/unlynx/lib/deterministic_tag"
Expand Down Expand Up @@ -152,12 +154,28 @@ func (p *ShufflingPlusDDTProtocol) Start() error {
func (p *ShufflingPlusDDTProtocol) Dispatch() error {
defer p.Done()

shufflingPlusDDTBytesMessageLength := <-p.LengthNodeChannel
tmp := <-p.PreviousNodeInPathChannel
timeout, err := time.ParseDuration(os.Getenv("MEDCO_TIMEOUT"))
if err != nil {
timeout = libunlynx.TIMEOUT
}

var shufflingPlusDDTBytesMessageLength shufflingPlusDDTBytesLengthStruct
select {
case shufflingPlusDDTBytesMessageLength = <-p.LengthNodeChannel:
case <-time.After(timeout):
return errors.New(p.ServerIdentity().String() + "didn't get the <shufflingPlusDDTBytesMessageLength> on time.")
}

var tmp shufflingPlusDDTBytesStruct
select {
case tmp = <-p.PreviousNodeInPathChannel:
case <-time.After(timeout):
return errors.New(p.ServerIdentity().String() + "didn't get the <tmp> on time.")
}

readData := libunlynx.StartTimer(p.Name() + "_ShufflingPlusDDT(ReadData)")
sm := ShufflingPlusDDTMessage{}
err := sm.FromBytes(tmp.Data, tmp.ShuffKey, shufflingPlusDDTBytesMessageLength.CVLengths)
err = sm.FromBytes(tmp.Data, tmp.ShuffKey, shufflingPlusDDTBytesMessageLength.CVLengths)
if err != nil {
return err
}
Expand Down
22 changes: 20 additions & 2 deletions protocols/shuffling_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package protocolsunlynx

import (
"errors"
"os"
"time"

"github.com/ldsec/unlynx/lib"
Expand Down Expand Up @@ -116,6 +117,7 @@ func NewShufflingProtocol(n *onet.TreeNodeInstance) (onet.ProtocolInstance, erro
break
}
}

return dsp, nil
}

Expand Down Expand Up @@ -186,9 +188,25 @@ func (p *ShufflingProtocol) Start() error {
func (p *ShufflingProtocol) Dispatch() error {
defer p.Done()

shufflingBytesMessageLength := <-p.LengthNodeChannel
timeout, err := time.ParseDuration(os.Getenv("MEDCO_TIMEOUT"))
if err != nil {
timeout = libunlynx.TIMEOUT
}

var shufflingBytesMessageLength shufflingBytesLengthStruct
select {
case shufflingBytesMessageLength = <-p.LengthNodeChannel:
case <-time.After(timeout):
return errors.New(p.ServerIdentity().String() + "didn't get the <shufflingBytesMessageLength> on time.")
}

var tmp shufflingBytesStruct
select {
case tmp = <-p.PreviousNodeInPathChannel:
case <-time.After(timeout):
return errors.New(p.ServerIdentity().String() + "didn't get the <tmp> on time.")
}

tmp := <-p.PreviousNodeInPathChannel
sm := ShufflingMessage{}
if err := sm.FromBytes(tmp.Data, shufflingBytesMessageLength.CVLengths); err != nil {
return err
Expand Down
Loading