Skip to content

Conversation

@Kubuxu
Copy link
Contributor

@Kubuxu Kubuxu commented Jun 5, 2024

It simplifies the structure of F3, gpbftHost/Runner. gpbftHost becomes a newtype of gpbftRunner to isolate exposure of APIs.

Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
@Kubuxu
Copy link
Contributor Author

Kubuxu commented Jun 5, 2024

I know it is an ugly PR (with multiple changes) let me know if I should split of these oneliners.

@codecov
Copy link

codecov bot commented Jun 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.33%. Comparing base (7757504) to head (a59b9f9).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #308   +/-   ##
=======================================
  Coverage   85.33%   85.33%           
=======================================
  Files          14       14           
  Lines        1459     1459           
=======================================
  Hits         1245     1245           
  Misses        136      136           
  Partials       78       78           
Files Coverage Δ
gpbft/participant.go 90.20% <100.00%> (ø)

// Validate the message.
if err = ValidateMessage(comt.power, comt.beacon, p.host, msg); err != nil {
return nil, fmt.Errorf("%w: %w", ErrValidationInvalid, err)
return nil, xerrors.Errorf("%v: %w", err, ErrValidationInvalid)
Copy link
Member

Choose a reason for hiding this comment

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

Can you please remind me what is the advantage of using xerrors over fmt in this case?

Copy link
Contributor Author

@Kubuxu Kubuxu Jun 5, 2024

Choose a reason for hiding this comment

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

It tracks line information and displays it when formatted with %+v, making debugging easier.
The key change here is that the first %w was invalid.

Client
runner *gpbftRunner
}
type gpbftHost gpbftRunner
Copy link
Member

Choose a reason for hiding this comment

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

Why the type alias?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To separate internal (towards gpbft.Participant) and external (towards f3.F3) APIs

Copy link
Member

@masih masih Jun 6, 2024

Choose a reason for hiding this comment

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

My sense is that this is superfluous if the goal is to make the code easier to understand for mere mortals who maintain this repo.


// gpbftRunner is responsible for running gpbft.Participant, taking in all concurrent events and
// passing them to gpbft in a single thread.
type gpbftRunner struct {
Copy link
Member

@masih masih Jun 5, 2024

Choose a reason for hiding this comment

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

Would be nice to reduce concepts here: gpbftHost/gpbftRunner/Module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Module got renamed F3, host and runner are the same thing just with different APIs exposed

Copy link
Member

Choose a reason for hiding this comment

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

Module got renamed F3

Has this change been pushed in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Uhhh, I accidentally un-did it.

@masih
Copy link
Member

masih commented Jun 5, 2024

Also please make sure PR description is in place as this repo uses squash merge and GitHub picks the PR description as commit message by default 🙏

Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
@Kubuxu Kubuxu requested review from Stebalien and masih June 5, 2024 15:46
Kubuxu added 2 commits June 5, 2024 18:44
Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
return func() { s.Close() }, s.Start()
}

type fakeSigner struct {
Copy link
Member

Choose a reason for hiding this comment

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

What is the rationale for having this wrapper?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need to override the Marshal function.

Client
runner *gpbftRunner
}
type gpbftHost gpbftRunner
Copy link
Member

@masih masih Jun 6, 2024

Choose a reason for hiding this comment

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

My sense is that this is superfluous if the goal is to make the code easier to understand for mere mortals who maintain this repo.

@Kubuxu Kubuxu added this pull request to the merge queue Jun 6, 2024
Merged via the queue into main with commit 9c39535 Jun 6, 2024
@Kubuxu Kubuxu deleted the misc/rename-module branch June 6, 2024 17:41
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