Deirdre Connolly
dd1b9166b0
Implement Zcash(De)Serialize for BlockHeaderHash, use general read_list for getheaders/headers
2019-10-09 22:25:37 -04:00
Deirdre Connolly
eed69063f6
Add read_list to ReadZcashExt
2019-10-09 22:25:37 -04:00
Henry de Valence
47513b1ae7
Suppress warnings from stub functions.
...
This just replaces a bunch of variable names with underscored variants
while the function bodies are still `unimplemented!()`.
2019-09-30 21:32:57 -04:00
Henry de Valence
1323fa7af7
Update zebra-chain/src/transaction.rs
2019-09-27 19:22:34 -07:00
Deirdre Connolly
2739970113
Fill out TransactionHash and rename
...
Resolves #35
2019-09-27 19:22:34 -07:00
Deirdre Connolly
b21b09bf8e
Moved stub TxHash into zebra_chain::transaction
2019-09-27 19:22:34 -07:00
Deirdre Connolly
29591df47e
Use the BlockHeaderHash from zebra-chain in the Inv message parsing
2019-09-27 19:22:34 -07:00
Henry de Valence
958fca8e68
Parse inv messages, refactor inventory vectors.
...
This removes the inventory vector structs from `zebra-chain` (as they
are really part of the network protocol) and refactors them into a
single `InventoryHash` type. This corresponds to Bitcoin's "inventory
vector" but with a different, better name (it's not a vector, it's just
a typed hash of some other item).
2019-09-27 20:41:45 -04:00
Henry de Valence
64b210b53c
Add a read_32_bytes helper method.
...
These are starting to stack up but I think until generic arrays arrive
the cure is worse than the disease :S
2019-09-27 20:41:45 -04:00
Deirdre Connolly
19258d6f54
Remove duplicate from MerkleTree
2019-09-26 23:41:25 -04:00
Deirdre Connolly
b4b72829b2
Sanity: checked
2019-09-26 23:41:25 -04:00
Deirdre Connolly
6236909210
Update zebra-chain/src/transaction.rs
...
Co-Authored-By: Henry de Valence <hdevalence@hdevalence.ca>
2019-09-26 23:41:25 -04:00
Deirdre Connolly
4e85bdb51b
Explain in BlockHeaderHash docstrings block hash vs block header hash
2019-09-26 23:41:25 -04:00
Deirdre Connolly
df5a5f56dd
Add equihash_solution to the lib.rs, impl Zcash(De)Serialize for Block
2019-09-26 23:41:25 -04:00
Deirdre Connolly
f4a6fec2d8
Comment out EquihashSolution::fmt for now
2019-09-26 23:41:25 -04:00
Deirdre Connolly
3f2a1b4f2c
Move around MerkleTree* structs
2019-09-26 23:41:25 -04:00
Deirdre Connolly
677d53897f
Use Vec<u8> for the equihash solution instead of [u8; 1344] for now
2019-09-26 23:41:25 -04:00
Deirdre Connolly
c4547ea806
Derive Clone, Debug, Default, Eq, and PartialEq for new structs
2019-09-26 23:41:25 -04:00
Deirdre Connolly
38015c11a6
Add stubbed-out *NoteCommitmentTree* structs
2019-09-26 23:41:25 -04:00
Deirdre Connolly
90e5ae2f4b
Add improved doc comments
2019-09-26 23:41:25 -04:00
Deirdre Connolly
cecbb1cc0a
Fill out the Block Message type
...
Should we serialize out `Block` or leave explicit like so? ¯\_(ツ)_/¯
2019-09-26 23:41:25 -04:00
Deirdre Connolly
d77dfb2344
Remove unused imports
2019-09-26 23:41:25 -04:00
Deirdre Connolly
0f84a6d38e
Implement Zcash(De)serialize traits specifically for MerkleTree<Transaction>
...
This is a general placeholder for now.
2019-09-26 23:41:25 -04:00
Deirdre Connolly
7340c7d9ce
Adding BlockHeader, BlockHash, MerkleRootHash, Sha256dWriter
2019-09-26 23:41:25 -04:00
Deirdre Connolly
00494d4963
Block and BlockHeader types
2019-09-26 23:41:25 -04:00
Henry de Valence
fe95ad3824
Suppress unused import warning in ReadZcashExt.
2019-09-25 14:59:47 -07:00
Henry de Valence
b3e094bc40
Clean parsing via ReadZcashExt read-array helpers.
...
This adds convenience methods to `ReadZcashExt` that read 4 and 12 byte
fixed size arrays from the `Reader`, making the actual parsing code more
legible.
Closes #10 .
2019-09-19 12:53:16 -04:00
Deirdre Connolly
73740841e1
Move `Transaction` and related types to their own module ( #9 )
...
* Move `Transaction` and related types to their own module
Resolves #6
* Fix references to `Transaction` after move
2019-09-19 07:45:37 -07:00
Deirdre Connolly
60fb4f6bb0
Remove InventoryType::MsgCmpctBlock
...
From BIP-152, which is not implemented by Zcash.
2019-09-18 17:32:06 -04:00
Deirdre Connolly
65632e9f42
Correct comment about pzec bytes::Bytes
2019-09-18 17:32:06 -04:00
Deirdre Connolly
46984cbb27
Add `tx` message, along with `Transaction`, `Transaction(In|Out)put`, and `OutPoint` types
2019-09-18 17:32:06 -04:00
Henry de Valence
733d090b9b
Add missing derives to newtypes.
2019-09-18 17:32:06 -04:00
Henry de Valence
32cf74db39
Move serialization to zebra-chain, rework traits.
...
The core serialization logic is now in zebra-chain and consists of two
pairs of traits:
These are analogues of the Serde `Serialize` and `Deserialize` traits,
but explicitly intended for consensus-critical serialization formats.
Thus some struct `Foo` may have derived `Serialize` and `Deserialize`
implementations for (internal) use with Serde, and explicitly-written
`ZcashSerialize` and `ZcashDeserialize` implementations for use in
consensus-critical contexts. The consensus-critical implementations
provide `zcash`-prefixed `zcash_serialize` and `zcash_deserialize`
methods to make it clear in client contexts that the serialization is
consensus-critical.
These are utility traits, analogous to the `ReadBytesExt` and
`WriteBytesExt` traits provided by `byteorder`. A generic
implementation is provided for any `io::Read` or `io::Write`, so that
bringing the traits into scope adds additional Zcash-specific traits to
generic readers and writers -- for instance, writing a `u64` in the
Bitcoin "CompactSize" format.
2019-09-18 17:32:06 -04:00
Henry de Valence
42cb9c1ff9
Add a `Sha256dChecksum` type for truncated double SHA256.
2019-09-18 17:32:06 -04:00
Deirdre Connolly
a2e50833be
Add InventoryType, InventoryVector, and Message::{Inventory, GetData, NotFound}
2019-09-18 17:32:06 -04:00
Deirdre Connolly
ac0d9732a0
WIP: Version message and various sub structures
...
Co-authored-by: Henry de Valence <hdevalence@hdevalence.ca>
2019-09-18 17:32:06 -04:00
Henry de Valence
ec363d2d41
Create workspace skeleton based on design.md
2019-08-29 14:46:54 -07:00