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

agreement: update AttachReceivedAt to handle compound (PP) messages #5142

Merged
merged 4 commits into from
Mar 10, 2023

Conversation

cce
Copy link
Contributor

@cce cce commented Feb 16, 2023

Summary

PP messages in the first period are compound messages, containing both a vote and a proposal, which are converted into a special messageEvent by setupCompoundMessage() with a structure like this:

messageEvent{
    T: votePresent, 
    Input: voteMsg, 
    Tail: &messageEvent{
        T: payloadPresent, 
        Input: proposalMsg}}

In TestPlayerRetainsReceivedValidatedAt in #5041 I was only testing sending in two separate vote and proposal messageEvents, not a single compound messageEvent like this, and so I missed this important case when attaching receivedAt timings.

Test Plan

  • update TestPlayerRetainsReceivedValidatedAt to handle this compound message case.
  • add back additional test exercising separate messageEvents too, as was tested before.
  • add some additional player tests that send in messageEvents with non-nil Tail fields for additional coverage Will do this in separate PR — requires updating the rest of player_test.go
  • update testing helper function getTrace().Contains(ev) to do a more thorough job comparing all the fields of expected events/actions against the trace, instead of just the action type. This would have helped me catch this more quickly (for example complaining that the verifyVote action's TaskIndex was not the same as the expected value I was passing into Contains()) Would require updating other player_test.go tests that rely on the current getTrace().Contains() behavior, will do in separate PR

@codecov
Copy link

codecov bot commented Feb 16, 2023

Codecov Report

Merging #5142 (73b28b4) into master (02af4ca) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #5142   +/-   ##
=======================================
  Coverage   53.45%   53.46%           
=======================================
  Files         431      431           
  Lines       54364    54368    +4     
=======================================
+ Hits        29061    29066    +5     
+ Misses      23049    23048    -1     
  Partials     2254     2254           
Impacted Files Coverage Δ
agreement/proposal.go 71.96% <ø> (ø)
agreement/demux.go 90.68% <100.00%> (ø)
agreement/events.go 62.50% <100.00%> (+0.87%) ⬆️
ledger/tracker.go 74.26% <0.00%> (-0.85%) ⬇️
ledger/acctonline.go 78.64% <0.00%> (-0.53%) ⬇️
network/wsPeer.go 67.81% <0.00%> (-0.46%) ⬇️
ledger/testing/randomAccounts.go 56.88% <0.00%> (+0.61%) ⬆️
catchup/service.go 70.11% <0.00%> (+1.17%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@cce cce force-pushed the fix-receivedAt-CompoundMessage branch from c7ea113 to e5d0e59 Compare March 7, 2023 17:37
@cce cce force-pushed the fix-receivedAt-CompoundMessage branch from e5d0e59 to d1133ff Compare March 7, 2023 17:41
@cce cce requested a review from algorandskiy March 7, 2023 21:12
@cce cce marked this pull request as ready for review March 7, 2023 21:12
@cce cce requested review from yossigi and iansuvak March 7, 2023 21:18
Copy link
Contributor

@algorandskiy algorandskiy left a comment

Choose a reason for hiding this comment

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

I did not dig deep into assertCorrectReceivedAtSet but the new AttachReceivedAt looks safe and valid.

Copy link
Contributor

@iansuvak iansuvak left a comment

Choose a reason for hiding this comment

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

Read through both changes and the tests and it looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants