-
Notifications
You must be signed in to change notification settings - Fork 217
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 integration tests for migration of reward balances #2655
Add integration tests for migration of reward balances #2655
Conversation
f9be46c
to
69d95c9
Compare
This integration test checks that it's possible to create a migration plan for a wallet that has rewards.
…withdrawal. For Shelley-era wallets, we specify `Just SelfWithdrawal`. For Byron-era wallets, we specify `Nothing`. In the case of Shelley-era wallets, this causes the full reward balance to always be included in the plan.
The node verifies that transactions are exactly balanced. Therefore, we can rely on the contents of the `fee` field of a successfully-submitted `ApiTransaction` to be correct. The previous implementation was incorrect, as it failed to include the reward withdrawal in the fee calculation.
In this test, we check that it's possible to migrate a wallet that has rewards.
…awal. For Shelley-era wallets, we specify `Just SelfWithdrawal`. For Byron-era wallets, we specify `Nothing`. In the case of Shelley-era wallets, this causes the full reward balance to always be included in the plan, and the resultant transactions.
This echoes usage elsewhere, and clearly indicates that the selection results are expected to have no change.
69d95c9
to
d695cb0
Compare
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.
lgtm!
. view #getQuantity | ||
. view #amount | ||
. head | ||
. view #withdrawals |
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.
👍
] | ||
|
||
-- Check that the source wallet has been depleted: | ||
eventually "Source wallet balance is depleted." $ do |
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.
👍
extraCoinSource = | ||
if (view #rewardWithdrawal migrationSelection) > Coin 0 | ||
then Just (view #rewardWithdrawal migrationSelection) | ||
else Nothing |
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.
We should add a comment here explaining why this is necessary.
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.
Fixed in c3a8bfd.
bors r+ |
Build succeeded: |
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.
Nice one 👍
Issue Number
ADP-840
Overview
This PR:
createMigrationPlan
.(
CREATE_MIGRATION_PLAN_06
)migrateWallet
.(
MIGRATE_09
)createMigrationPlan
to require callers to specify a reward withdrawal method, which it passes tomkRewardAccountBuilder
.(Previously it always passed
Nothing
.)migrateWallet
to require callers to specify a reward withdrawal method, which it passes tomkRewardAccountBuilder
.(Previously it always passed
Nothing
.)mkApiWalletMigrationPlan
to include the reward withdrawal balance in thebalanceSelected
field.(Previously the reward balance was omitted from the
balanceSelected
field.