Skip to content

refactor(consensus): separate sending block parts from "pick part" logic (backport #2663) - #3046

Merged
melekes merged 3 commits into
v1.xfrom
mergify/bp/v1.x/pr-2663
May 9, 2024
Merged

melekes merged 3 commits into
v1.xfrom
mergify/bp/v1.x/pr-2663

Conversation

@mergify

@mergify mergify Bot commented May 9, 2024

Copy link
Copy Markdown
Contributor

This was done by @ebuchman as part of a refactoring spree :-)

The goal of this is to improve testability of gossipDataRoutine by separating out the logic for picking which block part to send. We introduced a new pure function, pickPartToSend, which returns a block part, and then call the new SendPartSetHasPart method to send it and update the peer state. This greatly simplifies the loop in gossipDataRoutine, and allows the pickPartToSend function to be independently tested.

Note for reviewers:


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 #2663 done by [Mergify](https://mergify.com).

…gic (#2663)

This was done by @ebuchman as part of a refactoring spree :-)

The goal of this is to improve testability of `gossipDataRoutine` by
separating out the logic for picking which block part to send. We
introduced a new pure function, `pickPartToSend`, which returns a block
part, and then call the new `SendPartSetHasPart` method to send it and
update the peer state. This greatly simplifies the loop in
`gossipDataRoutine`, and allows the `pickPartToSend` function to be
independently tested.

Note for reviewers:
* This PR is built on top of #2659
* 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
- [x] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

---------

Co-authored-by: Sergio Mena <[email protected]>
Co-authored-by: Ethan Buchman <[email protected]>
(cherry picked from commit 163f2d5)

# Conflicts:
#	internal/consensus/reactor.go
@mergify

mergify Bot commented May 9, 2024

Copy link
Copy Markdown
Contributor Author

Cherry-pick of 163f2d5 has failed:

On branch mergify/bp/v1.x/pr-2663
Your branch is up to date with 'origin/v1.x'.

You are currently cherry-picking commit 163f2d5dc.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   internal/consensus/reactor.go

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify
mergify Bot requested a review from a team as a code owner May 9, 2024 07:22
@mergify mergify Bot added the conflicts label May 9, 2024
@mergify
mergify Bot requested a review from a team May 9, 2024 07:22
@melekes

melekes commented May 9, 2024

Copy link
Copy Markdown
Collaborator

@mergify recreate

@mergify

mergify Bot commented May 9, 2024

Copy link
Copy Markdown
Contributor Author

recreate

❌ Sorry but I didn't understand the command. Please consult the commands documentation 📚.

@melekes

melekes commented May 9, 2024

Copy link
Copy Markdown
Collaborator

@mergify rebase

@mergify

mergify Bot commented May 9, 2024

Copy link
Copy Markdown
Contributor Author

rebase

☑️ Nothing to do

Details
  • -conflict [📌 rebase requirement]
  • -closed [📌 rebase requirement]
  • queue-position=-1 [📌 rebase requirement]
  • any of:
    • #commits-behind>0 [📌 rebase requirement]
    • #commits>1 [📌 rebase requirement]
    • -linear-history [📌 rebase requirement]

@melekes

melekes commented May 9, 2024

Copy link
Copy Markdown
Collaborator

@Mergifyio update

@mergify

mergify Bot commented May 9, 2024

Copy link
Copy Markdown
Contributor Author

update

☑️ Nothing to do

Details
  • -conflict [📌 update requirement]
  • #commits-behind>0 [📌 update requirement]
  • -closed [📌 update requirement]
  • queue-position=-1 [📌 update requirement]

@melekes melekes closed this May 9, 2024
@melekes
melekes deleted the mergify/bp/v1.x/pr-2663 branch May 9, 2024 08:13
@melekes
melekes restored the mergify/bp/v1.x/pr-2663 branch May 9, 2024 08:15
@melekes melekes reopened this May 9, 2024
@melekes
melekes merged commit fec9682 into v1.x May 9, 2024
@melekes
melekes deleted the mergify/bp/v1.x/pr-2663 branch May 9, 2024 08:26
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