Commit Graph

339 Commits

Author SHA1 Message Date
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
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
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 306fa88214 Document the correctness of Poll::Pending wakeups 2021-03-27 08:55:49 -04:00
Deirdre Connolly 354396f525 Add some comments and tracing for groth16::Verifier tests 2021-03-25 18:34:47 -04: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 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 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
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
teor f19f0d0949 clippy: fix inconsistent struct ordering 2021-03-22 11:51:54 -04:00
teor 38585b6116
Fix whitespace for rustfmt 2021-03-22 11:18:37 +10:00
teor a6f916671a
Add a TODO comment for a missing no-coinbase check 2021-03-22 08:59:51 +10:00
teor d19585cfca Fix some missed Sapling to Canopy checkpoint code changes 2021-03-18 10:13:47 +10:00
teor 9da220517b Update docs for Sapling to Canopy checkpoint change 2021-03-18 10:13:47 +10:00
teor a649bd10e3 Also update testnet checkpoints 2021-03-18 10:13:47 +10:00
teor 6711d14bc4 Summarise how to rebuild checkpoints in list.rs 2021-03-18 10:13:47 +10:00
Alfredo Garcia a292cbe611 change the mandatory checkpoint to Canopy 2021-03-18 10:13:47 +10:00
dependabot[bot] 97cae4b2da build(deps): bump displaydoc from 0.1.7 to 0.2.0
Bumps [displaydoc](https://github.com/yaahc/displaydoc) from 0.1.7 to 0.2.0.
- [Release notes](https://github.com/yaahc/displaydoc/releases)
- [Changelog](https://github.com/yaahc/displaydoc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yaahc/displaydoc/commits/v0.2.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-17 15:50:40 -04:00
Alfredo Garcia d49eaab68e
Bump versions for zebrad 1.0.0-alpha.4 (#1913)
* Bump versions for zebrad 1.0.0-alpha.4

* add Cargo.lock
2021-03-16 21:12:37 -03:00
Jack Grigg e51f33a4b9 Use interoperable names for common metrics
These names match the equivalent metrics in zcashd, enabling common
metrics to be collected across both node types.
2021-03-17 09:38:07 +10:00
teor 873127aac1 Replace smart quotes with ascii quotes
Some tools don't deal well with unicode text. And we're not using it
consistently in Zebra anyway.
2021-03-15 03:18:10 -04:00
dependabot[bot] b618f5b522 build(deps): bump tracing-subscriber from 0.2.16 to 0.2.17
Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.2.16 to 0.2.17.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.2.16...tracing-subscriber-0.2.17)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-14 19:37:24 -04:00
teor 8103e89739 Check proof-of-work in the CheckpointVerifier
These checks make some resource exhaustion attacks harder to carry out,
because the malicious blocks need a valid proof-of-work.
2021-03-12 08:55:29 +10:00
teor c1a910942d Re-use some block checks in the CheckpointVerifier 2021-03-12 08:55:29 +10:00
teor 252affdf84 Add network to CheckpointVerifier
This refactor allows us to re-use some block checks in the checkpoint
verifier.
2021-03-12 08:55:29 +10:00
teor 2e64409d78 Make checkpoint restart test automatically use extra blocks
Also use block 10. (The previous version only really used blocks 0-9.)
2021-03-04 08:06:31 +10:00
teor e1002ce2ce Test checkpoints on mainnet and testnet 2021-03-04 08:06:31 +10:00
teor b8cc3bfb23 Delete duplicate test code for chain verifier
This code was commented-out, so the tests weren't actually running.
2021-03-04 08:06:31 +10:00
teor 436a4e9a5b Add better diagnostics for the checkpoint restart tests 2021-03-04 08:06:31 +10:00
teor db23258216 Re-enable the checkpoint restart tests 2021-03-04 08:06:31 +10:00
Alfredo Garcia 8883543a85
Add transaction version 5 stubs (#1824)
* add transaction V5 stub
* add v5_strategy
* deduplicate version group ids
* Update comment for V5 transactions
* Add V5 transactions to non_finalized_state

Currently these are all `unimplemented!(...)`

* Fix struct matches
* Apply trivial panic message changes
* add zcash_deserialize for V5
* make all tx versions explicit in sprout and sapling nullifier functions
* match exhaustively in sprout and sapling nullifier functions
* fix matches in zebra-consensus
* fix NU5 strategy
* We're still deciding if v5 transactions support Sprout

Co-authored-by: teor <teor@riseup.net>
2021-03-04 07:56:41 +10:00
Alfredo Garcia 65fa1c6bd9 replace canopy.pdf with protocol.pdf 2021-03-02 16:07:04 -05:00
dependabot[bot] 70327dc9f5 build(deps): bump once_cell from 1.6.0 to 1.7.0
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.6.0 to 1.7.0.
- [Release notes](https://github.com/matklad/once_cell/releases)
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.6.0...v1.7.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-25 15:32:03 -05:00
dependabot[bot] bf1e2bd3b8
build(deps): bump tracing from 0.1.24 to 0.1.25 (#1815)
Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.24 to 0.1.25.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.24...tracing-0.1.25)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-25 09:28:26 +10:00
dependabot[bot] 7b675bbd73 build(deps): bump futures from 0.3.12 to 0.3.13
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.12 to 0.3.13.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.12...0.3.13)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-23 16:09:53 -05:00
dependabot[bot] dab65b33eb build(deps): bump once_cell from 1.5.2 to 1.6.0
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.5.2 to 1.6.0.
- [Release notes](https://github.com/matklad/once_cell/releases)
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.5.2...v1.6.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-23 10:59:40 -05:00
teor 7558f74c78 Bump versions for zebrad 1.0.0-alpha.3 2021-02-23 10:39:13 -05:00
dependabot[bot] 304d7682f5 build(deps): bump tracing-subscriber from 0.2.15 to 0.2.16
Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.2.15 to 0.2.16.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.2.15...tracing-subscriber-0.2.16)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-22 01:38:42 -05:00
teor 3af57ece7a
Partly revert "Fix poll_ready usage in ChainVerifier" (#1735)
* Revert "Fix poll_ready usage in ChainVerifier (#1700)"

This reverts commit 0723ac5be1.

* Keep the VERIFIER_BUFFER_BOUND change
* Correctly implement multiple readiness
2021-02-20 10:43:38 +10:00
dependabot[bot] 7bba67d97b build(deps): bump thiserror from 1.0.23 to 1.0.24
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.23 to 1.0.24.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.23...1.0.24)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-19 14:54:40 -05:00
dependabot[bot] f19ef44493 build(deps): bump tracing from 0.1.23 to 0.1.24
Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.23 to 0.1.24.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.23...tracing-0.1.24)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-18 22:21:49 -05:00
dependabot[bot] 76e4b8f693 build(deps): bump tracing-futures from 0.2.4 to 0.2.5
Bumps [tracing-futures](https://github.com/tokio-rs/tracing) from 0.2.4 to 0.2.5.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-futures-0.2.4...tracing-futures-0.2.5)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-17 08:55:16 -05:00
teor 9056435942
Make the state usage clearer in script::Verifier (#1733) 2021-02-16 05:53:12 +10:00
Deirdre Connolly 0c5daa8410 Bump versions for zebrad 1.0.0-alpha.2
Including tower-batch bump to 0.2.0, tower-fallback to 0.2.0, zebra-script to 1.0.0-alpha.3
2021-02-09 16:14:29 -05:00
Alfredo Garcia 0723ac5be1
Fix poll_ready usage in ChainVerifier (#1700)
* change `poll_ready()` and `call()` of `ChainVerifier`
* add bound, move max_checkpoint_height
* add buffers to the checkpoint and block verifiers

And rename the chain verifier fields so `block` means `Arc<Block>`, and
`block_verifier` means `Buffer<BlockVerifier, ...>`.

* Fix the error types
* Use `ServiceExt::oneshot` in `ChainVerifier::call`

And:
* make the code look like the `main` branch as much as possible
* document the `poll_ready`/`call` invariant

* Use `ServiceExt::oneshot` in `chain::init`

Co-authored-by: teor <teor@riseup.net>
2021-02-09 08:13:55 +10:00