Commit Graph

5609 Commits

Author SHA1 Message Date
Conrado Gouvea da9e9235ec cargo fmt 2025-06-03 18:29:36 -03:00
Conrado Gouvea 57d1f14e2d fix docs links 2025-06-03 18:21:58 -03:00
Conrado Gouvea ec27deda70 add docs 2025-06-03 18:21:22 -03:00
Conrado Gouvea 6edfc82811 re-export types and flatten API 2025-06-03 18:21:22 -03:00
Conrado Gouvea fc70e00738 remove GetBlockhashResponse where not strictly needed 2025-06-03 18:21:22 -03:00
Conrado Gouvea e668d5f837 rpc: overall API cleanup 2025-06-03 18:21:20 -03:00
Conrado Gouvea f748d3781c
rpc: add deserialization tests (#9550)
* rpc: add deserialization tests

* move vectors to files; address misc comments
2025-06-03 20:49:57 +00:00
Arya e14d1d8e40
change(state): Upgrade db format to support new fields in RPC outputs (#9539)
* updates book/../state-db-upgrades.md

* updates zebra-consensus with the changes from PR #9432 and minor test changes from #9295

* updates zebra-chain with the changes from PR #9432

* updates imports in zebra-rpc

* Merges and applies changes to zebra-state from PRs #9295 and #9432

* adds a TODO.

* minor update to zebra-rpc to use the new ReadResponse::AddressBalance type

* renames add_block_info db upgrade

* moves migration from `add_balance_received` to `block_info_and_address_received`

* replaces `write` with `write_batch`

* update disk format snapshots

* combines partial_transparent_balance_change() and partial_transparent_received_change()

* fixes typo

* Replaces redundant code with a call to `construct_column_families()`

* refactors `AddressBalanceLocation` and `AddressBalanceLocationChange` into a newtypes around a common inner type.

* fixes lints and doc compilation issue

* updates snapshots

* bumps the db format version to the next major version (27.0.0) instead of the next minor version (26.1.0)

* fixes clippy lint, minor cleanups

* fixes lint

* applies suggestions from code review

* fixes a mistake in `is_reusable_major_upgrade` where v26.0.0 is not a restorable db version

* Fixes an issue around marking an upgraded db format in the disk version file before completing migrations when reusing a previous major db format and restarting Zebrad before the migration is complete.

* Apply suggestions from code review

---------

Co-authored-by: Gustavo Valverde <gustavo@iterativo.do>
2025-06-03 20:49:53 +00:00
Gustavo Valverde c8be9944cf
fix(ci): pin lightwalletd to v0.4.17 to prevent CI failures (#9575)
Pin lightwalletd container to v0.4.17 instead of using latest tag.
The latest version (v0.4.18) broke our lightwalletd integration tests,
causing CI pipeline failures.

Using pinned versions prevents unexpected test failures when upstream
dependencies change and gives us control over when to update and test
compatibility.
2025-06-03 16:10:34 +00:00
Arya d230f31c5a
change(consensus): Adds a `Nu6_1` variant to `NetworkUpgrade` (#9526)
* Adds a `Nu6_1` variant to `NetworkUpgrade`

* updates CONSENSUS_BRANCH_IDS to include NU6.1 and NU7 when compiled with the `zebra-test` feature

* Update zebra-chain/src/parameters/network/testnet.rs

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>

---------

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2025-06-03 16:10:30 +00:00
Arya f8de752f52
change(deps): Allow Zebra crates to be compiled with alternative versions of their dependencies (#9484)
* Avoid pinning Zebra crate dependencies to specific patch versions

* re-bump packages with required functionality

---------

Co-authored-by: Conrado Gouvea <conrado@zfnd.org>
2025-06-03 16:10:25 +00:00
Gustavo Valverde 1ab3b0f77c
fix(ci): prevent Google Cloud workflow failures on fork PRs (#9573)
- Add missing fork condition to build job in main CD workflow
- Fix inverted fork condition in patch-external workflow
- Resolves authentication errors when workflows run from forked repositories
2025-06-03 14:01:50 +01:00
Gustavo Valverde 2e60cedd30
refactor(ci): Run standard GitHub runners in forks and clones (#9362)
* refactor(ci): remove larger runners to allow running on forks

* fix(ci): some tests can't run with normal runners

* fix(ci): use largest runner for crates build

* fix(ci): log runner being used

* fix(ci): use the corect variable reference

* fix(ci): use the same approach on all the jobs

* chore: use the same runner as before

* imp: single liner

* chore: reduce diff

---------

Co-authored-by: Conrado Gouvea <conrado@zfnd.org>
2025-05-30 16:33:04 +00:00
Arya 806fcab1d2
add(process): Add hotfix release checklist (#9544)
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
2025-05-26 22:59:09 +01:00
Jack Grigg 694d11c7ac
tower-batch-control: Fix `Batch::new` compilation with `tokio_unstable` (#9547) 2025-05-26 15:19:34 +01:00
Gustavo Valverde 7c6b2f9e32
refactor(ci): Simplify cached disk selection logic (#9545) 2025-05-26 15:08:31 +01:00
Alfredo Garcia cbd1bb7fc3
feat(rpc): Update `(z_)validateaddress` to validate TEX addresses (#9483)
* add TEX support to validate address rpc methods

* update call docs

* fix comment

Co-authored-by: Conrado Gouvea <conrado@zfnd.org>

---------

Co-authored-by: Conrado Gouvea <conrado@zfnd.org>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2025-05-22 15:12:37 +00:00
Alfredo Garcia 5cc4357acb
add raw_value feature to serde_json (#9538) 2025-05-22 14:42:10 +00:00
Gustavo Valverde d3211081f9
feat(ci): Enable stateful MIGs and fix release deployment skipping (#9516)
* fix(ci): Ensure release deployments run and improve script clarity

This addresses several issues in the CD workflow:

- Modifies the 'build' job to remove its dependency on 'get-disk-name'.
  This allows the 'build' job and subsequently 'deploy-nodes' to run
  during release events, as 'get-disk-name' is intentionally skipped
  for releases.
- Updates the 'Create instance template' script in 'deploy-nodes' to
  correctly handle disk parameters for release events. It now ensures
  that release deployments attempt to use the existing persistent disk
  (e.g., 'zebrad-cache-mainnet') for state continuity, rather than
  relying on a dynamic cached image from the (skipped) 'get-disk-name' job.
- Refactors in-script comments within the 'deploy-nodes' job and moved them to the top, to avoid clutter in the script

* feat(ci): Implement stateful disk policy for release MIGs

This commit introduces a new step "Configure stateful disk policy for
release MIG" to the `deploy-nodes` job in the
`.github/workflows/cd-deploy-nodes-gcp.yml` workflow.

For `release` events, this step applies a stateful policy to the
Managed Instance Group (MIG) using the command:
`gcloud compute instance-groups managed set-stateful-policy`.

The policy is configured with
`--stateful-disk "device-name=zebrad-cache-${NETWORK},auto-delete=never"`.
This ensures that the specified data disk, which holds the Zebra node's
state, is preserved during instance recreations or updates within the MIG,
maintaining data persistence for production release deployments.
2025-05-22 14:30:13 +00:00
Jack Grigg a77de50cae
zebra-rpc: Correctly set optional `scriptPubKey` fields of transactions (#9536)
Closes ZcashFoundation/zebra#9535.
2025-05-16 23:07:06 +00:00
Arya cc062510a2
fix(clippy, build): fix latest Clippy lints introduced in v1.87.0 and migrate from vergen to vergen_git (#9531)
* fixes new lints

* rustfmt

* migrates from vergen to vergen_git2
2025-05-16 15:00:07 +00:00
Alfredo Garcia d171f4a509
remove test-scanner from CI (#9530) 2025-05-15 20:56:57 +00:00
idky137 8b9fdd073d
Transaction and block deserialization (#9522)
* added deserialisation to block and transaction structs

* fixed new test

* made TransactionObject::from_transaction pub

* renamed valueZat to valueSat

* removed double serde(with_hex)

* fixed script sig name

* Update zebra-chain/src/sapling/commitment.rs

Co-authored-by: Conrado Gouvea <conradoplg@gmail.com>

* qualify cursor

---------

Co-authored-by: Conrado Gouvea <conradoplg@gmail.com>
Co-authored-by: Hazel OHearn <gygaxis@zingolabs.org>
Co-authored-by: Conrado Gouvea <conrado@zfnd.org>
2025-05-14 23:19:25 +00:00
Marek 67bfc941fe
fix(rpc): Regroup imports (#9521)
* Regroup imports in `.../tests/common/regtest.rs`

* Regroup imports in `.../methods/tests/prop.rs`

* Regroup imports in `.../get_block_template.rs`

* Regroup imports in `.../zip317.rs`

* Regroup imports in `.../get_blockchain_info.rs`

* Regroup imports in `.../types/get_raw_mempool.rs`

* Regroup imports in `.../types/transaction.rs`

* Regroup imports in `.../server/tests/vectors.rs`

* Regroup imports in `.../args.rs`

* Regroup imports in `.../main.rs`

* Regroup imports in `.../openapi-generator/main.rs`

* Regroup imports in `zebrad/src/commands/start.rs`

* Regroup imports in `.../tests/fake_peer_set.rs`

* Regroup imports in `.../components/miner.rs`

* Regroup imports in `.../tests/acceptance.rs`

* Regroup imports in `.../get_block_template.rs`
2025-05-14 18:36:05 +00:00
Marek 89f825265a
change(rpc): Move GBT RPCs into the main RPC server (#9459)
* Remove the `getblocktemplate-rpcs` Cargo feature

* Merge GBT RPCs with the rest

* Fix `rpc_server_spawn_port_conflict`

* Fix snapshot data

* Remove old files after merge

* Fix snapshot for `get_mining_info`

* Fix refs in docs

* Update snapshot data for `bet_block_count`

* Update snapshot data for `get_minig_info`

* Fix snapshots

* Fix RPC tests

* Unguard internal miner config

* remove getblocktemplate file (#9485)

* Fix imports in `zebra-rpc/src/server.rs`

* Fix imports in `zebra-rpc/src/methods.rs`

* Rename vars in `RpcImpl::new`

* Split imports in `.../methods/tests/snapshot.rs`

* Refactor imports in `.../methods/tests/vectors.rs`

* Update error log messages

* fmt

* Fix snapshots with missing peers

* fmt

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
2025-05-09 09:56:54 +00:00
ala-mode ca51c39003
update README with Arch build patch (#9513)
* update readme with GCC on Arch patch

* suggested change
2025-05-08 07:46:59 +00:00
Alfredo Garcia 3a99279690
use `RawValue` instead of `Value` for the `result` field of `JsonRpcResponse` (#9474) 2025-05-07 10:19:15 +00:00
Alfredo Garcia 0ca510b7cb
fix z_get_treestate optional values (#9451) 2025-05-06 22:09:17 +00:00
Marek b0e7fd4a9a
chore: Release v2.3.0 (#9475)
* Update changelog

* Update end of support

* Add release date

* Add breaking change description

* Add new PRs to changelog

* Add breaking change description to changelog

* Update list of PRs in changelog

* chore: Release

* Apply suggestions from code review

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

---------

Co-authored-by: Arya <aryasolhi@gmail.com>
2025-05-06 14:47:47 +00:00
Alfredo Garcia 638b4a212d
feat(rpc): Add `time` and `size` field to `TransactionObject` (#9458)
* add size and time to getrawtransaction object

* fix annoying clippy lint about large enum variant

* add todo

* add TODO, remove TODO

Co-authored-by: Conrado Gouvea <conrado@zfnd.org>

---------

Co-authored-by: Conrado Gouvea <conrado@zfnd.org>
2025-05-06 08:44:03 +00:00
Arya 188cb77081
fix(ci): check, create and mount lwd cached state for tests (#9481)
Co-authored-by: Gustavo Valverde <g.valverde02@gmail.com>
2025-05-06 07:58:02 +01:00
Alfredo Garcia ee65be98c5
fix(usability): Improve the cache dir and database startup panics (#9441)
* improve cache dir database panics

* Apply suggestions from code review

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

* fix build

---------

Co-authored-by: Arya <aryasolhi@gmail.com>
2025-05-06 01:01:53 +00:00
Marek 3423e6c71c
Update `Cargo.lock` (#9467) 2025-05-06 00:00:46 +00:00
Conrado Gouvea 33a416b719
fix(ci): change dependabot to only update lockfile (#9416) 2025-05-05 22:01:36 +00:00
Marek 1e25546955
chore: Add checkpoints (#9466)
* Add Mainnet checkpoints

* Add Testnet checkpoints
2025-05-05 20:48:07 +00:00
Marek 7cd185855c
chore: Update docs (#9469)
* Simplify `README.md`

* Remove a resolved issue from known issues

* Simplify the PR template
2025-04-29 14:20:54 +00:00
Gustavo Valverde 12b3d5ea41
fix(ci): use log exit code instead of docker stop (#9465)
Tests in `sub-test-zebra-config.yml` were failing in some instances with exit code 137 (SIGKILL) or 139 (SIGSEGV) during the `docker stop` phase, even when the preceding log check (`grep`) succeeded. This occurred because zebrad sometimes doesn't shut down gracefully within the default docker stop timeout.

This change modifies the exit logic to return status 0 if the grep command passes, regardless of the exit code from `docker wait`. This aligns the step result with the actual test outcome determined by log analysis and mirrors the fix from PR #8107.

Ref: #7898
2025-04-29 13:49:32 +00:00
natalie 94f2e98dc1
refactor(chain): replace sinsemilla with external library (#9426)
* Replace sinsemilla with external library (#7801)

* Update zebra-chain/src/orchard/sinsemilla.rs

Co-authored-by: Conrado Gouvea <conrado@zfnd.org>

---------

Co-authored-by: Pili Guerra <1311133+mpguerra@users.noreply.github.com>
Co-authored-by: Conrado Gouvea <conrado@zfnd.org>
2025-04-25 14:37:15 +00:00
Gustavo Valverde 8408dc33ae
refactor(ci): simplify Docker tagging to remove redundant tags (#9431)
- Removed `latest_tag` and `tag_suffix` inputs from Docker build workflow, as those are no longer required.
- Split SHA tagging into PR and branch events for clarity.
- Removed tag event references and flavor customizations to prevent redundant tags.
- Updated comments for clarity on tag purposes.

Closes #7415
2025-04-25 10:12:11 +00:00
Paul e6dc3b6fd3
NU7 constants (#9256)
* Introduce Nu7

* Introduce Nu7 fo other crates of Zebra

* Fix of new_regtest call (as it additionally needs Nu7 arg now)

* Fix of new_regtest call (as it additionally needs Nu7 arg now) (2)

* Set Nu7 as a network update for testnet in zebra-chain network tests

* Fix serde names for NU7

* Update test snapshot in zebra-rpc to use NU7

* Copy Nu7-related changes from zsa-integration-state

* Uncomment zcash_unstable = nu7

* Fix Nu7 constants and add cfg(zcash_unstable ...) attribute according to PR #15 review comments

* Update network constant values according to PR #15 review comments

* Add zcash_unstable=nu6 Rust flag to .cargo/config.toml to use nu6 by default

* Add zcash_unstable = nu6 cfg in zebra-network/.../types.rs

* Fix nu7 activation heights in network_upgrade.rs (nu6 value + 1 does not work - causes a test failure)

* Add cfg for CURRENT_NETWORK_PROTOCOL_VERSION constant definition, add FIXMEs for a couple of Nu6 processing cases, add processing of Nu7

* Update get_blockchain_info@testnet_10.snap

* Update get_blockchain_info@mainnet_10.snap

* updated cfg flag

* remove `zcash_unstable` flag

* Remove testnet and mainnet NU7 activation heights, comment out consensus branch id and conversion to zcash primitives nu type

* Yep, it'll work after NU7

* Yep, the test should work fine after NU7

* Yep, it only needs to be a post-nu6 height.

* other fixes and cleanups

* Updates snapshots, removes unnecessary FIXMEs, fixes issues with bad merge conflict resolution

* fixes test hang when there are NUs defined without activation heights

* fixes test, applies suggestion from code review.

* Enable consensus branch ID for Nu7

---------

Co-authored-by: Dmitry Demin <dmitry@qed-it.com>
Co-authored-by: Arya <aryasolhi@gmail.com>
Co-authored-by: Marek <mail@marek.onl>
2025-04-21 13:38:44 +00:00
Alfredo Garcia 9002cfcbd3
downgrade info message (#9448) 2025-04-21 11:10:41 +00:00
Tomass fb3c8d80f2
docs: remove consecutive duplicate words (#9446)
* Update get_block_template.rs

* Update vectors.rs

* Update serialize.rs
2025-04-19 16:10:14 +00:00
Kris Nuttycombe 63723e7e84
zebra-state: Return only the history tree root in GetBlockTemplateChainInfo response. (#9444)
The `HistoryTree` type is intended for internal use within the node; it
should not be exposed via the ReadStateService response. Instead, this
response should simply include the hash needed for block template
construction.
2025-04-18 20:57:45 +00:00
Gustavo Valverde 6e039c26c3
fix(ci): set `ZEBRA_CACHE_DIR` in full and checkpoint syncs (#9434)
* fix(ci): set `ZEBRA_CACHE_DIR` in full and checkpoint syncs

Updates the GitHub Actions workflows for GCP integration tests to explicitly set the ZEBRA_CACHE_DIR environment variable to `/home/zebra/.cache/zebra` for the following test jobs:
- regenerate-stateful-disks (Zebra checkpoint sync to mandatory checkpoint)
- test-full-sync (Zebra full sync to tip on Mainnet)
- test-full-sync-testnet (Zebra full sync to tip on Testnet)

The rationale for this change is to address permission issues encountered during tests that attempt to create or access a cached database directory. By setting ZEBRA_CACHE_DIR to a specific path within the user's home directory, we ensure that the test has the necessary write permissions to create and manage the cache directory, avoiding 'Permission denied (os error 13)' errors that occur when using default or system directories without adequate access rights.

* chore: fix typo
2025-04-18 15:16:02 +00:00
Arya 33a44e5f9c
add(mining): Restore internal miner (#9311)
Co-authored-by: Marek <mail@marek.onl>
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2025-04-18 08:29:42 +01:00
Gustavo Valverde c572027ca9
fix(cd): allow to deploy without healthchecks (#9433) 2025-04-17 09:05:42 +00:00
Gustavo Valverde 4e3426c8f3
feat(ci): Centralize zebra configuration testing with Docker (#9423)
* refactor(docker): Enhance Zebra configuration options and entrypoint logic

- Introduced multiple methods for configuring Zebra, including custom config file paths and automatic generation from environment variables.
- Updated entrypoint script to handle configuration more robustly, checking for existing files and generating defaults as needed.
- Improved documentation in `docker.md` to clarify configuration options and their precedence.
- Adjusted environment variable handling in `docker/.env` for better clarity and functionality.
- Refactored `prepare_conf_file` to create a complete configuration based on environment variables, streamlining the setup process.

* fix(docker): remove non-essential variables and set correct defaults

* feat(ci): Centralize zebra configuration testing with Docker

- Replace multiple separate test jobs with a single comprehensive matrix-based test
- Create a new ADR documenting the design decision for centralizing Docker tests
- Move all test scenarios from both CI and CD pipelines into a single reusable workflow
- Define extensive test matrix covering network, RPC, directory, feature configurations
- Improve workflow readability with descriptive test names and clear organization
- Simplify workflow inputs to only require the Docker image identifier

* chore(ci): cleanup jobs that already don't exist
2025-04-16 14:16:27 +00:00
Gustavo Valverde aa7205d660
refactor(docker): Enhance Zebra configuration options and entrypoint logic (#9344)
* refactor(docker): Enhance Zebra configuration options and entrypoint logic

- Introduced multiple methods for configuring Zebra, including custom config file paths and automatic generation from environment variables.
- Updated entrypoint script to handle configuration more robustly, checking for existing files and generating defaults as needed.
- Improved documentation in `docker.md` to clarify configuration options and their precedence.
- Adjusted environment variable handling in `docker/.env` for better clarity and functionality.
- Refactored `prepare_conf_file` to create a complete configuration based on environment variables, streamlining the setup process.

* fix(entrypoint): use correct `ZEBRA_RPC_PORT` variable

This also removes the logic to set the default port for RPC as this was introducing a buggy logic

* fix(docker): remove non-essential variables and set correct defaults

* chore(docker): use the default config for docker-compose as the default approach

* Apply suggestions from code review

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

* chore: better comment for user understanding

* fix(entrypoint): set permissions correctly for parent directories

* chore: align documentation and implementation

* chore: clearer and aligned comments with docker-compose

* fix(entrypoint): chown the zebra config file when `ZEBRA_CONF_PATH` is not set

---------

Co-authored-by: Marek <mail@marek.onl>
2025-04-16 12:27:32 +00:00
Alfredo Garcia 0e05fb3f5c
feat(getaddresstxids): Make start and end fields optional and apply range rules to match zcashd (#9408)
* make start and end fields optional and apply new rules to match zcashd

* update docs to mark range fields as optionals

* Apply suggestions from code review

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

---------

Co-authored-by: Arya <aryasolhi@gmail.com>
2025-04-11 14:33:54 +00:00
Arya 4e1bb0e5e1
change(command): Use read-only db instance when running `tip-height` or `copy-state` commands (#9359)
* read tip height from read-only db instance when running "tip-height" command.

* use ReadStateService for the source state in the copy-state cmd
2025-04-11 12:37:28 +00:00