From 7c6fb1782497398698eb03cd7d0baa96e9c05bb2 Mon Sep 17 00:00:00 2001 From: jbhusson <jonah@elixxir.io> Date: Fri, 17 Dec 2021 12:18:53 -0500 Subject: [PATCH] Fix sending over multiple rounds --- cmd/root.go | 4 +++- go.mod | 2 +- go.sum | 4 ++-- network/message/sendCmix.go | 13 ++++++++----- network/message/sendE2E.go | 2 ++ network/message/sendManyCmix.go | 2 +- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index b8ce19238..e8eef0b45 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -312,7 +312,9 @@ var rootCmd = &cobra.Command{ paramsUnsafe := params.GetDefaultUnsafe() wg := &sync.WaitGroup{} sendCnt := int(viper.GetUint("sendCount")) - paramsE2E.UseExcluded = viper.GetBool("splitSends") + if viper.GetBool("splitSends") { + paramsE2E.UseExcluded = true + } wg.Add(sendCnt) go func() { //sendDelay := time.Duration(viper.GetUint("sendDelay")) diff --git a/go.mod b/go.mod index 6f9084e26..534f22b61 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( gitlab.com/elixxir/comms v0.0.4-0.20211208211635-ad88fa2850b0 gitlab.com/elixxir/crypto v0.0.7-0.20211208211534-e1c1462d945f gitlab.com/elixxir/ekv v0.1.5 - gitlab.com/elixxir/primitives v0.0.3-0.20211216205607-021a9c8c943a + 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/xx_network/primitives v0.0.4-0.20211014163031-53405cf191fb diff --git a/go.sum b/go.sum index 42586cbc2..9b5ba8355 100644 --- a/go.sum +++ b/go.sum @@ -266,8 +266,8 @@ 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.20211216205607-021a9c8c943a h1:joGFEIC3+kMzXkHXDAPLqg8X2HaGi2rGn3/dFrn1wEs= -gitlab.com/elixxir/primitives v0.0.3-0.20211216205607-021a9c8c943a/go.mod h1:vIelJqbvbhJ/dRqb+1AsICGliqcFJzPiNP+TpXsKBi8= +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/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= diff --git a/network/message/sendCmix.go b/network/message/sendCmix.go index 042a35757..a34c627f0 100644 --- a/network/message/sendCmix.go +++ b/network/message/sendCmix.go @@ -112,8 +112,14 @@ func sendCmixHelper(sender *gateway.Sender, msg format.Message, // TODO: does this conflict with the attempted object? // Check excluded rounds for the selected best round - if cmixParams.UseExcluded && cmixParams.ExcludedRounds != nil && cmixParams.ExcludedRounds.Has(bestRound.GetRoundId()) { - continue + 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) + } } // Determine whether the selected round contains any Nodes @@ -186,9 +192,6 @@ func sendCmixHelper(sender *gateway.Sender, msg format.Message, // Return if it sends properly gwSlotResp := result.(*pb.GatewaySlotResponse) if gwSlotResp.Accepted { - if cmixParams.UseExcluded && cmixParams.ExcludedRounds != nil { - cmixParams.ExcludedRounds.Insert(bestRound.ID) - } m := fmt.Sprintf("Successfully sent to EphID %v "+ "(source: %s) in round %d (msgDigest: %s), "+ "elapsed: %s numRoundTries: %d", ephID.Int64(), diff --git a/network/message/sendE2E.go b/network/message/sendE2E.go index 52d202393..f1c2982b4 100644 --- a/network/message/sendE2E.go +++ b/network/message/sendE2E.go @@ -98,6 +98,8 @@ func (m *Manager) SendE2E(msg message.Send, param params.E2E, param.IdentityPreimage = partner.GetE2EPreimage() } + jww.DEBUG.Printf("Excluded %+v", param.ExcludedRounds) + //send the cmix message, each partition in its own thread wg.Add(1) go func(i int) { diff --git a/network/message/sendManyCmix.go b/network/message/sendManyCmix.go index d37d48342..e218cafdf 100644 --- a/network/message/sendManyCmix.go +++ b/network/message/sendManyCmix.go @@ -205,7 +205,7 @@ func sendManyCmixHelper(sender *gateway.Sender, gwSlotResp := result.(*pb.GatewaySlotResponse) if gwSlotResp.Accepted { if param.UseExcluded && param.ExcludedRounds != nil { - param.ExcludedRounds.Insert(bestRound.ID) + param.ExcludedRounds.Insert(bestRound.GetRoundId()) } m := fmt.Sprintf("Successfully sent to EphIDs %s (sources: [%s]) "+ "in round %d", ephemeralIDsString, recipientString, bestRound.ID) -- GitLab