Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal_creator_election macro are +/- off by 1 because congruence #26

Closed
Jovonni opened this issue May 14, 2020 · 0 comments · Fixed by #27
Closed

proposal_creator_election macro are +/- off by 1 because congruence #26

Jovonni opened this issue May 14, 2020 · 0 comments · Fixed by #27
Assignees
Labels
bug Something isn't working

Comments

@Jovonni
Copy link
Contributor

Jovonni commented May 14, 2020

bug quoted from the paper repo:
paper issue

The proposal creation function still iterates congruently, but the expected node id is not what is expected. All tests pass now, but this is was the bug. It didn't stop proposal generation for nodes, but it chose the wrong participant to create the next proposal

wrong:

( ($latest_block_id + 1) % ( ($peer_length + 1) as i64) ) + 1

Should be:

($latest_block_id % $peer_length as i64) + 1

Because

[print( ( (x+1) % (3 + 1) ) + 1 ) for x in range(0,10)]
2
3
4
1
2
3
4
1
2
3

but this is correct

[print((x % 3) + 1) for x in range(0,10)]
1
2
3
1
2
3
1
2
3
1

This works for three, and for 2 peers

[print((x % 2) + 1) for x in range(0,10)]
1
2
1
2
1
2
1
2
1
2

and for 5 peers

[print((x % 5) + 1) for x in range(0,10)]
1
2
3
4
5
1
2
3
4
5
@Jovonni Jovonni added the bug Something isn't working label May 14, 2020
@Jovonni Jovonni self-assigned this May 14, 2020
@Jovonni Jovonni mentioned this issue May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant