Skip to content

Conversation

Empact
Copy link
Contributor

@Empact Empact commented Jun 23, 2018

This results in a more informative debug string to the validation state in the
case of failure.

Copy link
Contributor

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

@Empact Empact changed the title Report reason inputs are nonstandard from AreInputsStandard WIP: Report reason inputs are nonstandard from AreInputsStandard Jun 25, 2018
@DrahtBot
Copy link
Contributor

DrahtBot commented Jun 26, 2018

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

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK promag, MarcoFalke, 0xB10C, glozow, theStack
Stale ACK sipa

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #26403 ([POLICY] Ephemeral anchors by instagibbs)

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.

@Empact
Copy link
Contributor Author

Empact commented Jun 28, 2018

@promag Addressed your comments, including tests for each case.

@Empact Empact changed the title WIP: Report reason inputs are nonstandard from AreInputsStandard Report reason inputs are nonstandard from AreInputsStandard Jun 28, 2018
@sipa
Copy link
Member

sipa commented Jul 14, 2018

utACK 7298231aa8faaff65c261eac557448c223b76500

@luke-jr
Copy link
Member

luke-jr commented Jul 29, 2018

This is already part of #7533

At the very least, please try to use the short rejection reasons therein...

@luke-jr
Copy link
Member

luke-jr commented Jul 29, 2018

c59e716

@Empact Empact force-pushed the are-inputs-standard-reason branch from 7298231 to dab2384 Compare July 29, 2018 23:09
@Empact
Copy link
Contributor Author

Empact commented Jul 29, 2018

Thanks @luke-jr, I adapted the short reasons from c59e716. How does that look? Is it alright to put the input index in the rejection reason or better to append?

@Empact Empact force-pushed the are-inputs-standard-reason branch from dab2384 to b39bc02 Compare July 29, 2018 23:12
@Empact
Copy link
Contributor Author

Empact commented Jul 29, 2018

Also moved the string instantiation out of the bench loop.

@Empact Empact force-pushed the are-inputs-standard-reason branch from b39bc02 to 54f120c Compare July 29, 2018 23:56
@luke-jr
Copy link
Member

luke-jr commented Jul 30, 2018

Might be better to have the index at the end, not sure.

@Empact Empact force-pushed the are-inputs-standard-reason branch from 54f120c to bf785af Compare July 30, 2018 16:13
@Empact
Copy link
Contributor Author

Empact commented Jul 30, 2018

@luke-jr moved the input index to the end. Now I'm questioning the need for the bad-txns- prefix, given that these are to become debug output, rather than the reason string, which is what usually bears this prefix.

@Empact Empact force-pushed the are-inputs-standard-reason branch 2 times, most recently from 3135078 to 7986ccf Compare July 30, 2018 16:22
@Empact
Copy link
Contributor Author

Empact commented Jul 30, 2018

Removed bad-txns-. Note these are propagated as the debug string alongside a bad-txns-nonstandard-inputs CValidationState reject reason.

@luke-jr
Copy link
Member

luke-jr commented Aug 15, 2018

Why do you want to limit it to debug output? Reasons should be in the reason field.

@Empact Empact force-pushed the are-inputs-standard-reason branch from 7986ccf to 781c350 Compare August 15, 2018 20:06
@Empact
Copy link
Contributor Author

Empact commented Aug 15, 2018

@luke-jr Good point - split the reason and debug fields, and replaced bad-txns-nonstandard-inputs with one of: bad-txns-script-nonstandard, bad-txns-scriptsig-error, or bad-txns-scriptcheck-sigops.

@Empact Empact force-pushed the are-inputs-standard-reason branch from 781c350 to 54020f6 Compare August 15, 2018 20:22
@theStack
Copy link
Contributor

Concept ACK

@Empact Empact force-pushed the are-inputs-standard-reason branch 2 times, most recently from df4089e to 631d3c9 Compare August 8, 2022 05:15
@glozow glozow requested a review from theStack August 24, 2022 15:45
@Empact Empact force-pushed the are-inputs-standard-reason branch from 631d3c9 to 1f3c017 Compare October 9, 2022 22:57
Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

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

CI fails, seems like some functional tests need to be adapted to match the more specific failure reason string (https://cirrus-ci.com/task/6048174287618048?logs=ci#L3337):

...
AssertionError: [node 1] Expected messages "['bad-txns-input-script-nonstandard']" does not partially match log:
...

This adds specific debug information including the input index and manner of
failure.
@Empact Empact force-pushed the are-inputs-standard-reason branch from 1f3c017 to dfa1943 Compare October 10, 2022 15:44
@Empact
Copy link
Contributor Author

Empact commented Oct 10, 2022

CI fails, seems like some functional tests need to be adapted to match the more specific failure reason string (https://cirrus-ci.com/task/6048174287618048?logs=ci#L3337):

...
AssertionError: [node 1] Expected messages "['bad-txns-input-script-nonstandard']" does not partially match log:
...

@theStack fixed: https://github.com/bitcoin/bitcoin/compare/1f3c017cce798bdcee1d719bf160dc07783239f2..dfa194343fde1557420a3b4a52b6a93e42adb848

Copy link
Member

@achow101 achow101 left a comment

Choose a reason for hiding this comment

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

The more descriptive reason strings seem to have gotten lost in the past couple of years.

txWitnessUnknown.vin.resize(1);
txWitnessUnknown.vin[0].prevout.n = 9;
txWitnessUnknown.vin[0].prevout.hash = txFrom.GetHash();
txWitnessUnknown.vin[0].scriptSig << std::vector<unsigned char>(witnessUnknown.begin(), witnessUnknown.end());
Copy link
Member

Choose a reason for hiding this comment

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

In ba538fb "Propagate validation debug information from AreInputsStandard"

nit: setting scriptSig is unnecessary as the thing being checked is the scriptPubKey of the output being spent.

Copy link
Contributor

@aureleoules aureleoules left a comment

Choose a reason for hiding this comment

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

Instead of returning an option would the Result class make more sense?
Also, instead of a pair of strings, maybe create a new struct?

@achow101
Copy link
Member

Closing this as it has not had any activity in a while. If you are interested in continuing work on this, please leave a comment so that it can be reopened.

@achow101 achow101 closed this Apr 25, 2023
@bitcoin bitcoin locked and limited conversation to collaborators Dec 11, 2024
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.