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
d0286c67
Commit
d0286c67
authored
3 years ago
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Disable registration checks for expired identities
parent
475c5976
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!23
Release
,
!13
Hotfix/no host cooldown + return sende2e TS
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
network/ephemeral/tracker.go
+1
-1
1 addition, 1 deletion
network/ephemeral/tracker.go
storage/reception/registration.go
+6
-6
6 additions, 6 deletions
storage/reception/registration.go
storage/reception/registration_test.go
+17
-17
17 additions, 17 deletions
storage/reception/registration_test.go
with
24 additions
and
24 deletions
network/ephemeral/tracker.go
+
1
−
1
View file @
d0286c67
...
...
@@ -77,7 +77,7 @@ func track(session *storage.Session, addrSpace *AddressSpace, ourId *id.ID, stop
// Generates the IDs since the last track
protoIds
,
err
:=
ephemeral
.
GetIdsByRange
(
ourId
,
uint
(
addressSize
),
lastCheck
,
lastCheck
.
Sub
(
now
))
ourId
,
uint
(
addressSize
),
lastCheck
,
now
.
Sub
(
lastCheck
))
jww
.
DEBUG
.
Printf
(
"Now: %s, LastCheck: %s, Different: %s"
,
now
,
lastCheck
,
now
.
Sub
(
lastCheck
))
...
...
This diff is collapsed.
Click to expand it.
storage/reception/registration.go
+
6
−
6
View file @
d0286c67
...
...
@@ -8,7 +8,7 @@ import (
"gitlab.com/elixxir/client/storage/versioned"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id/ephemeral"
"gitlab.com/xx_network/primitives/netTime"
//
"gitlab.com/xx_network/primitives/netTime"
"strconv"
"time"
)
...
...
@@ -29,13 +29,13 @@ func newRegistration(reg Identity, kv *versioned.KV) (*registration, error) {
reg
.
EndValid
=
reg
.
EndValid
.
Round
(
0
)
reg
.
End
=
reg
.
End
.
Round
(
0
)
now
:=
netTime
.
Now
()
//
now := netTime.Now()
// Do edge checks to determine if the identity is valid
if
now
.
After
(
reg
.
End
)
&&
reg
.
ExtraChecks
<
1
{
return
nil
,
errors
.
New
(
"Cannot create a registration for an "
+
"identity which has expired"
)
}
//
if now.After(reg.End) && reg.ExtraChecks < 1 {
//
return nil, errors.New("Cannot create a registration for an " +
//
"identity which has expired")
//
}
// Set the prefix
kv
=
kv
.
Prefix
(
regPrefix
(
reg
.
EphId
,
reg
.
Source
,
reg
.
StartValid
))
...
...
This diff is collapsed.
Click to expand it.
storage/reception/registration_test.go
+
17
−
17
View file @
d0286c67
...
...
@@ -5,27 +5,27 @@ import (
"gitlab.com/elixxir/ekv"
"gitlab.com/xx_network/primitives/netTime"
"math/rand"
"strings"
//
"strings"
"testing"
"time"
)
func
TestNewRegistration_Failed
(
t
*
testing
.
T
)
{
// Generate an identity for use
rng
:=
rand
.
New
(
rand
.
NewSource
(
42
))
timestamp
:=
time
.
Date
(
2009
,
11
,
17
,
20
,
34
,
58
,
651387237
,
time
.
UTC
)
idu
,
_
:=
generateFakeIdentity
(
rng
,
15
,
timestamp
)
id
:=
idu
.
Identity
kv
:=
versioned
.
NewKV
(
make
(
ekv
.
Memstore
))
id
.
End
=
time
.
Time
{}
id
.
ExtraChecks
=
0
_
,
err
:=
newRegistration
(
id
,
kv
)
if
err
==
nil
||
!
strings
.
Contains
(
err
.
Error
(),
"Cannot create a registration for an identity which has expired"
)
{
t
.
Error
(
"Registration creation succeeded with expired identity."
)
}
}
//
func TestNewRegistration_Failed(t *testing.T) {
//
// Generate an identity for use
//
rng := rand.New(rand.NewSource(42))
//
timestamp := time.Date(2009, 11, 17, 20, 34, 58, 651387237, time.UTC)
//
idu, _ := generateFakeIdentity(rng, 15, timestamp)
//
id := idu.Identity
//
kv := versioned.NewKV(make(ekv.Memstore))
//
id.End = time.Time{}
//
id.ExtraChecks = 0
//
_, err := newRegistration(id, kv)
//
if err == nil || !strings.Contains(err.Error(), "Cannot create a registration for an identity which has expired") {
//
t.Error("Registration creation succeeded with expired identity.")
//
}
//
}
func
TestNewRegistration_Ephemeral
(
t
*
testing
.
T
)
{
// Generate an identity for use
...
...
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