-
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
Fix Input resolution for inputs only present in db #1685
Conversation
) | ||
=> (Context t -> [Natural] -> IO ApiByronWallet) | ||
-> SpecWith (Context t) | ||
scenario_TRANS_REG_1670 fixture = it title $ \ctx -> 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.
This fails before the fix.
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.
Since the tx input resolving is moved into the DBLayer, this test could probably be more easily done at the unit level.
-- to assemble coin selection information for outgoing payments. | ||
-- To reliably provide this information, it should be looked up when | ||
-- applying blocks, but that is future work (issue #573). | ||
assemble |
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.
no longer needed, the db now returns [TransactionInfo]
directly.
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.
Is it still noted somewhere that coin selection information can't (yet) be provided for outgoing payments?
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.
I've rewritten the comment and linked to the github issue in the relevant place in the db layer 👍 , good point
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
) | ||
=> (Context t -> [Natural] -> IO ApiByronWallet) | ||
-> SpecWith (Context t) | ||
scenario_TRANS_REG_1670 fixture = it title $ \ctx -> 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.
Since the tx input resolving is moved into the DBLayer, this test could probably be more easily done at the unit level.
-- to assemble coin selection information for outgoing payments. | ||
-- To reliably provide this information, it should be looked up when | ||
-- applying blocks, but that is future work (issue #573). | ||
assemble |
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.
Is it still noted somewhere that coin selection information can't (yet) be provided for outgoing payments?
bors r+ |
bors r- |
Canceled |
Whoops. I failed to push because there was a change upstream I didn't see. Rebasing and pushing. |
ad7f8f9
to
67adc07
Compare
bors r+ |
1685: Fix Input resolution for inputs only present in db r=KtorZ a=KtorZ # Issue Number <!-- Put here a reference to the issue this PR relates to and which requirements it tackles --> #1670 # Overview <!-- Detail in a few bullet points the work accomplished in this PR --> - 1502136 📍 **add regression test illustrating the issue** Input that should be resolved aren't. In order to resolve inputs, we are actually wrongly using the transactions available from the history that was fetched from the database, instead of using the entire database! So, giving different query parameters restricting the set of outputs has an influence on something it shouldn't. - 8ec0123 📍 **resolve transaction inputs from db when fetching the history** Before, this was done in the application layer, from the available history ('assemble' in 'Cardano.Wallet'). This requires exactly two extra lookups. One in the TxOut table, and one in the Checkpoint table so the performance impact should be quite small. It simplifies the application logic quite a bit and doesn't much impact the database logic, so it's almost a win-win. Plus, it fixes the issue where resolvable inputs would appear as non resolved - 64bf4db 📍 **fix DB model to also return full 'TransactionInfo' when fetching the tx history** - 21d75d2 📍 **Fix db benchmark build** Benchmarks may produce higher timings after this change, but it's OK since the answers are more correct now, and the work has just shifted from the wallet layer into the db layer. - fffe476 📍 **re-add lost comment about input resolution for incoming/outgoing transactions** - 67adc07 📍 **rename 'txs' -> 'pending' to better match context** # Comments <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Assign the PR to a corresponding milestone ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: KtorZ <[email protected]> Co-authored-by: Rodney Lorrimar <[email protected]>
Build failed |
Input that should be resolved aren't. In order to resolve inputs, we are actually wrongly using the transactions available from the history that was fetched from the database, instead of using the entire database! So, giving different query parameters restricting the set of outputs has an influence on something it shouldn't.
Before, this was done in the application layer, from the available history ('assemble' in 'Cardano.Wallet'). This requires exactly two extra lookups. One in the TxOut table, and one in the Checkpoint table so the performance impact should be quite small. It simplifies the application logic quite a bit and doesn't much impact the database logic, so it's almost a win-win. Plus, it fixes the issue where resolvable inputs would appear as non resolved
Benchmarks may produce higher timings after this change, but it's OK since the answers are more correct now, and the work has just shifted from the wallet layer into the db layer.
67adc07
to
7c085f9
Compare
bors r+ |
Build succeeded |
1696: sql: Fix input resolution when number of inputs is large r=KtorZ a=rvl ### Issue Number #1670 / #1685 ### Overview The "too many SQL variables" problem strikes again in the nightly benchmark. One way to fix it is to do a SQL join or subquery. Another way to fix it (this PR) is to make the select query in chunks. ### Comments Tested with: cabal run cardano-wallet-core:bench:db -- --match prefix "TxHistory (Read)/1000" or stack bench cardano-wallet-core:bench:db --ba '--match prefix "TxHistory (Read)/1000"' Co-authored-by: Rodney Lorrimar <[email protected]>
Issue Number
#1670
Overview
1502136
📍 add regression test illustrating the issue
Input that should be resolved aren't. In order to resolve inputs, we are actually wrongly using
the transactions available from the history that was fetched from the database, instead of using
the entire database! So, giving different query parameters restricting the set of outputs has an
influence on something it shouldn't.
8ec0123
📍 resolve transaction inputs from db when fetching the history
Before, this was done in the application layer, from the available history ('assemble' in 'Cardano.Wallet'). This requires exactly two extra lookups. One in the TxOut table, and one in the Checkpoint table so the performance impact should be quite small. It simplifies the application logic quite a bit and doesn't much impact the database logic, so it's almost a win-win. Plus, it fixes the issue where resolvable inputs would appear as non resolved
64bf4db
📍 fix DB model to also return full 'TransactionInfo' when fetching the tx history
21d75d2
📍 Fix db benchmark build
Benchmarks may produce higher timings after this change, but it's OK
since the answers are more correct now, and the work has just shifted
from the wallet layer into the db layer.
fffe476
📍 re-add lost comment about input resolution for incoming/outgoing transactions
67adc07
📍 rename 'txs' -> 'pending' to better match context
Comments