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

Add TransactionRecordQuery calls to capture failed transaction costs #593

Merged
merged 2 commits into from
Oct 6, 2022

Conversation

Nana-EC
Copy link
Collaborator

@Nana-EC Nana-EC commented Oct 6, 2022

Signed-off-by: Nana Essilfie-Conduah nana@swirldslabs.com

Description:
Add TransactionRecordQuery calls to capture fail transaction costs

  • update executeTransaction catch with TransactionRecordQuery logic
  • update executeGetTransactionRecord catch with TransactionRecordQuery logic

Related issue(s):

Fixes #592

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
@Nana-EC Nana-EC added enhancement New feature or request P1 labels Oct 6, 2022
@Nana-EC Nana-EC added this to the 0.10 milestone Oct 6, 2022
@Nana-EC Nana-EC self-assigned this Oct 6, 2022
@codecov-commenter
Copy link

Codecov Report

Base: 71.39% // Head: 70.88% // Decreases project coverage by -0.50% ⚠️

Coverage data is based on head (52e8272) compared to base (54bb7d4).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #593      +/-   ##
==========================================
- Coverage   71.39%   70.88%   -0.51%     
==========================================
  Files          16       16              
  Lines        1115     1123       +8     
  Branches      192      194       +2     
==========================================
  Hits          796      796              
- Misses        267      275       +8     
  Partials       52       52              
Impacted Files Coverage Δ
packages/relay/src/lib/clients/sdkClient.ts 6.50% <0.00%> (-0.33%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

georgi-l95
georgi-l95 previously approved these changes Oct 6, 2022
Copy link
Collaborator

@georgi-l95 georgi-l95 left a comment

Choose a reason for hiding this comment

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

LG

@Nana-EC Nana-EC changed the title Add TransactionRecordQuery calls to capture fail transaction costs Add TransactionRecordQuery calls to capture failed transaction costs Oct 6, 2022
let transactionFee: number | Hbar = 0;
if (sdkClientError.isValidNetworkError()) {
// pull transaction record for fee
const transctionRecord = await new TransactionRecordQuery()
Copy link
Member

Choose a reason for hiding this comment

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

Wondering if we should handle exceptions thrown by these calls?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There shouldn't be exceptions since validateReceiptStatus is false (which i need to update for the instance above).
I can wrap this in a try catch

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addressed

Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 6, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@Nana-EC Nana-EC merged commit 19d1acb into main Oct 6, 2022
@Nana-EC Nana-EC deleted the 592-capture-failes-transaction-costs branch October 6, 2022 20:58
Nana-EC added a commit that referenced this pull request Oct 6, 2022
…593)

Add TransactionRecordQuery calls to capture fail transaction costs

- update executeTransaction catch with TransactionRecordQuery logic
- update executeGetTransactionRecord catch with TransactionRecordQuery logic

Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
Nana-EC added a commit that referenced this pull request Oct 6, 2022
…(0.9) (#596)

Cherry pick #593

Add TransactionRecordQuery calls to capture fail transaction costs

- update executeTransaction catch with TransactionRecordQuery logic
- update executeGetTransactionRecord catch with TransactionRecordQuery logic

Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P1
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Capture missing costs from failed consensus node transactions
4 participants