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

Light-mode: Fixes for Ada balance and rewards #3386

Merged
merged 9 commits into from
Jul 26, 2022

Conversation

HeinrichApfelmus
Copy link
Contributor

@HeinrichApfelmus HeinrichApfelmus commented Jul 13, 2022

Issue number

ADP-2013

Overview

This pull request fixes a couple of issues with light-mode, specifically those relating to the ADA and reward balances.

Details

  • Fix accidental interchange of regular and collateral inputs in fromInputs.
  • Fix usage of wholeList. This function only makes sense when we fetch an entire block — only then do we know that we have the whole list, not just a sublist.
  • Use _accountInfoWithdrawableAmount instead of_accountInfoRewardsSum. It looks like the latter function shows all rewards that were ever accumulated, while we want the balance of rewards that can still be withdrawn from the account.
  • Fix filtering of transactions for RewardAccount — we only want those transactions that fall within the bounds bhFrom and bhTo.
  • Fix sorting of transaction outputs — it turns out that _transactionUtxosOutputs does not necessarily yield the transaction outputs in order, which messes up the output indices.

@HeinrichApfelmus HeinrichApfelmus force-pushed the HeinrichApfelmus/ADP-2013/light-mode-fixes branch 3 times, most recently from 3db2873 to 0eeab11 Compare July 19, 2022 13:24
Move `blockfrostLightSyncSource` to the outermost scope.
Doing this also requires moving `fetchCurrentNodeTip` to the outermost scope.
`bfGetAccountWithdrawals` fetches all transactions, but we only want those that are within the range set by `bhFrom` and `bhTo`.
@HeinrichApfelmus HeinrichApfelmus force-pushed the HeinrichApfelmus/ADP-2013/light-mode-fixes branch from 6668d39 to b306c6d Compare July 20, 2022 14:27
It turns out that list `_transactionUtxosOutputs` may be unsorted, which messes up the output indices.
@HeinrichApfelmus HeinrichApfelmus marked this pull request as ready for review July 21, 2022 15:03
@HeinrichApfelmus HeinrichApfelmus requested a review from Unisay July 21, 2022 15:15
Copy link
Contributor

@Unisay Unisay left a comment

Choose a reason for hiding this comment

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

Thanks for all the nice improvements as well as the fix :)

@HeinrichApfelmus
Copy link
Contributor Author

bors merge

iohk-bors bot added a commit that referenced this pull request Jul 25, 2022
3386: Light-mode: Fixes for Ada balance and rewards r=HeinrichApfelmus a=HeinrichApfelmus

### Issue number

ADP-2013

### Overview

This pull request fixes a couple of issues with light-mode, specifically those relating to the ADA and reward balances.

### Details
* Fix accidental interchange of regular and collateral inputs in `fromInputs`.
* Fix usage of `wholeList`. This function only makes sense when we fetch an entire block — only then do we know that we have the whole list, not just a sublist.
* Use `_accountInfoWithdrawableAmount` instead of`_accountInfoRewardsSum`. It looks like the latter function shows all rewards that were ever accumulated, while we want the balance of rewards that can still be withdrawn from the account.
* Fix filtering of transactions for RewardAccount — we only want those transactions that fall within the bounds `bhFrom` and `bhTo`.
* Fix sorting of transaction outputs — it turns out that `_transactionUtxosOutputs` does not necessarily yield the transaction outputs in order, which messes up the output indices.


Co-authored-by: Heinrich Apfelmus <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jul 25, 2022

Build failed:

  src/Test/Integration/Scenario/API/Byron/Migrations.hs:426:19: 
  1) API Specifications, BYRON_MIGRATIONS, BYRON_MIGRATE_04 - Actual fee for migration is identical to predicted fee.
       From the following response: Left
           ( DecodeFailure "Something went wrong" "Error in $: Failed reading: not a valid json value at 'Somethingwentwrong'" )
       While verifying value:
         ( Status
             { statusCode = 500
             , statusMessage = "Internal Server Error"
             }
         , Left
             ( DecodeFailure "Something went wrong" "Error in $: Failed reading: not a valid json value at 'Somethingwentwrong'" )
         )
       expected: Status {
                   statusCode = 202,
                   statusMessage = "Accepted"
                 }
        but got: Status {
                   statusCode = 500,
                   statusMessage = "Internal Server Error"
                 }

#3441

@HeinrichApfelmus
Copy link
Contributor Author

bors retry

iohk-bors bot added a commit that referenced this pull request Jul 25, 2022
3386: Light-mode: Fixes for Ada balance and rewards r=HeinrichApfelmus a=HeinrichApfelmus

### Issue number

ADP-2013

### Overview

This pull request fixes a couple of issues with light-mode, specifically those relating to the ADA and reward balances.

### Details
* Fix accidental interchange of regular and collateral inputs in `fromInputs`.
* Fix usage of `wholeList`. This function only makes sense when we fetch an entire block — only then do we know that we have the whole list, not just a sublist.
* Use `_accountInfoWithdrawableAmount` instead of`_accountInfoRewardsSum`. It looks like the latter function shows all rewards that were ever accumulated, while we want the balance of rewards that can still be withdrawn from the account.
* Fix filtering of transactions for RewardAccount — we only want those transactions that fall within the bounds `bhFrom` and `bhTo`.
* Fix sorting of transaction outputs — it turns out that `_transactionUtxosOutputs` does not necessarily yield the transaction outputs in order, which messes up the output indices.


Co-authored-by: Heinrich Apfelmus <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jul 25, 2022

Build failed:

  Waited longer than 300s to resolve action: "metadata is fetched".
       expected: 3
        but got: 4

  To rerun use: --match "/API Specifications/SHELLEY_STAKE_POOLS/STAKE_POOLS_SMASH_01 - fetching metadata from SMASH works with delisted pools/"

Randomized with seed 114451994

#2331

@HeinrichApfelmus
Copy link
Contributor Author

bors retry

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jul 26, 2022

Build succeeded:

@iohk-bors iohk-bors bot merged commit 2540427 into master Jul 26, 2022
@iohk-bors iohk-bors bot deleted the HeinrichApfelmus/ADP-2013/light-mode-fixes branch July 26, 2022 08:18
WilliamKingNoel-Bot pushed a commit that referenced this pull request Jul 26, 2022
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.

2 participants