Skip to content

Conversation

@MorganaFuture
Copy link

@MorganaFuture MorganaFuture commented Aug 17, 2025

Add epoch tracking to handle uint32 wraparound safely Implement overflow detection and epoch increment

Links: Issues

Add epoch tracking to handle uint32 wraparound safely
Implement overflow detection and epoch increme
@MorganaFuture MorganaFuture marked this pull request as ready for review August 17, 2025 08:59
@MorganaFuture
Copy link
Author

@Ben-PH @richard-ramos Could you please take a look?

@richard-ramos
Copy link
Member

cc: @AkshayaMani

Comment on lines +49 to +61
if a.epoch != b.epoch:
if a.epoch < b.epoch:
return -1
else:
return 1

# Same epoch, compare counters normally
if a.counter < b.counter:
return -1
elif a.counter > b.counter:
return 1
else:
return 0
Copy link
Member

@vladopajic vladopajic Aug 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if a.epoch != b.epoch:
if a.epoch < b.epoch:
return -1
else:
return 1
# Same epoch, compare counters normally
if a.counter < b.counter:
return -1
elif a.counter > b.counter:
return 1
else:
return 0
if a.epoch == b.epoch:
return a.counter - b.counter
return a.epoch - b.epoch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants