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

[Access] Add implementation for transaction statuses data providers #6818

Open
wants to merge 37 commits into
base: master
Choose a base branch
from

Conversation

AndriiDiachuk
Copy link
Contributor

@AndriiDiachuk AndriiDiachuk commented Dec 17, 2024

Closes: #6586

In this PR TransactionStatusesDataProvider and SendTransactionStatusesDataProvider was implemented.

New functionality was covered with tests.

Guitarheroua and others added 23 commits November 19, 2024 13:42
…The-K-R-O-K/flow-go into AndriiDiachuk/6586-tx-statuses-data-providers-impl
…' of github.com:The-K-R-O-K/flow-go into AndriiDiachuk/6586-tx-statuses-data-providers-impl
…github.com:The-K-R-O-K/flow-go into AndriiDiachuk/6586-tx-statuses-data-providers-impl
@codecov-commenter
Copy link

codecov-commenter commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 64.57680% with 113 lines in your changes missing coverage. Please review.

Project coverage is 41.14%. Comparing base (941178d) to head (4bd61bd).

Files with missing lines Patch % Lines
access/mock/api.go 0.00% 44 Missing ⚠️
.../access/rpc/backend/backend_stream_transactions.go 59.15% 24 Missing and 5 partials ⚠️
...ta_providers/send_transaction_statuses_provider.go 79.52% 21 Missing and 5 partials ⚠️
...ts/data_providers/transaction_statuses_provider.go 89.06% 5 Missing and 2 partials ⚠️
cmd/util/cmd/run-script/cmd.go 0.00% 6 Missing ⚠️
access/handler.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6818      +/-   ##
==========================================
+ Coverage   41.10%   41.14%   +0.04%     
==========================================
  Files        2107     2109       +2     
  Lines      185286   185571     +285     
==========================================
+ Hits        76156    76358     +202     
- Misses     102727   102797      +70     
- Partials     6403     6416      +13     
Flag Coverage Δ
unittests 41.14% <64.57%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AndriiDiachuk AndriiDiachuk removed the request for review from peterargue December 17, 2024 12:59
return nil, status.Errorf(codes.Internal, "message index already incremented to %d", messageIndex.Value())
}

return &models.TransactionStatusesResponse{
Copy link
Contributor

Choose a reason for hiding this comment

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

@UlyanaAndrukhiv this is just a note not to forget to include this PR to #6802, or should @AndriiDiachuk make changes in this PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

@Guitarheroua, yes responses will be included in #6802.

}

return &models.TransactionStatusesResponse{
TransactionResults: txResults,
Copy link
Contributor

Choose a reason for hiding this comment

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

we should return results one by one, not as an array, check handler.go implementation as an example:

flow-go/access/handler.go

Lines 1435 to 1454 in 941178d

messageIndex := counters.NewMonotonousCounter(0)
return subscription.HandleRPCSubscription(sub, func(txResults []*TransactionResult) error {
for i := range txResults {
index := messageIndex.Value()
if ok := messageIndex.Set(index + 1); !ok {
return status.Errorf(codes.Internal, "message index already incremented to %d", messageIndex.Value())
}
err = stream.Send(&access.SendAndSubscribeTransactionStatusesResponse{
TransactionResults: TransactionResultToMessage(txResults[i]),
MessageIndex: index,
})
if err != nil {
return rpc.ConvertError(err, "could not send response", codes.Internal)
}
}
return nil
})

Copy link
Contributor

Choose a reason for hiding this comment

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

The same should be done for TransactionStatusesDataProvider

…github.com:The-K-R-O-K/flow-go into AndriiDiachuk/6586-tx-statuses-data-providers-impl

// TransactionStatusesResponse is the response message for 'events' topic.
type TransactionStatusesResponse struct {
TransactionResults []*access.TransactionResult `json:"transaction_results"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
TransactionResults []*access.TransactionResult `json:"transaction_results"`
TransactionResult *access.TransactionResult `json:"transaction_result"`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Access] Add implementation for transaction status data providers
4 participants