Commit Graph

2452 Commits

Author SHA1 Message Date
teor 2ace597da1
Clean up use statements in `arbitrary` modules (#1984)
* Clean up use statements in `arbitrary` modules

Co-authored-by: Deirdre Connolly <durumcrustulum@gmail.com>
2021-04-07 18:08:02 +10:00
teor db87a8410e Update tower-batch tests to rand 0.8
And move the ed25519-zebra patch to the workspace Cargo.toml.

This fix helps avoid Cargo.lock instability.
2021-04-07 01:46:22 -04:00
teor 7cb7b6143c Rename the NU5 block commitment variant based on what it commits to
This change helps avoid confusion with block commitment variants in
future network upgrades, which may add more hashes to the commitment
list.
2021-04-07 01:33:18 -04:00
teor 64662a758d
Move the preallocate tests into their own files (#1977)
* Move the preallocate tests into their own files

And move the MetaAddr proptest into its own file.

Also do some minor formatting and cleanups.

Co-authored-by: Deirdre Connolly <durumcrustulum@gmail.com>
2021-04-07 12:32:27 +10:00
teor 05b60db993
Clean up block commitment enum and parsing (#1978)
* Rename RootHash to Commitment based on ZIP-244

Interactive replace using:
```sh
fastmod RootHash Commitment
fastmod root_hash commitment
fastmod root_bytes commitment_bytes
git mv zebra-chain/src/block/root_hash.rs zebra-chain/src/block/commitment.rs
```

All replacements were accepted.

* rustfmt

* Comment and format cleanups after interactive replace

* Distinguish Sapling tree roots from other tree roots

* Add the NU5 BlockCommitmentsHash variant to block::Commitment

This change parses the hash, but does not perform validation.

* Validate reserved values in Block::commitment

- change Block::commitment to return a Result rather than an Option
- enforce the all-zeroes reserved value consensus rules
- change `PreSaplingReserved([u8; 32])` to `PreSaplingReserved`
- change `ChainHistoryActivationReserved([u8; 32])` to `ChainHistoryActivationReserved`
- update the function comments to describe when each variant is verified

* Fix comment whitespace
2021-04-06 20:19:28 +10:00
Preston Evans 0daaf582e2
Implement Trusted Vector Preallocation (#1920)
* Implement SafePreallocate. Resolves #1880

* Add proptests for SafePreallocate

* Apply suggestions from code review

Comments which did not include replacement code will be addressed in a follow-up commit.

Co-authored-by: teor <teor@riseup.net>

* Rename [Safe-> Trusted]Allocate. Add doc and tests

Add tests to show that the largest allowed vec under TrustedPreallocate
is small enough to fit in a Zcash block/message (depending on type).
Add doc comments to all TrustedPreallocate test cases.
Tighten bounds on max_trusted_alloc for some types.

Note - this commit does NOT include TrustedPreallocate
impls for JoinSplitData, String, and Script.
These impls will be added in a follow up commit

* Implement SafePreallocate. Resolves #1880

* Add proptests for SafePreallocate

* Apply suggestions from code review

Comments which did not include replacement code will be addressed in a follow-up commit.

Co-authored-by: teor <teor@riseup.net>

* Rename [Safe-> Trusted]Allocate. Add doc and tests

Add tests to show that the largest allowed vec under TrustedPreallocate
is small enough to fit in a Zcash block/message (depending on type).
Add doc comments to all TrustedPreallocate test cases.
Tighten bounds on max_trusted_alloc for some types.

Note - this commit does NOT include TrustedPreallocate
impls for JoinSplitData, String, and Script.
These impls will be added in a follow up commit

* Impl TrustedPreallocate for Joinsplit

* Impl ZcashDeserialize for Vec<u8>

* Arbitrary, TrustedPreallocate, Serialize, and tests for Spend<SharedAnchor>

Co-authored-by: teor <teor@riseup.net>
2021-04-06 09:49:42 +10:00
Deirdre Connolly 6bb5220b13
Bump redjubjub to 0.4.0 (#1975) 2021-04-03 11:09:14 -04:00
teor 83b88f5b7a
Merge pull request #1972 from ZcashFoundation/peer-set-demand-deadlock-doc
Document peer set deadlock resistance
2021-04-01 22:50:17 -04:00
teor 109ca4db86 Zebra Client RFC: add mandatory sweep fast startup option
A mandatory sweep would help `zebra-client` match `zebrad`'s
blazingly fast speeds.
2021-04-01 07:41:10 -04:00
Alfredo Garcia 48a8a7b851
Refactor Sapling data and use it in V4 (#1946)
* start refactoring transaction v4 for transaction v5
- move ShieldedData to sapling
- add AnchorVariant
- rename shielded_data to sapling_shielded data in V4
- move value_balance into ShieldedData
- update prop tests for new structure

* add AnchorVariant to Spend
- make anchor types available from sapling crate
- update serialize

* change shielded_balances_match() arguments
* change variable name anchor to shared_anchor in ShieldedData
* fix empty value balance serialization
* use AnchorV in shielded spends
* Rename anchor to per_spend_anchor

* Use nullifiers function directly in non-finalized state
* Use self.value_balance instead of passing it as an argument

* Add missing fields to ShieldedData PartialEq
* Derive Copy for tag types

* Add doc comments for ShieldedData refactor
* Implement a per-spend anchor compatibility iterator

Co-authored-by: teor <teor@riseup.net>
2021-04-01 07:34:25 +10:00
teor 29163cd0b4
Rename RootHash to Commitment based on ZIP-244 (#1957)
* Rename RootHash to Commitment based on ZIP-244

Interactive replace using:
```sh
fastmod RootHash Commitment
fastmod root_hash commitment
fastmod root_bytes commitment_bytes
git mv zebra-chain/src/block/root_hash.rs zebra-chain/src/block/commitment.rs
```

All replacements were accepted.

* rustfmt
2021-03-31 09:51:42 +10:00
Deirdre Connolly 0ffab6d589
Ed25519 async batch verification for JoinSplit signatures (#1952)
* Ed25519 async batch verification for JoinSplit signatures

We've been verifying JoinSplitSigs one-by-one pre-ZIP-215. Now as we're post-ZIP-215,
we can take advantage of the batch math to validate this signatures.

I would have pumped all the joinsplits in our MAINNET_BLOCKS test vectors but these
signatures are over the sighash, which needs the NU code to compute, and once we're
doing all that set up, we're basically doing transaction validation, so.

Resolves #1944

* Repoint to latest ed25519-zebra commit with note to point at 3.0 when released

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
Co-authored-by: teor <teor@riseup.net>
2021-03-31 09:08:19 +10:00
teor 8caf016ead Update RFC PR template for drafts 2021-03-30 18:22:03 -04:00
teor c4c0b6705a Use small xxxxs 2021-03-30 18:22:03 -04:00
teor b5bc8576a8 Update the RFC process to include drafts
We put RFCs in drafts, and only assign them a number when they merge.
2021-03-30 18:22:03 -04:00
teor f6c56a0018 Avoid pinging old staff for RFCs 2021-03-30 10:39:08 -04:00
Alfredo Garcia 1302ffe0a1
Draft RFC: Block subsidy (#1129)
* create block subsidy rfc
* add reference in miner subsidy

* remove `or 0` from function descriptions.

It is clear from the signature that the function will return `Error` on any failure(including input errors, for example a wrong height). Describing this will force us to write it for all functions that returns an error so better remove it.

* add links to subsidy categories
* fix design in Funding streams parameter constants
* fix order in FUNDING_STREAM_RECEIVER_NUMERATORS
* return `PayToScriptHash` in `funding_stream_address`
* add shielded coinbase

* Apply suggestions from code review

Co-authored-by: teor <teor@riseup.net>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>

* improve  transparent value pool section
* add a test plan section
* rename `subsidy_is_correct` to `subsidy_is_valid`
* add funding streams address constants
* fix funding stream addresses
* add errors
* remove ending dot for  error descriptions

Co-authored-by: Jane Lusby <jlusby42@gmail.com>

* modify founders reward
* change ECC to BP
* add note about state needed for transparent pool
* split constants
* Tweak block subsidy RFC wording

Co-authored-by: Jane Lusby <jlusby42@gmail.com>

* Clarify transaction fees definition
* Use consistent fee terminology
* Clarify transparent value pool
* Revise implementation plan based on latest priorities
* Change tests based on new priorities
* Fix markdown

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>

* Fix value pool description
* change block and miner subsidy definitions
* fee pool definitions, fix all links to protocol
* add reference to zip209
* add note for MG stream number of addresses

Co-authored-by: teor <teor@riseup.net>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: Jane Lusby <jlusby42@gmail.com>
2021-03-30 16:25:41 +10:00
Henry de Valence 0e5a6d7efd
RFC: Release process (#1063)
* rfc: initial draft of release process proposal

This is a version of the notes I posted in slack for preliminary
discussion, slightly reformatted to fit the Zebra RFC template.

@yaahc suggested I post them as an RFC, to have a concrete proposal for
discussion.

* Add draft note and link to ticket and PR

Co-authored-by: teor <teor@riseup.net>
2021-03-30 15:55:23 +10:00
teor 258bd881aa
Draft RFC: Initial draft for basic network integration testing (#1007)
* Initial draft for basic integration testing
* Update draft, comment out template
2021-03-30 15:44:57 +10:00
Henry de Valence 73708eebff
RFC: Transaction diffusion with isolated, minimally-distinguishable Tor connections (Stolon) (#1006)
* stolon: Initial RFC draft.
* rfc: add spec of minimally-distinguished handshake
* Add ticket references and a draft note

Co-authored-by: teor <teor@riseup.net>
2021-03-30 15:33:08 +10:00
dependabot[bot] 562c141ee1
build(deps): bump displaydoc from 0.2.0 to 0.2.1 (#1959)
Bumps [displaydoc](https://github.com/yaahc/displaydoc) from 0.2.0 to 0.2.1.
- [Release notes](https://github.com/yaahc/displaydoc/releases)
- [Changelog](https://github.com/yaahc/displaydoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yaahc/displaydoc/compare/v0.2.0...v0.2.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-30 09:27:00 +10:00
teor 0562fa7e23
Clarify anchor names (#1955)
When we're naming the anchors without the corresponding type or struct,
it's not clear if they are shared or per spend.

Rename the fields as `shared_anchor` or `per_spend_anchor`.
2021-03-30 09:22:07 +10:00
dependabot[bot] 4e754089a6 build(deps): bump owo-colors from 1.4.2 to 2.0.0
Bumps [owo-colors](https://github.com/jam1garner/owo-colors) from 1.4.2 to 2.0.0.
- [Release notes](https://github.com/jam1garner/owo-colors/releases)
- [Commits](https://github.com/jam1garner/owo-colors/compare/v1.4.2...v2.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-29 08:01:44 -04:00
teor 306fa88214 Document the correctness of Poll::Pending wakeups 2021-03-27 08:55:49 -04:00
teor 829a6f11c5 Document the behaviour of the `select!` macro 2021-03-27 08:55:49 -04:00
dependabot[bot] 1c87372b03 build(deps): bump owo-colors from 1.3.0 to 1.4.2
Bumps [owo-colors](https://github.com/jam1garner/owo-colors) from 1.3.0 to 1.4.2.
- [Release notes](https://github.com/jam1garner/owo-colors/releases)
- [Commits](https://github.com/jam1garner/owo-colors/commits/v1.4.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-26 14:47:11 -04:00
teor b329892665 Add a comment about a zcashd inv message bug 2021-03-26 11:26:59 -04:00
Deirdre Connolly a5ff0e983b Pin coverage.yml nightly to 2021-03-24 for now 2021-03-26 11:24:16 -04:00
dependabot[bot] a8b3ced7e9 build(deps): bump rand_core from 0.6.1 to 0.6.2
Bumps [rand_core](https://github.com/rust-random/rand) from 0.6.1 to 0.6.2.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/rand_core-0.6.1...rand_core-0.6.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-26 09:33:39 -04:00
teor ee0fc35380
Increase coverage CI timeout (#1947)
Since coverage uses nightly, it can be slightly slower than other CI.
2021-03-26 09:47:14 +10:00
Deirdre Connolly 354396f525 Add some comments and tracing for groth16::Verifier tests 2021-03-25 18:34:47 -04:00
teor 1a159dfcb6 Add more methods for creating MetaAddrs
This refactor lets us remove `MetaAddr::update_last_seen()`.
2021-03-26 07:23:49 +10:00
teor 6fe81d8992 Make MetaAddr.last_seen into a private field 2021-03-26 07:23:49 +10:00
teor eae59de1e8 use PeerAddrState::* 2021-03-26 07:23:49 +10:00
teor e9cdc224a2 Rewrite MetaAddr::sanitize so it's harder to misuse
`sanitize` could be misused in two ways:
* accidentally modifying the addresses in the address book itself
* forgetting to sanitize new fields added to `MetaAddr`

This change prevents accidental modification by taking `&self`, and
explicitly creates a new sanitized `MetaAddr` with all fields listed.
2021-03-26 07:23:49 +10:00
Deirdre Connolly c5bad9fac2
Rename NU5 to Nu5 to appease newly stable clippy::upper-case-acronyms (#1945) 2021-03-26 07:22:50 +10:00
Deirdre Connolly c95716e246 Add link to Ed25519 async batch verification ticket 2021-03-25 16:34:16 -04:00
teor 16c073c4e0 Comment: transparent sighash in script verifier 2021-03-25 16:34:16 -04:00
teor 32b754d517 Add an error grafana dashboard 2021-03-25 16:34:16 -04:00
teor 83bdc1a9f3 Add a metric for binding sig errors
But keep ignoring those errors until we fix binding sigs in #1939
2021-03-25 16:34:16 -04:00
teor 0bad6bc615 Add a TODO for ed25519 batch verification 2021-03-25 16:34:16 -04:00
teor e4f58f018a Re-enable joinsplit and sapling spend auth verification 2021-03-25 16:34:16 -04:00
teor f8dc989e99 Move a quick check earlier in transaction validation 2021-03-25 16:34:16 -04:00
Deirdre Connolly b77f41419e
CODE_OF_CONDUCT.md (#1097)
* Create CODE_OF_CONDUCT.md

Starting with the zcashd CoC and the Rust CoC

* Update CODE_OF_CONDUCT.md

* Update contact email

Co-authored-by: Jane Lusby <jlusby42@gmail.com>

* Remove redundant contact line

Co-authored-by: Jane Lusby <jlusby42@gmail.com>

* cleanup code of conduct

* move the email link to be consistent with rustlangs

* Apply suggestions from code review

Co-authored-by: Deirdre Connolly <deirdre@zfnd.org>

* Update CODE_OF_CONDUCT.md

remove forums from the list of official Zcash Foundation venues as the forums already have their own CoC

Co-authored-by: Jane Lusby <jlusby42@gmail.com>
Co-authored-by: Jane Lusby <jane@zfnd.org>
Co-authored-by: Pili Guerra <mpguerra@users.noreply.github.com>
2021-03-25 10:54:08 +01:00
Alfredo Garcia 32beef233e
V5 transaction rfc (#1886)
* propose a v5 transaction rfc
* define orchard flags
* Update test sections
* Add security section
* move some code into sapling and orchard crates, do renames
* Move sapling value balance into shielded data
* Add AuthorizedAction type
* Order fields based on last serialized data
* Add the proofsOrchard field
* Delete visibility modifiers for readability

All those `pub`s make the design harder to read.

* Model anchor variants as generic trait types
* Be specific about the network upgrade
* Specify a file for each new type
* Document how the Orchard flags are used

Co-authored-by: teor <teor@riseup.net>
2021-03-25 10:30:30 +10:00
Deirdre Connolly 7efc700aca
Merge pull request #1713 from ZcashFoundation/use-groth16-batch-math
Use batch optimizations, load params in groth16::Verifier, verify Spend & Output descriptions in transaction verifier
2021-03-24 12:28:25 -04:00
dependabot[bot] e0643f3664 build(deps): bump serde from 1.0.124 to 1.0.125
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.124 to 1.0.125.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.124...v1.0.125)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-23 15:25:12 -04:00
Deirdre Connolly 33e9efe2dd
Mention git diff --stat in release PR template (#1934) 2021-03-23 14:39:12 +10:00
teor b396bb9be5 Document that the mandatory checkpoint can change
We don't want users relying on the exact height of Zebra's
mandatory checkpoint.
2021-03-22 22:17:44 -04:00
Deirdre Connolly ca1d2de87d
Bump versions for v1.0.0-alpha.5 (#1932)
Zebra's latest alpha checkpoints on Canopy activation, continues our work on NU5, and fixes a security issue.

Some notable changes include:

## Added
- Log address book metrics when PeerSet or CandidateSet don't have many peers (#1906)
- Document test coverage workflow (#1919)
- Add a final job to CI, so we can easily require all the CI jobs to pass (#1927)

## Changed
- Zebra has moved its mandatory checkpoint from Sapling to Canopy (#1898, #1926)
  - This is a breaking change for users that depend on the exact height of the mandatory checkpoint.

## Fixed
- tower-batch: wake waiting workers on close to avoid hangs (#1908)
- Assert that pre-Canopy blocks use checkpointing (#1909)
- Fix CI disk space usage by disabling incremental compilation in coverage builds (#1923)

## Security
- Stop relying on unchecked length fields when preallocating vectors (#1925)
2021-03-22 22:05:01 -04:00