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

Remote ReadStateService #9338

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft
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
164 changes: 160 additions & 4 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,12 @@ dependencies = [
"shlex",
]

[[package]]
name = "cesu8"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"

[[package]]
name = "cexpr"
version = "0.6.0"
Expand Down Expand Up @@ -875,6 +881,16 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"

[[package]]
name = "combine"
version = "4.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd"
dependencies = [
"bytes",
"memchr",
]

[[package]]
name = "console"
version = "0.15.10"
Expand Down Expand Up @@ -939,6 +955,16 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6"

[[package]]
name = "core-foundation"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
dependencies = [
"core-foundation-sys",
"libc",
]

[[package]]
name = "core-foundation-sys"
version = "0.8.7"
Expand Down Expand Up @@ -1837,9 +1863,9 @@ dependencies = [

[[package]]
name = "http"
version = "1.2.0"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea"
checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565"
dependencies = [
"bytes",
"fnv",
Expand Down Expand Up @@ -1934,6 +1960,7 @@ dependencies = [
"http",
"hyper",
"hyper-util",
"log",
"rustls",
"rustls-pki-types",
"tokio",
Expand Down Expand Up @@ -2319,6 +2346,26 @@ version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"

[[package]]
name = "jni"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec"
dependencies = [
"cesu8",
"combine",
"jni-sys",
"log",
"thiserror 1.0.69",
"walkdir",
]

[[package]]
name = "jni-sys"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"

[[package]]
name = "jobserver"
version = "0.1.32"
Expand Down Expand Up @@ -2356,6 +2403,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "834af00800e962dee8f7bfc0f60601de215e73e78e5497d733a2919da837d3c8"
dependencies = [
"jsonrpsee-core",
"jsonrpsee-http-client",
"jsonrpsee-server",
"jsonrpsee-types",
"tokio",
Expand Down Expand Up @@ -2384,6 +2432,31 @@ dependencies = [
"tracing",
]

[[package]]
name = "jsonrpsee-http-client"
version = "0.24.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87c24e981ad17798bbca852b0738bfb7b94816ed687bd0d5da60bfa35fa0fdc3"
dependencies = [
"async-trait",
"base64 0.22.1",
"http-body",
"hyper",
"hyper-rustls",
"hyper-util",
"jsonrpsee-core",
"jsonrpsee-types",
"rustls",
"rustls-platform-verifier",
"serde",
"serde_json",
"thiserror 1.0.69",
"tokio",
"tower 0.4.13",
"tracing",
"url",
]

[[package]]
name = "jsonrpsee-proc-macros"
version = "0.24.8"
Expand Down Expand Up @@ -2884,6 +2957,12 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"

[[package]]
name = "openssl-probe"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"

[[package]]
name = "option-ext"
version = "0.2.0"
Expand Down Expand Up @@ -3883,6 +3962,19 @@ dependencies = [
"zeroize",
]

[[package]]
name = "rustls-native-certs"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5"
dependencies = [
"openssl-probe",
"rustls-pemfile",
"rustls-pki-types",
"schannel",
"security-framework",
]

[[package]]
name = "rustls-pemfile"
version = "2.2.0"
Expand All @@ -3901,6 +3993,33 @@ dependencies = [
"web-time",
]

[[package]]
name = "rustls-platform-verifier"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afbb878bdfdf63a336a5e63561b1835e7a8c91524f51621db870169eac84b490"
dependencies = [
"core-foundation",
"core-foundation-sys",
"jni",
"log",
"once_cell",
"rustls",
"rustls-native-certs",
"rustls-platform-verifier-android",
"rustls-webpki",
"security-framework",
"security-framework-sys",
"webpki-roots",
"winapi",
]

[[package]]
name = "rustls-platform-verifier-android"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"

[[package]]
name = "rustls-webpki"
version = "0.102.8"
Expand Down Expand Up @@ -3977,6 +4096,15 @@ dependencies = [
"zip32",
]

[[package]]
name = "schannel"
version = "0.1.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d"
dependencies = [
"windows-sys 0.59.0",
]

[[package]]
name = "scopeguard"
version = "1.2.0"
Expand Down Expand Up @@ -4012,6 +4140,30 @@ dependencies = [
"zeroize",
]

[[package]]
name = "security-framework"
version = "2.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"
dependencies = [
"bitflags 2.8.0",
"core-foundation",
"core-foundation-sys",
"libc",
"num-bigint",
"security-framework-sys",
]

[[package]]
name = "security-framework-sys"
version = "2.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32"
dependencies = [
"core-foundation-sys",
"libc",
]

[[package]]
name = "semver"
version = "1.0.25"
Expand Down Expand Up @@ -5829,12 +5981,13 @@ dependencies = [
[[package]]
name = "zcash_history"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fde17bf53792f9c756b313730da14880257d7661b5bfc69d0571c3a7c11a76d"
source = "git+https://github.com/idky137/librustzcash.git?branch=remote_read_state_service_1#2f66120327fb666bd5955ea57aa6dbd36ef95652"
dependencies = [
"blake2b_simd",
"byteorder",
"hex",
"primitive-types",
"serde",
]

[[package]]
Expand Down Expand Up @@ -6269,11 +6422,13 @@ dependencies = [
"hex",
"hex-literal",
"howudoin",
"http",
"human_bytes",
"humantime-serde",
"indexmap 2.7.1",
"insta",
"itertools 0.14.0",
"jsonrpsee",
"jubjub",
"lazy_static",
"metrics",
Expand All @@ -6296,6 +6451,7 @@ dependencies = [
"tokio",
"tower 0.4.13",
"tracing",
"url",
"zebra-chain",
"zebra-test",
]
Expand Down
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ halo2 = "0.3.0"
hex = "0.4.3"
hex-literal = "0.4.1"
howudoin = "0.1.2"
http = "1.3.1"
http-body-util = "0.1.2"
human_bytes = { version = "0.4.3", default-features = false }
humantime = "2.1.0"
Expand Down Expand Up @@ -146,12 +147,16 @@ tracing-journald = "0.3.0"
tracing-subscriber = "0.3.19"
tracing-test = "0.2.4"
uint = "0.10.0"
url = "2.5.4"
vergen = { version = "8.3.2", default-features = false }
wagyu-zcash-parameters = "0.2.0"
x25519-dalek = "2.0.1"
zcash_note_encryption = "0.4.1"
zcash_script = "0.2.0"

[patch.crates-io]
zcash_history = { git = "https://github.com/idky137/librustzcash.git", branch = "remote_read_state_service_1" }

[workspace.metadata.release]

# We always do releases from the main branch
Expand Down
3 changes: 3 additions & 0 deletions zebra-chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ internal-miner = []
# Experimental elasticsearch support
elasticsearch = []

# Serde Serialisation and Deserialisation for ReadRequest and ReadResponse, required for remote use of the [`ReadStateService`].
remote_read_state_service = ["zcash_history/remote_read_state_service"]

# Test-only features

proptest-impl = [
Expand Down
4 changes: 4 additions & 0 deletions zebra-chain/src/amount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,10 @@ impl Constraint for NegativeAllowed {
/// );
/// ```
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Default)]
#[cfg_attr(
feature = "remote_read_state_service",
derive(serde::Serialize, serde::Deserialize)
)]
pub struct NonNegative;

impl Constraint for NonNegative {
Expand Down
8 changes: 7 additions & 1 deletion zebra-chain/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,15 @@ pub use arbitrary::LedgerState;
/// A Zcash block, containing a header and a list of transactions.
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(
any(test, feature = "proptest-impl", feature = "elasticsearch"),
any(
test,
feature = "proptest-impl",
feature = "elasticsearch",
feature = "remote_read_state_service"
),
derive(Serialize)
)]
#[cfg_attr(feature = "remote_read_state_service", derive(serde::Deserialize))]
pub struct Block {
/// The block header, containing block metadata.
pub header: Arc<Header>,
Expand Down
4 changes: 4 additions & 0 deletions zebra-chain/src/block/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ impl Header {
/// This structure is used in the Bitcoin network protocol.
///
/// The transaction count field is always zero, so we don't store it in the struct.
#[cfg_attr(
feature = "remote_read_state_service",
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(any(test, feature = "proptest-impl"), derive(Arbitrary))]
pub struct CountedHeader {
Expand Down
4 changes: 4 additions & 0 deletions zebra-chain/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ impl<T: fmt::Display> From<T> for DisplayToDebug<T> {
///
/// For collections and exact size iterators, it only displays the
/// collection/iterator type, the item type, and the length.
#[cfg_attr(
feature = "remote_read_state_service",
derive(serde::Serialize, serde::Deserialize)
)]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct SummaryDebug<CollectionOrIter>(pub CollectionOrIter)
where
Expand Down
Loading
Loading