Deirdre Connolly
3b01dc50ef
Use unicode scalar field characters instead of LaTeX
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-08-14 02:04:12 -04:00
Deirdre Connolly
1d494a2b7a
Docstring wrap
2020-08-14 02:04:12 -04:00
Deirdre Connolly
e22afa3c8f
Generate uniformly random scalar w/ Fr::from_bytes_wide()
...
Which reduces mod r always.
2020-08-14 02:04:12 -04:00
Deirdre Connolly
c46cda920f
Add primitive merkle_crh_sapling function
2020-08-14 02:04:12 -04:00
Deirdre Connolly
10a9aa5844
Add prf_nf and use in From impl to derive Sapling Nullifier
2020-08-14 02:04:12 -04:00
Deirdre Connolly
eb731a6e2f
Add note commitment tree Position type
2020-08-14 02:04:12 -04:00
Deirdre Connolly
65f8f2c613
Add mixing_pedersen_hash
...
Tidy constructors for NoteCommitment
2020-08-14 02:04:12 -04:00
Deirdre Connolly
ed888b38ef
Correctly generate a sapling NoteCommitment from the NoteCommitmentRandomness
2020-08-14 02:04:12 -04:00
Deirdre Connolly
b6385ca36f
Move commitment types into commitments module
...
Docs, tidy
2020-08-14 02:04:12 -04:00
Deirdre Connolly
4ccec84768
Add explicit pedersen_hash function
2020-08-14 02:04:12 -04:00
Deirdre Connolly
83c41869e1
Improve docs
2020-08-14 02:04:12 -04:00
Deirdre Connolly
caef323f9b
pedersen_hash_to_point() works, with submethods using bitvec
...
Also tidy, document
2020-08-14 02:04:12 -04:00
Deirdre Connolly
919557c20c
My BitSlice doesn't have a known size at compile time?
...
error[E0277]: the size for values of type cannot be known at compilation time
2020-08-14 02:04:12 -04:00
Deirdre Connolly
579f1ed134
Flesh out windowed_pedersen_commitment_r
2020-08-14 02:04:12 -04:00
Deirdre Connolly
9d87f30d18
Start of, but currently unfinished, Sapling note commitment / Windowed Pedersen Commitment
2020-08-14 02:04:12 -04:00
Deirdre Connolly
f64e0c4bc5
Sapling value commitment, half done Sapling note commitment
2020-08-14 02:04:12 -04:00
Deirdre Connolly
823b06b219
Break out subtypes into modules, including arbitrary's
2020-08-14 02:04:12 -04:00
Deirdre Connolly
dfb10ab10f
Add NoteCommitment.extract_u()
2020-08-14 02:04:12 -04:00
Deirdre Connolly
33730a05cb
Do not confuse a NoteCommitment for U(NoteCommitment)
2020-08-14 02:04:12 -04:00
Deirdre Connolly
0f46a9b6a8
NoteCommitments, renames, ValueCommitment, strategies, stub commit()
2020-08-14 02:04:12 -04:00
Deirdre Connolly
fa053e2b0b
Derive a Sprout nullifier from a nullifier seed (rho) and spending key
2020-08-14 02:04:12 -04:00
Deirdre Connolly
0d618a3abf
Start treestate module
2020-08-14 02:04:12 -04:00
Deirdre Connolly
28a7420079
Remove unused imports
2020-08-14 02:04:12 -04:00
Deirdre Connolly
15899bc6d3
More Note refinements
2020-08-14 02:04:12 -04:00
Deirdre Connolly
2c285985c8
Move nullifiers to respective note modules, pull in existing types from keys
2020-08-14 02:04:12 -04:00
Jane Lusby
8b78a55c71
Start work implementing sprout note commitment function
2020-08-14 02:04:12 -04:00
teor
0e21a70b88
feature: Implement CompactDifficulty to Work ( #838 )
...
* Implement CompactDifficulty to Work
* Add Bitcoin test vectors for difficulty
2020-08-14 09:48:15 +10:00
Henry de Valence
07917421cb
Correct coinbase check ( #898 )
...
* chain: add Transaction::is_coinbase()
This matches the check in zcashd/src/primitives/transaction.h:682
(CTransaction::IsCoinBase).
* chain: correct Block::is_coinbase_first
This matches zcashd/src/main.cpp:3968-3974 in CheckBlock.
Previously, the check allowed the first transaction to have multiple coinbase inputs.
* chain: return slices from Transaction::inputs()/outputs()
They're slices internally so we might as well just expose them that way.
2020-08-13 14:04:43 -07:00
Henry de Valence
36093b4721
Tweak light client root hash definition.
...
This changes the `light_client_root_hash` field to `light_client_root_bytes` to
hint that it's unparsed, and makes it public to match the rest of the
`BlockHeader` fields. The `LightClientRootHash` serialization methods are
hidden from the public API, so that the `LightClientRootHash` has to be
constructed by the method on the `Block`.
2020-08-11 19:13:50 -04:00
Henry de Valence
f8a24f9c11
Rename script fields to lock/unlock scripts. ( #866 )
...
This is slightly clearer and more correct than the previous pk_script.
2020-08-10 11:49:38 -07:00
teor
7afd76f5fb
feature: Add light_client_root_hash(network) to Block
...
* use the right variant in LightClientRootHash::from_bytes()
* make block.header.light_client_root_hash pub(super)
* add tests for LightClientRootHash and block.light_client_root_hash
2020-08-10 18:54:42 +10:00
teor
ee6f0de14d
refactor: Move NetworkUpgrade to zebra-chain
2020-08-10 18:54:42 +10:00
teor
c4eb136426
feature: Add a LightClientRootHash type
2020-08-10 18:54:42 +10:00
teor
53ce01fd23
fix: Rename the light client hash field
2020-08-10 18:54:42 +10:00
Henry de Valence
a987394782
Add KaTeX to rendered docs. ( #832 )
...
This adds a single test formula to the `zebra-chain` docs. We can remove it
after merging this and running it through CI to confirm that it works.
2020-08-05 17:34:30 -07:00
teor
d49c11ee70
fix: Allow PROPTEST_CASES to override the lower block case default
2020-08-05 02:07:05 -07:00
teor
ac7a4ae517
fix: Speed up the block round trip proptest
...
Reduce the number of cases run by the block round trip proptest, to
speed up the Zebra tests.
2020-08-04 22:35:01 -07:00
teor
78b5bf5e9a
refactor: Move the difficulty tests into their own file
2020-08-04 15:24:52 -04:00
teor
efb9313460
fix: Resolve a type ambiguity in a proptest
...
For some reason, implementing
`PartialOrd<BlockHeaderHash> for ExpandedDifficulty` (or its converse)
makes this unrelated code ambiguous.
2020-08-04 12:29:07 +10:00
teor
c8b502a5da
feature: Compare ExpandedDifficulty and BlockHeaderHash
2020-08-04 12:29:07 +10:00
teor
b7fac7b3bc
feature: Make ExpandedDifficulty use U256 internally
...
Adds a dependency on the primitive-types crate.
Also adds custom hex debug formatting for compact and expanded
difficulties.
2020-08-04 12:29:07 +10:00
teor
c04d1b7b8f
doc: Consensus-critical difficulty encodings
2020-08-04 12:29:07 +10:00
teor
06157a7c8e
Update the BlockHeader fields for Heartwood ( #767 )
...
The Heartwood upgrade changes the meaning of the hashFinalSaplingRoot to
hashLightClientRoot. Since we don't know the network upgrade heights in
zebra-chain, we just use [u8; 32] for now.
2020-08-04 12:15:28 +10:00
teor
195948e5b1
feature: Add an ExpandedDifficulty type and conversion
...
Also add tests.
2020-08-03 10:28:31 +10:00
teor
c4dec3fb36
feature: Make a CompactDifficulty wrapper
...
Wrap the compact difficulty "bits" field in a CompactDifficulty struct,
and rename the header field for clarity.
2020-08-03 10:28:31 +10:00
Jane Lusby
1015db25a8
remap the state storage to only store blocks once ( #741 )
2020-07-31 09:21:54 +10:00
Henry de Valence
7d0a3debb6
chain: ensure impl Deserialize for Amount validates data.
...
This uses serde's try_from attribute to run deserialized values through the
TryFrom impl. Also adds a test to make sure that validation actually does
happen.
2020-07-28 12:20:40 -07:00
teor
5ece62f0a5
fix: Update comments for Heartwood's hashChainHistoryRoot
2020-07-27 14:00:56 -04:00
teor
41225660fb
doc: The genesis coinbase is the same in every network
2020-07-23 03:46:24 -04:00
Jane Lusby
7d4e717182
Add block locator request to state layer ( #712 )
...
* Add block locator request to state layer
* pass genesis in request
* Update zebrad/src/commands/start/sync.rs
* fix errors
2020-07-22 18:01:31 -07:00