Commit Graph

394 Commits

Author SHA1 Message Date
Henry de Valence e492cf067e Disable version string test. 2020-01-15 12:06:31 -08:00
Henry de Valence 4fcb550aa6 Fix a deadlock in TokioComponent.
The components are accessed by a lock on application state.  When some command
calls block_on to enter an async context, it obtained a write lock on the
entire application state.  This meant that if the application state were
accessed later in an async context, a deadlock would occur.  Instead the
TokioComponent holds an Option<Runtime> now, so that before calling block_on,
the caller can .take() the runtime and release the lock.  Since we only ever
enter an async context once, it's not a problem that the component is then
missing its runtime, as once we are inside of a task we can access the runtime.
2020-01-15 12:06:31 -08:00
Henry de Valence ab3db201ee Change TracingEndpoint to forward to the Abscissa Tracing component. 2020-01-15 12:06:31 -08:00
Tony Arcieri 45eb81a204 Upgrade to Abscissa v0.5 2020-01-15 12:06:31 -08:00
Henry de Valence d3e954cd4a Remove vestigial tower git dep 2020-01-15 14:23:01 -05:00
Deirdre Connolly a3b09c3690
Target crates.io 0.3 versions of tower and tower-load (#172) 2020-01-14 17:18:14 -05:00
Deirdre Connolly 50e20a1053
Update GitHub Actions workflow to use latest GoogleCloudPlatform located actions (#171)
The locations of the Actions were moved around for some reason, resulting in 404s.
2020-01-14 17:03:51 -05:00
dependabot-preview[bot] c14a372f4c Bump tokio from 0.2.7 to 0.2.9
Bumps [tokio](https://github.com/tokio-rs/tokio) from 0.2.7 to 0.2.9.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-0.2.7...tokio-0.2.9)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-13 15:39:27 -08:00
dependabot-preview[bot] b8796114c8 Bump tokio from 0.2.6 to 0.2.7
Bumps [tokio](https://github.com/tokio-rs/tokio) from 0.2.6 to 0.2.7.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-0.2.6...tokio-0.2.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-07 16:43:53 -05:00
dependabot-preview[bot] e0848e0d23 Bump sha2 from 0.8.0 to 0.8.1
Bumps [sha2](https://github.com/RustCrypto/hashes) from 0.8.0 to 0.8.1.
- [Release notes](https://github.com/RustCrypto/hashes/releases)
- [Commits](https://github.com/RustCrypto/hashes/compare/sha2-v0.8.0...sha2-v0.8.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-06 11:16:57 -08:00
Henry de Valence 41021c65ad Implement transaction (de)serialization. 2019-12-31 02:46:39 -05:00
Henry de Valence 53cae4647e Make invalid ShieldedData unrepresentable.
ShieldedData objects must have at least one spend or output; using Either
ensures that at least one must be present.  This is similar to the
JoinSplitData case, but slightly more complicated: rather than enforcing that
one list has at least one element (which can be done as `(first, rest)`), here
we need to use Either.   This has the downside that it is possible to construct
multiple equivalent internal representations (choosing whether a spend or
output goes in the `first` slot), but this easily fixed with a custom PartialEq
implementation.
2019-12-31 02:46:39 -05:00
Henry de Valence 3a7ddbad2d Add another convenience method for arrays, this time 64 bytes. 2019-12-31 02:46:39 -05:00
Henry de Valence 049998c751 Fix publicity for SaplingNoteTreeRootHash 2019-12-31 02:46:39 -05:00
Henry de Valence 8ff4139c1f Use Groth16Proof in ShieldedData, not just JoinSplits. 2019-12-31 02:46:39 -05:00
Henry de Valence 92ddf0542f Provide impl Zcash[De]Serialize for Vec<T: Zcash[De]Serialize>.
This replaces the read_list function and makes the code significantly cleaner.

The only downside is that it loses exact preallocation, but this is probably not a big deal.
2019-12-31 02:46:39 -05:00
Henry de Valence 1199cfa23e impl Zcash[De]Serialize for Script 2019-12-31 02:46:39 -05:00
Henry de Valence 392825c4cb Add Zcash[De]Serialize bound to ZkSnarkProof. 2019-12-31 02:46:39 -05:00
Henry de Valence fa1e168fb5 Ensure that invalid JoinSplitDatas are unrepresentable.
All JoinSplitDatas must contain at least one JoinSplit.
2019-12-31 02:46:39 -05:00
Henry de Valence c26304d983 Correct an error in transaction modeling.
In the previous transaction modeling I defined the structs so that the number
of old and new commitments for a JoinSplit were variable, when in fact the
Sprout design fixes both to be 2.  So now they are hardcoded as 2 in the source
code as well.  This commit also fixes some missing `pub` fields on the
`JoinSplit` struct.
2019-12-31 02:46:39 -05:00
Henry de Valence 056127dc94 Copy a transaction test vector from librustzcash. 2019-12-31 02:46:39 -05:00
dependabot-preview[bot] a0647341a2 Bump tracing from 0.1.10 to 0.1.11
Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.10 to 0.1.11.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.10...tracing-0.1.11)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-26 10:58:38 -08:00
dependabot-preview[bot] 434457467f Bump tower from `2dc9a72` to `7b48479`
Bumps [tower](https://github.com/tower-rs/tower) from `2dc9a72` to `7b48479`.
- [Release notes](https://github.com/tower-rs/tower/releases)
- [Commits](2dc9a72bea...7b48479bd2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-25 15:05:49 -05:00
dependabot-preview[bot] f827d89061 Bump tokio from 0.2.5 to 0.2.6
Bumps [tokio](https://github.com/tokio-rs/tokio) from 0.2.5 to 0.2.6.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-0.2.5...tokio-0.2.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-25 15:04:48 -05:00
dependabot-preview[bot] 21b49ed022 Bump tokio from 0.2.4 to 0.2.5
Bumps [tokio](https://github.com/tokio-rs/tokio) from 0.2.4 to 0.2.5.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-0.2.4...tokio-0.2.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-19 09:11:30 -08:00
dependabot-preview[bot] 3c77c6f685 Bump hyper from 0.13.0 to 0.13.1
Bumps [hyper](https://github.com/hyperium/hyper) from 0.13.0 to 0.13.1.
- [Release notes](https://github.com/hyperium/hyper/releases)
- [Changelog](https://github.com/hyperium/hyper/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hyperium/hyper/compare/v0.13.0...v0.13.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-17 17:11:28 -05:00
dependabot-preview[bot] 7aa1a27fe9 Bump serde from 1.0.103 to 1.0.104
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.103 to 1.0.104.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.103...v1.0.104)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-16 15:12:34 -05:00
Henry de Valence 2965187b91 Upgrade tokio, futures, hyper to released versions. 2019-12-13 17:42:15 -05:00
Henry de Valence 4315235d52 Use RedJubjub types in zebra-chain. (#142) 2019-12-12 14:23:19 -05:00
Henry de Valence c013895cd7 Update Transaction definition. (#105)
* Added a few more top-level fields for the Transaction struct

* Add a placeholder Script type.

This could alternately use bytes::Bytes to save some allocations
but I don't think this is important to get perfectly now.  In the future, we
will want to have all of the script handling code in the zebra-script crate,
but we will need to have a container type for an encoded script in zebra-chain,
because otherwise zebra-chain would depend on zebra-script and not the other
way around.

* Rename Transaction{Input,Output} -> Transparent{Input,Output}.

These are only *transparent* inputs and outputs, so by putting Transparent in
the name (instead of Transaction) it's more clear that a transaction's inputs
or outputs can also be shielded.

* Add a LockTime enum.

* First attempt at a Transaction enum.

This attempts to map the versioning and field presence rules into an ADT, so
that structurally invalid transactions (e.g., a BCTV14 proof in a Sapling
transaction) are unrepresentable.

* Update zebra-chain/src/transaction.rs

Co-Authored-By: Daira Hopwood <daira@jacaranda.org>

* Add fixme note on type refinement.

* Rename Transaction variants according to version.

* Split transaction.rs into submodules.

* Start filling in spend, output descriptions.

* Progress on JoinSplit data structures.

This has a lot of duplication and should really use generics to abstract over
Sprout-on-BCTV14 or Sprout-on-Groth16.

* Add data types for Bctv14 and Groth16 proofs.

This also adds a trait to abstract over them.

* Make JoinSplit descriptions generic over the proof system.

* Update zebra-chain/src/transaction/joinsplit.rs
2019-12-05 15:56:58 -05:00
Deirdre Connolly 82e246d87b
Merge pull request #135 from ZcashFoundation/130
On receipt of a Filter(Load|Add|Clear) message, disconnect from peer
2019-12-05 14:06:05 -05:00
Deirdre Connolly d559a3fa52 Return an error result if the filterload msg size is out of bounds 2019-12-05 13:48:42 -05:00
Deirdre Connolly cbd95dfc1f Pass body_len to read_filterload instead of calculating it ourself
This lets us still be generic over the reader trait and we aren't recomputing  again.

Co-Authored-By: Henry de Valence <hdevalence@hdevalence.ca>
2019-12-05 13:48:42 -05:00
Deirdre Connolly 3fbfffeb44 Remove superfluous zcash_(de)serialize impls 2019-12-05 13:48:42 -05:00
Deirdre Connolly 9a0c2198aa Parse out exact/max possible lengths for filterload filters
Add some unit tests that make sure we obey max values.
2019-12-05 13:48:42 -05:00
Deirdre Connolly 78f0b8aab0 Remove NODE_BLOOM service bit
We do not support bloom filters.
2019-12-05 13:48:42 -05:00
Deirdre Connolly 3c26092b01 Read max of 520 bytes for data fields when parsing filteradd messages 2019-12-05 13:48:42 -05:00
Deirdre Connolly 1b8b4d0fac Encode and decode Filter* messages
Also remove stubs related to MerkleBlock and the catchall case for unknown types since we
are finally matching all variants of the Message enum.
2019-12-05 13:48:42 -05:00
Deirdre Connolly 72def27b78 Add FilterLoad, FilterAdd, FilterClear message variants
Also remove MerkleBlock stub, we are no longer supporting it (zcashd doesn't either).
2019-12-05 13:48:42 -05:00
Deirdre Connolly f5aa5f3794 Add Tweak and Filter types 2019-12-05 13:48:42 -05:00
Deirdre Connolly 51b888c0ff Impl custom Debug for TransactionHash
Resolves #104
2019-12-05 10:07:47 -08:00
dependabot-preview[bot] 762617b917 Bump thiserror from 1.0.8 to 1.0.9
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.8 to 1.0.9.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.8...1.0.9)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-04 09:15:06 -08:00
dependabot-preview[bot] a97ece996f Bump thiserror from 1.0.6 to 1.0.8
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.6 to 1.0.8.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.6...1.0.8)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-03 12:25:55 -08:00
Henry de Valence 36cd6d6e06 cargo fmt 2019-11-27 23:53:36 -05:00
Henry de Valence f58aaac1ae Privately re-export ErrorSlot, ClientRequest in peer.
This means that all sub-modules of `peer` can import everything they need from
the `peer` module itself, without having to be aware of the internal structure
of their sibling modules.
2019-11-27 23:53:36 -05:00
Henry de Valence ad6525574b Rename PeerConnector -> peer::Connector 2019-11-27 23:53:36 -05:00
Henry de Valence 778e49b127 Rename PeerHandshake -> peer::Handshake 2019-11-27 23:53:36 -05:00
Henry de Valence 9ff0fd90dc Rename ServerState -> State.
There's no need to write `Server` every time because it's only used inside of
the server code, and when the handshake service constructs a Server.
2019-11-27 23:53:36 -05:00
Henry de Valence d1b3e8fe6b Rename PeerServer -> peer::Server 2019-11-27 23:53:36 -05:00
Henry de Valence 77191e62f6 Remove outdated fixup note. 2019-11-27 23:53:36 -05:00