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

feat: implement non-interactive defaults logic #680

Merged
merged 9 commits into from
Sep 7, 2022
Merged

Conversation

evan-forbes
Copy link
Member

adds the non-interactive default logic to the share's package as described in #673

part of #382

@codecov-commenter
Copy link

codecov-commenter commented Sep 2, 2022

Codecov Report

Merging #680 (9d46124) into main (feebea0) will increase coverage by 1.12%.
The diff coverage is 94.82%.

@@            Coverage Diff             @@
##             main     #680      +/-   ##
==========================================
+ Coverage   39.28%   40.41%   +1.12%     
==========================================
  Files          27       28       +1     
  Lines        2795     2853      +58     
==========================================
+ Hits         1098     1153      +55     
- Misses       1609     1611       +2     
- Partials       88       89       +1     
Impacted Files Coverage Δ
pkg/shares/non_interactive_defaults.go 94.82% <94.82%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@rach-id rach-id left a comment

Choose a reason for hiding this comment

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

Awesome stuff. Left a blocking question concerning whether the lowest power of two is strict or not.

pkg/shares/non_interactive_defaults.go Show resolved Hide resolved
pkg/shares/non_interactive_defaults_test.go Show resolved Hide resolved
rach-id
rach-id previously approved these changes Sep 6, 2022
Copy link
Member

@rach-id rach-id left a comment

Choose a reason for hiding this comment

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

🚀 🚀 🚀 🚀 :shipit:

rootulp
rootulp previously approved these changes Sep 6, 2022
Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

I really appreciate the thorough unit tests. Great work!


// MsgSharesUsedNIDefaults calculates the number of shares used by a given set
// of messages share lengths. It follows the non-interactive default rules and
// assumes that each msg length in msgShareLens
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the rest of this comment got lost. Perhaps it meant to say

Suggested change
// assumes that each msg length in msgShareLens
// assumes that each msg length in msgShareLens is <= origSquareSize

If so, should this function panic if this assumption is not met?

Copy link
Member Author

Choose a reason for hiding this comment

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

This function does not rely on that assumption, otherwise it would not be able to handles messges that are larger than a single row. It definitely looks like we have to complete those docs, not exactly sure what I was going for originally 91c0d72

pkg/shares/non_interactive_defaults.go Outdated Show resolved Hide resolved
pkg/shares/non_interactive_defaults.go Outdated Show resolved Hide resolved
pkg/shares/non_interactive_defaults_test.go Show resolved Hide resolved
fits: false,
},
{
name: "8 msgs of various sizes, 7 starting shares (63 msg shares, 1 contigous, size 8)",
Copy link
Collaborator

Choose a reason for hiding this comment

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

[no change needed] I had a tough time visualizing so sharing if helpful for other reviewers

| |3|3|3| | | | |
|9|9|9|9|9|9|9|9|
|9| | | |3|3|3| |
|7|7|7|7|7|7|7| |
|8|8|8|8|8|8|8|8|
|3|3|3| | | | | |
|7|7|7|7|7|7|7| |
|8|8|8|8|8|8|8|8|

fits: true,
},
{
name: "8 msgs of various sizes, 7 starting shares (63 msg shares, 6 contigous, size 8)",
Copy link
Collaborator

Choose a reason for hiding this comment

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

[question] I don't understand what contiguous means in this context. Given the cursor starts at 6 in this test, is it possible contiguous should instead be start or cursor?

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 6777ea5

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, I still don't understand what contiguous means in this context or why 6 is incorrect but 7 is correct.

Copy link
Member Author

Choose a reason for hiding this comment

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

starting was just a confusing way to say contiguous shares. switched all to compact here 2bc32cf

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay thanks for explaining. I think the test names in 2bc32cf are inaccurate so commented #681 (review)

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, sorry, accidentally pushed to the wrong branch. will fix there.

tests := []test{
{2, 4, 1, []int{1}, []uint32{2}},
{2, 2, 1, []int{1}, []uint32{2}},
{3, 4, 8, []int{3, 3}, []uint32{4, 8}},
Copy link
Collaborator

Choose a reason for hiding this comment

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

[no change needed] visual

| | | | |
|3|3|3| |
|3|3|3| |
| | | | |

pkg/shares/non_interactive_defaults_test.go Outdated Show resolved Hide resolved
pkg/shares/non_interactive_defaults_test.go Outdated Show resolved Hide resolved
Co-authored-by: Rootul Patel <[email protected]>
@evan-forbes evan-forbes dismissed stale reviews from rootulp and rach-id via fb3632b September 6, 2022 20:00
evan-forbes and others added 2 commits September 7, 2022 11:45
Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

Approved w/ a non-blocking question in #680 (comment)

@evan-forbes evan-forbes merged commit 05aa7b8 into main Sep 7, 2022
@evan-forbes evan-forbes deleted the evan/NID-logic branch September 7, 2022 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants