Skip to content
Snippets Groups Projects
Commit 9d36ee60 authored by Jonah Husson's avatar Jonah Husson
Browse files

Implement use of excluded rounds

parent 8bb20522
No related branches found
No related tags found
2 merge requests!117Release,!86M203/excluded rounds
......@@ -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.20211215181643-55748529a237
gitlab.com/elixxir/crypto v0.0.7-0.20211215181538-688f96f4c4c0
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.20211208211148-752546cf2e46
gitlab.com/xx_network/comms v0.0.4-0.20211215181459-0918c1141509
gitlab.com/xx_network/crypto v0.0.5-0.20211215175729-3c916d3c5344
gitlab.com/elixxir/primitives v0.0.3-0.20211216205607-021a9c8c943a
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
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
golang.org/x/net v0.0.0-20210525063256-abc453219eb5
......
......@@ -253,27 +253,28 @@ 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.20211215181643-55748529a237 h1:kVFSZaqeX3md7W/tADOXAzejuaAqy7QLoJEJMPH1Svg=
gitlab.com/elixxir/comms v0.0.4-0.20211215181643-55748529a237/go.mod h1:Xsq9E5RDQ15CxsblsFeGd0gcOnRIVWTIgaufRHCRTfk=
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/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.20211215181538-688f96f4c4c0 h1:WUrLqko7VYPRtxjL0o++RHFpS5Xjtlxed7qHuMu1iAo=
gitlab.com/elixxir/crypto v0.0.7-0.20211215181538-688f96f4c4c0/go.mod h1:SQHmwjgX9taGCbzrtHGbIcZmV5iPielNP7c5wzLCUhM=
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/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.20211208211148-752546cf2e46 h1:KL/CVczLH7VXy9snvr7WJG2YtJRoHGfL9o9pY+CKzdw=
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/xx_network/comms v0.0.0-20200805174823-841427dd5023/go.mod h1:owEcxTRl7gsoM8c3RQ5KAm5GstxrJp5tn+6JfQ4z5Hw=
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/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/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.20211215175729-3c916d3c5344 h1:mkLcKpSw7WX1uXrSZoHNH6UYNWRNPBkbk3tZj2MmtFg=
gitlab.com/xx_network/crypto v0.0.5-0.20211215175729-3c916d3c5344/go.mod h1:GeUUB5eMlu7G1u7LXpClfOyUYsSDxAhiZBf+RZeGftc=
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/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=
......
......@@ -9,6 +9,7 @@ package params
import (
"encoding/json"
"gitlab.com/elixxir/primitives/excludedRounds"
"time"
)
......@@ -17,6 +18,8 @@ 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
IdentityPreimage []byte
......@@ -27,6 +30,8 @@ func GetDefaultCMIX() CMIX {
RoundTries: 10,
Timeout: 25 * time.Second,
RetryDelay: 1 * time.Second,
UseExcluded: false,
ExcludedRounds: excludedRounds.New(),
}
}
......@@ -34,7 +39,7 @@ func (c CMIX) Marshal() ([]byte, error) {
return json.Marshal(c)
}
// Obtain default CMIX parameters, or override with given parameters if set
// GetCMIXParameters func obtains default CMIX parameters, or overrides with given parameters if set
func GetCMIXParameters(params string) (CMIX, error) {
p := GetDefaultCMIX()
if len(params) > 0 {
......
......@@ -110,6 +110,12 @@ 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 && cmixParams.ExcludedRounds.Has(bestRound.GetRoundId()) {
continue
}
// Determine whether the selected round contains any Nodes
// that are blacklisted by the params.Network object
containsBlacklisted := false
......@@ -180,6 +186,9 @@ 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(),
......
......@@ -100,6 +100,11 @@ func sendManyCmixHelper(sender *gateway.Sender,
// tried again
attempted.Insert(bestRound)
// Check excluded rounds for the selected best round
if param.UseExcluded && param.ExcludedRounds != nil && param.ExcludedRounds.Has(bestRound.GetRoundId()) {
continue
}
// Determine whether the selected round contains any nodes that are
// blacklisted by the params.Network object
containsBlacklisted := false
......@@ -199,6 +204,9 @@ func sendManyCmixHelper(sender *gateway.Sender,
// Return if it sends properly
gwSlotResp := result.(*pb.GatewaySlotResponse)
if gwSlotResp.Accepted {
if param.UseExcluded && param.ExcludedRounds != nil {
param.ExcludedRounds.Insert(bestRound.ID)
}
m := fmt.Sprintf("Successfully sent to EphIDs %s (sources: [%s]) "+
"in round %d", ephemeralIDsString, recipientString, bestRound.ID)
jww.INFO.Print(m)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment