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

Segregated witness rebased #8149

Merged
merged 27 commits into from
Jun 24, 2016
Merged

Segregated witness rebased #8149

merged 27 commits into from
Jun 24, 2016

Conversation

sipa
Copy link
Member

@sipa sipa commented Jun 6, 2016

This PR is a rebased and squashed version of #7910. As this is the form (in pieces or in whole) that we expect it to be merged in, I'm opening a separate pull request for it. I will leave the old one open for discussion and history.

The tree here is identical to the resulting tree there:

$ git show -s --format="%T" 3cb46c1a4ac94f4a7f25368bc2ba3c784c901b89
8ddfe56cfedba64667c63dd0fef6ee9584889719
$ git show -s --format="%T" 17389dc466f2acf8bfa64ce0416f3b5281445a5c
8ddfe56cfedba64667c63dd0fef6ee9584889719

Where 3cb46c1 is #7910's tip commit, and 17389dc is this PR's tip commit.

Please make comments on #7910, so the history can be tracked, and everything stays in one place.

@sipa
Copy link
Member Author

sipa commented Jun 6, 2016

Here is a categorized list of the commits:

  • P2P/node/consensus (sipa/bitcoin@4182520...7080d47)
    • 8199125 BIP144: Serialization, hashes, relay (sender side)
    • 04dd13a BIP141: Witness program
    • 1fff664 BIP141: Commitment structure and deployment
    • 902c279 BIP144: Handshake and relay (receiver side)
    • 113b3e5 Refactor script validation to observe amounts
    • 1f5bb93 BIP143: Verification logic
    • 87252e9 [RPC] Return witness data in blockchain RPCs
    • 94c2abb BIP141: Other consensus critical limits, and BIP145
    • f0b33a5 [libconsensus] Script verification API with amounts
    • 76cb63b Add rewind logic to deal with post-fork software updates
  • wallet (sipa/bitcoin@7080d47...8a5665a)
    • b344e52 BIP143: Signing logic
    • ddb6682 [RPC] Add wallet support for witness transactions (using P2SH)
    • 0c57081 [RPC] signrawtransaction can sign P2WSH
  • tests (sipa/bitcoin@8a5665a...37916d3)
    • f7d6e0a [qa] Witness version 0 signing unit tests
    • 2cbf540 [qa] Add transaction tests for segwit
    • 29344db [qa] Add segwit support to script_tests
    • ec00dc9 [qa] Autogeneration support for witness in script_tests
    • e711429 [qa] Add rpc test for segwit
    • 7d828f1 [qa] p2p segwit tests
    • 0612ad6 [qa] script_tests: witness tests can specify tx amount
    • 89179b0 [qa] Add GetTransactionSigOpCost unit tests
  • deployment (sipa/bitcoin@37916d3...74300b9)
    • 74300b9 BIP9 parameters for testnet

@kanzure
Copy link
Contributor

kanzure commented Jun 6, 2016

ACK for same git tree hash for 3cb46c1 and 17389dc.

@sipa sipa mentioned this pull request Jun 6, 2016
7 tasks
{
ScriptError error;
CTransaction inputi(input);
bool ret = VerifyScript(inputi.vin[0].scriptSig, output.vout[0].scriptPubKey, inputi.wit.vtxinwit.size() > 0 ? &inputi.wit.vtxinwit[0].scriptWitness : NULL, flags, TransactionSignatureChecker(&inputi, 0, output.vout[0].nValue), &error);
Copy link
Member Author

Choose a reason for hiding this comment

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

Please comment in #7910.

@sipa sipa force-pushed the segwit-master2 branch from 17389dc to 08ff5f2 Compare June 12, 2016 20:24
@sipa
Copy link
Member Author

sipa commented Jun 12, 2016

Updated with a rebased/squashed version of the changes in #7910. The resulting tree should still be identical.

@sipa sipa force-pushed the segwit-master2 branch from 08ff5f2 to 29d9650 Compare June 13, 2016 20:06
@sipa
Copy link
Member Author

sipa commented Jun 13, 2016

Updated again.

@maflcko maflcko added this to the 0.13.0 milestone Jun 15, 2016
@sipa sipa force-pushed the segwit-master2 branch 5 times, most recently from 5a5abad to 74300b9 Compare June 16, 2016 18:31
@sdaftuar
Copy link
Member

ACK 74300b9a5ed24e9f7d80ecc39d4e19690732ccbe

@jonasschnelli
Copy link
Contributor

Reviewed everything. Tested different scenarios. Mostly focused on the wallet.
ACK 74300b9a5ed24e9f7d80ecc39d4e19690732ccbe

@NicolasDorier
Copy link
Contributor

NicolasDorier commented Jun 17, 2016

ACK 74300b9a5ed24e9f7d80ecc39d4e19690732ccbe (focused more on the scripting side, and tx signature v2, lightly reviewed the rest)

sipa and others added 11 commits June 22, 2016 15:42
Contains refactorings by Eric Lombrozo.
Contains fixup by Nicolas Dorier.
Contains cleanup of CInv::GetCommand by Alex Morcos
Includes a fix by Suhas Daftuar and LongShao007
Service bit logic by Nicolas Dorier.

Only download blocks from witness peers after fork.
This is a preparation for BIP143 support.
Includes simplifications by Eric Lombrozo.
Includes RPC field name changes by Luke-jr.
Includes changes by Suhas Daftuar, Luke-jr, and mruddy.
script_tests: always test bitcoinconsensus_verify_script_with_amount if VERIFY_WITNESS isn't set

Rename internal method + make it static

trim bitcoinconsensus_ prefix

Add SERIALIZE_TRANSACTION_WITNESS flag
Includes logic for dealing with pruning by Suhas Daftuar.
@bitcoin bitcoin deleted a comment from Trevorulliac Apr 26, 2020
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request Aug 5, 2020
d1d15c8 Fix missing sigverion in main_test.cpp CreateDummyScriptSigWithKey. (furszy)
a034daf Rename to PrecomputedTransactionData (furszy)
b4b181b Unit test for sighash caching (furszy)
2ef3872 Report non-mandatory script failures correctly. (furszy)
446d340 Precompute sighashes (furszy)
dfd24eb Update wallet_txn_close.py test: (furszy)
a5170f0 BIP143: Signing logic. (furszy)
d2dd547 BIP143: Verification logic. (furszy)
dccc3c6 Refactor script validation to observe amounts (furszy)
daf044a Reduce unnecessary hashing in signrawtransaction (furszy)

Pull request description:

  Base work for the new transaction digest algorithm for signature verification on PIVX Sapling transactions.

  Essentially, an implementation of BIP143 + few more good commits that found down the rabbit hole.

  Back ports:

  * bitcoin#7276
  * bitcoin#7976
  * bitcoin#8118
  * bitcoin#8149 (only amount validation and SignatureHash commits).
  * bitcoin#6088 (only the dummy signature one - will be removed once #1663 get merged -).
  * bitcoin#6379
  * bitcoin#8524

  Next step over this area (need 1553 merged to be able to push it) is the further specialization of BIP143 into our custom implementation of ZIP143 (with a different digest algorithm definition using our tx data and hash personalization).

ACKs for top commit:
  Fuzzbawls:
    utACK d1d15c8
  random-zebra:
    ACK d1d15c8 and merging...

Tree-SHA512: 7665cccf095c5bce0b18ef7ab8fcf7bede9304993b48f1af9c352c568861dec728d1d68671aab857b73d46567678492c4b97c24644a15f3f29fc4d723b183522
KolbyML added a commit to c-sports/cspn that referenced this pull request Apr 17, 2021
KolbyML added a commit to c-sports/cspn that referenced this pull request Apr 19, 2021
kwvg added a commit to kwvg/dash that referenced this pull request May 25, 2021
kwvg added a commit to kwvg/dash that referenced this pull request May 25, 2021
kwvg added a commit to kwvg/dash that referenced this pull request May 25, 2021
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request May 28, 2021
UdjinM6 added a commit to UdjinM6/dash that referenced this pull request May 28, 2021
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Aug 1, 2021
…s_program/witness_script/)

8a2b58d test: fix segwit terminology (s/witness_program/witness_script/) (Sebastian Falbesoner)

Pull request description:

  This PR fixes wrong uses of the term "witness program", which according to [BIP141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#Witness_program)  is defined as follows:
  > A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of a 1-byte push opcode (for 0 to 16) followed by a data push between 2 and 40 bytes gets a new special meaning. The value of the first push is called the "version byte". **The following byte vector pushed is called the "witness program".**

  In most cases where "witness program" is used in tests (concerns comments, variable names and in one instance even a function name) what we really want to denote is the "witness script". Thanks to [MarcoFalke for pointing this out in a review comment](bitcoin#22363 (comment))!

  Some historical background: At the time when the P2P segwit tests were first introduced (commit 330b0f3, PR bitcoin#8149), the term "witness program" was not used consistently in BIP141: https://bitcoin.stackexchange.com/questions/46451/what-is-the-precise-definition-of-witness-program
  This was fixed in PR bitcoin/bips#416 later.

  So in some way, this PR can be seen as a very late follow-up to the BIP141 fix that also reflects these changes in the tests.

ACKs for top commit:
  josibake:
    tACK bitcoin@8a2b58d

Tree-SHA512: f36bb9e53d1b54b86bfa87ec12f33e3ebca64b5f59d97e9662fe35ba12c25e1c9a4f93a5425d0eaa3879dce9e50368d345555b927bfab76945511f873396892b
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 1, 2021
…s_program/witness_script/)

8a2b58d test: fix segwit terminology (s/witness_program/witness_script/) (Sebastian Falbesoner)

Pull request description:

  This PR fixes wrong uses of the term "witness program", which according to [BIP141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#Witness_program)  is defined as follows:
  > A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of a 1-byte push opcode (for 0 to 16) followed by a data push between 2 and 40 bytes gets a new special meaning. The value of the first push is called the "version byte". **The following byte vector pushed is called the "witness program".**

  In most cases where "witness program" is used in tests (concerns comments, variable names and in one instance even a function name) what we really want to denote is the "witness script". Thanks to [MarcoFalke for pointing this out in a review comment](bitcoin#22363 (comment))!

  Some historical background: At the time when the P2P segwit tests were first introduced (commit 330b0f3, PR bitcoin#8149), the term "witness program" was not used consistently in BIP141: https://bitcoin.stackexchange.com/questions/46451/what-is-the-precise-definition-of-witness-program
  This was fixed in PR bitcoin/bips#416 later.

  So in some way, this PR can be seen as a very late follow-up to the BIP141 fix that also reflects these changes in the tests.

ACKs for top commit:
  josibake:
    tACK bitcoin@8a2b58d

Tree-SHA512: f36bb9e53d1b54b86bfa87ec12f33e3ebca64b5f59d97e9662fe35ba12c25e1c9a4f93a5425d0eaa3879dce9e50368d345555b927bfab76945511f873396892b
zkbot added a commit to zcash/zcash that referenced this pull request Aug 17, 2021
ZIP 239 preparations 3

Cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#8080
- bitcoin/bitcoin#8082
- bitcoin/bitcoin#8126
- bitcoin/bitcoin#7910
  - This is the unsquashed version of bitcoin/bitcoin#8149
  - We take three cleanup commits to the protocol / `CInv` code.
- bitcoin/bitcoin#8822
- bitcoin/bitcoin#8880
  - Excluding the first commit (we don't have the comment it fixes yet).
- bitcoin/bitcoin#19322
christiancfifi pushed a commit to christiancfifi/dash that referenced this pull request Aug 24, 2021
… are valid

Does not include commit (fae3617) that makes a change to code introduced here:
	330b0f3 [qa] p2p segwit tests (Merge bitcoin#8149: Segregated witness rebased)
which I don't think is in Dash

aaaa8eb test: consensus: Check that final transactions are valid (MarcoFalke)
fae3617 test: Correctly deserialize without witness (MarcoFalke)

Pull request description:

  There is no check that checks that final transactions are valid, i.e. the consensus rules could be changed (accidentally) with none of the tests failing.

Tree-SHA512: 48f4c24bfcc525ddbc1bfe8c37131953b464823428c1f7a278ba6d98b98827b6b84a8eb2b33396bfb5b8cc4012b7cc1cd771637f405ea20beddae001c22aa290
christiancfifi pushed a commit to christiancfifi/dash that referenced this pull request Aug 24, 2021
… are valid

Does not include commit (fae3617) that makes a change to code introduced here:
	330b0f3 [qa] p2p segwit tests (Merge bitcoin#8149: Segregated witness rebased)
which I don't think is in Dash

aaaa8eb test: consensus: Check that final transactions are valid (MarcoFalke)
fae3617 test: Correctly deserialize without witness (MarcoFalke)

Pull request description:

  There is no check that checks that final transactions are valid, i.e. the consensus rules could be changed (accidentally) with none of the tests failing.

Tree-SHA512: 48f4c24bfcc525ddbc1bfe8c37131953b464823428c1f7a278ba6d98b98827b6b84a8eb2b33396bfb5b8cc4012b7cc1cd771637f405ea20beddae001c22aa290
christiancfifi pushed a commit to christiancfifi/dash that referenced this pull request Aug 25, 2021
… are valid

Does not include commit (fae3617) that makes a change to code introduced here:
	330b0f3 [qa] p2p segwit tests (Merge bitcoin#8149: Segregated witness rebased)
which I don't think is in Dash

aaaa8eb test: consensus: Check that final transactions are valid (MarcoFalke)
fae3617 test: Correctly deserialize without witness (MarcoFalke)

Pull request description:

  There is no check that checks that final transactions are valid, i.e. the consensus rules could be changed (accidentally) with none of the tests failing.

Tree-SHA512: 48f4c24bfcc525ddbc1bfe8c37131953b464823428c1f7a278ba6d98b98827b6b84a8eb2b33396bfb5b8cc4012b7cc1cd771637f405ea20beddae001c22aa290
christiancfifi pushed a commit to christiancfifi/dash that referenced this pull request Aug 26, 2021
… are valid

Does not include commit (fae3617) that makes a change to code introduced here:
	330b0f3 [qa] p2p segwit tests (Merge bitcoin#8149: Segregated witness rebased)
which I don't think is in Dash

aaaa8eb test: consensus: Check that final transactions are valid (MarcoFalke)
fae3617 test: Correctly deserialize without witness (MarcoFalke)

Pull request description:

  There is no check that checks that final transactions are valid, i.e. the consensus rules could be changed (accidentally) with none of the tests failing.

Tree-SHA512: 48f4c24bfcc525ddbc1bfe8c37131953b464823428c1f7a278ba6d98b98827b6b84a8eb2b33396bfb5b8cc4012b7cc1cd771637f405ea20beddae001c22aa290
christiancfifi pushed a commit to christiancfifi/dash that referenced this pull request Aug 28, 2021
… are valid

Does not include commit (fae3617) that makes a change to code introduced here:
	330b0f3 [qa] p2p segwit tests (Merge bitcoin#8149: Segregated witness rebased)
which I don't think is in Dash

aaaa8eb test: consensus: Check that final transactions are valid (MarcoFalke)
fae3617 test: Correctly deserialize without witness (MarcoFalke)

Pull request description:

  There is no check that checks that final transactions are valid, i.e. the consensus rules could be changed (accidentally) with none of the tests failing.

Tree-SHA512: 48f4c24bfcc525ddbc1bfe8c37131953b464823428c1f7a278ba6d98b98827b6b84a8eb2b33396bfb5b8cc4012b7cc1cd771637f405ea20beddae001c22aa290
christiancfifi pushed a commit to christiancfifi/dash that referenced this pull request Aug 29, 2021
… are valid

Does not include commit (fae3617) that makes a change to code introduced here:
	330b0f3 [qa] p2p segwit tests (Merge bitcoin#8149: Segregated witness rebased)
which I don't think is in Dash

aaaa8eb test: consensus: Check that final transactions are valid (MarcoFalke)
fae3617 test: Correctly deserialize without witness (MarcoFalke)

Pull request description:

  There is no check that checks that final transactions are valid, i.e. the consensus rules could be changed (accidentally) with none of the tests failing.

Tree-SHA512: 48f4c24bfcc525ddbc1bfe8c37131953b464823428c1f7a278ba6d98b98827b6b84a8eb2b33396bfb5b8cc4012b7cc1cd771637f405ea20beddae001c22aa290
christiancfifi pushed a commit to christiancfifi/dash that referenced this pull request Aug 29, 2021
… are valid

Does not include commit (fae3617) that makes a change to code introduced here:
	330b0f3 [qa] p2p segwit tests (Merge bitcoin#8149: Segregated witness rebased)
which I don't think is in Dash

aaaa8eb test: consensus: Check that final transactions are valid (MarcoFalke)
fae3617 test: Correctly deserialize without witness (MarcoFalke)

Pull request description:

  There is no check that checks that final transactions are valid, i.e. the consensus rules could be changed (accidentally) with none of the tests failing.

Tree-SHA512: 48f4c24bfcc525ddbc1bfe8c37131953b464823428c1f7a278ba6d98b98827b6b84a8eb2b33396bfb5b8cc4012b7cc1cd771637f405ea20beddae001c22aa290
@bitcoin bitcoin locked and limited conversation to collaborators Feb 20, 2022
@bitcoin bitcoin deleted a comment from Bladez1753 Feb 20, 2022
@bitcoin bitcoin deleted a comment from Bladez1753 Feb 20, 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.