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 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
5 of 7 tasks complete
{
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);

This comment has been minimized.

@sipa

sipa Jun 7, 2016 Author Member

Please comment in #7910.

@sipa sipa force-pushed the sipa:segwit-master2 branch from 17389dc Jun 12, 2016
@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 sipa:segwit-master2 branch to 29d9650 Jun 13, 2016
@sipa
Copy link
Member Author

sipa commented Jun 13, 2016

Updated again.

@MarcoFalke MarcoFalke added this to the 0.13.0 milestone Jun 15, 2016
@sipa sipa force-pushed the sipa:segwit-master2 branch 5 times, most recently Jun 16, 2016
@sdaftuar
Copy link
Member

sdaftuar commented Jun 17, 2016

ACK 74300b9a5ed24e9f7d80ecc39d4e19690732ccbe

@jonasschnelli
Copy link
Member

jonasschnelli commented Jun 17, 2016

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 Mar 31, 2016
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.
zkbot added a commit to zcash/zcash that referenced this pull request Feb 7, 2018
Network upgrade activation mechanism

Implements ZIP 200.

Integration with `CChainParams` inspired by bitcoin/bitcoin#7575.

Includes block index rewinding logic cherry-picked from bitcoin/bitcoin#8149.

Closes #2286. Part of #2905.
zkbot added a commit to zcash/zcash that referenced this pull request Feb 8, 2018
Overwinter SignatureHash

Implements zcash/zips#129.

Includes code cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#7276
- bitcoin/bitcoin#7976
- bitcoin/bitcoin#8118
- bitcoin/bitcoin#8149
  - Only amount validation and SignatureHash commits.
- bitcoin/bitcoin#6915
  - Only the rework of `mempool.check()` calls that the next PR depends on.
- bitcoin/bitcoin#8346
- bitcoin/bitcoin#8524

Part of  #2254. Closes #1408 and #2584.
zkbot added a commit to zcash/zcash that referenced this pull request Feb 8, 2018
Overwinter SignatureHash

Implements zcash/zips#129.

Includes code cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#7276
- bitcoin/bitcoin#7976
- bitcoin/bitcoin#8118
- bitcoin/bitcoin#8149
  - Only amount validation and SignatureHash commits.
- bitcoin/bitcoin#6915
  - Only the rework of `mempool.check()` calls that the next PR depends on.
- bitcoin/bitcoin#8346
- bitcoin/bitcoin#8524

Part of  #2254. Closes #1408 and #2584.
zkbot added a commit to zcash/zcash that referenced this pull request Feb 19, 2018
Overwinter SignatureHash

Implements zcash/zips#129.

Includes code cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#7276
- bitcoin/bitcoin#7976
- bitcoin/bitcoin#8118
- bitcoin/bitcoin#8149
  - Only amount validation and SignatureHash commits.
- bitcoin/bitcoin#6915
  - Only the rework of `mempool.check()` calls that the next PR depends on.
- bitcoin/bitcoin#8346
- bitcoin/bitcoin#8524

Part of #2074 and #2254. Closes #1408 and #2584.
zkbot added a commit to zcash/zcash that referenced this pull request Feb 20, 2018
Overwinter SignatureHash

Implements ZIP 143.

Includes code cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#7276
- bitcoin/bitcoin#7976
- bitcoin/bitcoin#8118
- bitcoin/bitcoin#8149
  - Only amount validation and SignatureHash commits.
- bitcoin/bitcoin#8346
- bitcoin/bitcoin#8524

Part of #2074 and #2254. Closes #1408 and #2584.
zkbot added a commit to zcash/zcash that referenced this pull request Feb 20, 2018
Overwinter SignatureHash

Implements ZIP 143.

Includes code cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#7276
- bitcoin/bitcoin#7976
- bitcoin/bitcoin#8118
- bitcoin/bitcoin#8149
  - Only amount validation and SignatureHash commits.
- bitcoin/bitcoin#8346
- bitcoin/bitcoin#8524

Part of #2074 and #2254. Closes #1408 and #2584.
MarcoFalke added a commit that referenced this pull request Apr 25, 2019
bb530ef Disallow extended encoding for non-witness transactions (Pieter Wuille)

Pull request description:

  BIP144 specifies that transactions without witness should use the legacy encoding, which is currently not enforced.

  This rule was present in the original SegWit implementation (#8149), but was subsequently dropped (#8589).

  As all hashes, txids, and weights are always computed over a reserialized version of a transaction, it is mostly harmless to permit extended encoding for non-segwit transactions, but I'd rather strictly follow the BIP.

ACKs for commit bb530e:
  instagibbs:
    utACK bb530ef
  stevenroose:
    utACK bb530ef

Tree-SHA512: 1aeccd6a555f43784fefb076ce2e8ad2f5ba7be49840544a50050d0390f82373f87201bf56cf8bb30841b4f9cd893b382261a080da875d4e11ab7051f8640dbe
sidhujag added a commit to syscoin/syscoin that referenced this pull request Apr 27, 2019
…actions

bb530ef Disallow extended encoding for non-witness transactions (Pieter Wuille)

Pull request description:

  BIP144 specifies that transactions without witness should use the legacy encoding, which is currently not enforced.

  This rule was present in the original SegWit implementation (bitcoin#8149), but was subsequently dropped (bitcoin#8589).

  As all hashes, txids, and weights are always computed over a reserialized version of a transaction, it is mostly harmless to permit extended encoding for non-segwit transactions, but I'd rather strictly follow the BIP.

ACKs for commit bb530e:
  instagibbs:
    utACK bitcoin@bb530ef
  stevenroose:
    utACK bb530ef

Tree-SHA512: 1aeccd6a555f43784fefb076ce2e8ad2f5ba7be49840544a50050d0390f82373f87201bf56cf8bb30841b4f9cd893b382261a080da875d4e11ab7051f8640dbe
@MarkLTZ MarkLTZ mentioned this pull request Apr 30, 2019
53 of 77 tasks complete
str4d added a commit to str4d/zcash that referenced this pull request Nov 14, 2019
Zcash: Excludes comments for variables and functions we don't have:

- fAcceptDatacarrier (bitcoin/bitcoin#6961)
- GetScriptForRawPubKey (bitcoin/bitcoin#6415)
- GetScriptForWitness (bitcoin/bitcoin#8149)
str4d added a commit to str4d/zcash that referenced this pull request Dec 3, 2019
Zcash: Excludes comments for variables and functions we don't have:

- fAcceptDatacarrier (bitcoin/bitcoin#6961)
- GetScriptForRawPubKey (bitcoin/bitcoin#6415)
- GetScriptForWitness (bitcoin/bitcoin#8149)
str4d added a commit to str4d/zcash that referenced this pull request Dec 4, 2019
Zcash: Excludes comments for variables and functions we don't have:

- GetScriptForRawPubKey (bitcoin/bitcoin#6415)
- GetScriptForWitness (bitcoin/bitcoin#8149)
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked issues

Successfully merging this pull request may close these issues.

None yet

You can’t perform that action at this time.