Skip to content

Commit

Permalink
Memory Wallet Implementation (#1)
Browse files Browse the repository at this point in the history
* add stubbed version of getting balances for wallet summary

* adds helper methods at top level and partially implements filter for unspent notes

* add map to store block end heights for tree shards

* add orchard as well

* accounts table

* implement block_height_extrema

* add impl of update_chain_tip

* remove some unwraps from get_summary

* add impls for get_max_checkpointed_height

* add impl of get_target_and_anchor_heights

* fix get_transaction

* add impl for get_min_unspent_height

* add get_memo impl

* adds comment for truncate_to_height. Will implement this in future

* tracing debug

* yep

* update last_Scanned_height outside tx loop

* add updating orchard balance

* clippy

* add impls for inputSource trait

* add sorting when selecting notes

* Update Cargo.toml

* serde block

* allow constructing nullifiers

* serde notes

* serde transactions

* top level in progress

* scan queue

* export error type

* start account serde

* serde account birthday

* move serialization to separate module

* clippy fix

* skip

* add unimplemented warnings for account import from seed phrase

* remove unused imports

* Remove Uivk

* serde ufvk

* Keep track of current diversifier idx

* serde account

* serde accounts

* only serde left is on shard tree

* almost done shardstore

* use new trait

* remote visit_seq from orchard note wrapper

* remove unused array module

* more nullifier to use trait

* serialize shard store. need to deser now

* serde memoryshardstore

* serd shardtree

* bring remaing code across for scanning

* add orchard tree handling in put_blocks

* only import if orchard enabled

* Network Wrapper

* done! cleanup time

* clippy

* break into modules

* clippy fix

* fmt

* fmt

* clean up frontierwrapper structs

* add implementation of DataStoreFactor for memwallet

* add back loading accounts from seeds only for testing

* switch to use mutable ref in testing trait

* partial implementation of scan_complete

* fix bug from attepting to iterate over a reverse range in Rust

* type safe tree and frontier serde

* fmt

* rename

* more rename

* fix issue with non-inclusive range

* more cleanup

* forgot to import

* more clean

* add proper recording of spend notes and memos

* add partially implemented get_tx_history

* ByteArray Trait

* more refactor

* clippy\ fix

* Rename

* cippy cix

* proptest for shardtree serde

* add fix for orchard support

* more clean

* donezo

* clippy

* add wasm-bindgen feature

* move to upstream imt and shardtree patch

* migrate 3 more tests across

* adds new trait method to implement change_note_spends_succeed

* Serde SendNoteTable

* clippy fix

* fmt

* remove comment

* Fix tree serialization when wallet has just been initialized

* remove the raw field on get_tx_history as it broke tests

* fix issue querying notes

* add error handling

* migrate send_multi_step_proposed_transfer

* fix wallet deser

* add data_api methods to allow fetching historical checkpoints

* global fmt

* fix clippy lints

* fix test

* add logic for detecting pending notes in wallet summary

* fix serialization

* fmt

* change_note_spends_succeed passing for sapling!

* add scan progress

* add more comprehensive scan progress calculatioon

* add unscanned ranges functionality

* feature gate orchard import

* add updating scan ranges on wallet import

* fix bug in shard_end for updating ranges

* passing birthday range scan check

* cargo lock

* screen out locked transactions when computing balance

* fix missing nullifiers for orchard

* retrievel all inputs in get_spendable_notes rather than filtering

* rewrite note selection strategy to be split per pool

* fix checkpoint getter for tests

* fix clippy lints

* switch from maybe_rayon to rayon for memwallet

* remove proptest genereated file

* move MemBlockCache to own module outside of testing

* implement BlockCache and BlockSource

* works!

* change back batch size of batchrunners until further experimentation

* TODO on for_each_checkpoint on sql store

* switch from parking_lot to wasm_sync

* add new records for transaction and add_partial method

* mostly complete adding transparent output logic

* remove debug

* re add async trait

* remove comment

* test passing for shielding a transparent output

* add start of implementation of data retrieval queue

* add the extra features to wallet_read we need for tests

* migrate tests to librustzcash and make generic over wallet impl

* add test module for transparent tests

* implement get_transparent_balance and get first transparent test passing

* fix sqllite test

* add truncate_to_height and gets transparent tests passing

* global fmt

* remove all IntoIterator impls

* handle unwrap in get_spendable_transparent_outputs

* serde on transparent related tables

* fmt sqlite changes

* remove incorrect todo

* proto

* make all methods in sync public

* add from impl

* adds serialization attributes to librustzcash types

* format

* add serialization to enable proposals to be serialized

* put client memory back

* add derives for noteId

* add derives for FeeRule

* add NoteSummary type to serialize notes

* proto

* fix transparent_balance_across_shielding

* fix account delta

* remove prints

* handle ephemeral addrs

* Add todo

* default legacy transparent

* filling in store_decrypted_tx

* funding_accounts

* multi_step passes

* fmt

* remove some prints

* fmt

* fmt

* fmt

* fix suggestions

* ensure tests build with all feature flag combinations

* removes serde skip from addresses field for an account and adds intermediate types to enable serialization

* merge upstream and fix missing implementations. tests not passing

* return a zero recovery ratio for now

* fixing is_change error

* fix nullifier spend detection logic

* clippy lint

* add tx account detection for utxo sending only. All tests passing

* Willem's refactor

* re-add .cargo

* re-add editor config

* keep willems branch with main

* fix proto

* remove whitespace

---------

Co-authored-by: Willem Olding <willemolding@gmail.com>
  • Loading branch information
ec2 and willemolding authored Dec 3, 2024
1 parent c33ad67 commit c334f70
Show file tree
Hide file tree
Showing 43 changed files with 9,603 additions and 24 deletions.
177 changes: 163 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ members = [
"zcash",
"zcash_client_backend",
"zcash_client_sqlite",
"zcash_client_memory",
"zcash_extensions",
"zcash_history",
"zcash_keys",
Expand Down Expand Up @@ -126,7 +127,7 @@ subtle = "2.2.3"
rusqlite = { version = "0.32", features = ["bundled"] }
schemerz = "0.2"
schemerz-rusqlite = "0.320"
time = "0.3.22"
time = { version = "0.3.22", default-features = false }
uuid = "1.1"

# Static constants and assertions
Expand Down Expand Up @@ -155,7 +156,7 @@ trait-variant = "0.1"
# ZIP 32
aes = "0.8"
fpe = "0.6"
zip32 = "0.1.1"
zip32 = "0.1.2"

[profile.release]
lto = true
Expand Down
2 changes: 1 addition & 1 deletion components/zcash_protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub mod memo;
pub mod value;

/// A Zcash shielded transfer protocol.
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum ShieldedProtocol {
/// The Sapling protocol
Sapling,
Expand Down
9 changes: 8 additions & 1 deletion zcash_client_backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ zip321.workspace = true
# Dependencies exposed in a public API:
# (Breaking upgrades to these require a breaking upgrade to this crate.)
# - Data Access API
time = "0.3.22"
time.workspace = true
nonempty.workspace = true

# - CSPRNG
Expand Down Expand Up @@ -151,6 +151,8 @@ zcash_proofs = { workspace = true, features = ["bundled-prover"] }
zcash_protocol = { workspace = true, features = ["local-consensus"] }

[features]
default = ["time/default"]

## Enables the `tonic` gRPC client bindings for connecting to a `lightwalletd` server.
lightwalletd-tonic = ["dep:tonic", "hyper-util?/tokio"]

Expand Down Expand Up @@ -228,6 +230,11 @@ unstable-serialization = ["dep:byteorder"]
## Exposes the [`data_api::scanning::spanning_tree`] module.
unstable-spanning-tree = []

## feature to allow building for wasm using wasm-bindgen
wasm-bindgen = [
"time/wasm-bindgen",
]

[lib]
bench = false

Expand Down
Loading

0 comments on commit c334f70

Please sign in to comment.