Commit Graph

1367 Commits

Author SHA1 Message Date
dependabot[bot] b6a18e9bab
build(deps): bump the log-time group with 2 updates (#7579)
* build(deps): bump the log-time group with 2 updates

Bumps the log-time group with 2 updates: [chrono](https://github.com/chronotope/chrono) and [sentry](https://github.com/getsentry/sentry-rust).


Updates `chrono` from 0.4.30 to 0.4.31
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.30...v0.4.31)

Updates `sentry` from 0.31.6 to 0.31.7
- [Release notes](https://github.com/getsentry/sentry-rust/releases)
- [Changelog](https://github.com/getsentry/sentry-rust/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-rust/compare/0.31.6...0.31.7)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: log-time
- dependency-name: sentry
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: log-time
...

Signed-off-by: dependabot[bot] <support@github.com>

* reduce nanoseconds range in arbitrary tests

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
2023-09-20 23:41:05 +00:00
teor 92d6da3531
Fix a subtree comparison edge case (#7587) 2023-09-20 18:58:32 +00:00
teor 7a7d79dfaf
fix(state): Use correct end heights for end of block subtrees during the full sync (#7566)
* Avoid manual handling of previous sapling trees by using iterator windows instead

* Avoid manual sapling subtree index handling by comparing prev and current subtree indexes instead

* Simplify adding notes by using the exact number of remaining notes

* Simplify by skipping the first block, because it can't complete a subtree

* Re-use existing tree update code

* Apply the sapling changes to orchard subtree updates

* add a reverse database column family iterator function

* Make skipping the lowest tree independent of iteration order

* Move new subtree checks into the iterator, rename to end_height

* Split subtree calculation into a new method

* Split the calculate and write methods

* Quickly check the first subtree before running the full upgrade

* Do the quick checks every time Zebra runs, and refactor slow check error handling

* Do quick checks for orchard as well

* Make orchard tree upgrade match sapling upgrade code

* Upgrade subtrees in reverse height order

* Bump the database patch version so the upgrade runs again

* Reset previous subtree upgrade data before doing this one

* Add extra checks to subtree calculation to diagnose errors

* Use correct heights for subtrees completed at the end of a block

* Add even more checks to diagnose issues

* Instrument upgrade methods to improve diagnostics

* Prevent modification of re-used trees

* Debug with subtree positions as well

* Fix an off-by-one error with completed subtrees

* Fix typos and confusing comments

Co-authored-by: Marek <mail@marek.onl>

* Fix mistaken previous tree handling and end tree comments

* Remove unnecessary subtraction in remaining leaves calc

* Log heights when assertions fail

* Fix new subtree detection filter

* Move new subtree check into a method, cleanup unused code

* Remove redundant assertions

* Wait for subtree upgrade before testing RPCs

* Fix subtree search in quick check

* Temporarily upgrade subtrees in forward height order

* Clarify some comments

* Fix missing test imports

* Fix subtree logging

* Add a comment about a potential hang with future upgrades

* Fix zebrad var ownership

* Log more info when add_subtrees.rs fails

* cargo fmt --all

* Fix unrelated clippy::unnecessary_unwrap

* cargo clippy --fix --all-features --all-targets; cargo fmt --all

* Stop the quick check depending on tree de-duplication

* Refactor waiting for the upgrade into functions

* Wait for state upgrades whenever the cached state is updated

* Wait for the testnet upgrade in the right place

* Fix unused variable

* Fix a subtree detection bug and comments

* Remove an early reference to reverse direction

* Stop skipping subtrees completed at the end of blocks

* Actually fix new subtree code

---------

Co-authored-by: Marek <mail@marek.onl>
2023-09-19 14:49:36 +00:00
dependabot[bot] 4f6d28f9b1
build(deps): bump the formats group with 1 update (#7577)
Bumps the formats group with 1 update: [serde_json](https://github.com/serde-rs/json).

- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.106...v1.0.107)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: formats
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 18:42:35 +00:00
dependabot[bot] c2764c8c1b
build(deps): bump the crypto group with 1 update (#7550)
Bumps the crypto group with 1 update: [ed25519-zebra](https://github.com/ZcashFoundation/ed25519-zebra).

- [Release notes](https://github.com/ZcashFoundation/ed25519-zebra/releases)
- [Changelog](https://github.com/ZcashFoundation/ed25519-zebra/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ZcashFoundation/ed25519-zebra/compare/4.0.2...4.0.3)

---
updated-dependencies:
- dependency-name: ed25519-zebra
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: crypto
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: teor <teor@riseup.net>
2023-09-14 18:07:54 +00:00
dependabot[bot] 70d34a6d4b
build(deps): bump the formats group with 2 updates (#7526)
Bumps the formats group with 2 updates: [serde_json](https://github.com/serde-rs/json) and [bytes](https://github.com/tokio-rs/bytes).


Updates `serde_json` from 1.0.105 to 1.0.106
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.105...v1.0.106)

Updates `bytes` from 1.4.0 to 1.5.0
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.4.0...v1.5.0)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: formats
- dependency-name: bytes
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: formats
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-12 00:33:20 +00:00
dependabot[bot] 3ec142d2ee
build(deps): bump the log-time group with 1 update (#7527)
Bumps the log-time group with 1 update: [chrono](https://github.com/chronotope/chrono).

- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.29...v0.4.30)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: log-time
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-11 21:59:04 +00:00
dependabot[bot] e5a2f307a8
build(deps): bump the crypto group with 2 updates (#7524)
Bumps the crypto group with 2 updates: [blake2b_simd](https://github.com/oconnor663/blake2_simd) and [blake2s_simd](https://github.com/oconnor663/blake2_simd).


Updates `blake2b_simd` from 1.0.1 to 1.0.2
- [Commits](https://github.com/oconnor663/blake2_simd/compare/1.0.1...1.0.2)

Updates `blake2s_simd` from 1.0.1 to 1.0.2
- [Commits](https://github.com/oconnor663/blake2_simd/compare/1.0.1...1.0.2)

---
updated-dependencies:
- dependency-name: blake2b_simd
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: crypto
- dependency-name: blake2s_simd
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: crypto
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-11 17:56:41 +00:00
dependabot[bot] 885ee71195
build(deps): bump the log-time group with 2 updates (#7493)
Bumps the log-time group with 2 updates: [chrono](https://github.com/chronotope/chrono) and [thiserror](https://github.com/dtolnay/thiserror).


Updates `chrono` from 0.4.28 to 0.4.29
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.28...v0.4.29)

Updates `thiserror` from 1.0.47 to 1.0.48
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.47...1.0.48)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: log-time
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: log-time
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-06 02:44:01 +00:00
teor 8a3e8f8432
Match zcashd's getblockchaininfo capitalisation for NU5 (#7454) 2023-09-05 23:07:26 +00:00
dependabot[bot] cc2dbe32da
build(deps): bump the time group with 1 update (#7455)
Bumps the time group with 1 update: [chrono](https://github.com/chronotope/chrono).

- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.27...v0.4.28)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: time
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-05 19:06:57 +00:00
teor cc61bd50b9
change(state): Add note subtree indexes for new and existing blocks (#7437)
* Copy the add_subtrees upgrade from the original branch

* Copy the database write changes in shielded.rs from the original branch

* Copy the tree API changes from the original branch

* Simplify subtree APIs to avoid exposing frontiers

* Fix a dead code warning by re-using existing methods

* Use mpsc::Receiver<CancelFormatChange> in the subtree upgrade

* Run the subtree upgrade on startup

* Bump the database format version to 25.2.0

* Fix a confusing 'upgrade complete' log

* Clarify some comments and error messages

* Simplify prev_tree unwrap to avoid an (impossible?) concurrency bug

* Use separate subtree writing functions

* Use common note commitment list code

* Fix subtree completion condition and add asserts

* Simplify subtree API and avoid exposing Address

* Fix API compatibility when Arcs are removed

* Log when each subtree is added

* If a format change is cancelled, don't mark the database as upgraded or do format checks

* Log subtree progress about once every two minutes

* Adds a state validity check for subtrees upgrade

* Orchard is faster, decrease log interval

* Clarify subtree index docs

* Move a log to the correct location

* Refactor subtree upgrade to remove duplicate inverted loop conditions

* updates subtree state validity check

* Add a subtree format check when there is no upgrade

* Fix an off-by-one error with the final subtree check

* Use error-level logs for database format checks

* Skip format checks in tests that create invalid formats

* fix state validity test

* Add a concurrency comment to subtree by height methods

* Add individual subtree state methods: reverts removing these methods in an earlier PR

* fastmod "subtrees_by_index" "subtree_list_by_index_for_rpc"

---------

Co-authored-by: arya2 <aryasolhi@gmail.com>
2023-09-05 16:52:06 +00:00
teor 97b43fb4a6
Format subtree roots in little-endian order (#7466) 2023-09-05 12:27:26 +00:00
teor 188d06e7a1
change(state): Add state requests and support code for the `z_getsubtreesbyindex` RPC (#7408)
* Make NoteCommitmentSubtreeIndex compatible with serde-based RPCs

* Add a stub for z_getsubtreesbyindex

* Define a GetSubtrees RPC response type

* Reject invalid shielded pool names

* Make limit optional

* Define state request and response types for subtrees

* Implement FromDisk for NoteCommitmentSubtreeIndex and add a round-trip test

* Make subtrees compatible with round-trip proptests

* Add finalized state subtree list methods and delete unused methods

* Remove Arc from subtrees in zebra-chain

* Remove Arc from subtrees in zebra-state and use BTreeMap

* Implement subtree list lookups in the non-finalized state and delete unused methods

* Implement consistent concurrent subtree read requests

* Implement ToHex for sapling::Node

* Implement ToHex for orchard::Node

* Implement z_get_subtrees_by_index RPC

* Check for the start_index from the non-finalized state

* Remove an unused mut

* Fix missing doc links

* Fix RPC comments

* Temporarily remove the z_get_subtrees_by_index RPC method
2023-09-03 22:18:41 +00:00
Alfredo Garcia 6f503049c6
Release Zebra v1.2.0 (#7431)
* chore: Release

* change estimated release height

* add 1.2.0 changelog

* apply suggestions to changelog

Co-authored-by: teor <teor@riseup.net>

* remove item

* change release date to today

---------

Co-authored-by: teor <teor@riseup.net>
2023-09-01 20:45:20 +00:00
Alfredo Garcia e567ab812d
change(deps): Run `cargo update` (#7429)
* cargo update

* update rustls duplicated dependency version

* replace deprecated function
2023-08-31 00:49:01 +00:00
dependabot[bot] a2b5e4b3be
build(deps): bump the test group with 1 update (#7401)
Bumps the test group with 1 update: [proptest-derive](https://github.com/proptest-rs/proptest).

- [Release notes](https://github.com/proptest-rs/proptest/releases)
- [Changelog](https://github.com/proptest-rs/proptest/blob/0.4.0/CHANGELOG.md)
- [Commits](https://github.com/proptest-rs/proptest/compare/proptest-derive-0.3.0...0.4.0)

---
updated-dependencies:
- dependency-name: proptest-derive
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: test
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
2023-08-30 01:32:50 +00:00
dependabot[bot] e58000f07f
build(deps): bump the formats group with 2 updates (#7400)
Bumps the formats group with 2 updates: [serde](https://github.com/serde-rs/serde) and [regex](https://github.com/rust-lang/regex).


Updates `serde` from 1.0.185 to 1.0.188
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.185...v1.0.188)

Updates `regex` from 1.9.3 to 1.9.4
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.9.3...1.9.4)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: formats
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: formats
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: teor <teor@riseup.net>
2023-08-29 04:01:15 +00:00
Arya 94d9155adb
change(state): Add note subtree index handling to zebra-state, but don't write them to the finalized state yet (#7334)
* zebra-chain changes from the subtree-boundaries branch

```sh
git checkout -b subtree-boundaries-zebra-chain main
git checkout origin/subtree-boundaries zebra-chain
git commit
```

* Temporarily populate new subtree fields with None - for revert

This temporary commit needs to be reverted in the next PR.

* Applies suggestions from code review

* removes from_repr_unchecked methods

* simplifies loop

* adds subtrees to zebra-state

* uses split_at, from_repr, & updates state-db-upgrades.md

* Update book/src/dev/state-db-upgrades.md

Co-authored-by: teor <teor@riseup.net>

* renames partial_subtree to subtree_data

* tests that subtree serialization format

* adds raw data format serialization round-trip test

* decrements minor version and skips inserting subtrees in db

---------

Co-authored-by: teor <teor@riseup.net>
2023-08-28 08:50:31 +00:00
teor 62258d51da
0. Add note commitment subtree types to zebra-chain (#7371)
* zebra-chain changes from the subtree-boundaries branch

```sh
git checkout -b subtree-boundaries-zebra-chain main
git checkout origin/subtree-boundaries zebra-chain
git commit
```

* Temporarily populate new subtree fields with None - for revert

This temporary commit needs to be reverted in the next PR.

* Applies suggestions from code review

* removes from_repr_unchecked methods

* simplifies loop

---------

Co-authored-by: arya2 <aryasolhi@gmail.com>
2023-08-28 00:48:16 +00:00
teor 67e3c26190
Avoid expensive cryptographic tree root recalculations in eq() (#7386)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-08-26 01:45:46 +00:00
dependabot[bot] c696c520ce
build(deps): bump the async group with 2 updates (#7360)
* build(deps): bump the async group with 2 updates

Bumps the async group with 2 updates: [tokio](https://github.com/tokio-rs/tokio) and [reqwest](https://github.com/seanmonstar/reqwest).


Updates `tokio` from 1.31.0 to 1.32.0
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.31.0...tokio-1.32.0)

Updates `reqwest` from 0.11.18 to 0.11.19
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.18...v0.11.19)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: async
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: async
...

Signed-off-by: dependabot[bot] <support@github.com>

* update bans

* fix typo in version

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
2023-08-25 20:34:00 +00:00
Alfredo Garcia 000c7b4bc6
fix(clippy): Fix clippy and rustfmt after last releases today (#7381)
* fix clippy and rustfmt after last releases today

* Ignore clippy::arc_with_non_send_sync false positives in proptest code only

* Remove .cargo/config.toml changes that didn't work

---------

Co-authored-by: teor <teor@riseup.net>
2023-08-25 04:08:13 +00:00
Marek e86197f6be
fix(docs): Simplify the docs for nodes in Sapling trees (#7378)
* fix docs build

* fix docs build errors in sapling trees

* fix docs build in sprout joinsplits

* fix doc build in handshake

* fix docs build in zebra-state

* fix docs build in zebrad

* new line fix

* Fix docs

* Simplify importing `bridgetree`

---------

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
2023-08-24 15:55:53 +00:00
Alfredo Garcia 0cc48a322a
fix(docs): docs after new rust version (#7375)
* fix docs build

* fix docs build errors in sapling trees

* fix docs build in sprout joinsplits

* fix doc build in handshake

* fix docs build in zebra-state

* fix docs build in zebrad

* new line fix
2023-08-24 11:31:10 +00:00
dependabot[bot] 31426f3b0e
build(deps): bump the formats group with 2 updates (#7357)
Bumps the formats group with 2 updates: [serde](https://github.com/serde-rs/serde) and [serde_with](https://github.com/jonasbb/serde_with).


Updates `serde` from 1.0.183 to 1.0.185
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.183...v1.0.185)

Updates `serde_with` from 3.2.0 to 3.3.0
- [Release notes](https://github.com/jonasbb/serde_with/releases)
- [Commits](https://github.com/jonasbb/serde_with/compare/v3.2.0...v3.3.0)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: formats
- dependency-name: serde_with
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: formats
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-21 21:05:24 +00:00
dependabot[bot] 7123701183
build(deps): bump the log group with 2 updates (#7355)
Bumps the log group with 2 updates: [thiserror](https://github.com/dtolnay/thiserror) and [inferno](https://github.com/jonhoo/inferno).


Updates `thiserror` from 1.0.46 to 1.0.47
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.46...1.0.47)

Updates `inferno` from 0.11.15 to 0.11.16
- [Changelog](https://github.com/jonhoo/inferno/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jonhoo/inferno/compare/v0.11.15...v0.11.16)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: log
- dependency-name: inferno
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: log
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-21 21:04:54 +00:00
Marek d8f5d6b6f1
change(state): Deduplicate note commitment trees stored in the finalized state (#7312)
* Add support for deleting the trees

* Prune the trees

* Remove `Network` from `DiskWriteBatch`

Removing the `Network` from `DiskWriteBatch` makes it easy to
instantiate `DiskWriteBatch`es in `ZebraDb` that remove individual note
commitment trees.

The `Network` from `DiskWriteBatch` was used only for transparent
addresses, so the refactor isn't large. After removing it from
`DiskWriteBatch`, I passed it as a function argument instead. However,
we should simplify the parameter lists because at least two functions
have more than seven parameters now.

* Support individual tree removal in `ZebraDb`

* Refactor the tree removal task

* Prune old comments

* Remove redundant code

* Batch the removals

* delete ranges before relevant network upgrades

* moves prev_tree inits

* add iterator methods for reading note commitment trees

* Sets up skeleton of sapling pipeline

* Replaces .filter with .take_while

Fills in pipeline

Reuses zs_range_iter instead of repeating that code

Updates logic to stop at initial tip height

* uses std threads

* delete_range excludes end key

* fixes off by one bugs

* Log warning when a send fails

* Removes progress logs

* Log join errors instead of panicking

* Revert: Make the `db` field of `ZebraDb` private

* Move `delete_range_sapling_tree`

* Remove a redundant `else if` branch

Rationale:

The condition `n == 1` for the removed branch is true for a subset of
values of `n` in the preceding condition `n >= 1`.

* Use more specific error messages

* Revert: Remove redundant methods for tree removal

* Suggestions for Deduplicate note commitment trees stored in the finalized state (#7330)

* Add TODOs to some `Height` methods

* Add methods for deleting individual trees

* Refactor the tasks for deleting trees

---------

Co-authored-by: arya2 <aryasolhi@gmail.com>
2023-08-17 00:41:11 +00:00
dependabot[bot] b0003076c3
build(deps): bump the data-structures group with 1 update (#7327)
Bumps the data-structures group with 1 update: [bitflags](https://github.com/bitflags/bitflags).

- [Release notes](https://github.com/bitflags/bitflags/releases)
- [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bitflags/bitflags/compare/2.3.3...2.4.0)

---
updated-dependencies:
- dependency-name: bitflags
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: data-structures
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-16 19:17:49 +00:00
dependabot[bot] 22b4c061ba
build(deps): bump the async group with 1 update (#7323)
Bumps the async group with 1 update: [tokio](https://github.com/tokio-rs/tokio).

- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.29.1...tokio-1.31.0)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: async
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-16 16:10:32 +00:00
dependabot[bot] 951469956f
build(deps): bump the formats group with 2 updates (#7336)
Bumps the formats group with 2 updates: [serde](https://github.com/serde-rs/serde) and [serde_json](https://github.com/serde-rs/json).


Updates `serde` from 1.0.179 to 1.0.183
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.179...v1.0.183)

Updates `serde_json` from 1.0.104 to 1.0.105
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.104...v1.0.105)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: formats
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: formats
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-16 16:09:51 +00:00
dependabot[bot] 7605a3376b
build(deps): bump the log group with 2 updates (#7337)
Bumps the log group with 2 updates: [thiserror](https://github.com/dtolnay/thiserror) and [log](https://github.com/rust-lang/log).


Updates `thiserror` from 1.0.44 to 1.0.46
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.44...1.0.46)

Updates `log` from 0.4.19 to 0.4.20
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.19...0.4.20)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: log
- dependency-name: log
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: log
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-16 11:10:03 +00:00
dependabot[bot] e2bf4aa330
build(deps): bump the formats group with 4 updates (#7298)
Bumps the formats group with 4 updates: [serde](https://github.com/serde-rs/serde), [regex](https://github.com/rust-lang/regex), [serde_json](https://github.com/serde-rs/json) and [serde_with](https://github.com/jonasbb/serde_with).


Updates `serde` from 1.0.175 to 1.0.179
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.175...v1.0.179)

Updates `regex` from 1.9.1 to 1.9.3
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.9.1...1.9.3)

Updates `serde_json` from 1.0.103 to 1.0.104
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.103...v1.0.104)

Updates `serde_with` from 3.1.0 to 3.2.0
- [Release notes](https://github.com/jonasbb/serde_with/releases)
- [Commits](https://github.com/jonasbb/serde_with/compare/v3.1.0...v3.2.0)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: formats
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: formats
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: formats
- dependency-name: serde_with
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: formats
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2023-08-10 22:28:00 +00:00
Marek 57c9249141
change(state): Insert only the first tree in each series of identical trees into finalized state (#7266)
* Pass ZebraDB to batch preparation

* Dedup the insertion of Sapling trees into database

* Dedup the insertion of Orchard trees into database

* Update snapshots

* Rename batch preparation of trees

* Simplify the naming of note commitment trees

* Correctly retrieve Sapling trees from fin state

* Correctly retrieve Orchard trees from fin state

* Simplify the naming of methods for Sprout trees

* Simplify the naming of methods for Sapling trees

* Simplify the naming of methods for Orchard trees

* Reduce disk reads by caching trees. (#7276)

* Bump the state minor version

* Reset the state patch version

* Simplify the preparation of genesis trees

* Store the roots of the trees of the genesis block

* Add the genesis roots to snapshots

* fix(test): Don't include shielded data in genesis blocks (#7302)

* fix(state): Fix marking format upgrades (#7304)

---------

Co-authored-by: Arya <aryasolhi@gmail.com>
2023-08-09 00:32:27 +00:00
dependabot[bot] b8dd54081d
build(deps): bump the formats group with 1 update (#7283)
Bumps the formats group with 1 update: [serde](https://github.com/serde-rs/serde).

- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.171...v1.0.175)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: formats
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-25 02:22:22 +00:00
dependabot[bot] bce8e1a842
build(deps): bump the log group with 1 update (#7281)
Bumps the log group with 1 update: [thiserror](https://github.com/dtolnay/thiserror).

- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.43...1.0.44)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: log
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-24 20:20:22 +00:00
Arya a6bdb480bb
Release Zebra v1.1.0 (#7259)
* Updates dependencies

* Dedups bindgen, removes windows-sys from deny.toml

* Updates checkpoints

* chore: Release

* Adds changelog draft

* updates estimated_release_height

* Updates changelog

* Apply suggestions from code review

Co-authored-by: teor <teor@riseup.net>

---------

Co-authored-by: teor <teor@riseup.net>
2023-07-22 01:18:09 +00:00
teor c3e7d749ed
fix(log): Limit verbose RPC responses in logs (#7258)
* Truncate verbose RPC responses in test logs

* Downgrade verbose block template state log to debug
2023-07-21 20:35:56 +00:00
Marek 9ebd56092b
change(test): Refactor the tests of non-finalized state (#7262)
* Allow generating blocks with only coinbase tx

* Fix the `forked_equals_pushed_genesis` test
2023-07-19 21:20:37 +00:00
Pili Guerra 7f64ff35a4
add(metrics): Track mempool actions and size bucketed by weight (copy of #6972, credit @str4d) (#7019)
* metrics: Track mempool actions and size bucketed by weight

* Fix tests

* draft fix tests

* fix `fix_arbitrary_generated_action_overflows`

* add some docs

* manually derive arbitrary

* remove unused import

---------

Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Marek <mail@marek.onl>
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
2023-07-18 23:04:32 +00:00
Marek 1db4f567f7
change(state): Deduplicate note commitment trees in non-finalized state (#7239)
* Remove duplicate asserts

There are the same two asserts above the two removed ones.

* Remove workarounds for inserting trees into NFS

NFS = non finalized state

* Use correct height for constructing new chain

We were using the height of the last block instead of the initial block
to construct a new chain.

* Don't push the 0th block into a chain

* Don't commit two blocks at the same height

* Add helpers for heights

* Support the retrieval of deduped Sprout trees

* Dedup Sprout trees

* Refactor docs for adding & removing Sprout trees

* Support the retrieval of deduped Sapling trees

* Dedup Sapling trees

* Refactor docs for adding & removing Sapling trees

* Support the retrieval of deduped Orchard trees

* Dedup Orchard trees

* Refactor docs for adding & removing Orchard trees

* Make the docs for storing trees clearer
2023-07-18 23:04:11 +00:00
dependabot[bot] 3e75cb50f6
build(deps): bump the crypto group with 1 update (#7222)
Bumps the crypto group with 1 update: [reddsa](https://github.com/ZcashFoundation/reddsa).

- [Release notes](https://github.com/ZcashFoundation/reddsa/releases)
- [Changelog](https://github.com/ZcashFoundation/reddsa/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ZcashFoundation/reddsa/compare/0.5.0...0.5.1)

---
updated-dependencies:
- dependency-name: reddsa
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: crypto
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-18 12:13:51 +00:00
Arya 62f717244b
cleanup(deps): Bump sha2 and secp256k1 to remove duplicate dependencies (#7238)
* Bumps sha2/secp256k1, updates deny.toml

* removes unused import, updates method calls
2023-07-18 07:13:40 +00:00
Marek f9a5635105
fix(state): Remove workarounds for storing trees (#7218)
* Remove duplicate asserts

There are the same two asserts above the two removed ones.

* Remove workarounds for inserting trees into NFS

NFS = non finalized state

* Use correct height for constructing new chain

We were using the height of the last block instead of the initial block
to construct a new chain.

* Don't push the 0th block into a chain

* Don't commit two blocks at the same height

* Fix typo

* Generate chains with at least two blocks

---------

Co-authored-by: teor <teor@riseup.net>
2023-07-18 04:54:22 +00:00
teor 3bbe3cec4f
fix(panic): Stop panicking on async task cancellation on shutdown in network and state futures (#7219)
* Add an async-error feature and an initial module structure

* Implement checking for panics in OS threads and async tasks

* Implement waiting for panics in OS threads and async tasks

* Add a TODO to simplify some state request error handling

* Use the new panic-checking methods in zebra-state

* Use new panic-checking methods in zebra-network

* fixup! Implement waiting for panics in OS threads and async tasks

* Replace existing async code with generic panic-checking methods

* Simplify trait to a single method

* Move thread panic code into generic trait impls

* Simplify option handling

Co-authored-by: Arya <aryasolhi@gmail.com>

* Fix comment

Co-authored-by: Arya <aryasolhi@gmail.com>

* Add missing track_caller

---------

Co-authored-by: Arya <aryasolhi@gmail.com>
2023-07-18 04:53:26 +00:00
Alfredo Garcia e2f010eb4f
build(deps): update ecc dependencies for `zcashd` 5.6.0, and create legacy state format compatibility layer (#7053)
* update ecc dependencies no serialization

* use zcash_primitives merke tree functions for serialization/deserialization in orchard and sapling trees

* some more work in sapling/orchard serialization/deserialization

* clippy

* fix doc links

* fix missing doc

* make orchard trees serializa/deserialize as they were before upgrade

* make sapling trees serialize/deserialize as they were before upgrade

* use legacy for sprout

* remove unused code

* readd snapshot tests

* repalce some code

* upgrade zcash_proofs

* remove legacy code for sprout

* fix the count method

* add root to serialize

* fixes in as_bytes and from_bytes

* use legacy code

* add todo about pow2 tests

* remove unused sprout code

* fix doc typos

* Add a recalculate_root() method to trees for tests

* Rename test tree types to make them easier to change

* Add TODOs for tests for old and new serialization formats

* fix doc typos

* add more test to note commitment trees

* fix comment

* fix leaf serializatiuon, reverse to old hashes in pow2 tests

* fix serialization

* put sapling SerializedTree code back

* put orchard SerializedTree code back

* clippy

* add duplicated dependencies until zebra_script updates

* fix a doc link

* minor cleanup

* remove todo comment from tests

* add one more check to tests

* update zebra_script

* update deny.toml

* replace custom function with library

* fix some tests

* update docs

* Remove duplicate dependencies from deny.toml

Based on the list at:
https://github.com/ZcashFoundation/zebra/actions/runs/5557139662/jobs/10150543673?pr=7053#step:5:14

---------

Co-authored-by: teor <teor@riseup.net>
2023-07-17 22:06:27 +00:00
dependabot[bot] 3b34e48bf2
build(deps): bump the ed25519-zebra group with 1 update (#7188)
* cargo upgrade --workspace ed25519-zebra x25519-dalek; cargo check

* Remove unused libm dependency exception

---------

Co-authored-by: teor <teor@riseup.net>
2023-07-12 23:59:49 +00:00
teor f9a48266ad
change(test): Add a recalculate_root() method to trees for tests (#7204)
* Add a recalculate_root() method to trees for tests

* Rename test tree types to make them easier to change

* Add TODOs for tests for old and new serialization formats

* fix doc typos

---------

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
2023-07-12 17:07:10 +00:00
dependabot[bot] 0d332646bf
build(deps): bump the serde group with 1 update (#7184)
Bumps the serde group with 1 update: [serde](https://github.com/serde-rs/serde).

- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.166...v1.0.168)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: serde
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-10 08:27:21 +00:00
dependabot[bot] 8c5bcb7487
build(deps): bump thiserror from 1.0.41 to 1.0.43 (#7174)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.41 to 1.0.43.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.41...1.0.43)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-10 03:37:10 +00:00