diff --git a/cmd/root.go b/cmd/root.go index e8eef0b454727b42ebe7bd91d86b4b8a894848e9..3c0ce1f240846efb1c867799a86c37446c17a4d9 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -21,6 +21,7 @@ import ( "gitlab.com/elixxir/client/interfaces/params" "gitlab.com/elixxir/client/switchboard" "gitlab.com/elixxir/crypto/contact" + "gitlab.com/elixxir/primitives/excludedRounds" "gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/utils" "io/ioutil" @@ -313,7 +314,7 @@ var rootCmd = &cobra.Command{ wg := &sync.WaitGroup{} sendCnt := int(viper.GetUint("sendCount")) if viper.GetBool("splitSends") { - paramsE2E.UseExcluded = true + paramsE2E.ExcludedRounds = excludedRounds.New() } wg.Add(sendCnt) go func() { diff --git a/go.mod b/go.mod index 534f22b61abe313ac55659f9f02825966650a079..2cd11548a1c072391f70c3349be45a3530d39c5f 100644 --- a/go.mod +++ b/go.mod @@ -17,12 +17,12 @@ 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.20211208211635-ad88fa2850b0 - gitlab.com/elixxir/crypto v0.0.7-0.20211208211534-e1c1462d945f + gitlab.com/elixxir/comms v0.0.4-0.20211217222342-cab5871fa697 + gitlab.com/elixxir/crypto v0.0.7-0.20211215181538-688f96f4c4c0 gitlab.com/elixxir/ekv v0.1.5 - gitlab.com/elixxir/primitives v0.0.3-0.20211217162004-35f6c2257db2 - gitlab.com/xx_network/comms v0.0.4-0.20211202195810-9dfc0b6cdb28 - gitlab.com/xx_network/crypto v0.0.5-0.20211014163843-57b345890686 + gitlab.com/elixxir/primitives v0.0.3-0.20211217222116-f6a477c0a01e + gitlab.com/xx_network/comms v0.0.4-0.20211215181459-0918c1141509 + gitlab.com/xx_network/crypto v0.0.5-0.20211215175729-3c916d3c5344 gitlab.com/xx_network/primitives v0.0.4-0.20211014163031-53405cf191fb golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 golang.org/x/net v0.0.0-20210525063256-abc453219eb5 diff --git a/go.sum b/go.sum index 9b5ba83551d8064a7b674d97a78622e199d043c9..9089cce7e53473931371b1abe77701650f938e2f 100644 --- a/go.sum +++ b/go.sum @@ -253,12 +253,12 @@ 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.20211208211635-ad88fa2850b0 h1:Xv0xV8zID5in8IqrJT0L6/QQiFEyQRgL6ibXCZlSIRA= -gitlab.com/elixxir/comms v0.0.4-0.20211208211635-ad88fa2850b0/go.mod h1:Q/9VctYnyN1T92Q/WhrFXYGWu819cKX33iRPvf6I63U= +gitlab.com/elixxir/comms v0.0.4-0.20211217222342-cab5871fa697 h1:ZrYswkTKRXknwoZaAZWD18oGhwB8JlpnzhKQoVu32Y0= +gitlab.com/elixxir/comms v0.0.4-0.20211217222342-cab5871fa697/go.mod h1:jyt7har6KD2S1+P38fII1CEvlUDl5JHv1A+1w3zlz00= 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.20211208211534-e1c1462d945f h1:owzmRi0kBBWUJIZ50XB9ZmxcVJB4ZTlnh3sbKOi3HJ8= -gitlab.com/elixxir/crypto v0.0.7-0.20211208211534-e1c1462d945f/go.mod h1:ftTGW5CHKj1QyLpF7BniMw1awB27KWKYwIV1aBrO39k= +gitlab.com/elixxir/crypto v0.0.7-0.20211215181538-688f96f4c4c0 h1:WUrLqko7VYPRtxjL0o++RHFpS5Xjtlxed7qHuMu1iAo= +gitlab.com/elixxir/crypto v0.0.7-0.20211215181538-688f96f4c4c0/go.mod h1:SQHmwjgX9taGCbzrtHGbIcZmV5iPielNP7c5wzLCUhM= 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= @@ -266,15 +266,15 @@ gitlab.com/elixxir/primitives v0.0.0-20200804170709-a1896d262cd9/go.mod h1:p0Vel 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.20211208211148-752546cf2e46/go.mod h1:zZy8AlOISFm5IG4G4sylypnz7xNBfZ5mpXiibqJT8+8= -gitlab.com/elixxir/primitives v0.0.3-0.20211217162004-35f6c2257db2 h1:j34iZKqA8oZF/GfqZGJSOWVlNsHURtgN64l/Xcfx1DI= -gitlab.com/elixxir/primitives v0.0.3-0.20211217162004-35f6c2257db2/go.mod h1:vIelJqbvbhJ/dRqb+1AsICGliqcFJzPiNP+TpXsKBi8= +gitlab.com/elixxir/primitives v0.0.3-0.20211217222116-f6a477c0a01e h1:o0zkgetagG5aCfa2xTvC10R4G8qv4QzFdtWyLgkcmMY= +gitlab.com/elixxir/primitives v0.0.3-0.20211217222116-f6a477c0a01e/go.mod h1:vIelJqbvbhJ/dRqb+1AsICGliqcFJzPiNP+TpXsKBi8= gitlab.com/xx_network/comms v0.0.0-20200805174823-841427dd5023/go.mod h1:owEcxTRl7gsoM8c3RQ5KAm5GstxrJp5tn+6JfQ4z5Hw= -gitlab.com/xx_network/comms v0.0.4-0.20211202195810-9dfc0b6cdb28 h1:CEZJfCiV6F6GQnWiYqoEjlzL2KpLipRy/ccV2smgf0E= -gitlab.com/xx_network/comms v0.0.4-0.20211202195810-9dfc0b6cdb28/go.mod h1:wR9Vx0KZLrIs0g2Efcp0UwFPStjcDRWkg/DJLVQI2vw= +gitlab.com/xx_network/comms v0.0.4-0.20211215181459-0918c1141509 h1:1z5LpSCTUDiocy8V4Ujbtpv6o6Emw873p3TdMdFek6o= +gitlab.com/xx_network/comms v0.0.4-0.20211215181459-0918c1141509/go.mod h1:43s+Fb0F/q7MHH83YB5tJdLPzGeu2u7Y9dKxCm5Qsu0= 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= -gitlab.com/xx_network/crypto v0.0.5-0.20211014163843-57b345890686/go.mod h1:GeUUB5eMlu7G1u7LXpClfOyUYsSDxAhiZBf+RZeGftc= +gitlab.com/xx_network/crypto v0.0.5-0.20211215175729-3c916d3c5344 h1:mkLcKpSw7WX1uXrSZoHNH6UYNWRNPBkbk3tZj2MmtFg= +gitlab.com/xx_network/crypto v0.0.5-0.20211215175729-3c916d3c5344/go.mod h1:GeUUB5eMlu7G1u7LXpClfOyUYsSDxAhiZBf+RZeGftc= gitlab.com/xx_network/primitives v0.0.0-20200803231956-9b192c57ea7c/go.mod h1:wtdCMr7DPePz9qwctNoAUzZtbOSHSedcK++3Df3psjA= gitlab.com/xx_network/primitives v0.0.0-20200804183002-f99f7a7284da/go.mod h1:OK9xevzWCaPO7b1wiluVJGk7R5ZsuC7pHY5hteZFQug= gitlab.com/xx_network/primitives v0.0.2/go.mod h1:cs0QlFpdMDI6lAo61lDRH2JZz+3aVkHy+QogOB6F/qc= diff --git a/interfaces/params/CMIX.go b/interfaces/params/CMIX.go index 60f10ee5b71b7eeba0ecac866f8c75c667835744..197978cad403947b062e710e29216abaab20cf7f 100644 --- a/interfaces/params/CMIX.go +++ b/interfaces/params/CMIX.go @@ -18,7 +18,6 @@ type CMIX struct { RoundTries uint Timeout time.Duration RetryDelay time.Duration - UseExcluded bool ExcludedRounds *excludedRounds.ExcludedRounds // an alternate identity preimage to use on send. If not set, the default // for the sending identity will be used @@ -27,11 +26,9 @@ type CMIX struct { func GetDefaultCMIX() CMIX { return CMIX{ - RoundTries: 10, - Timeout: 25 * time.Second, - RetryDelay: 1 * time.Second, - UseExcluded: false, - ExcludedRounds: excludedRounds.New(), + RoundTries: 10, + Timeout: 25 * time.Second, + RetryDelay: 1 * time.Second, } } diff --git a/network/message/sendCmix.go b/network/message/sendCmix.go index a34c627f0f274e0e6ad9486c4ad40ccf4c41c0eb..88998e327dc0c26a131904b8f5cda6023723dd5e 100644 --- a/network/message/sendCmix.go +++ b/network/message/sendCmix.go @@ -9,7 +9,6 @@ package message import ( "fmt" - "github.com/golang-collections/collections/set" "github.com/pkg/errors" jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/client/interfaces" @@ -20,6 +19,7 @@ import ( pb "gitlab.com/elixxir/comms/mixmessages" "gitlab.com/elixxir/comms/network" "gitlab.com/elixxir/crypto/fastRNG" + "gitlab.com/elixxir/primitives/excludedRounds" "gitlab.com/elixxir/primitives/format" "gitlab.com/elixxir/primitives/states" "gitlab.com/xx_network/comms/connect" @@ -75,9 +75,15 @@ func sendCmixHelper(sender *gateway.Sender, msg format.Message, stop *stoppable.Single) (id.Round, ephemeral.Id, error) { timeStart := netTime.Now() - attempted := set.New() maxTimeout := sender.GetHostParams().SendTimeout + var attempted *excludedRounds.ExcludedRounds + if cmixParams.ExcludedRounds != nil { + attempted = cmixParams.ExcludedRounds + } else { + attempted = excludedRounds.New() + } + jww.INFO.Printf("Looking for round to send cMix message to %s "+ "(msgDigest: %s)", recipient, msg.Digest()) @@ -96,8 +102,8 @@ func sendCmixHelper(sender *gateway.Sender, msg format.Message, msg.Digest()) } - remainingTime := cmixParams.Timeout - elapsed //find the best round to send to, excluding attempted rounds + remainingTime := cmixParams.Timeout - elapsed bestRound, err := instance.GetWaitingRounds().GetUpcomingRealtime(remainingTime, attempted, sendTimeBuffer) if err != nil { jww.WARN.Printf("Failed to GetUpcomingRealtime (msgDigest: %s): %+v", msg.Digest(), err) @@ -108,19 +114,7 @@ func sendCmixHelper(sender *gateway.Sender, msg format.Message, } //add the round on to the list of attempted, so it is not tried again - attempted.Insert(bestRound) - - // TODO: does this conflict with the attempted object? - // Check excluded rounds for the selected best round - if cmixParams.UseExcluded && cmixParams.ExcludedRounds != nil { - if cmixParams.ExcludedRounds.Has(bestRound.GetRoundId()) { - jww.WARN.Printf("Round %d is excluded, skipping...", bestRound.ID) - continue - } else { - cmixParams.ExcludedRounds.Insert(bestRound.GetRoundId()) - jww.WARN.Printf("Added %d to excluded rounds", bestRound.ID) - } - } + attempted.Insert(bestRound.GetRoundId()) // Determine whether the selected round contains any Nodes // that are blacklisted by the params.Network object diff --git a/network/message/sendManyCmix.go b/network/message/sendManyCmix.go index 0e6e70b511d3af2ca6c713ec837abbfdb3fed665..40ed5fe08b6e624e3d2ece75b2e35fccefb3a8ef 100644 --- a/network/message/sendManyCmix.go +++ b/network/message/sendManyCmix.go @@ -9,7 +9,6 @@ package message import ( "fmt" - "github.com/golang-collections/collections/set" "github.com/pkg/errors" jww "github.com/spf13/jwalterweatherman" "gitlab.com/elixxir/client/interfaces" @@ -21,6 +20,7 @@ import ( pb "gitlab.com/elixxir/comms/mixmessages" "gitlab.com/elixxir/comms/network" "gitlab.com/elixxir/crypto/fastRNG" + "gitlab.com/elixxir/primitives/excludedRounds" "gitlab.com/elixxir/primitives/format" "gitlab.com/xx_network/comms/connect" "gitlab.com/xx_network/primitives/id" @@ -63,7 +63,12 @@ func sendManyCmixHelper(sender *gateway.Sender, id.Round, []ephemeral.Id, error) { timeStart := netTime.Now() - attempted := set.New() + var attempted *excludedRounds.ExcludedRounds + if param.ExcludedRounds != nil { + attempted = param.ExcludedRounds + } else { + attempted = excludedRounds.New() + } maxTimeout := sender.GetHostParams().SendTimeout @@ -98,18 +103,7 @@ func sendManyCmixHelper(sender *gateway.Sender, // Add the round on to the list of attempted rounds so that it is not // tried again - attempted.Insert(bestRound) - - // Check excluded rounds for the selected best round - if param.UseExcluded && param.ExcludedRounds != nil { - if param.ExcludedRounds.Has(bestRound.GetRoundId()) { - jww.WARN.Printf("Round %d is excluded, skipping...", bestRound.ID) - continue - } else { - param.ExcludedRounds.Insert(bestRound.GetRoundId()) - jww.WARN.Printf("Added %d to excluded rounds", bestRound.ID) - } - } + attempted.Insert(bestRound.GetRoundId()) // Determine whether the selected round contains any nodes that are // blacklisted by the params.Network object