* adds/impls types in zebra-chain to be used by the zebra-scan RPC server
* Adds methods for parsing and a test
* adds test for key hash encoding
* Apply suggestions from code review
Co-authored-by: Marek <mail@marek.onl>
* refactors viewing key type
* refactors/renames for viewing keys
* fixes doc links
* Apply suggestions from code review
* Apply suggestions from code review
* removes ViewingKeyHash and ViewingKeyWithHash types
* removes `to_bytes` methods
* remove outdated method and call
---------
Co-authored-by: Marek <mail@marek.onl>
* add `zebra-grpc` crate
* add missing fields
* convert to a lib
* add zebra-scan and tonic as depenency
* add a getinfo grpc
* remove zebra-scanner dependency
* Adds scan_service field to scanner grpc server
* remove dependency
* test launching the grpc server from the zebra-scan crate (not building)
* fix async issue
* fixes build issues
* add binary for manual testing
* try fix try run
---------
Co-authored-by: Arya <aryasolhi@gmail.com>
* impl TryFrom<zcash_primitives::BlockHeight> for Height
* Add type-safe read and write database methods
* Only allow typed access to the scanner DB
* Update docs
* Implement a common method as a trait
* Fix imports
* Tidy state imports
* Activate tracing logging macros in the whole scanner crate
* Fix dead code warnings
* Use a more sensible export order
* Remove a 1.72 lint exception now 1.74 is stable
* Switch history trees over to TypedColumnFamily, and remove redundant code
* Add typed batch creation methods, and switch history trees to them
* Convert ValueBalance to typed column families
* Make the APIs compatible after a merge
* Use `ZebraDb` instead of `DiskDb` where needed
---------
Co-authored-by: Marek <mail@marek.onl>
* impl TryFrom<zcash_primitives::BlockHeight> for Height
* Add type-safe read and write database methods
* Only allow typed access to the scanner DB
* Update docs
* Implement a common method as a trait
* Fix imports
* Tidy state imports
* Activate tracing logging macros in the whole scanner crate
* Fix dead code warnings
* start scanner where it was left
* fix tests
* add a `scan_start_where_left` test
* refactor a log msg
* fix some comments
* remove function
* fix doc comment
* clippy
* fix `sapling_keys_and_last_scanned_heights()`
* simplify start height
* i went too far, revert some changes back
* change log info to every 10k blocks
* fix build
* Update height snapshot code and check last height is consistent
* Add strictly before and strictly after database key gets
* Move to the previous key using strictly before ops
* Assert that keys are only inserted once
* Update the index in each loop
* Update snapshots
* Remove debugging code
* start scanning at min available height
---------
Co-authored-by: teor <teor@riseup.net>
* Refactor test data into functions
* Add a typed snapshot test for scanner storage
* Use standard hex serialization with SaplingScannedResult
* Simplify transaction::Hash hex serialization
* Sort HashMaps before snapshotting
* Add typed snapshot data
* Make some scanner storage methods more flexible
* Move tests to a submodule and expose test functions and constants
* Make scanner functions clearer and easier to use
* Simplify state snapshot test code
* Add raw data snapshot tests for the scanner
* Add snapshots
* Fix import path
* Fix import conditional compilation
* fix imports
* fix imports 2
* Put read and write db exports together
* Remove confusing IntoDisk/FromDisk impl
* Fix an incorrect unused method that could panic
* Delete a test that is no longer valid
---------
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
* Upgrade the scanner database major version to 1
* Update format docs
* Change the high-level scanner db format
* Change the scanner serialization formats
* Fix value format and tests
* Fix incorrect types
* Update documentation
---------
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
* Update multiple key docs
* Add a TODO for the tree size
* Fix scan() docs
* Split out a scan_height...() function
* Clarify it's the state database we're using for scanning heights
Co-authored-by: Marek <mail@marek.onl>
* Remove unused import
---------
Co-authored-by: Marek <mail@marek.onl>
* Derive & impl helper traits from `std`
* Create `compact_to_v4` fn
* Create `fake_block` fn
* Refactor existing tests to use the new functions
* Cosmetics
* Refactor docs
* Put `Default` behind `cfg_attr(test)`
Rationale
---------
We avoid implementing `Default` on consensus-critical types because it's
easy to miss an incorrect use in a review. It's easy to hide a
`default()` in a call like `unwrap_or_default()` or even more subtle
methods.
---------
Co-authored-by: teor <teor@riseup.net>
* Fix availability of tokio::time in scanner
* Create a function that parses a key into a list of keys
* Pass a ChainTipChange to the scanner function
* Convert a scanned block to a sapling result
* Make it easier to pass keys and blocks
* Increase scanner wait times
* Parse keys once at the start of the scan
* Get a block from the state instead of the tip
* Don't log secret keys, only log every 100,000 blocks
* Scan each block and add the results to storage
* Move blocking tasks into spawn_blocking()
* Update the acceptance test
* Use a dummy sapling tree size
* Use a larger dummy size
* Expose IntoDisk and FromDisk in zebra-state
* Implement database serialization for SaplingScanningKey Strings
* Implement serialization for Vec<SaplingScannedResult> (Vec<transaction::Hash>)
* Implement seralization for SaplingScannedDatabaseIndex
* Add an is_empty() method
* Add a read method for a specific index, and document it
* Implement writing scanner results to the database
* Make read name more explicit
* Implement writing scanner keys
* Implement reading sapling keys
* Spawn blocking tasks correctly in async code
* Change storage results methods to use the database
* Update tests that use storage
* Use spawn_blocking() for database methods
* Change the check interval to slightly less than the block interval
* Expose raw database methods with shielded-scan
* fix `scan_task_starts` test
* minor doc change in test
---------
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
* Create an empty storage/db module
* Use ephemeral storage in tests
* Populate storage inside new() method
* Move scanner setup into an init() method
* Pass the network to scanner init
* Create a database but don't actually use it
* Skip shutdown format checks when skipping format upgrades
* Allow the scanner to skip launching format upgrades in production
* Refactor skipping format upgrades so it is consistent
* Allow checking configs for equality
* Restore Network import
* Run clippy and build all targets on all crates individually
* Fix prod and test features for scanner deps
* Standardise dependency order
* Remove unnecessary async in tests
* Fix an unused import in a test
* Work around a no space left on device error
* Actually just use a larger runner
* Wrap `zcash_client_backend::scanning::scan_block`
* Use the new `scan_block` fn
* Use full path for `zcash::primitives::Network`
* Add docs for `scan_block`
* Impl `From` for networks in `zcash_primitives`
* Update zebra-scan/src/tests.rs
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
* Move code from `tests.rs` to `scan.rs`
---------
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
* connect zebrad with zebra-scan
* remove unwrap
* use tokio::sleep
* fix the task handler
* Don't panic on an empty state
---------
Co-authored-by: teor <teor@riseup.net>
* add a basic RAM database for the scanner
* specify a crate version for zebra-chain dependency
* add a type for sapling keys
* rename everything to reflect sapling
* change some storage methods
* get started with the blockchain scanner poc
* rustfmt
* fix the tests
* Reads blocks from db
* Adds conversion functions
* scans blocks and counts transactions
* fix bug
* split into 2 tests
* add duplicated dependencies to deny.toml
* upgrade zebra-scanner version
* try removing ecc duplicated dependencies
* try fix deny.toml
* remove unintended paste from deny.toml
* remove duplicated code from the other test
* remove strict version of `zcash_primitives` crate
* change description
* remove feture
* remove tokio features
* change lib doc
* add more documentation
* change expect
* do not use default in compact block creation
* more docs
* add more checks to test
* remove zebra-consensus dependency
* move all deps to dev-deps
* change crate version
* rename crate to zebra-scan
* lock file
* add test for zecpages populated state
* scans all cached blocks for zecpages viewing key expecting Ok results.
* use test blocks
* fixes test
* fix expect messages
* Discard changes to Cargo.lock
* Discard changes to deny.toml
---------
Co-authored-by: arya2 <aryasolhi@gmail.com>
Co-authored-by: teor <teor@riseup.net>
* get started with the blockchain scanner poc
* rustfmt
* fix the tests
* Reads blocks from db
* Adds conversion functions
* scans blocks and counts transactions
* fix bug
* split into 2 tests
* add duplicated dependencies to deny.toml
* upgrade zebra-scanner version
* try removing ecc duplicated dependencies
* try fix deny.toml
* remove unintended paste from deny.toml
* remove duplicated code from the other test
* remove strict version of `zcash_primitives` crate
* change description
* remove feture
* remove tokio features
* change lib doc
* add more documentation
* change expect
* do not use default in compact block creation
* more docs
* add more checks to test
* remove zebra-consensus dependency
* move all deps to dev-deps
* change crate version
* rename crate to zebra-scan
* lock file
* ifix cargo.lock
* remove internal dev dependencies versions
Co-authored-by: teor <teor@riseup.net>
* fix docs url
Co-authored-by: teor <teor@riseup.net>
* fix expect messages
Co-authored-by: teor <teor@riseup.net>
* remove duplicated in deny.toml
Co-authored-by: teor <teor@riseup.net>
* add a comment about moving code to production
---------
Co-authored-by: arya2 <aryasolhi@gmail.com>
Co-authored-by: teor <teor@riseup.net>