-
Notifications
You must be signed in to change notification settings - Fork 474
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
BatchVerifier: Rename and unexport local functions in verify/txn #4578
BatchVerifier: Rename and unexport local functions in verify/txn #4578
Conversation
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.
Good cleanup. I like it. This should make future changes much more clear about the scope of things in this package.
Codecov Report
@@ Coverage Diff @@
## master #4578 +/- ##
==========================================
+ Coverage 54.12% 54.16% +0.03%
==========================================
Files 401 401
Lines 51642 51615 -27
==========================================
+ Hits 27951 27955 +4
+ Misses 21341 21312 -29
+ Partials 2350 2348 -2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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 need access to TxnBatchVerify for external optimization (verifying more than one TxnGroup at a time)
another function that needs renaming (e.g. from logicSigBatchVerify to logicSigVerify):
this is a copy-paste typo — logicSigBatchVerify does not take a batchVerifier argument, and the caller does not have the responsibility to call it after calling this function, since one is not provided |
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 like these name changes, I was pretty scared callers would think the old things performed verification rather than just set it up.
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.
Not going to approve so others get eyes on, but reading through think it is 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.
LGTM
@@ -113,7 +112,7 @@ func (b *BatchVerifier) GetNumberOfEnqueuedSignatures() int { | |||
// if the batch is zero an appropriate error is return. | |||
func (b *BatchVerifier) Verify() error { | |||
if b.GetNumberOfEnqueuedSignatures() == 0 { | |||
return ErrZeroTransactionInBatch | |||
return nil |
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 change means that TxnGroup
will now add things to the cache where before it would just exit out early with the ctx and nil error
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.
Yes. This is the intention, so that the logicsig transactions which were not added to BatchVerifier at the level of TxnGroup
and do not contribute to this GetNumberOfEnqueuedSignatures
, but were verified at local batches, also get cached.
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 was wondering about that too, I looked up the version just before the BV refactor merged in #2578 and it looks like any verified txngroup (even those with 0 sigs) would get cached in the old version
https://github.com/algorand/go-algorand/blame/16bada1e2b185348a41e1590eefd9eebd4315064/data/transactions/verify/txn.go#L115
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.
so are we OK this this change?
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.
yes, we discussed it and it is the intention to make this change and then have logicsigs be cached like they used to.
Rename and make local functions which are internal to the package.
The purpose is to enhance the code readability.
Also removing a function which is not used.