Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
c86790e5
Commit
c86790e5
authored
2 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Propagate key residue for receiver
parent
b83ad5f4
No related branches found
No related tags found
2 merge requests
!510
Release
,
!344
Xx 4084/send e2e residue
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
e2e/parse/partition.go
+1
-1
1 addition, 1 deletion
e2e/parse/partition.go
e2e/parse/partition/store.go
+9
-4
9 additions, 4 deletions
e2e/parse/partition/store.go
e2e/parse/partition_test.go
+5
-2
5 additions, 2 deletions
e2e/parse/partition_test.go
with
15 additions
and
7 deletions
e2e/parse/partition.go
+
1
−
1
View file @
c86790e5
...
...
@@ -80,7 +80,7 @@ func (p *Partitioner) Partition(recipient *id.ID, mt catalog.MessageType,
func
(
p
*
Partitioner
)
HandlePartition
(
sender
*
id
.
ID
,
contents
[]
byte
,
relationshipFingerprint
[]
byte
,
residue
e2eCrypto
.
KeyResidue
)
(
receive
.
Message
,
bool
)
{
residue
e2eCrypto
.
KeyResidue
)
(
receive
.
Message
,
e2eCrypto
.
KeyResidue
,
bool
)
{
if
isFirst
(
contents
)
{
// If it is the first message in a set, then handle it as so
...
...
This diff is collapsed.
Click to expand it.
e2e/parse/partition/store.go
+
9
−
4
View file @
c86790e5
...
...
@@ -54,7 +54,7 @@ func (s *Store) AddFirst(partner *id.ID, mt catalog.MessageType,
messageID
uint64
,
partNum
,
numParts
uint8
,
senderTimestamp
,
storageTimestamp
time
.
Time
,
part
[]
byte
,
relationshipFingerprint
[]
byte
,
residue
e2e
.
KeyResidue
)
(
receive
.
Message
,
bool
)
{
receive
.
Message
,
e2e
.
KeyResidue
,
bool
)
{
mpm
:=
s
.
load
(
partner
,
messageID
)
mpm
.
AddFirst
(
mt
,
partNum
,
numParts
,
senderTimestamp
,
storageTimestamp
,
part
)
...
...
@@ -64,34 +64,39 @@ func (s *Store) AddFirst(partner *id.ID, mt catalog.MessageType,
s
.
mux
.
Lock
()
defer
s
.
mux
.
Unlock
()
keyRes
:=
e2e
.
KeyResidue
{}
if
!
ok
{
s
.
activeParts
[
mpm
]
=
true
s
.
saveActiveParts
()
}
else
{
keyRes
=
mpm
.
KeyResidue
mpID
:=
getMultiPartID
(
mpm
.
Sender
,
mpm
.
MessageID
)
delete
(
s
.
multiParts
,
mpID
)
}
return
msg
,
ok
return
msg
,
keyRes
,
ok
}
func
(
s
*
Store
)
Add
(
partner
*
id
.
ID
,
messageID
uint64
,
partNum
uint8
,
part
[]
byte
,
relationshipFingerprint
[]
byte
)
(
receive
.
Message
,
bool
)
{
part
[]
byte
,
relationshipFingerprint
[]
byte
)
(
receive
.
Message
,
e2e
.
KeyResidue
,
bool
)
{
mpm
:=
s
.
load
(
partner
,
messageID
)
mpm
.
Add
(
partNum
,
part
)
msg
,
ok
:=
mpm
.
IsComplete
(
relationshipFingerprint
)
keyRes
:=
e2e
.
KeyResidue
{}
if
!
ok
{
s
.
activeParts
[
mpm
]
=
true
s
.
saveActiveParts
()
}
else
{
keyRes
=
mpm
.
KeyResidue
mpID
:=
getMultiPartID
(
mpm
.
Sender
,
mpm
.
MessageID
)
delete
(
s
.
multiParts
,
mpID
)
}
return
msg
,
ok
return
msg
,
keyRes
,
ok
}
// prune clears old messages on it's stored timestamp.
...
...
This diff is collapsed.
Click to expand it.
e2e/parse/partition_test.go
+
5
−
2
View file @
c86790e5
...
...
@@ -8,6 +8,7 @@
package
parse
import
(
"gitlab.com/elixxir/crypto/e2e"
"testing"
"gitlab.com/elixxir/client/catalog"
...
...
@@ -72,10 +73,11 @@ func TestPartitioner_HandlePartition(t *testing.T) {
p
:=
NewPartitioner
(
versioned
.
NewKV
(
ekv
.
MakeMemstore
()),
len
(
ipsumTestStr
))
m
:=
newMessagePart
(
1107
,
1
,
[]
byte
(
ipsumTestStr
),
len
(
ipsumTestStr
)
+
headerLen
)
_
,
_
=
p
.
HandlePartition
(
_
,
_
,
_
=
p
.
HandlePartition
(
&
id
.
DummyUser
,
m
.
bytes
(),
[]
byte
{
't'
,
'e'
,
's'
,
't'
,
'i'
,
'n'
,
'g'
,
's'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
},
e2e
.
KeyResidue
{},
)
}
...
...
@@ -85,9 +87,10 @@ func TestPartitioner_HandleFirstPartition(t *testing.T) {
m
:=
newFirstMessagePart
(
catalog
.
XxMessage
,
1107
,
1
,
netTime
.
Now
(),
[]
byte
(
ipsumTestStr
),
len
([]
byte
(
ipsumTestStr
))
+
firstHeaderLen
)
_
,
_
=
p
.
HandlePartition
(
_
,
_
,
_
=
p
.
HandlePartition
(
&
id
.
DummyUser
,
m
.
bytes
(),
[]
byte
{
't'
,
'e'
,
's'
,
't'
,
'i'
,
'n'
,
'g'
,
's'
,
't'
,
'r'
,
'i'
,
'n'
,
'g'
},
e2e
.
KeyResidue
{},
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment