diff --git a/VERSION b/VERSION index c5d4cee36..1e0c609c9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.51.0 +0.51.1 diff --git a/protocol/ens.go b/protocol/ens.go index 984e4939d..a39340fea 100644 --- a/protocol/ens.go +++ b/protocol/ens.go @@ -8,13 +8,13 @@ import ( // maxRetries is the maximum number of attempts we do before giving up const maxRetries uint64 = 11 -// ENSBackoffTimeMs is the step of the exponential backoff -// we retry roughly for 17 hours after receiving the message 2^11 * 30000 -const ENSBackoffTimeMs uint64 = 30000 +// ENSBackoffTimeSec is the step of the exponential backoff +// we retry roughly for 17 hours after receiving the message 2^11 * 30 +const ENSBackoffTimeSec uint64 = 30 // We calculate if it's too early to retry, by exponentially backing off func verifiedENSRecentlyEnough(now, verifiedAt, retries uint64) bool { - return now < verifiedAt+ENSBackoffTimeMs*retries*uint64(math.Exp2(float64(retries))) + return now < verifiedAt+ENSBackoffTimeSec*retries*uint64(math.Exp2(float64(retries))) } func shouldENSBeVerified(c *Contact, now uint64) bool { diff --git a/protocol/ens_test.go b/protocol/ens_test.go index 149eb4c48..86f646ecf 100644 --- a/protocol/ens_test.go +++ b/protocol/ens_test.go @@ -34,7 +34,7 @@ func (s *ENSSuite) TestShouldBeVerified() { ENSVerificationRetries: 4, }, Expected: true, - TimeNow: 10 + ENSBackoffTimeMs*4*16 + 1, + TimeNow: 10 + ENSBackoffTimeSec*4*16 + 1, }, { Name: "Empty name", @@ -63,7 +63,7 @@ func (s *ENSSuite) TestShouldBeVerified() { ENSVerificationRetries: 4, }, Expected: false, - TimeNow: 10 + ENSBackoffTimeMs*4*16 - 1, + TimeNow: 10 + ENSBackoffTimeSec*4*16 - 1, }, { Name: "max retries reached", @@ -73,7 +73,7 @@ func (s *ENSSuite) TestShouldBeVerified() { ENSVerificationRetries: 11, }, Expected: false, - TimeNow: 10 + ENSBackoffTimeMs*5*2048 + 1, + TimeNow: 10 + ENSBackoffTimeSec*5*2048 + 1, }, } for _, tc := range testCases { diff --git a/protocol/messenger.go b/protocol/messenger.go index 673cd94ab..e266dfd81 100644 --- a/protocol/messenger.go +++ b/protocol/messenger.go @@ -2057,7 +2057,8 @@ func (m *Messenger) VerifyENSNames(ctx context.Context, rpcEndpoint, contractAdd var ensDetails []enstypes.ENSDetails - now := m.getTimesource().GetCurrentTime() + // Now in seconds + now := m.getTimesource().GetCurrentTime() / 1000 for _, contact := range m.allContacts { if shouldENSBeVerified(contact, now) { ensDetails = append(ensDetails, enstypes.ENSDetails{ @@ -2091,6 +2092,7 @@ func (m *Messenger) VerifyENSNames(ctx context.Context, rpcEndpoint, contractAdd zap.String("publicKey", details.PublicKeyString), zap.Error(details.Error), ) + contact.ENSVerificationRetries++ } response.Contacts = append(response.Contacts, contact) }