Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
network: Limit message length based on Tag #5388
network: Limit message length based on Tag #5388
Changes from 32 commits
a9131bb
6ce8cea
94dbf71
0d17dc6
73be798
70ee7e3
8153660
67d89db
a181944
5ea2771
03df5fe
0646f7f
50a267d
d6e6366
ecda744
f7b369e
4c25f21
64288a5
66cbf61
f82c316
4580863
45b0d65
e9ba543
dbf99c2
f6b4101
895d9a7
8d37cbb
3c11c66
ffb02ba
fb8c934
49e0e5d
bfff077
82efc8c
5e3a434
a3df2d2
3289d45
5d923e2
4925a33
6c8b13d
74ce8f1
1e57b2b
c074625
a1b01cc
5867661
0c6d583
f610a9b
cb3029b
1f008bb
a500239
4bd07f5
e52b870
03f4b01
e563c69
02364e1
289b062
e0cc3ee
3e84468
5de753b
9db27dd
7d31ac7
b64ca5b
ffcf43e
52cc1d8
036f012
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit: we should probably start using crypto/rand more in test cases like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example is so tiny it doesn't matter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would one need to change this parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should never be necessary. The reason why this is so large is as I mentioned in the comment that there are tests that depend on the test name being passed around as the genesisID
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am very worried about having such fine-grained calculations done manually.
The tradeoff we need to consider is:
what is the risk of allowing loose bounds versus having such fine-grained calculations done manually.
Still considering this, and making sure the calculations are correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually not fully manual. It's a modification of the autogenerated test: here https://github.com/algorand/go-algorand/pull/5388/files#diff-add6a5ef46c2629eb7484bf3113df670d70cfdb6661ca69e236a778a7e1cb4c4R334
and we have a test here https://github.com/algorand/go-algorand/pull/5388/files#diff-181a1af1a38a976d2ddce9a94f778520e2ad787079c3cc99dbd1b7483386aa73R248 that ensures that that auto-generated ProofMaxSize and and ProofMaxSizeByElements output the same value when the allocbound is used as the input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test is very good and reliable. However, the mapping of the function
SingleLeafProofMaxSize
toSingleLeafProof
is not obvious for someone who is not aware of this arrangement.In this particular case, this function is not needed. It can be implemented by setting a constant bound directly to the Proof field in:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but we do have a pattern for doing this manual implementation already for basics.MicroAlgos and this solution will continue working if we ever use SingleLeafProof elsewhere. Finding it's
maxtotalbytes
bound and using it is more implicit IMO.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything here is calculated from constants. Can't
SingleLeafProofMaxSize
just return a constant pre-calculated value?Then, a test can be added to confirm the constant value remains valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can make the change but none of these MaxSize() functions are used at runtime outside of testing. The only thing that this PR uses at runtime is constants populating the MaxSize() method on the protocol.Tag type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then these functions should be defined in the test files, not in production files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm open to that but they are theoretically valid in production as well and on msgp library side they are generated like all the other functions. Moving the core generation pass to only generate code in the test path would break the symmetry
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.