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

Demo removing signing, message-building and semi-automated delivery own messages #385

Closed
wants to merge 2 commits into from

Conversation

anorth
Copy link
Member

@anorth anorth commented Jun 28, 2024

Demo some of the things I discussed in #359 to check for myself that they make sense.

Don't merge this PR - take or leave whatever you want from it.

masih and others added 2 commits June 27, 2024 15:31
Implement an emulator to test the core GPBFT protocol, with fine-grained
control and assertion over message-by-message progress of a participant.

Add utility functions to reduce the boilerplate code during testing and
implement state transition tests that assert state transition occurs:
 * for proposal when there is strong evidence of prepare.
 * for base when there is no strong support for any proposal
 * for base by timeout alone for a sole participant.

Part of #9
Copy link

codecov bot commented Jun 28, 2024

Codecov Report

Attention: Patch coverage is 92.59259% with 10 lines in your changes missing coverage. Please review.

Project coverage is 82.63%. Comparing base (b11b000) to head (5f0e4e7).

Additional details and impacted files

Impacted file tree graph

@@                         Coverage Diff                         @@
##           masih/emulator-with-simple-test     #385      +/-   ##
===================================================================
+ Coverage                            82.42%   82.63%   +0.20%     
===================================================================
  Files                                   21       21              
  Lines                                 2048     2038      -10     
===================================================================
- Hits                                  1688     1684       -4     
- Misses                                 209      212       +3     
+ Partials                               151      142       -9     
Files Coverage Δ
gpbft/emulator/assertions.go 100.00% <100.00%> (ø)
gpbft/emulator/instance.go 79.16% <100.00%> (-7.50%) ⬇️
gpbft/emulator/host.go 84.00% <90.00%> (+9.00%) ⬆️
gpbft/emulator/signing.go 66.66% <77.77%> (+16.66%) ⬆️
gpbft/emulator/emulator.go 79.54% <83.33%> (+14.68%) ⬆️

... and 1 file with indirect coverage changes

@masih masih force-pushed the masih/emulator-with-simple-test branch from b11b000 to a3215b1 Compare July 1, 2024 08:18
Copy link
Member

@masih masih left a comment

Choose a reason for hiding this comment

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

Many thanks for taking the time to put this together. I'll cherry pick things from it onto the original PR 🙏


// New instantiates a new Emulator with the given GPBFT options. See
// Emulator.Start.
func New(assertions *Assertions, o ...gpbft.Option) *Driver {
Copy link
Member

Choose a reason for hiding this comment

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

May be a YAGNI but the reason i did not do this was to avoid having emulator package depend on testing. This is so that the emulator can be used at production level code in the future for non-testing scenarios: for example using emulator as a light-weight tool to research core protocol improvements. That would separate the emulated behaviour from what it considers "correct".

If YAGNI, then I would take testing.T here straight up.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I would use the simulator for protocol R&D (that's what it was first built for). This is for unit tests.

Copy link
Member

Choose a reason for hiding this comment

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

You are probably right, thanks

proposal := instance.GetProposal()
// TODO: replace verifyBroadcast with VerifyQuality, VerifyPrepare etc that
// have similar inspections to those removed from Assertions
em.VerifyBroadcast(instance.NewQuality(proposal))
Copy link
Member

Choose a reason for hiding this comment

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

This style is much more readable than mine; thanks Alex

@masih masih force-pushed the masih/emulator-with-simple-test branch 3 times, most recently from aaaa25e to b48b568 Compare July 2, 2024 21:44
Base automatically changed from masih/emulator-with-simple-test to main July 2, 2024 22:17
@Stebalien Stebalien closed this Sep 23, 2024
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