Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

[RCD-46] fix Prefiltering not ignoring txIds from Inputs #3855

Merged
merged 1 commit into from
Nov 15, 2018

Conversation

kderme
Copy link
Member

@kderme kderme commented Nov 14, 2018

Description

Prefiltering seems to totally ignore txIds from Inputs while creating blockMeta. On the other hand it uses TxIns to see which utxos are used. This means that if an account has only inputs in a tx, the tx will apear as Failed. This can happens when it creates a tx and uses a utxo entirely (no changes). QA testing found this bug while trying to empty the wallet, which is a special case of the above.

Before the fix, we can see the Prefiltered Block of a failed Transaction which empties the wallet:
PrefilteredBlock. There is no _blockMetaSlotId.

{
pfbInputs = fromList [TxInUtxo (AbstractHash a3cf538a8390fda0cf5477bbdf49da68415a44f45db14ad9b8c2dd9ea62219d6) 0],
pfbOutputs = fromList [],
pfbAddrs = [],
pfbMeta = LocalBlockMeta {localBlockMeta = BlockMeta {_blockMetaSlotId = InDb {_fromDb = fromList []}, _blockMetaAddressMeta = fromList []}},
pfbContext = BlockContext {_bcSlotId = InDb {_fromDb = SlotId {siEpoch = EpochIndex {getEpochIndex = 82}, siSlot = UnsafeLocalSlotIndex {getSlotIndex = 16153}}}, _bcHash = InDb {_fromDb = AbstractHash be62ec0264cc0346ca2a70e789f3aa016854ba04e9d46adc72a25eba4a64700d}, _bcPrevMain = Just (InDb {_fromDb = AbstractHash 2673c69268b00dc8c969e9bf81348c7f4def139ad199ed69f95ead38872203c2})}}),(HdAccountId {_hdAccountIdParent = HdRootId {getHdRootId = InDb {_fromDb = Address {addrRoot = AbstractHash bf3db4cc8c9dd5533d35cc52e16cca39e1845484a548c03fa8beba74, addrAttributes = Attributes { data: AddrAttributes {aaPkDerivationPath = Nothing, aaStakeDistribution = BootstrapEraDistr, aaNetworkMagic = NetworkMainOrStage} }, addrType = ATPubKey}}}, _hdAccountIdIx = HdAccountIx {getHdAccountIx = 2147483648}},

failed-tx

After the fix we have the txId (search pfbMeta and _blockMetaSlotId):

PrefilteredBlock {

pfbInputs = fromList [TxInUtxo (AbstractHash 525a73a963652b3e542bc499efe942f419af8664e602471ddd36b81e7ff49754) 0],

pfbOutputs = fromList [], pfbAddrs = [],
pfbMeta = LocalBlockMeta {localBlockMeta = BlockMeta {_blockMetaSlotId = InDb {_fromDb = fromList [(AbstractHash cd6c848cff95214492822ba94da174f07a264305d9a1223bf6e11395bce0ff13,SlotId {siEpoch = EpochIndex {getEpochIndex = 82}, siSlot = UnsafeLocalSlotIndex {getSlotIndex = 16691}})]}, _blockMetaAddressMeta = fromList []}},
pfbContext = BlockContext {_bcSlotId = InDb {_fromDb = SlotId {siEpoch = EpochIndex {getEpochIndex = 82}, siSlot = UnsafeLocalSlotIndex {getSlotIndex = 16691}}}, _bcHash = InDb {_fromDb = AbstractHash 97b5fae902dc4b4b070c1308007e19d2d2107f0fe9425f0bdc06b9bd870e712a}, _bcPrevMain = Just (InDb {_fromDb = AbstractHash 2a487cce352083ff755b737cb8c8d52cb0f29a4af6070c95207ee30a65bd9b2e})}}),(HdAccountId {_hdAccountIdParent = HdRootId {getHdRootId = InDb {_fromDb = Address {addrRoot = AbstractHash bf3db4cc8c9dd5533d35cc52e16cca39e1845484a548c03fa8beba74, addrAttributes = Attributes { data: AddrAttributes {aaPkDerivationPath = Nothing, aaStakeDistribution = BootstrapEraDistr, aaNetworkMagic = NetworkMainOrStage} }, addrType = ATPubKey}}}, _hdAccountIdIx = HdAccountIx {getHdAccountIx = 2147483648}},

success-tx

As a final test, I have a wallet with a failed txs as a result of the previous bug. I will try to restore:

before-restore

Restored succesfully:

restored-good

Linked issue

https://iohk.myjetbrains.com/youtrack/issue/RCD-46

Type of change

  • 🐞 Bug fix (non-breaking change which fixes an issue)

QA Steps

try to empty a wallet by following the fee estimation and no ada is left to the wallet.

Copy link
Contributor

@KtorZ KtorZ left a comment

Choose a reason for hiding this comment

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

LGTM

@KtorZ KtorZ merged commit b8ce721 into release/2.0.0 Nov 15, 2018
@KtorZ KtorZ deleted the kderme/RCD-46 branch November 15, 2018 15:46
@KtorZ
Copy link
Contributor

KtorZ commented Nov 15, 2018

Reminder @kderme :

  • Let's issue an identical PR against develop

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants