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

Track net value entering and exiting the Sprout circuit #2795

Merged
merged 4 commits into from Dec 16, 2017

Conversation

Projects
None yet
6 participants
@str4d
Contributor

str4d commented Dec 13, 2017

Delta values will be stored for new blocks; old blocks can be filled in by
re-indexing. The net value currently in the Sprout circuit is only calculated
when delta values for all previous blocks are present.

Part of #2351.

@str4d str4d added this to the 1.0.14 milestone Dec 13, 2017

@str4d str4d requested review from bitcartel and daira Dec 13, 2017

@str4d

This comment has been minimized.

Show comment
Hide comment
@str4d

str4d Dec 13, 2017

Contributor

Currently this just tracks the values internally, but doesn't expose them anywhere or enforce their ranges. If we want to expose this in an RPC method, we should figure out which one (maybe getblock? getblockchaininfo for current height? only put the fields in when there are usable values?)

Contributor

str4d commented Dec 13, 2017

Currently this just tracks the values internally, but doesn't expose them anywhere or enforce their ranges. If we want to expose this in an RPC method, we should figure out which one (maybe getblock? getblockchaininfo for current height? only put the fields in when there are usable values?)

@bitcartel

This comment has been minimized.

Show comment
Hide comment
@bitcartel

bitcartel Dec 14, 2017

Contributor

Yes the value should be returned via RPC so that we can write a QA test.

Contributor

bitcartel commented Dec 14, 2017

Yes the value should be returned via RPC so that we can write a QA test.

Show outdated Hide outdated src/chain.h Outdated
@@ -144,6 +146,15 @@ class CBlockIndex
//! (memory only) The anchor for the tree state up to the end of this block
uint256 hashAnchorEnd;
//! Change in value held by the Sprout circuit over this block.
//! Will be boost::none for older blocks on old nodes until a reindex has taken place.

This comment has been minimized.

@arielgabizon

arielgabizon Dec 14, 2017

Contributor

So we're changing the blocks retroactively and adding this value to all of them?

@arielgabizon

arielgabizon Dec 14, 2017

Contributor

So we're changing the blocks retroactively and adding this value to all of them?

This comment has been minimized.

@str4d

str4d Dec 14, 2017

Contributor

We are changing the block indices retroactively, not the blocks themselves. For older indices, if/when they are rewritten this value will be boost::none until a full reindex is done.

@str4d

str4d Dec 14, 2017

Contributor

We are changing the block indices retroactively, not the blocks themselves. For older indices, if/when they are rewritten this value will be boost::none until a full reindex is done.

Show outdated Hide outdated src/rpcblockchain.cpp Outdated

str4d added some commits Nov 9, 2017

Track net value entering and exiting the Sprout circuit
Delta values will be stored for new blocks; old blocks can be filled in by
re-indexing. The net value currently in the Sprout circuit is only calculated
when delta values for all previous blocks are present.
@str4d

This comment has been minimized.

Show comment
Hide comment
@str4d

str4d Dec 14, 2017

Contributor

@arielgabizon comments addressed.

Contributor

str4d commented Dec 14, 2017

@arielgabizon comments addressed.

Show outdated Hide outdated src/chain.h Outdated

@str4d str4d requested a review from ebfull Dec 15, 2017

@ebfull

ebfull approved these changes Dec 15, 2017

@str4d

This comment has been minimized.

Show comment
Hide comment
@str4d

str4d Dec 16, 2017

Contributor

Added a commit to clarify the operator precedence. Still trying to figure out if I can solve the TODO (reduce the size of the index); if I can't figure it out tomorrow I will merge this PR as-is.

Contributor

str4d commented Dec 16, 2017

Added a commit to clarify the operator precedence. Still trying to figure out if I can solve the TODO (reduce the size of the index); if I can't figure it out tomorrow I will merge this PR as-is.

Remove nSproutValue TODO from CDiskBlockIndex
Block indices are flushed to disk when they are marked as dirty, and this
happens via enough distinct pathways that it would be sufficiently complex to
update nSproutValue via all of them. Thus it is necessary to be able to
serialize "no value" for writes by upgraded clients.
@str4d

This comment has been minimized.

Show comment
Hide comment
@str4d

str4d Dec 16, 2017

Contributor

Decided it would significantly complicate the code if we tried to ensure nSproutValue was non-zero every time we write a block index to disk, so I've removed the TODO comment and decided we will wear the 1-byte extra per block index on disk. We won't need to wear that for Sapling, as we can introduce the index value from the beginning (and the default value for older blocks can reliably be zero).

@zkbot r+

Contributor

str4d commented Dec 16, 2017

Decided it would significantly complicate the code if we tried to ensure nSproutValue was non-zero every time we write a block index to disk, so I've removed the TODO comment and decided we will wear the 1-byte extra per block index on disk. We won't need to wear that for Sapling, as we can introduce the index value from the beginning (and the default value for older blocks can reliably be zero).

@zkbot r+

@zkbot

This comment has been minimized.

Show comment
Hide comment
@zkbot

zkbot Dec 16, 2017

Contributor

📌 Commit e365ca1 has been approved by str4d

Contributor

zkbot commented Dec 16, 2017

📌 Commit e365ca1 has been approved by str4d

@zkbot

This comment has been minimized.

Show comment
Hide comment
@zkbot

zkbot Dec 16, 2017

Contributor

⌛️ Testing commit e365ca1 with merge 7888624...

Contributor

zkbot commented Dec 16, 2017

⌛️ Testing commit e365ca1 with merge 7888624...

zkbot added a commit that referenced this pull request Dec 16, 2017

Auto merge of #2795 - str4d:2351-sprout-circuit-value, r=str4d
Track net value entering and exiting the Sprout circuit

Delta values will be stored for new blocks; old blocks can be filled in by
re-indexing. The net value currently in the Sprout circuit is only calculated
when delta values for all previous blocks are present.

Part of #2351.
@zkbot

This comment has been minimized.

Show comment
Hide comment
@zkbot

zkbot Dec 16, 2017

Contributor

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

Contributor

zkbot commented Dec 16, 2017

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

@zkbot zkbot merged commit e365ca1 into zcash:master Dec 16, 2017

1 check passed

homu Test successful
Details
@daira

post-hoc utACK

if pool['id'] == name:
found = True
assert_equal(pool['monitored'], True)
assert_equal(pool['chainValue'], total)

This comment has been minimized.

@daira

daira Dec 16, 2017

Contributor

Also check chainValueZat.

@daira

daira Dec 16, 2017

Contributor

Also check chainValueZat.

@str4d str4d deleted the str4d:2351-sprout-circuit-value branch Dec 18, 2017

zkbot added a commit that referenced this pull request Jan 17, 2018

Auto merge of #2848 - str4d:2795-rpc-test-chainValueZat, r=<try>
Check chainValueZat when checking value pool monitoring

Addresses #2795 (comment)

zkbot added a commit that referenced this pull request Jan 17, 2018

Auto merge of #2848 - str4d:2795-rpc-test-chainValueZat, r=str4d
Check chainValueZat when checking value pool monitoring

Addresses #2795 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment