Skip to content

Conversation

jnewbery
Copy link
Contributor

CheckInputs() used to check no double spends, scripts & sigs and amounts. Since
832e074, the double spend and amount checks
have been moved to CheckTxInputs(), and CheckInputs() now just validates
input scripts. Rename the function to CheckInputScripts().

Also fix incorrect comments.

@jnewbery

This comment has been minimized.

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 19, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #17399 (validation: Templatize ValidationState instead of subclassing by jkczyz)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@jnewbery jnewbery force-pushed the 2019-08-rename-CheckInputs branch from 4618cf2 to bf5b449 Compare August 25, 2019 19:47
@jnewbery jnewbery changed the title [validation] Rename CheckInputs to CheckInputScripts validation: Rename CheckInputs to CheckInputScripts Aug 25, 2019
@jnewbery jnewbery changed the title validation: Rename CheckInputs to CheckInputScripts [WIP] validation: Rename CheckInputs to CheckInputScripts Aug 26, 2019
Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

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

Concept ACK

This builds on #13868. Please review that PR first.

I have reviewed the base PR.

Should 046cd75 be a scripted-diff? This should produce the same change:

gsed -i 's/\<CheckInputs\>/CheckInputScripts/g' src/*.h src/*.cpp src/**/*.h src/**/*.cpp

This needs a couple functional test changes for the expected messages:

with self.nodes[0].assert_debug_log(expected_msgs=['CheckInputs on {} failed with non-mandatory-script-verify-flag (Non-canonical DER signature)'.format(block.vtx[-1].hash)]):

with self.nodes[0].assert_debug_log(expected_msgs=['CheckInputs on {} failed with non-mandatory-script-verify-flag (Negative locktime)'.format(block.vtx[-1].hash)]):

@jnewbery jnewbery force-pushed the 2019-08-rename-CheckInputs branch from bf5b449 to 41d1528 Compare September 2, 2019 15:23
@jnewbery jnewbery changed the title [WIP] validation: Rename CheckInputs to CheckInputScripts validation: Rename CheckInputs to CheckInputScripts Sep 2, 2019
@jnewbery
Copy link
Contributor Author

jnewbery commented Sep 2, 2019

Rebased and removed WIP tag.

Thanks for the review @fanquake

This needs a couple functional test changes for the expected messages.

Fixed. Thanks.

Should 046cd75 be a scripted-diff?

I think this is small enough to be a non-scripted commit, and I'd need to add more to your suggested one-liner to make the test changes atomic with the validation.cpp changes. I'm leaving as it is for now, but can change if other reviewers agree that scripted would be better.

@ajtowns
Copy link
Contributor

ajtowns commented Sep 3, 2019

I'd need to add more to your suggested one-liner to make the test changes atomic with the validation.cpp changes

FWIW, I believe a valid scripted-diff line for 3623a8f would be:

sed -i -E -e 's/CheckInputs\b/CheckInputScripts/g' $(git grep -l CheckInputs | grep -v doc/)

@jnewbery jnewbery force-pushed the 2019-08-rename-CheckInputs branch from 41d1528 to d0dd908 Compare September 4, 2019 22:32
@jnewbery
Copy link
Contributor Author

jnewbery commented Sep 4, 2019

FWIW, I believe a valid scripted-diff line for 3623a8f would be...

I've updated the commit to use your scripted diff one-liner. Thanks!

@michaelfolkson
Copy link

Concept ACK. I ran a git grep on CheckInputs in this PR branch and apart from old release notes that obviously won't change, there is a ValidateCheckInputsForAllFlags function in src/test/txvalidationcache_tests.cpp, a CheckInputsAndUpdateCoins function in src/txmempool.cpp and CheckInputsFromMempoolAndCache function in src/validation.cpp. Should they be changed too?

@fanquake
Copy link
Member

fanquake commented Sep 8, 2019

@jnewbery Looks like the scripted diff needs fixing:

$ set -o errexit; source ./ci/lint/06_script.sh
Error: script block marker but no scripted-diff in title
Failed

@jnewbery
Copy link
Contributor Author

jnewbery commented Sep 8, 2019

Looks like the scripted diff needs fixing

Thanks. Will fix next week.

@jnewbery jnewbery force-pushed the 2019-08-rename-CheckInputs branch from d0dd908 to 3386c65 Compare September 10, 2019 12:55
@jnewbery
Copy link
Contributor Author

Looks like the scripted diff needs fixing

should be fixed

@jnewbery jnewbery force-pushed the 2019-08-rename-CheckInputs branch from 3386c65 to 3ee9ad7 Compare October 1, 2019 14:18
@jnewbery
Copy link
Contributor Author

jnewbery commented Oct 1, 2019

rebased

@maflcko
Copy link
Member

maflcko commented Oct 11, 2019

ACK 3ee9ad7 thanks for fixing documentation

Show signature and timestamp

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

ACK 3ee9ad76803c0f9fdcb21ac1ad6162df79df07da thanks for fixing documentation
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUg1jQwAystQNbOYRs28u4UXVAow/cWruoKgEWgtVxmszf3FIl6XOkkK35LHsXD8
P0YZ/7XAaGIXufQYGkMr4Iaq/lONZjw6oQOqkgCNfq5UjPS4JesEuj/QtKwrQGPp
xFYdGzuU4CE5NQlAtx1bXK5CebOc03FgFYuN9u74579t7nl0P5dp/VjaIUVcdZFE
Wgxgwfa2DboOnI5sv9drQvcX9nLJcUPfBZWufb9RUCE+rklB0hjTomISPUbF75fd
2XFUuOFgIonwwrFkgg6ChTaecDHaphCsttauGRigKxWyOsk3NIjwc8DfAyDK2+H8
HZcMguMNy183bqRFbzbL/VEJD3rDYvj8dtg8cwGlejcP20tj3g1yZqJIerqXU8GZ
5t6xENcNWHjOuL8HpuRg9JiRBM1E12/c39IUAKaG/5W3K4tODI3ziRfu8JQMKpDH
CrDHoaB23mTzzjYxq7R9aMWDSdA0oLzTKL1kGi1Y3SEOWs06e7JSAMhdnoOiueg4
st2HgDxb
=CD9a
-----END PGP SIGNATURE-----

Timestamp of file with hash 2fb4b49625388db44b56838d9617fb9d4d07331a02b3a6db6af05658e13fad54 -

@maflcko maflcko removed the Tests label Oct 11, 2019
@jnewbery
Copy link
Contributor Author

rebased

@jnewbery jnewbery force-pushed the 2019-08-rename-CheckInputs branch from 3ee9ad7 to 44d20b8 Compare October 25, 2019 13:31
@maflcko
Copy link
Member

maflcko commented Oct 25, 2019

re-ACK 44d20b8 only change is rebase the scripted diff

Show signature and timestamp

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

re-ACK 44d20b86b74445adb6d96f20e44efd1afae36035 only change is rebase the scripted diff
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUhQBgv/f7OOsZwi+esjzjBssh0Bf6JMXRjjbZ+ARDo7KEqKjlf6x09B1ViMqC+X
+emq0IRC9dNzDLW6foblXUGvNwwsBCoULWmI7gXL+m6wZxkD2Byiuq1RDrLLvty1
cadiGJUbhIrMzUHXPsYPx/nt/Wq3kRc9UX09DU/JbkjBcZYYYsrMy96mqPt+2q+e
/hQ/1JsfofAqqS6cFNSNvnxSUG/vywJb6dgKd/c5+2SYAuZ1Nl4eTQiTeueP67nL
lypZt55WRlWoGo+1zUQIE6dDQxkfyNJfdsRQa8tNWS8wRdsBJNafuNRPiRpTcV6T
PJKq/J5syT7AYBQiyfyLyqYKaPve4j/nR4opIBtnZZzc02eQZH0MnHPhpamzV+LO
/Mqm5IYPC7xR5csWzTJas7lRaum81DWSKVowL7MO69M+TUmKH2K4n7vZ0kj1YKCY
dxvTZIzkglBR7uD9vRKUPv7KhVTNPiCSm1SreLyUSJJuE82Mex1JXAXt4Hj7UUSH
foyxWkSG
=oHWs
-----END PGP SIGNATURE-----

Timestamp of file with hash 0630b39dafbd879abe6610f1a999b11bd28a1e6e9f1c97ebdfa437aa875e56fa -

@promag
Copy link
Contributor

promag commented Oct 25, 2019

TIL git grep -l CheckInputs -- ':!doc'.

Code review ACK.

@jnewbery jnewbery force-pushed the 2019-08-rename-CheckInputs branch from 44d20b8 to ff6fa17 Compare October 30, 2019 16:47
@jnewbery
Copy link
Contributor Author

Rebased on master

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 7, 2019

Needs rebase

@maflcko
Copy link
Member

maflcko commented Nov 7, 2019

This is a trivial fix that should be ready for merge after rebase

CheckInputs() used to check no double spends, scripts & sigs and amounts. Since
832e074, the double spend and amount checks
have been moved to CheckTxInputs(), and CheckInputs() now just validates
input scripts. Rename the function to CheckInputScripts().

-BEGIN VERIFY SCRIPT-
sed -i -E -e 's/CheckInputs\b/CheckInputScripts/g' $(git grep -l CheckInputs | grep -v doc/)
-END VERIFY SCRIPT-
@jnewbery jnewbery force-pushed the 2019-08-rename-CheckInputs branch from ff6fa17 to 3bd8db8 Compare November 7, 2019 18:52
@jnewbery
Copy link
Contributor Author

jnewbery commented Nov 7, 2019

Rebased

@maflcko
Copy link
Member

maflcko commented Nov 7, 2019

re-ACK 3bd8db8, did the rebase myself, checked the scripted diff 👡

Show signature and timestamp

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

re-ACK 3bd8db80d8d335ab63ece4f110b0fadd562e80b7, did the rebase myself, checked the scripted diff 👡
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUjh4wv/WSY4eMrYXocYlXm6kXbisKRQM+4z5HS9drtint6Mf3u/Zj3zioAxEApI
sIk6tuwzracrSYy2D6YtZnSSjpMwrtCRYy48OOt8e0WDnlUpZwTUyjCwp+l4nsMa
Bc+MUtTe9Eq8ICEAyFbNVGr+yvt18WlqM/h5DEIchFlGIE76BajPBTRxnf1QVe5o
OiC7ErXnpj79LzBYP5MF8/R7AMb66y+++Xop9pZeMkLAWM//0exTlsGrJU7V/GJW
2Mx/wApRUFjTz/NNDl5iArpayOa7KFcPZ9MhzvfBV0v+vihH3HzDKmvT9NYTDgox
6WvsBr1nj2F1ONV/fZQ9h8SK0jj4ewguDgNJ8cwB2uJQBqUOaWayNNNbE1egJIOv
33VpHuFdUIHsuRJMufZPpuNrK2/h0HguHVunuIM8jIvdG0dt+ioFYabXmKkywPi8
EQjw/j4DyvGzKILVKFpHatAFHLET87oGMH2Ph7ComQKOmYjsuyXvnys04y6KOwlg
4n7UJzLs
=3RbB
-----END PGP SIGNATURE-----

Timestamp of file with hash 4aa6710c657c2553e2de927e5918efcd786d8c666d5ddcdb193f75684907f609 -

@promag
Copy link
Contributor

promag commented Nov 7, 2019

ACK 3bd8db8 :trollface:

maflcko pushed a commit that referenced this pull request Jan 2, 2020
3bd8db8 [validation] fix comments in CheckInputScripts() (John Newbery)
6f6465c scripted-diff: [validation] Rename CheckInputs to CheckInputScripts (John Newbery)

Pull request description:

  CheckInputs() used to check no double spends, scripts & sigs and amounts. Since
  832e074, the double spend and amount checks
  have been moved to CheckTxInputs(), and CheckInputs() now just validates
  input scripts. Rename the function to CheckInputScripts().

  Also fix incorrect comments.

ACKs for top commit:
  MarcoFalke:
    re-ACK 3bd8db8, did the rebase myself, checked the scripted diff 👡
  promag:
    ACK 3bd8db8 :trollface:

Tree-SHA512: 7b3f8597d210492798fb784ee8ea47ea6377519111190161c7cc34a967509013f4337304f52e9bedc97b7710de7b0ff8880e08cd7f867754567f82e7b02c794c
@maflcko maflcko merged commit 3bd8db8 into bitcoin:master Jan 2, 2020
@jnewbery jnewbery deleted the 2019-08-rename-CheckInputs branch January 2, 2020 16:36
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jan 2, 2020
3bd8db8 [validation] fix comments in CheckInputScripts() (John Newbery)
6f6465c scripted-diff: [validation] Rename CheckInputs to CheckInputScripts (John Newbery)

Pull request description:

  CheckInputs() used to check no double spends, scripts & sigs and amounts. Since
  832e074, the double spend and amount checks
  have been moved to CheckTxInputs(), and CheckInputs() now just validates
  input scripts. Rename the function to CheckInputScripts().

  Also fix incorrect comments.

ACKs for top commit:
  MarcoFalke:
    re-ACK 3bd8db8, did the rebase myself, checked the scripted diff 👡
  promag:
    ACK 3bd8db8 :trollface:

Tree-SHA512: 7b3f8597d210492798fb784ee8ea47ea6377519111190161c7cc34a967509013f4337304f52e9bedc97b7710de7b0ff8880e08cd7f867754567f82e7b02c794c
sidhujag pushed a commit to syscoin-core/syscoin that referenced this pull request Nov 10, 2020
3bd8db8 [validation] fix comments in CheckInputScripts() (John Newbery)
6f6465c scripted-diff: [validation] Rename CheckInputs to CheckInputScripts (John Newbery)

Pull request description:

  CheckInputs() used to check no double spends, scripts & sigs and amounts. Since
  832e074, the double spend and amount checks
  have been moved to CheckTxInputs(), and CheckInputs() now just validates
  input scripts. Rename the function to CheckInputScripts().

  Also fix incorrect comments.

ACKs for top commit:
  MarcoFalke:
    re-ACK 3bd8db8, did the rebase myself, checked the scripted diff 👡
  promag:
    ACK 3bd8db8 :trollface:

Tree-SHA512: 7b3f8597d210492798fb784ee8ea47ea6377519111190161c7cc34a967509013f4337304f52e9bedc97b7710de7b0ff8880e08cd7f867754567f82e7b02c794c
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 13, 2021
Summary:
3bd8db80d8d335ab63ece4f110b0fadd562e80b7 [validation] fix comments in CheckInputScripts() (John Newbery)
6f6465cefcd599c89c00f7b51f42a4b87a5ffb0b scripted-diff: [validation] Rename CheckInputs to CheckInputScripts (John Newbery)

Pull request description:

  CheckInputs() used to check no double spends, scripts & sigs and amounts. Since
  832e074, the double spend and amount checks
  have been moved to CheckTxInputs(), and CheckInputs() now just validates
  input scripts. Rename the function to CheckInputScripts().

  Also fix incorrect comments.

---

Backport of Core [[bitcoin/bitcoin#16658 | PR16658]]

Test Plan:
  ninja all check check-functional

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D8762
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
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.

7 participants