Skip to content

refactor(consensus): separate sending votes from "pick votes" logic (backport #2659) - #3047

Merged
melekes merged 1 commit into
v1.xfrom
mergify/bp/v1.x/pr-2659
May 9, 2024
Merged

melekes merged 1 commit into
v1.xfrom
mergify/bp/v1.x/pr-2659

Conversation

@mergify

@mergify mergify Bot commented May 9, 2024

Copy link
Copy Markdown
Contributor

This is done by @adizere , @ebuchman , and @sergio-mena as part of a refactoring spree :-)

The goal of this is to improve testability of gossipVotesRoutine by separating out the logic for picking which vote to send. We introduced a new pure function, pickVoteToSend, which returns a vote, and then call the new SendVoteSetHasVote method to send it. This greatly simplifies the loop in gossipVoteRoutine, and allows the pickVoteToSend function to be independently tested.

Note for reviewers:

  • This is pure refactoring, no logic change was intended.
  • This PR can be reviewed commit by commit

PR checklist

  • Tests written/updated
  • Changelog entry added in .changelog (we use unclog to manage our changelog)
  • Updated relevant documentation (docs/ or spec/) and code comments
  • Title follows the Conventional Commits spec

This is an automatic backport of pull request #2659 done by [Mergify](https://mergify.com).

…2659)

This is done by @adizere , @ebuchman , and @sergio-mena as part of a
refactoring spree :-)

The goal of this is to improve testability of gossipVotesRoutine by
separating out the logic for picking which vote to send. We introduced a
new pure function, pickVoteToSend, which returns a vote, and then call
the new SendVoteSetHasVote method to send it. This greatly simplifies
the loop in gossipVoteRoutine, and allows the pickVoteToSend function to
be independently tested.

Note for reviewers:
* This is pure refactoring, no logic change was intended.
* This PR can be reviewed commit by commit

---

#### PR checklist

- [ ] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [ ] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

---------

Co-authored-by: Daniel <[email protected]>
(cherry picked from commit 34e41c5)
@mergify
mergify Bot requested a review from a team as a code owner May 9, 2024 07:23
@mergify
mergify Bot requested a review from a team May 9, 2024 07:23
@melekes
melekes merged commit fc1c2ba into v1.x May 9, 2024
@melekes
melekes deleted the mergify/bp/v1.x/pr-2659 branch May 9, 2024 07:35
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.

2 participants