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
Enable ZIP 216 for blocks prior to NU5 activation #6000
Conversation
@@ -135,7 +135,8 @@ class CMainParams : public CChainParams { | |||
uint256S("00000000002038016f976744c369dce7419fca30e7171dfac703af5e5f7ad1d4"); | |||
consensus.vUpgrades[Consensus::UPGRADE_NU5].nProtocolVersion = 170100; | |||
consensus.vUpgrades[Consensus::UPGRADE_NU5].nActivationHeight = 1687104; | |||
|
|||
consensus.vUpgrades[Consensus::UPGRADE_NU5].hashActivationBlock = | |||
uint256S("0000000000d723156d9b65ffcf4984da7a19675ed7e2f06d9e5d5188af087bf8"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked this hash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also checked this hash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't check this hash.
@@ -239,7 +240,7 @@ class CMainParams : public CChainParams { | |||
} | |||
|
|||
// The best chain should have at least this much work. | |||
consensus.nMinimumChainWork = uint256S("00000000000000000000000000000000000000000000000004a90edff47bbdc6"); | |||
consensus.nMinimumChainWork = uint256S("000000000000000000000000000000000000000000000000098e5c63248dcb28"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not check this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirmed that this minimum chain work is greater than the chain work at the NU5 activation block, as required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't check this either.
}; | ||
|
||
self.0 | ||
.final_check(value_balance, sighash_value, binding_sig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These APIs (final_check
and SaplingVerificationContext::final_check
) also have arguments in an inconsistent order, but here there's no argument that we're preserving the field order in the v4 transaction encoding, because sighash_value
is not a field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK with comments.
2a6c77a
to
8b0f27e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
6767c5c
to
41ddf87
Compare
41ddf87
to
079e87c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
…ules to use the new API.
The chain work is taken from mainnet block 1710000.
b3f33b3
to
af2b3d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK af2b3d3
// This is added because `check_spend` takes several arguments over FFI. This | ||
// annotation gets removed by the cxx procedural macro so it needs to be enabled | ||
// on the entire module. | ||
#![allow(clippy::too_many_arguments)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed dtolnay/cxx#1061
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was fixed in dtolnay/cxx#1062, merged in cxx 1.0.70.
self.0.check_output( | ||
cv, | ||
cm, | ||
ephemeral_key, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RedDSA.Validate takes an abstract public key and reserializes it for input to
As @str4d says, ephemeral_key
should be renamed to epk
here.
ephemeral_key, | |
epk, |
std::array<uint8_t, WIDTH> GetRawBytes() const | ||
{ | ||
std::array<uint8_t, WIDTH> buf = {}; | ||
memcpy(buf.data(), this->begin(), WIDTH); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
memcpy(buf.data(), this->begin(), WIDTH); | |
std::memcpy(buf.data(), this->begin(), WIDTH); |
It probably works without the std::
(and without using std::memcpy
or using namespace std;
) by coincidence of the included headers implicitly declaring memcpy
in the global namespace. Strictly speaking that's not portable (similarly for the uses of memset
in this file).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, definitely not portable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK with suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
This completes the work started in zcash#6000. Closes zcash#6396.
As a side-effect, we remove the ability to verify individual transactions with pre-ZIP 216 rules (which we already removed from `zcashd` consensus nodes in zcash/zcash#6000 and zcash/zcash#6399, as all pre-ZIP 216 transactions on mainnet are also valid under ZIP 216).
As a side-effect, we remove the ability to verify individual transactions with pre-ZIP 216 rules (which we already removed from `zcashd` consensus nodes in zcash/zcash#6000 and zcash/zcash#6399, as all pre-ZIP 216 transactions on mainnet are also valid under ZIP 216).
I also take the opportunity in this PR to remove the legacy Sapling verification FFI stuff and replace it with the new
cxx
approach.I've tested that ZIP 216 can be applied to blocks prior to activation on both mainnet and testnet.