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

Update cost-tracker to return more updated costs after successful try_add call #1141

Conversation

tao-stones
Copy link

Problem

After successful try_add(...) call, it currently return the updated block cost onlyu; It'd be useful to also include updated costliest account cost in the return, so the call site can know after adding TransactionCost to cost track, which account it updated has highest units.

One particular use case for that additional information is: when Forwarder decides which "batch" a forwardable packet should be placed into, it can look at its "costliest account cost", mod by each batch's account limit, to get the target batch index.

Summary of Changes

  • add return struct UpdatedCosts
  • updated related functions to return Result<UpdatedCosts> instead of Result<u64>

Fixes #

@tao-stones tao-stones requested a review from apfitzge May 2, 2024 03:42
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 80.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 82.1%. Comparing base (12d009e) to head (6147400).

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #1141     +/-   ##
=========================================
- Coverage    82.1%    82.1%   -0.1%     
=========================================
  Files         881      881             
  Lines      235742   235749      +7     
=========================================
+ Hits       193677   193678      +1     
- Misses      42065    42071      +6     

@tao-stones tao-stones merged commit b1b6b9d into anza-xyz:master May 2, 2024
38 checks passed
@tao-stones tao-stones deleted the banking-cost-tracker-returns-more-info branch May 2, 2024 16:53
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.

3 participants