Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(config): Allow to add keys to be scanned by the zebra-scan crate to config #7949

Merged
merged 3 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5780,8 +5780,10 @@ dependencies = [
"color-eyre",
"ff",
"group",
"indexmap 2.1.0",
"jubjub",
"rand 0.8.5",
"serde",
"tokio",
"zcash_client_backend",
"zcash_note_encryption",
Expand Down Expand Up @@ -5959,6 +5961,7 @@ dependencies = [
"zebra-network",
"zebra-node-services",
"zebra-rpc",
"zebra-scan",
"zebra-state",
"zebra-test",
"zebra-utils",
Expand Down
3 changes: 3 additions & 0 deletions zebra-scan/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ categories = ["cryptography::cryptocurrencies"]
[dependencies]
zebra-chain = { path = "../zebra-chain", version = "1.0.0-beta.31" }

indexmap = { version = "2.0.1", features = ["serde"] }
serde = { version = "1.0.192", features = ["serde_derive"] }

[dev-dependencies]

zcash_client_backend = "0.10.0-rc.1"
Expand Down
23 changes: 23 additions & 0 deletions zebra-scan/src/config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//! Configuration for blockchain scanning tasks.

use indexmap::IndexMap;
use serde::{Deserialize, Serialize};

use crate::storage::SaplingScanningKey;

#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(deny_unknown_fields, default)]
/// Configuration for scanning.
pub struct Config {
/// The sapling keys to scan for and the birthday height of each of them.
// TODO: any value below sapling activation as the birthday height should default to sapling activation.
pub sapling_keys_to_scan: IndexMap<SaplingScanningKey, u32>,
}

impl Default for Config {
fn default() -> Self {
Self {
sapling_keys_to_scan: IndexMap::new(),
}
}
}
1 change: 1 addition & 0 deletions zebra-scan/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#![doc(html_logo_url = "https://zfnd.org/wp-content/uploads/2022/03/zebra-icon.png")]
#![doc(html_root_url = "https://docs.rs/zebra_scan")]

pub mod config;
mod storage;

#[cfg(test)]
Expand Down
6 changes: 6 additions & 0 deletions zebrad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ getblocktemplate-rpcs = [
"zebra-chain/getblocktemplate-rpcs",
]

# Experimental shielded blockchain scanning
shielded-scan = ["zebra-scan"]

# Experimental elasticsearch indexing
elasticsearch = [
"zebra-state/elasticsearch",
Expand Down Expand Up @@ -152,6 +155,9 @@ zebra-node-services = { path = "../zebra-node-services", version = "1.0.0-beta.3
zebra-rpc = { path = "../zebra-rpc", version = "1.0.0-beta.31" }
zebra-state = { path = "../zebra-state", version = "1.0.0-beta.31" }

# Experimental shielded-scan feature
zebra-scan = { path = "../zebra-scan", version = "0.1.0-alpha.0", optional = true }

# Required for crates.io publishing, but it's only used in tests
zebra-utils = { path = "../zebra-utils", version = "1.0.0-beta.31", optional = true }

Expand Down
4 changes: 4 additions & 0 deletions zebrad/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ pub struct ZebradConfig {
#[serde(skip_serializing_if = "zebra_rpc::config::mining::Config::skip_getblocktemplate")]
/// Mining configuration
pub mining: zebra_rpc::config::mining::Config,

#[cfg(feature = "zebra-scan")]
/// Scanner configuration
pub shielded_scan: zebra_scan::config::Config,
}
Loading