Kris Nuttycombe
8a7d051138
Rustfmt
2021-01-13 18:06:42 -07:00
Kris Nuttycombe
a3f9fa788d
Update data_api doctests for error handling changes.
2021-01-13 15:43:39 -07:00
Kris Nuttycombe
5a21580f13
Correct the hierarchy of errors.
2021-01-13 15:20:11 -07:00
Kris Nuttycombe
6c6b05fa9b
Trivial rename.
2021-01-12 21:32:46 -07:00
Kris Nuttycombe
ce06db197a
Rustfmt.
2021-01-12 21:10:34 -07:00
Kris Nuttycombe
eef2d5944b
Use a slice literal instead of a vec in put_received_note
2021-01-12 21:06:57 -07:00
Kris Nuttycombe
fcb2f7a433
Use collect instead of collecting a vec manually.
2021-01-12 21:04:42 -07:00
Kris Nuttycombe
011eda364f
Add get_spendable_notes method to WalletRead
2021-01-12 20:42:04 -07:00
Kris Nuttycombe
48f226f8b5
Move decoding errors to sqlite crate.
...
Also move dependency on params out of wallet read/write methods.
The result is cleaner because these parameters are only required
for backend-specific encoding and decoding operations.
2021-01-12 20:07:02 -07:00
Kris Nuttycombe
ca4567b275
More data api documentation.
2021-01-12 13:55:22 -07:00
Kris Nuttycombe
34bc655f64
Add MockBlockSource and MockWalletDB
...
These can readily be made into an in-memory wallet implementation.
2021-01-12 12:55:24 -07:00
Kris Nuttycombe
7d92150965
Fix test compilation with WalletWrite changes.
2021-01-11 18:13:40 -07:00
Kris Nuttycombe
aad2e174c1
Consistently use nullifier and AccountId newtypes.
2021-01-08 21:49:38 -07:00
Kris Nuttycombe
56adbbb545
Make `WalletWrite` depend upon `WalletRead`.
2021-01-08 12:49:10 -07:00
Kris Nuttycombe
e96578195a
Not sure how this happened.
2020-12-03 10:10:37 -07:00
Kris Nuttycombe
4e608216c1
Do not create nested transaction in rewind_to_height
...
Fixes #321
2020-12-02 14:36:56 -07:00
Kris Nuttycombe
d77784eba8
Do not update `is_change` in received_notes with null values.
...
Fixes #322
2020-12-02 13:16:02 -07:00
Kris Nuttycombe
7ac08631b9
Fix doctest imports.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
cf2dae8af0
Add hrp_sapling_extended_spending_key to Parameters trait.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
1fd74d0a71
Improve naming for wallet/block database connections.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
897a70dd9e
Simplify block source & clean up chain validation.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
8a215d67fe
Improve wallet "database" trait names.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
b2cc240454
Do not require wallet database for chain scan.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
e6de7c07f0
Use <module_name>.rs instead of <module_name>/mod.rs
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
f742895118
Fix test/doctest errors.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
2e2f34b033
Use named_params macro for query_and_then_named (less error-prone)
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
25b5fc965f
Fix broken empty_database_has_no_balance test
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
c60b9d3ece
Remove database initialization calls from common API.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
903ef58ec6
Fix transactionality in rewind_to_height
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
4c2cda48e6
Clean up transactional API.
...
This API is still somewhat unsafe in that it doesn't inhibit nested
transactions, but it's better than it was.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
cd2729bbd0
Move 'create_spend_to_address' to wallet backend.
...
This required changing a bit about the relationship between
database errors and wallet errors, and opens up the possibility
of now simplifying the error situation a bit.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
e144015558
Reuse sent note insertion for wallet/transact.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
68737dd1dd
Remove duplicate method.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
8de05f3429
Move transact.rs to wallet module.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
8967745c22
Push chain & wallet functionality down to child modules.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
22ef05239c
Split init module into chain and wallet-related parts.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
a181203179
Move related functions into the same modules.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
eab2951c99
Move decrypt_and_store_transaction to zcash_client_backend
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
0165ae7003
Minor renamings.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
746c4c9a00
Move scan_cached_blocks out of sqlite crate.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
d16c124ffe
Abstract over data access in scan_cached_blocks.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
06c1772692
Move traversal of cached blocks to CacheOps
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
604294dd9f
Factor out nullifier retrieval into data api.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
ffd503134d
Factor out witness retrieval from scan.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
499dcd2e6c
Add the remainder of sqlite/query.rs functions to the data API.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
56e6091876
Factor out `get_commitment_tree` from scan.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
d16c74725e
Extract get_extended_full_viewing_keys function.
...
This required a bit of generalization of the data_api error types.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
3eec6f8faa
Add get_balance, get_verified_balance to data api.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
70de11dd32
Add address retrieval.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
b72251ee28
Add accounts table initialization.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
724fbac33a
Add database initialization implementation.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
f3f3512068
Move get_target_and_anchor_heights to data_api.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
9874abfd6c
Implement chain validation & fix doctests.
2020-12-02 09:46:17 -07:00
Jack Grigg
936b399599
Fix remaining tests after default fee change
2020-11-24 01:50:47 +00:00
str4d
7176ff077c
Apply suggestions from code review
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-10-24 12:05:15 +01:00
Jack Grigg
450d68f073
Merge branch 'master' into zcash_client_sqlite-0.2.1
2020-10-24 00:44:37 +01:00
Jack Grigg
74bf85641c
zcash_client_sqlite 0.2.1
2020-10-24 00:42:24 +01:00
Jack Grigg
524cc2e979
zcash_client_sqlite: Read rcm correctly from data DB after Canopy
...
ZIP 212 alters the note plaintext to store a seed from which rcm is
derived, rather than storing rcm directly. In the mobile SDKs we only
need rcm, so for post-ZIP 212 notes, we derive rcm from the seed and
store rcm in the data DB.
However, when selecting notes to spend, `create_to_address` was using the
transaction's target height to determine if Canopy is active, and parsing
the rcm value as the seed if so. This effectively applied a seed->rcm
derivation to all selected notes' rcms once Canopy activated on the
chain. As a result, the note commitments were incorrect, and thus the
anchors derived from the witness paths were also incorrect. This caused
two kinds of observed failures:
- If more than one note was selected, the builder would fail with
"anchor mismatch", as the note commitments would be effectively
randomised, causing the derived anchors to also randomise.
- If a single note was selected, the transaction would be built using
the randomised anchor, and then rejected when sent to the network.
The fix is to "pretend" in `create_to_address` that all notes are
pre-ZIP 212 notes. This works fine because we never need to serialize
back to the note plaintext while spending a note.
2020-10-24 00:23:05 +01:00
Kris Nuttycombe
b1c3f9d3f0
ZIP 321 Reference Implementation ( #294 )
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2020-10-15 14:03:40 +01:00
str4d
e0587e752b
Merge pull request #290 from str4d/273-remove-decryption-epk-subgroup-check
...
Take epk as a jubjub::ExtendedPoint for note decryption
2020-09-22 03:05:35 +12:00
Kris Nuttycombe
cfb6850d7c
Rustfmt
2020-09-18 10:52:58 -06:00
Kris Nuttycombe
80e1d35ea6
Apply additional suggestions from code review.
2020-09-18 10:40:30 -06:00
Kris Nuttycombe
90d8980162
Apply suggestions from code review
...
Co-authored-by: str4d <thestr4d@gmail.com>
2020-09-18 10:39:37 -06:00
Kris Nuttycombe
1ad9294933
Remove static determination of network state.
...
In the interest of making the library usable for both
testnet and mainnet without recompilation, static resolution
of network parameters has been replaced with a parameter passed
to the relevant functions. This also moves addres prefix constants
into the network parameters.
2020-09-17 10:34:42 -06:00
Kris Nuttycombe
efaba87681
Add newtype for block height.
2020-09-17 10:26:41 -06:00
Jack Grigg
192db29a25
Take epk as a jubjub::ExtendedPoint for note decryption
...
We don't need to check if epk is in the prime-order subgroup before we
trial-decrypt, which saves a third of the cost of trial-decrypting
outputs that are not ours.
2020-09-10 00:39:21 +01:00
Sean Bowe
d4cba74402
Version bump 0.4.0 for crates
...
Bumps zcash_proofs, zcash_primitives, zcash_client_backend to 0.4.0
Also bumps zcash_client_sqlite to 0.2.0
2020-09-09 14:41:19 -06:00
ebfull
c7e9523dce
Merge pull request #284 from str4d/259-ovk-none
...
zcash_primitives: Support ovk = ⊥ in note encryption
2020-09-09 14:32:57 -06:00
Jack Grigg
59e26a0c0f
bls12_381 0.3.1 and jubjub 0.5.1
2020-09-09 16:51:53 +01:00
Jack Grigg
d4f87c12ed
rusqlite 0.24
2020-09-09 00:53:42 +01:00
Jack Grigg
46f17bd624
Bump protobuf dependencies
...
MSRV is now 1.44.1.
2020-09-09 00:32:16 +01:00
Jack Grigg
96bd59b942
Migrate to ff 0.8 and bellman 0.8
...
bellman 0.8 includes fixes for several performance regressions.
MSRV is now 1.44.0, matching the ff crate.
2020-09-09 00:27:51 +01:00
Jack Grigg
40e135783c
zcash_primitives: Support ovk = ⊥ in note encryption
...
Closes zcash/librustzcash#259 .
2020-08-28 21:17:16 +01:00
Jack Grigg
3f06d92eec
Depend on published versions of subtree crates
2020-08-27 23:25:20 +01:00
Jack Grigg
3cd8f64240
zcash_client_sqlite 0.1.0
2020-08-23 16:23:53 +01:00
Jack Grigg
0a3752c088
zcash_client_backend 0.3.0
2020-08-23 16:23:53 +01:00
Jack Grigg
9ce0994f0b
zcash_proofs 0.3.0
2020-08-23 16:23:53 +01:00
Jack Grigg
e25a7dacdf
zcash_primitives 0.3.0
2020-08-23 16:23:53 +01:00
Jack Grigg
d112add8a3
jubjub 0.4.0
2020-08-23 16:23:53 +01:00
Jack Grigg
bdb42bcbc8
pairing 0.17.0
2020-08-23 15:31:09 +01:00
Jack Grigg
ee3e8fbfbb
group 0.7.0
2020-08-23 15:31:09 +01:00
Jack Grigg
55fa366730
ff 0.7.0
2020-08-23 15:31:09 +01:00
Jack Grigg
d15acf8acc
zcash_primitives: Rename Note::cm to Note::cmu
2020-08-21 18:35:04 +01:00
Jack Grigg
fdf06032e3
s/{pairing::bls12_381, zcash_primitives::jubjub}/{bls12_381, jubjub}
...
FINALLY.
2020-08-19 23:08:19 +01:00
therealyingtong
c3d89644e2
Revert SaplingNoteEncryption::new() API to take rng instead of esk
2020-08-06 12:47:35 +08:00
therealyingtong
9970a8aefd
Hard-code NetworkUpgrade::Canopy in generate_random_rseed
2020-08-06 12:27:20 +08:00
therealyingtong
b05e257f79
Fix database queries in scan.rs and transact.rs
2020-08-06 12:00:49 +08:00
therealyingtong
44f46e50ce
Add <P: consensus::Parameters> type parameter to Builder struct
2020-08-06 11:43:07 +08:00
therealyingtong
d6deaddc0a
Only query last_height when needed in decrypt_and_store_transaction()
2020-08-05 16:09:41 +08:00
therealyingtong
2ed9b6f881
Refactor contextual random rseed generation into util method in zcash_primitives
2020-08-05 15:21:42 +08:00
therealyingtong
d5f80618ef
Switch plaintext version on height in commit_to_address() in zcash_client_sqlite
2020-08-05 14:26:57 +08:00
therealyingtong
a25348dfba
Revert passing Parameters to methods
2020-08-05 12:47:29 +08:00
therealyingtong
74b2f0a79e
Pass height to decrypt_transaction()
2020-08-04 21:05:29 +08:00
therealyingtong
895e251793
Fix tests
2020-07-31 22:40:48 +08:00
therealyingtong
65504d9ca7
Add enum Rseed<E::Fs> to Note struct
2020-07-31 22:28:40 +08:00
therealyingtong
b537f0f712
Pass height to methods which encrypt or decrypt Sapling outputs
2020-07-31 12:39:39 +08:00
Jack Grigg
8c250ca3de
zcash_sqlite: Add an unreliability warning to query::get_balance docs
2020-07-10 09:50:43 +12:00
Jack Grigg
8188fae779
zcash_client_sqlite: Implement outgoing viewing key policies
...
This enables an SQLite light client to specify whether recipient history
can be recovered from the block chain (and by what outgoing viewing key)
with per-transaction granularity.
2020-07-09 23:48:09 +12:00
Jack Grigg
0a61db0317
Upgrade to rusqlite 0.23
...
Requires bumping the MSRV to 1.40.0 because libsqlite3-sys uses features
introduced in that version. remove_dir_all can similarly be unpinned.
2020-06-27 00:45:12 +12:00
Jack Grigg
131e00e25d
zcash_client_sqlite::scan::decrypt_and_store_transaction
2020-06-25 18:54:41 +12:00