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

Additional checks for input existence in transactions #2405

Merged
merged 4 commits into from
Jan 5, 2021

Conversation

piotr-iohk
Copy link
Contributor

@piotr-iohk piotr-iohk commented Dec 18, 2020

Issue Number

It turns out there are no checks for that.
A bit related to #2327.

Overview

  • 2605a9f
    Additional checks for inputs in incoming and outgoing transactions in integration tests

  • 1247f9a
    Additional checks for inputs in join/quit pool transactions

  • bd2916b
    remove redundant cases & fix fixture wallet sharing common funding UTxOs
    It's a bit fucked up. Since the scenario is using fixtureWallet, the
    UtxO from the wallet comes from one of the fixture transaction made
    when initializing the cluster. There are many pre-funded fixture
    wallets with 10 UTxO, but in order not to spend 10 days funding them
    all, the cluster generate pretty large transaction with ~100
    outputs. So a single fixture transaction funds about 10 fixture
    wallets.

    Now it means that, a particular fixture wallet will know the value
    of all inputs of its funding fixture transaction and therefore, when
    picking two fixtureWallet one after the other, it may likely happen
    that both wallets are able to resolve inputs of any UTxO coming from
    their original fixture transaction.

    I fixed it by simply using fixtureWalletWith [...] which generates
    completly new and uncorrelated UTxOs.

  • cdf556a
    Add input check for multi-address pending tx

Comments

@piotr-iohk piotr-iohk added the IMPROVEMENT Mark a PR as an improvement, for auto-generated CHANGELOG label Dec 18, 2020
@piotr-iohk piotr-iohk self-assigned this Dec 18, 2020
-- all tx inputs have address and amount
, expectField #inputs $ \inputs' -> do
let addrAmt = (fmap source inputs')
addrAmt `shouldSatisfy` (all isJust)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Test fails here... it turns out that for delegation inputs are not there in the output of the join/quit transaction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@KtorZ as far as your simplifications to the checks, I see you have removed this one and also the one from multi-output transactions. I'd argue that these are redundant, especially that one above was failing before (not because of fixtureWallet thing). It is OK now (after #2370 I suppose) but still worth checking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, sorry, you didn't remove that. It was the commit diff that mislead me 😅
Anyway... I have added small additional check to multi-output tx in cdf556a.

-- as the tx is incoming
, expectField #inputs $ \inputs' -> do
let addrAmt2 = (fmap source inputs')
addrAmt2 `shouldSatisfy` (all isNothing)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fails here 🤔 ... inputs are there on incoming transaction on fixtureWallet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can confirm this also on shelley-test-cluster. So it seems that:

  • in case of transaction fixtureWalletSrc -> fixtureWalletDest there are resolved inputs visible on incoming transaction on fixtureWalletDest.
  • in case of transaction emptyWallet -> fixtureWallet there are NO resolved inputs visible on incoming transaction on fixtureWallet

Could this be due to fixtureWallet share the same key or something, so they are able to resolve the inputs in case of transaction between them?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah it's a bit fucked up. Since the scenario is using fixtureWallet, the UtxO from the wallet comes from one of the fixture transaction made when initializing the cluster. There are many pre-funded fixture wallets with 10 UTxO, but in order not to spend 10 days funding them all, the cluster generate pretty large transaction with ~100 outputs. So a single fixture transaction funds about 10 fixture wallets.

Now it means that, a particular fixture wallet will know the value of all inputs of its funding fixture transaction and therefore, when picking two fixtureWallet one after the other, it may likely happen that both wallets are able to resolve inputs of any UTxO coming from their original fixture transaction.

I fixed it by simply using fixtureWalletWith [...] which generates completly new and uncorrelated UTxOs.

-- as the tx is incoming
, expectField #inputs $ \inputs' -> do
let addrAmt2 = (fmap source inputs')
addrAmt2 `shouldSatisfy` (all isNothing)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't fail here... The difference is that the destination wallet is emptyWallet.

@piotr-iohk piotr-iohk force-pushed the piotr/check-inputs-in-tx-tests branch from 37ee67f to cabc8b9 Compare December 18, 2020 14:31
Piotr Stachyra and others added 3 commits December 31, 2020 14:14
    It's a bit fucked up. Since the scenario is using fixtureWallet, the
    UtxO from the wallet comes from one of the fixture transaction made
    when initializing the cluster. There are many pre-funded fixture
    wallets with 10 UTxO, but in order not to spend 10 days funding them
    all, the cluster generate pretty large transaction with ~100
    outputs. So a single fixture transaction funds about 10 fixture
    wallets.

    Now it means that, a particular fixture wallet will know the value
    of all inputs of its funding fixture transaction and therefore, when
    picking two fixtureWallet one after the other, it may likely happen
    that both wallets are able to resolve inputs of any UTxO coming from
    their original fixture transaction.

    I fixed it by simply using fixtureWalletWith [...] which generates
    completly new and uncorrelated UTxOs.
@KtorZ KtorZ force-pushed the piotr/check-inputs-in-tx-tests branch from cabc8b9 to bd2916b Compare December 31, 2020 13:54
Copy link
Member

@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.

Reviewed it, fixed it and removed some redundant cases 👍

@KtorZ
Copy link
Member

KtorZ commented Dec 31, 2020

bors merge

iohk-bors bot added a commit that referenced this pull request Dec 31, 2020
2370: [ADP-500] Change addresses are not listed as soon as a transaction is no longer pending r=KtorZ a=hasufell

# Issue Number

ADP-500

# Overview

- [x] created an integration test that checks the accepctance criteria and fails on the current branch
- [x] fixed the code in `knownAddresses` to also return all used change addresses

# Comments

## Questions

Do we need to communicate this to API users?


2405: Additional checks for input existence in transactions r=KtorZ a=piotr-iohk

# Issue Number

It turns out there are no checks for that.
A bit related to #2327.

# Overview

- 1c7215b
  Additional checks for inputs in incoming and outgoing transactions in integration tests
  
- cabc8b9
  Additional checks for inputs in join/quit pool transactions




# 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)
 ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding ticket
 ✓ Acknowledge any changes required to the Wiki
 ✓ Finally, in the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages.
-->


Co-authored-by: Julian Ospald <[email protected]>
Co-authored-by: KtorZ <[email protected]>
Co-authored-by: Piotr Stachyra <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Dec 31, 2020

Build failed (retrying...):

  src/Test/Integration/Scenario/API/Shelley/StakePools.hs:199:5: 
  2) API Specifications, SHELLEY_STAKE_POOLS, STAKE_POOLS_JOIN_01 - Cannot join existent stakepool with wrong password
       uncaught exception: RequestException
       DecodeFailure "{\"code\":\"network_unreachable\",\"message\":\"The node backend is unreachable at the moment. Trying again in a bit might work.\"}"

#2320

iohk-bors bot added a commit that referenced this pull request Dec 31, 2020
2405: Additional checks for input existence in transactions r=KtorZ a=piotr-iohk

# Issue Number

It turns out there are no checks for that.
A bit related to #2327.

# Overview

- 1c7215b
  Additional checks for inputs in incoming and outgoing transactions in integration tests
  
- cabc8b9
  Additional checks for inputs in join/quit pool transactions




# 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)
 ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding ticket
 ✓ Acknowledge any changes required to the Wiki
 ✓ Finally, in the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages.
-->


Co-authored-by: Piotr Stachyra <[email protected]>
Co-authored-by: KtorZ <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Dec 31, 2020

Build failed:

      src/Test/Integration/Scenario/API/Shelley/StakePools.hs:420:5:
            1) API Specifications, SHELLEY_STAKE_POOLS, STAKE_POOLS_JOIN_02 - Cannot join already joined stake pool
                       uncaught exception: RequestException
                                  DecodeFailure "{\"code\":\"network_unreachable\",\"message\":\"The node backend is unreachable at the moment. Trying again in a bit might work.\"}"

#2320

@KtorZ
Copy link
Member

KtorZ commented Dec 31, 2020

bors merge

iohk-bors bot added a commit that referenced this pull request Dec 31, 2020
2405: Additional checks for input existence in transactions r=KtorZ a=piotr-iohk

# Issue Number

It turns out there are no checks for that.
A bit related to #2327.

# Overview

- 1c7215b
  Additional checks for inputs in incoming and outgoing transactions in integration tests
  
- cabc8b9
  Additional checks for inputs in join/quit pool transactions




# 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)
 ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding ticket
 ✓ Acknowledge any changes required to the Wiki
 ✓ Finally, in the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages.
-->


Co-authored-by: Piotr Stachyra <[email protected]>
Co-authored-by: KtorZ <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Dec 31, 2020

Build failed:

Failures:

  src/Test/Integration/Scenario/API/Shelley/StakePools.hs:506:5:
  1) API Specifications, SHELLEY_STAKE_POOLS, STAKE_POOLS_JOIN_01 - Can rejoin another stakepool
       uncaught exception: RequestException
       DecodeFailure "{\"code\":\"network_unreachable\",\"message\":\"The node backend is unreachable at the moment. Trying again in a bit might work.\"}"

  To rerun use: --match "/API Specifications/SHELLEY_STAKE_POOLS/STAKE_POOLS_JOIN_01 - Can rejoin another stakepool/"

Randomized with seed 1875000912

#2320

@piotr-iohk
Copy link
Contributor Author

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jan 5, 2021

Build succeeded:

@iohk-bors iohk-bors bot merged commit 37ff0b2 into master Jan 5, 2021
@iohk-bors iohk-bors bot deleted the piotr/check-inputs-in-tx-tests branch January 5, 2021 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IMPROVEMENT Mark a PR as an improvement, for auto-generated CHANGELOG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants