Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Nov 11, 2021

It seems confusing to return a P2SH wrapping address that is eventually either policy- or consensus-unspendable.

@Sjors
Copy link
Member

Sjors commented Nov 11, 2021

Concept ACK. For slightly easier review, maybe split into a pure refactor/reformat commit and the actual behavior change.

@maflcko
Copy link
Member Author

maflcko commented Nov 11, 2021

If you pass in --ignore-all-space, it will show only the behaviour changes. I think it makes sense to adjust the whitespace in the same commit that removes the if-body.

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 12, 2021

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #23545 (scripted-diff: Use clang-tidy syntax for C++ named arguments [WIP; TOO MANY CONFLICTS] by MarcoFalke)

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.

@laanwj
Copy link
Member

laanwj commented Nov 12, 2021

I agree with @Sjors here. I think it makes sense to split the functionality change into a separate commit. Even if it can still be reviewed by providing extra arguments to diff, it just seems cleaner, say, when browsing git history later.

Does this need a functional test?

@laanwj
Copy link
Member

laanwj commented Nov 12, 2021

Code review ACK fa1c1f4

Code review re-ACK fa972d8

@maflcko
Copy link
Member Author

maflcko commented Nov 12, 2021

Does this need a functional test?

There are steps to test in the first comment, but I am happy to add a commit with tests if someone writes them. I am also happy to review a pull if someone adds them after merge.

@Sjors
Copy link
Member

Sjors commented Nov 12, 2021

tACK fa1c1f4

@maflcko maflcko changed the title rpc: Avoid returning P2SH for witness_v1_taproot in decodescript rpc: Only return P2SH wrapped witness programs for BIP141 types in decodescript Nov 14, 2021
@maflcko maflcko changed the title rpc: Only return P2SH wrapped witness programs for BIP141 types in decodescript rpc: Only allow specific types to be P2SH wrapped in decodescript Nov 14, 2021
@maflcko maflcko force-pushed the 2111-rpcScript branch 2 times, most recently from fa827d2 to fa972d8 Compare November 14, 2021 17:21
@maflcko
Copy link
Member Author

maflcko commented Nov 14, 2021

Reworked and updated pull request description

@sipa
Copy link
Member

sipa commented Nov 15, 2021

We may also need to check that no OP_CHECKSIGADD opcodes occur in a script before reporting a P2WSH for it.

@achow101
Copy link
Member

We may also need to check that no OP_CHECKSIGADD opcodes occur in a script before reporting a P2WSH for it.

And OP_SUCCESSx too

@maflcko maflcko changed the title rpc: Only allow specific types to be P2SH wrapped in decodescript rpc: Only allow specific types to be P2(W)SH wrapped in decodescript Nov 16, 2021
@maflcko
Copy link
Member Author

maflcko commented Nov 16, 2021

And OP_SUCCESSx too

And unparseable, and unspendable scripts.

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.

Even without the two issues mentioned below, it seems that decodescript is unable to decode scripts containing OP_CHECKSIGADD and OP_SUCCESSx. But I think fixing those would be out of scope for this PR.

@maflcko maflcko force-pushed the 2111-rpcScript branch 2 times, most recently from 2e26400 to faa1b5e Compare November 22, 2021 11:19
@maflcko
Copy link
Member Author

maflcko commented Nov 22, 2021

Force pushed to fix a "typo" 😖 and updated OP to include more tests.

break;
case TxoutType::NULL_DATA:
case TxoutType::SCRIPTHASH:
case TxoutType::WITNESS_UNKNOWN:
Copy link
Member

Choose a reason for hiding this comment

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

Isn't it TBD if future witnesses can be wrapped? Though maybe too unlikely to matter...

Copy link
Member Author

Choose a reason for hiding this comment

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

It is possible but unlikely. In that case you need to upgrade to a version of Bitcoin Core that "understands" the witness program to wrap it.

@maflcko maflcko force-pushed the 2111-rpcScript branch 3 times, most recently from fadc110 to fad77aa Compare December 2, 2021 14:42
@maflcko
Copy link
Member Author

maflcko commented Dec 6, 2021

Rebased to add tests ✨

@laanwj
Copy link
Member

laanwj commented Dec 6, 2021

Code review re-ACK 9999342
It's nice to be able to see in the .json what exactly the difference in output is.

@@ -38,38 +36,21 @@
"6a00",
{
"asm": "OP_RETURN 0",
"type": "nulldata",
"p2sh": "2NG8CqGyR16jkZU5H7J9WM5xpCT6Fpw6bww"
"type": "nulldata"
}
],
[
"6aee",
{
"asm": "OP_RETURN OP_UNKNOWN",
Copy link
Member

Choose a reason for hiding this comment

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

(not in this PR) it would be nice to have some test entries that do give segwit output

Copy link
Member Author

Choose a reason for hiding this comment

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

good first issue ;)

@laanwj laanwj merged commit 695ba2f into bitcoin:master Dec 6, 2021
@maflcko maflcko deleted the 2111-rpcScript branch December 7, 2021 08:07
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 7, 2021
RandyMcMillan pushed a commit to RandyMcMillan/mempool-tab that referenced this pull request Dec 23, 2021
…W)SH wrapped in decodescript

086d811 rpc: Only allow specific types to be P2(W)SH wrapped in decodescript (MarcoFalke)

Pull request description:

  It seems confusing to return a P2SH wrapping address that is eventually either policy- or consensus-unspendable.

ACKs for top commit:
  laanwj:
    Code review re-ACK 086d811

Tree-SHA512: 3cd530442acee7c295d244995f0f17b2cae7212f1e0970bb5807621f8ff8e4308a3236b385d77087cd493d32ee524813d8edd15e91d937ef9a800094b7bc4946
@bitcoin bitcoin locked and limited conversation to collaborators Dec 23, 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.

8 participants