Skip to content

Conversation

@str4d
Copy link
Contributor

@str4d str4d commented May 14, 2018

@str4d str4d added I-performance Problems and improvements with respect to performance C-upstream-port Category: Changes that are ported from the Bitcoin Core codebase. labels May 14, 2018
@str4d
Copy link
Contributor Author

str4d commented May 14, 2018

@zkbot try

@zkbot
Copy link
Contributor

zkbot commented May 14, 2018

⌛ Trying commit 2d921e12098fa33542cda090e8d485d0441ddf1a with merge 9217c8e09347bf3d17fb8443c5fd07dc45a20d1e...

@zkbot
Copy link
Contributor

zkbot commented May 14, 2018

💔 Test failed - pr-try

@str4d
Copy link
Contributor Author

str4d commented May 14, 2018

Missed an indirect merge conflict.

@zkbot try

@zkbot
Copy link
Contributor

zkbot commented May 14, 2018

⌛ Trying commit 127c67e with merge 8ce4bc1...

zkbot added a commit that referenced this pull request May 14, 2018
Bitcoin 0.12 performance improvements

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6918
- bitcoin/bitcoin#6932

Part of #2074.
@zkbot
Copy link
Contributor

zkbot commented May 14, 2018

💔 Test failed - pr-try

@str4d
Copy link
Contributor Author

str4d commented May 14, 2018

Above failure was a transient failure in one of the RPC tests; all other builders passed.

daira
daira previously requested changes May 16, 2018
Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

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

Zcash has no duplicate coinbase transactions; simplify the code and test accordingly.

src/coins.h Outdated
* Return a modifiable reference to a CCoins. Assumes that no entry with the given
* txid exists and creates a new one. This saves a database access in the case where
* the coins were to be wiped out by FromTx anyway. This should not be called with
* the 2 historical coinbase duplicate pairs because the new coins are marked fresh, and
Copy link
Contributor

@daira daira May 16, 2018

Choose a reason for hiding this comment

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

There are no "2 historical coinbase duplicate pairs" in Zcash-derived chains, since we have enforced both BIP 30 and BIP 34 ("height in coinbase") since launch. This was accidentally omitted for the genesis block, but that omission can have no effect on the BIP 30/34 goal of avoiding duplicate transactions. Delete this sentence from the comment, and replace it with:

We rely on Zcash-derived block chains having no duplicate transactions, since BIP 30 and (except for the genesis block) BIP 34 have been enforced since launch. See the Zcash protocol specification, section "Bitcoin Improvement Proposals".

src/main.cpp Outdated
// lookup to be sure the coins do not already exist otherwise we do not
// know whether to mark them fresh or not. We want the duplicate coinbases
// before BIP30 to still be properly overwritten.
inputs.ModifyCoins(tx.GetHash())->FromTx(tx, nHeight);
Copy link
Contributor

Choose a reason for hiding this comment

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

This complication is unnecessary for Zcash-derived chains as explained above. Just call inputs.ModifyNewCoins unconditionally (instead of inputs.ModifyCoins) outside the if (!tx.IsCoinBase()) block.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also delete the last sentence of the commit message.

// except the emphasis is on testing the functionality of UpdateCoins
// random txs are created and UpdateCoins is used to update the cache stack
// In particular it is tested that spending a duplicate coinbase tx
// has the expected effect (the other duplicate is overwitten at all cache levels)
Copy link
Contributor

Choose a reason for hiding this comment

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

Simplify the test by removing the testing of duplicate coinbase transactions:

  • delete the last sentence of the above comment
  • delete the spent_a_duplicate_coinbase and duplicateids declarations
  • delete " unless intended to duplicate" in the comment on line 910
  • delete the "1/100 times create a duplicate coinbase" if body
  • delete the comment that mentions BIP 34 (but not the code it refers to! just the comment is inapplicable)
  • delete the comment starting "The test is designed" and the two code lines after it.

@str4d
Copy link
Contributor Author

str4d commented May 31, 2018

Addressed @daira's comments.

@str4d
Copy link
Contributor Author

str4d commented May 31, 2018

@zkbot try

@zkbot
Copy link
Contributor

zkbot commented May 31, 2018

⌛ Trying commit 008213a with merge 03532b1...

zkbot added a commit that referenced this pull request May 31, 2018
Bitcoin 0.12 performance improvements

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6918
- bitcoin/bitcoin#6932

Part of #2074.
@zkbot
Copy link
Contributor

zkbot commented May 31, 2018

☀️ Test successful - pr-try
State: approved= try=True

@str4d
Copy link
Contributor Author

str4d commented Jul 30, 2018

Rebased on master to fix merge conflict.

@str4d str4d dismissed daira’s stale review October 24, 2018 11:10

Comments addressed

sipa and others added 5 commits October 24, 2018 19:28
When processing a new transaction, in addition to spending the Coins of its txin's it creates a new Coins for its outputs.  The existing ModifyCoins function will first make sure this Coins does not already exist.  It can not exist due to BIP 30, but because of that the lookup can't be cached and always has to go to the database.  Since we are creating the coins to match the new tx anyway, there is no point in checking if they exist first anyway.

Zcash: Modified to account for the fact that BIP 30 and BIP 34 have applied
from the beginning.
Zcash: Modified to also address Zcash changes.

Co-authored-by: Jack Grigg <[email protected]>
morcos and others added 2 commits October 24, 2018 20:10
Inapplicable to Zcash because BIP 30 and BIP 34 have been applied from the
beginning.
@str4d
Copy link
Contributor Author

str4d commented Oct 24, 2018

Rebased on master and address @Eirik0's comments.

@str4d str4d requested review from Eirik0 and daira October 24, 2018 12:13
Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

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

ut(ACK+cov) 40e4981

Copy link
Contributor

@Eirik0 Eirik0 left a comment

Choose a reason for hiding this comment

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

utACK

@str4d str4d added this to the v2.0.3 milestone Nov 30, 2018
@str4d
Copy link
Contributor Author

str4d commented Nov 30, 2018

@zkbot r+

@zkbot
Copy link
Contributor

zkbot commented Nov 30, 2018

📌 Commit 40e4981 has been approved by str4d

@zkbot
Copy link
Contributor

zkbot commented Nov 30, 2018

⌛ Testing commit 40e4981 with merge 9cd7486...

zkbot added a commit that referenced this pull request Nov 30, 2018
Bitcoin 0.12 performance improvements

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6918
- bitcoin/bitcoin#6932

Part of #2074.
@str4d str4d mentioned this pull request Nov 30, 2018
@zkbot
Copy link
Contributor

zkbot commented Dec 1, 2018

☀️ Test successful - pr-merge
Approved by: str4d
Pushing 9cd7486 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-upstream-port Category: Changes that are ported from the Bitcoin Core codebase. I-performance Problems and improvements with respect to performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants