diff --git a/bindings/group.go b/bindings/group.go index 729aac8781d24258e61a077b01ee4eb5a43baec6..a1f32b34e9c613bbb4357f6c2705ee930a7d3c01 100644 --- a/bindings/group.go +++ b/bindings/group.go @@ -64,10 +64,10 @@ func NewGroupManager(client *Client, requestFunc GroupRequestFunc, // MakeGroup creates a new group and sends a group request to all members in the // group. The ID of the new group, the rounds the requests were sent on, and the // status of the send are contained in NewGroupReport. -func (g *GroupChat) MakeGroup(membership *IdList, name, message []byte)*NewGroupReport { +func (g *GroupChat) MakeGroup(membership *IdList, name, message []byte) *NewGroupReport { grp, rounds, status, err := g.m.MakeGroup(membership.list, name, message) errStr := "" - if err !=nil{ + if err != nil { errStr = err.Error() } return &NewGroupReport{&Group{grp}, rounds, status, errStr} @@ -83,14 +83,14 @@ func (g *GroupChat) ResendRequest(groupIdBytes []byte) (*NewGroupReport, error) } grp, exists := g.m.GetGroup(groupID) - if !exists{ - return nil,errors.Errorf("Failed to find group %s", groupID) + if !exists { + return nil, errors.Errorf("Failed to find group %s", groupID) } rounds, status, err := g.m.ResendRequest(groupID) errStr := "" - if err !=nil{ + if err != nil { errStr = err.Error() } return &NewGroupReport{&Group{grp}, rounds, status, errStr}, nil @@ -166,11 +166,11 @@ type NewGroupReport struct { group *Group rounds []id.Round status gc.RequestStatus - err string + err string } type GroupReportDisk struct { - List []id.Round + List []id.Round GrpId []byte Status int } @@ -201,10 +201,9 @@ func (ngr *NewGroupReport) GetError() string { return ngr.err } - func (ngr *NewGroupReport) Marshal() ([]byte, error) { grpReportDisk := GroupReportDisk{ - List: ngr.rounds, + List: ngr.rounds, GrpId: ngr.group.GetID()[:], Status: ngr.GetStatus(), } diff --git a/go.mod b/go.mod index 27a55715ff942c4cbdc2bd6fcd82ce1694ebcbd7..ac0f08dfa250f2987f3a12eaea516eba6b157535 100644 --- a/go.mod +++ b/go.mod @@ -17,11 +17,11 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 github.com/spf13/viper v1.7.1 gitlab.com/elixxir/bloomfilter v0.0.0-20200930191214-10e9ac31b228 - gitlab.com/elixxir/comms v0.0.4-0.20211101174956-590ba1b47887 - gitlab.com/elixxir/crypto v0.0.7-0.20211118181958-04390d5356fa + gitlab.com/elixxir/comms v0.0.4-0.20211202005321-fc955f62958e + gitlab.com/elixxir/crypto v0.0.7-0.20211202005218-64b0b94b8a02 gitlab.com/elixxir/ekv v0.1.5 gitlab.com/elixxir/primitives v0.0.3-0.20211111194525-20889b10db75 - gitlab.com/xx_network/comms v0.0.4-0.20211014163953-e774276b83ae + gitlab.com/xx_network/comms v0.0.4-0.20211201234554-509121aa9654 gitlab.com/xx_network/crypto v0.0.5-0.20211014163843-57b345890686 gitlab.com/xx_network/primitives v0.0.4-0.20211014163031-53405cf191fb golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 diff --git a/go.sum b/go.sum index 3fec2e96ed182103a775e254ff4bafa318b1d2f3..ec6cb95c10fca8762742dd22b737badb5f5e022f 100644 --- a/go.sum +++ b/go.sum @@ -253,25 +253,23 @@ github.com/zeebo/pcg v1.0.0 h1:dt+dx+HvX8g7Un32rY9XWoYnd0NmKmrIzpHF7qiTDj0= github.com/zeebo/pcg v1.0.0/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4= gitlab.com/elixxir/bloomfilter v0.0.0-20200930191214-10e9ac31b228 h1:Gi6rj4mAlK0BJIk1HIzBVMjWNjIUfstrsXC2VqLYPcA= gitlab.com/elixxir/bloomfilter v0.0.0-20200930191214-10e9ac31b228/go.mod h1:H6jztdm0k+wEV2QGK/KYA+MY9nj9Zzatux/qIvDDv3k= -gitlab.com/elixxir/comms v0.0.4-0.20211101174956-590ba1b47887 h1:SOQaoEvc6RqImz86jSjsj7wIW3ZhgxXc38GzvRkKdOw= -gitlab.com/elixxir/comms v0.0.4-0.20211101174956-590ba1b47887/go.mod h1:rQpTeFVSn08ocbQeEw5AbMhGWXHfXmQ0y1/ZprAIVVU= +gitlab.com/elixxir/comms v0.0.4-0.20211202005321-fc955f62958e h1:dq2LW9Ls1LNqDgswa78pNRImbSlDxmE6rKMGT0YYqA0= +gitlab.com/elixxir/comms v0.0.4-0.20211202005321-fc955f62958e/go.mod h1:MLKt4/XK4Y6ie76lzBUBfuF0lFrVqkT7q8aOuaWWTTQ= gitlab.com/elixxir/crypto v0.0.0-20200804182833-984246dea2c4/go.mod h1:ucm9SFKJo+K0N2GwRRpaNr+tKXMIOVWzmyUD0SbOu2c= gitlab.com/elixxir/crypto v0.0.3/go.mod h1:ZNgBOblhYToR4m8tj4cMvJ9UsJAUKq+p0gCp07WQmhA= -gitlab.com/elixxir/crypto v0.0.7-0.20211022013957-3a7899285c4c/go.mod h1:teuTEXyqsqo4N/J1sshcTg9xYOt+wNTurop7pkZOiCg= -gitlab.com/elixxir/crypto v0.0.7-0.20211118181958-04390d5356fa h1:XwoFEIRO4QXpKzeBZehebO/9kU/C3xew/MS5yDyvu1o= -gitlab.com/elixxir/crypto v0.0.7-0.20211118181958-04390d5356fa/go.mod h1:teuTEXyqsqo4N/J1sshcTg9xYOt+wNTurop7pkZOiCg= +gitlab.com/elixxir/crypto v0.0.7-0.20211202005218-64b0b94b8a02 h1:zkoiltG9FhMK+9pBppEJG+uMLgVBlQCYRafN+lbNTQs= +gitlab.com/elixxir/crypto v0.0.7-0.20211202005218-64b0b94b8a02/go.mod h1:58ZxWaMzTmgP6gWkiGSXVL8qIw5cnVAdlgIpbZ/olMU= gitlab.com/elixxir/ekv v0.1.5 h1:R8M1PA5zRU1HVnTyrtwybdABh7gUJSCvt1JZwUSeTzk= gitlab.com/elixxir/ekv v0.1.5/go.mod h1:e6WPUt97taFZe5PFLPb1Dupk7tqmDCTQu1kkstqJvw4= gitlab.com/elixxir/primitives v0.0.0-20200731184040-494269b53b4d/go.mod h1:OQgUZq7SjnE0b+8+iIAT2eqQF+2IFHn73tOo+aV11mg= gitlab.com/elixxir/primitives v0.0.0-20200804170709-a1896d262cd9/go.mod h1:p0VelQda72OzoUckr1O+vPW0AiFe0nyKQ6gYcmFSuF8= gitlab.com/elixxir/primitives v0.0.0-20200804182913-788f47bded40/go.mod h1:tzdFFvb1ESmuTCOl1z6+yf6oAICDxH2NPUemVgoNLxc= gitlab.com/elixxir/primitives v0.0.1/go.mod h1:kNp47yPqja2lHSiS4DddTvFpB/4D9dB2YKnw5c+LJCE= -gitlab.com/elixxir/primitives v0.0.3-0.20211014164029-06022665b576/go.mod h1:zZy8AlOISFm5IG4G4sylypnz7xNBfZ5mpXiibqJT8+8= gitlab.com/elixxir/primitives v0.0.3-0.20211111194525-20889b10db75 h1:LQ9EmPJvm7T6WxwNltjnYKLF0QSYCrS+hyteb8Dfttk= gitlab.com/elixxir/primitives v0.0.3-0.20211111194525-20889b10db75/go.mod h1:zZy8AlOISFm5IG4G4sylypnz7xNBfZ5mpXiibqJT8+8= gitlab.com/xx_network/comms v0.0.0-20200805174823-841427dd5023/go.mod h1:owEcxTRl7gsoM8c3RQ5KAm5GstxrJp5tn+6JfQ4z5Hw= -gitlab.com/xx_network/comms v0.0.4-0.20211014163953-e774276b83ae h1:jmZWmSm8eH40SX5B5uOw2XaYoHYqVn8daTfa6B80AOs= -gitlab.com/xx_network/comms v0.0.4-0.20211014163953-e774276b83ae/go.mod h1:wR9Vx0KZLrIs0g2Efcp0UwFPStjcDRWkg/DJLVQI2vw= +gitlab.com/xx_network/comms v0.0.4-0.20211201234554-509121aa9654 h1:ETX91+m5H+fBpC+nP320H9QqIwd7JcNqozt9RvQ6yyI= +gitlab.com/xx_network/comms v0.0.4-0.20211201234554-509121aa9654/go.mod h1:wR9Vx0KZLrIs0g2Efcp0UwFPStjcDRWkg/DJLVQI2vw= gitlab.com/xx_network/crypto v0.0.3/go.mod h1:DF2HYvvCw9wkBybXcXAgQMzX+MiGbFPjwt3t17VRqRE= gitlab.com/xx_network/crypto v0.0.4/go.mod h1:+lcQEy+Th4eswFgQDwT0EXKp4AXrlubxalwQFH5O0Mk= gitlab.com/xx_network/crypto v0.0.5-0.20211014163843-57b345890686 h1:mEjKISxi9LrguYgz6evroFwsfxH78/hYmr32yws+WV0= diff --git a/interfaces/preimage/generate.go b/interfaces/preimage/generate.go index 476e6b7157c8953ac82a572e119f725c0a081475..84798d696a8b2311e6e89b01f64c885eb6c2d5b8 100644 --- a/interfaces/preimage/generate.go +++ b/interfaces/preimage/generate.go @@ -7,7 +7,7 @@ import ( func Generate(data []byte, t string) []byte { - if t==Default{ + if t == Default { return data } // Hash fingerprints diff --git a/network/gateway/hostpool_test.go b/network/gateway/hostpool_test.go index 919d3faedbada3445219de4886fc84ba2362cdeb..5e93ba8df80ded94f70034bdc6ba3540ac6d1644 100644 --- a/network/gateway/hostpool_test.go +++ b/network/gateway/hostpool_test.go @@ -9,6 +9,7 @@ package gateway import ( "fmt" + jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/client/storage" "gitlab.com/elixxir/comms/network" "gitlab.com/elixxir/crypto/fastRNG" @@ -16,10 +17,17 @@ import ( "gitlab.com/xx_network/crypto/csprng" "gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/ndf" + "os" "reflect" "testing" ) +func TestMain(m *testing.M) { + jww.SetStdoutThreshold(jww.LevelTrace) + connect.TestingOnlyDisableTLS = true + os.Exit(m.Run()) +} + // Unit test func TestNewHostPool(t *testing.T) { manager := newMockManager() diff --git a/network/manager.go b/network/manager.go index bb69e30a5154ec09e4d029d6c797171d088e01fb..c968102e2f5b04269c123c5d1b624ae7a865678a 100644 --- a/network/manager.go +++ b/network/manager.go @@ -99,10 +99,10 @@ func NewManager(session *storage.Session, switchboard *switchboard.Switchboard, earliest := uint64(0) // create manager object m := manager{ - param: params, - tracker: &tracker, - addrSpace: ephemeral.NewAddressSpace(), - events: events, + param: params, + tracker: &tracker, + addrSpace: ephemeral.NewAddressSpace(), + events: events, earliestRound: &earliest, } @@ -258,19 +258,18 @@ func (m *manager) GetVerboseRounds() string { return m.verboseRounds.String() } - -func (m *manager) SetFakeEarliestRound(rnd id.Round) { +func (m *manager) SetFakeEarliestRound(rnd id.Round) { atomic.StoreUint64(m.earliestRound, uint64(rnd)) } // GetFakeEarliestRound generates a random earliest round for a fake identity. -func (m *manager) GetFakeEarliestRound() id.Round { +func (m *manager) GetFakeEarliestRound() id.Round { b, err := csprng.Generate(8, rand.Reader) if err != nil { jww.FATAL.Panicf("Could not get random number: %v", err) } - rangeVal := binary.LittleEndian.Uint64(b) % 800 + rangeVal := binary.LittleEndian.Uint64(b) % 800 earliestKnown := atomic.LoadUint64(m.earliestRound) diff --git a/network/message/garbled_test.go b/network/message/garbled_test.go index b651c02e041f68467799d02d7892e4916f032042..45a0a98fc672a2df88e0076116237c7a6ff0c0c5 100644 --- a/network/message/garbled_test.go +++ b/network/message/garbled_test.go @@ -2,6 +2,7 @@ package message import ( "encoding/binary" + jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/client/interfaces/message" "gitlab.com/elixxir/client/interfaces/params" "gitlab.com/elixxir/client/network/gateway" @@ -13,13 +14,21 @@ import ( "gitlab.com/elixxir/comms/client" "gitlab.com/elixxir/crypto/fastRNG" "gitlab.com/elixxir/primitives/format" + "gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/crypto/csprng" "gitlab.com/xx_network/primitives/netTime" "math/rand" + "os" "testing" "time" ) +func TestMain(m *testing.M) { + jww.SetStdoutThreshold(jww.LevelTrace) + connect.TestingOnlyDisableTLS = true + os.Exit(m.Run()) +} + type TestListener struct { ch chan bool } diff --git a/network/rounds/remoteFilters_test.go b/network/rounds/remoteFilters_test.go index 924f7f970d9dd3c9f8d915b4f3f1f3524417de11..a04d7f51c7f580402744fef7a5b1f128d5f23332 100644 --- a/network/rounds/remoteFilters_test.go +++ b/network/rounds/remoteFilters_test.go @@ -8,17 +8,26 @@ package rounds import ( + jww "github.com/spf13/jwalterweatherman" bloom "gitlab.com/elixxir/bloomfilter" "gitlab.com/elixxir/client/interfaces" "gitlab.com/elixxir/client/storage/reception" "gitlab.com/elixxir/comms/mixmessages" + "gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id/ephemeral" + "os" "reflect" "testing" "time" ) +func TestMain(m *testing.M) { + jww.SetStdoutThreshold(jww.LevelTrace) + connect.TestingOnlyDisableTLS = true + os.Exit(m.Run()) +} + // Unit test NewRemoteFilter func TestNewRemoteFilter(t *testing.T) { bloomFilter := &mixmessages.ClientBloom{ diff --git a/registration/permissioning_test.go b/registration/permissioning_test.go index 56083a5dd302c22872d1e172c67124bb56199093..616ab9393b868bf4da25e69976a3d316adc23d84 100644 --- a/registration/permissioning_test.go +++ b/registration/permissioning_test.go @@ -8,12 +8,21 @@ package registration import ( + jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/comms/client" + "gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/ndf" + "os" "testing" ) +func TestMain(m *testing.M) { + jww.SetStdoutThreshold(jww.LevelTrace) + connect.TestingOnlyDisableTLS = true + os.Exit(m.Run()) +} + // Init should create a valid Registration communications struct func TestInit(t *testing.T) { // Create dummy comms and ndf diff --git a/ud/addFact_test.go b/ud/addFact_test.go index eebb92a1d867c3873897ad56eac60d1b415ec5f2..ba6db2dc18596d476676666e7a4eaed4da0feabc 100644 --- a/ud/addFact_test.go +++ b/ud/addFact_test.go @@ -1,6 +1,7 @@ package ud import ( + jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/comms/client" pb "gitlab.com/elixxir/comms/mixmessages" "gitlab.com/elixxir/primitives/fact" @@ -8,9 +9,16 @@ import ( "gitlab.com/xx_network/crypto/csprng" "gitlab.com/xx_network/crypto/signature/rsa" "gitlab.com/xx_network/primitives/id" + "os" "testing" ) +func TestMain(m *testing.M) { + jww.SetStdoutThreshold(jww.LevelTrace) + connect.TestingOnlyDisableTLS = true + os.Exit(m.Run()) +} + type testAFC struct{} // Dummy implementation of SendRegisterFact so that we don't need to run our own