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

[RCD-40] Enforce address discrimination check when sending transactions #3823

Merged

Conversation

KtorZ
Copy link
Contributor

@KtorZ KtorZ commented Nov 5, 2018

Description

On release/2.0.0, one can attempt to construct and send transactions to addresses which are of a different network via the wallet-new V1 API. Even though the nodes reject this transaction since it's invalid (as a result of CO-410), an error should be returned by the API in order to prevent users from even attempting this.

Linked issue

[RCD-40]

Type of change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • 🛠 New feature (non-breaking change which adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)
  • 🏭 Refactoring that does not change existing functionality but does improve things like code readability, structure etc
  • 🔨 New or improved tests for existing code
  • ⛑ git-flow chore (backport, hotfix, etc)

Developer checklist

  • I have read the style guide document, and my code follows the code style of this project.
  • If my code deals with exceptions, it follows the guidelines.
  • I have updated any documentation accordingly, if needed. Documentation changes can be reflected in opening a PR on cardanodocs.com, amending the inline Haddock comments, any relevant README file or one of the document listed in the docs directory.
  • CHANGELOG entry has been added and is linked to the correct PR on GitHub.

Testing checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.

QA Steps

Screenshots (if available)

@KtorZ KtorZ changed the title Ktor z/rcd 40/enforce address discrimination when sending tx Enforce address discrimination check when sending transactions Nov 5, 2018
@KtorZ KtorZ changed the title Enforce address discrimination check when sending transactions [RCD-40] Enforce address discrimination check when sending transactions Nov 5, 2018
@intricate intricate self-assigned this Nov 5, 2018
@intricate intricate force-pushed the KtorZ/RCD-40/enforce-address-discrimination-when-sending-tx branch 2 times, most recently from a502bb8 to d311d12 Compare November 5, 2018 19:35
genPayeeWithNM :: NetworkMagic -> Core.Utxo -> Pay -> Gen (NonEmpty Core.TxOut)
genPayeeWithNM nm _utxo payment = do
let balance = toLovelaces payment
genTxOutWithNM nm StakeGenOptions {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Genuine question: I thought stake distribution wasn't used in cardano addresses?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it important to get an answer to this?

@KtorZ
Copy link
Contributor Author

KtorZ commented Nov 5, 2018

LGTM. I can't approve on github because I created the PR 🙃

Copy link
Contributor Author

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

a small question...

@intricate intricate requested review from erikd, mhuesch, intricate and alan-mcnicholas and removed request for intricate November 5, 2018 20:10
@intricate intricate force-pushed the KtorZ/RCD-40/enforce-address-discrimination-when-sending-tx branch 2 times, most recently from 6bbe086 to b51501a Compare November 6, 2018 00:58
Copy link
Contributor

@mhuesch mhuesch left a comment

Choose a reason for hiding this comment

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

LGTM, but I'll leave the final approval for @KtorZ

@KtorZ
Copy link
Contributor Author

KtorZ commented Nov 6, 2018

@kderme @mhuesch

Can someone put his approval on the PR via the GitHub interface please 😂 ...
I can't since I opened the PR.

@KtorZ KtorZ force-pushed the KtorZ/RCD-40/enforce-address-discrimination-when-sending-tx branch from f06a813 to 1ce9786 Compare November 6, 2018 17:01
intricate and others added 2 commits November 6, 2018 18:02
…rkMagic` in `wallet-new` API V1

(cherry picked from commit a6373f6)
Both changes (new tests for fees sanity check and network magic
validation) were introduced in parallel and merged concomitanttly.
As a result, CI accepted both changes whereas the newly introduced tests
should also be fixed.
@KtorZ KtorZ force-pushed the KtorZ/RCD-40/enforce-address-discrimination-when-sending-tx branch from 1ce9786 to c91aafa Compare November 6, 2018 17:02
@KtorZ
Copy link
Contributor Author

KtorZ commented Nov 6, 2018

*Fixed invalid tests newly introduced by CSL-2526 which also need to account for NetworkMagic when generating new payee.

Copy link
Contributor

@intricate intricate left a comment

Choose a reason for hiding this comment

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

Odd for me to do this, but I'm just going to go ahead and approve it.

Copy link
Contributor

@mhuesch mhuesch left a comment

Choose a reason for hiding this comment

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

LGTM, besides unanswered question.

@KtorZ KtorZ merged commit 537260a into develop Nov 6, 2018
@KtorZ KtorZ deleted the KtorZ/RCD-40/enforce-address-discrimination-when-sending-tx branch November 6, 2018 18:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants