-
Notifications
You must be signed in to change notification settings - Fork 140
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
Cleanup record access #2792
Cleanup record access #2792
Conversation
…ords this is pointless) Signed-off-by: tinker-michaelj <[email protected]>
…unt=180 Signed-off-by: tinker-michaelj <[email protected]>
Signed-off-by: tinker-michaelj <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #2792 +/- ##
=========================================
Coverage 95.76% 95.77%
- Complexity 9656 9667 +11
=========================================
Files 699 699
Lines 26377 26395 +18
Branches 2710 2714 +4
=========================================
+ Hits 25260 25279 +19
+ Misses 581 580 -1
Partials 536 536
Continue to review full report at Codecov.
|
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 !
I'm taking a deeper look at the PR. If we are going to add a mechanism to limit the number of returned records (and we really do need this), then we should also talk about pagination or watermarking. Since the number of transactions change all the time, I don't think we can do pagination (it would be basically worthless). Instead we should allow the user to say "get me the next N number of records newer than time T" or "newer than record R", or something along those lines. And we have a cap (as proposed in this PR) for the number of records returned. We can do that as a second PR, but we must recognize that this PR does introduce a breaking change in our API behavior and we need to make sure we document it as such as well. |
Created a PR in hedera-protobufs to support this watermarking. |
hedera-node/src/main/java/com/hedera/services/queries/answering/AnswerFunctions.java
Show resolved
Hide resolved
@@ -112,6 +153,6 @@ public HederaFunctionality canonicalFunction() { | |||
@Override | |||
public Optional<SignedTxnAccessor> extractPaymentFrom(final Query query) { | |||
final var paymentTxn = query.getCryptoGetAccountRecords().getHeader().getPayment(); | |||
return Optional.ofNullable(SignedTxnAccessor.uncheckedFrom(paymentTxn)); | |||
return Optional.of(SignedTxnAccessor.uncheckedFrom(paymentTxn)); |
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.
What was the significance of 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.
The gRPC accessors never return null
, so IntelliJ was marking this Optional.ofNullable()
as a code smell.
Description:
GetTxnRecordAnswer
that looks for the theTransactionRecord
in theTransactionID
's payer account when it is missing from thetxnHistories
map.txnHistories
map. (Both live for 180 seconds, and are removed simultaneously during record expiration.)CryptoGetAccountRecordsQuery
by the global/dynamic propertyledger.records.maxQueryableByAccount=180
.Map<String, Object> queryCtx
set by theStakedAnswerFlow
.