-
Notifications
You must be signed in to change notification settings - Fork 183
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
[Access] Implement subscribe transaction statuses by transaction ID #6737
base: master
Are you sure you want to change the base?
[Access] Implement subscribe transaction statuses by transaction ID #6737
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6737 +/- ##
=======================================
Coverage 41.19% 41.20%
=======================================
Files 2149 2150 +1
Lines 189039 188999 -40
=======================================
- Hits 77881 77879 -2
+ Misses 104652 104610 -42
- Partials 6506 6510 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
added a few small comments, but otherwise looks good
Co-authored-by: Peter Argue <[email protected]>
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.
added a couple more comments, but otherwise looks good.
Co-authored-by: Peter Argue <[email protected]>
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.
looks good other than missing irrecoverable error
…isarchuk/6573-pending-should-return-immediately
…' of github.com:The-K-R-O-K/flow-go into AndriiSlisarchuk/6573-pending-should-return-immediately
there was a significant refactor since my review
…' of github.com:The-K-R-O-K/flow-go into AndriiSlisarchuk/6573-pending-should-return-immediately
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.
added some comments about finishing touches, but otherwise I think this looks good
@durkmurder can you take another look 🙏 |
Co-authored-by: Peter Argue <[email protected]>
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.
First batch of comments, still have tests to review.
block, err := tm.blocks.ByCollectionID(tm.txResult.CollectionID) | ||
if err != nil { | ||
if errors.Is(err, storage.ErrNotFound) { | ||
return subscription.ErrBlockNotReady |
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 returns ErrBlockNotReady
but this is not explained in the godoc.
// - height: The block height used for searching transaction data. | ||
// | ||
// Expected errors during normal operation: | ||
// - `ErrBlockNotReady` if the block at the given height is not found. |
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 believe there are more errors that can happen in sub-routines, can we describe them?
access/api.go
Outdated
// Monitoring begins from the specified block height. The subscription streams status updates until the transaction | ||
// reaches a final state (TransactionStatusSealed or TransactionStatusExpired). When the transaction reaches one of | ||
// these final statuses, the subscription will automatically terminate. | ||
// SubscribeTransactionStatuses subscribes to transaction status updates for a given transaction ID. Monitoring begins |
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 seems this documentation is out of sync with the implementation file. I a big fan of copying the same documentation to the implementation and having it in sync, it's easier to check if the implementation really follows the interface. Can you also expand it to mention how it will behave if you pass transaction from past time? The "last block ID" makes it hard to understand.
@@ -22,9 +21,7 @@ import ( | |||
|
|||
// transactionStatusesArguments contains the arguments required for subscribing to transaction statuses | |||
type transactionStatusesArguments struct { |
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.
Do we need this? It holds a single field, might be simpler just to replace it with that field?
"fmt" | ||
"os" | ||
"testing" | ||
"time" | ||
|
||
"github.com/onflow/flow-go/module/irrecoverable" |
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.
Can we properly group those imports? There is no need to have that many groups that are repeating themselves.
Co-authored-by: Yurii Oleksyshyn <[email protected]>
Closes #6573 and #6574
This PR implements a new subscription to a transaction by txID and changes the existing send and subscribe endpoint.
This PR introduces a separate
transactionSubscriptionMetadata
private module and moves the handling of transactions status logic there to simplify streaming module logic.