Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
427be0d
Not compiling at OrchardDomain doesn't impl Domain, likely to do with…
AloeareV Jun 17, 2022
228d19b
Patch zcash_note_encryption to make orchard work
AloeareV Jun 20, 2022
62b9cad
Update proto files to include orchard data types
AloeareV Jun 21, 2022
74dcd6e
Rip out price functionality now that we target zcash's server
AloeareV Jun 21, 2022
de71b85
Fix remainder of proto update breakages
AloeareV Jun 21, 2022
5c7a89a
more cleanup, mostly missed price-related cpde
AloeareV Jun 23, 2022
77bd5e0
Reformat after rebase
AloeareV Jun 23, 2022
b94acbb
Start work on reading orchard transactions from compact blocks
AloeareV Jun 22, 2022
af11c44
Orchard transactions may now be detected. Can't load old wallet due t…
AloeareV Jun 23, 2022
3e6bc9a
Partial revert of 5c7a89a
AloeareV Jun 23, 2022
5c4ab5c
We can now decrypt incoming orchard transactions
AloeareV Jun 24, 2022
8f0f7e0
Fix bad formatting inherited from cherry-pick/revert/rebase/something…
AloeareV Jun 24, 2022
4de17ea
Add 'sapling' to symbols in preparation for orchard equivilants to be…
AloeareV Jun 24, 2022
e09e8a0
start on trial_decrypt_batch orchard decryption support
AloeareV Jun 24, 2022
2a03501
Update orchard crate and librustzcash to newest zcash
AloeareV Jun 27, 2022
00ea83d
Factor scan_orchard_bundle into incomplete helper
AloeareV Jun 28, 2022
953aabd
revert price removal
AloeareV Jun 28, 2022
2ed5b8a
Cleanup temp variable
AloeareV Jun 28, 2022
ed7ce0f
K B L O D E
zancas Jun 29, 2022
0318a73
silence annoying future-used-vars warnings
zancas Jun 29, 2022
f34d7b8
Merge pull request #1 from zancas/even_morchard
AloeareV Jun 29, 2022
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
59 changes: 25 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ members = [
]

[profile.release]
debug = false
debug = false

[patch.crates-io]
zcash_note_encryption = { git = "https://github.com/zcash/librustzcash", rev = "8ad60a0fc020ac0338615fd9f242e6eff7b66542" }
zcash_primitives = { git = "https://github.com/zcash/librustzcash", rev = "8ad60a0fc020ac0338615fd9f242e6eff7b66542" }
orchard = { git = "https://github.com/zcash/orchard", rev = "597f37a869d2d03bb40b8b8108b88fba984b0842" }
4 changes: 2 additions & 2 deletions config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
zcash_primitives = { git = "https://github.com/zcash/librustzcash", rev = "73d9395c9d3c5fa81fc7becd363a2c1a51772a76", features = ["transparent-inputs", "test-dependencies"] }
zcash_address = { git = "https://github.com/zcash/librustzcash", rev = "73d9395c9d3c5fa81fc7becd363a2c1a51772a76"}
zcash_primitives = { git = "https://github.com/zcash/librustzcash", rev = "8ad60a0fc020ac0338615fd9f242e6eff7b66542", features = ["transparent-inputs", "test-dependencies"] }
zcash_address = { git = "https://github.com/zcash/librustzcash", rev = "8ad60a0fc020ac0338615fd9f242e6eff7b66542"}
14 changes: 7 additions & 7 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ jubjub = "0.9.0"
bls12_381 = "0.7"
group = "0.12"
rust-embed = { version = "6.3.0", features = ["debug-embed"] }
orchard = "0.1.0"
orchard = "0.2.0"
subtle = "2.4.1"
zcash_address = { git = "https://github.com/zcash/librustzcash", rev = "73d9395c9d3c5fa81fc7becd363a2c1a51772a76"}
zcash_primitives = { git = "https://github.com/zcash/librustzcash", rev = "73d9395c9d3c5fa81fc7becd363a2c1a51772a76", features = ["transparent-inputs", "test-dependencies"] }
zcash_client_backend = { git = "https://github.com/zcash/librustzcash", rev = "73d9395c9d3c5fa81fc7becd363a2c1a51772a76"}
zcash_proofs = { git = "https://github.com/zcash/librustzcash", rev = "73d9395c9d3c5fa81fc7becd363a2c1a51772a76", features = ["multicore"]}
zcash_encoding = { git = "https://github.com/zcash/librustzcash", rev = "73d9395c9d3c5fa81fc7becd363a2c1a51772a76"}
zcash_note_encryption = { git = "https://github.com/zcash/librustzcash", rev = "73d9395c9d3c5fa81fc7becd363a2c1a51772a76", features = ["pre-zip-212"]}
zcash_address = { git = "https://github.com/zcash/librustzcash", rev = "8ad60a0fc020ac0338615fd9f242e6eff7b66542"}
zcash_primitives = { git = "https://github.com/zcash/librustzcash", rev = "8ad60a0fc020ac0338615fd9f242e6eff7b66542", features = ["transparent-inputs", "test-dependencies"] }
zcash_client_backend = { git = "https://github.com/zcash/librustzcash", rev = "8ad60a0fc020ac0338615fd9f242e6eff7b66542"}
zcash_proofs = { git = "https://github.com/zcash/librustzcash", rev = "8ad60a0fc020ac0338615fd9f242e6eff7b66542", features = ["multicore"]}
zcash_encoding = { git = "https://github.com/zcash/librustzcash", rev = "8ad60a0fc020ac0338615fd9f242e6eff7b66542"}
zcash_note_encryption = { git = "https://github.com/zcash/librustzcash", rev = "8ad60a0fc020ac0338615fd9f242e6eff7b66542", features = ["pre-zip-212"]}
zingoconfig = { path = "../config" }

[dev-dependencies]
Expand Down
22 changes: 16 additions & 6 deletions lib/proto/compact_formats.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,30 @@ message CompactTx {
// valueBalance + (sum(vPubNew) - sum(vPubOld) - sum(tOut))
uint32 fee = 3;

repeated CompactSpend spends = 4; // inputs
repeated CompactOutput outputs = 5; // outputs
repeated CompactSaplingSpend spends = 4; // inputs
repeated CompactSaplingOutput outputs = 5; // outputs
repeated CompactOrchardAction actions = 6;
}

// CompactSpend is a Sapling Spend Description as described in 7.3 of the Zcash
// CompactSaplingSpend is a Sapling Spend Description as described in 7.3 of the Zcash
// protocol specification.
message CompactSpend {
message CompactSaplingSpend {
bytes nf = 1; // nullifier (see the Zcash protocol specification)
}

// output is a Sapling Output Description as described in section 7.4 of the
// Zcash protocol spec. Total size is 948.
message CompactOutput {
message CompactSaplingOutput {
bytes cmu = 1; // note commitment u-coordinate
bytes epk = 2; // ephemeral public key
bytes ciphertext = 3; // ciphertext and zkproof
bytes ciphertext = 3; // first 52 bytes of ciphertext
}

// https://github.com/zcash/zips/blob/main/zip-0225.rst#orchard-action-description-orchardaction
// (but not all fields are needed)
message CompactOrchardAction {
bytes nullifier = 1; // [32] The nullifier of the input note
bytes cmx = 2; // [32] The x-coordinate of the note commitment for the output note
bytes ephemeralKey = 3; // [32] An encoding of an ephemeral Pallas public key
bytes ciphertext = 4; // [52] The note plaintext component of the encCiphertext field
}
19 changes: 10 additions & 9 deletions lib/proto/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ message TxFilter {
}

// RawTransaction contains the complete transaction data. It also optionally includes
// the block height in which the transaction was included.
// the block height in which the transaction was included, or, when returned
// by GetMempoolStream(), the latest block height.
message RawTransaction {
bytes data = 1; // exact data returned by Zcash 'getrawtransaction'
uint64 height = 2; // height that the transaction was mined (or -1)
Expand Down Expand Up @@ -109,11 +110,12 @@ message Exclude {

// The TreeState is derived from the Zcash z_gettreestate rpc.
message TreeState {
string network = 1; // "main" or "test"
uint64 height = 2;
string hash = 3; // block id
uint32 time = 4; // Unix epoch time when the block was mined
string tree = 5; // sapling commitment tree state
string network = 1; // "main" or "test"
uint64 height = 2; // block height
string hash = 3; // block id
uint32 time = 4; // Unix epoch time when the block was mined
string saplingTree = 5; // sapling commitment tree state
string orchardTree = 6; // orchard commitment tree state
}

// Results are sorted by height, which makes it easy to issue another
Expand Down Expand Up @@ -176,9 +178,6 @@ service CompactTxStreamer {
// Return the txids corresponding to the given t-address within the given block range
rpc GetTaddressTxids(TransparentAddressBlockFilter) returns (stream RawTransaction) {}

// Legacy API that is used as a fallback for t-Address support, if the server is running the old version (lwdv2)
rpc GetAddressTxids(TransparentAddressBlockFilter) returns (stream RawTransaction) {}

rpc GetTaddressBalance(AddressList) returns (Balance) {}
rpc GetTaddressBalanceStream(stream Address) returns (Balance) {}

Expand All @@ -193,6 +192,8 @@ service CompactTxStreamer {
// in the exclude list that don't exist in the mempool are ignored.
rpc GetMempoolTx(Exclude) returns (stream CompactTx) {}

// Return a stream of current Mempool transactions. This will keep the output stream open while
// there are mempool transactions. It will close the returned stream when a new block is mined.
rpc GetMempoolStream(Empty) returns (stream RawTransaction) {}

// GetTreeState returns the note commitment tree state corresponding to the given block.
Expand Down
9 changes: 5 additions & 4 deletions lib/src/blaze/block_witness_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl BlockAndWitnessData {
let mut tree_state = TreeState::default();
tree_state.height = h;
tree_state.hash = hash.to_string();
tree_state.tree = tree.to_string();
tree_state.sapling_tree = tree.to_string();

tree_state
}),
Expand Down Expand Up @@ -220,7 +220,8 @@ impl BlockAndWitnessData {
return true;
}
let mut tree =
CommitmentTree::<Node>::read(&hex::decode(ct.tree).unwrap()[..]).unwrap();
CommitmentTree::<Node>::read(&hex::decode(ct.sapling_tree).unwrap()[..])
.unwrap();

{
let blocks = blocks.read().await;
Expand Down Expand Up @@ -249,7 +250,7 @@ impl BlockAndWitnessData {
tree.write(&mut buf).unwrap();

// Return if verified
hex::encode(buf) == vt.tree
hex::encode(buf) == vt.sapling_tree
})
})
.collect();
Expand Down Expand Up @@ -472,7 +473,7 @@ impl BlockAndWitnessData {
CommitmentTree::empty()
} else {
let tree_state = GrpcConnector::get_sapling_tree(uri, prev_height).await?;
let sapling_tree = hex::decode(&tree_state.tree).unwrap();
let sapling_tree = hex::decode(&tree_state.sapling_tree).unwrap();
self.verification_list.write().await.push(tree_state);
CommitmentTree::read(&sapling_tree[..]).map_err(|e| format!("{}", e))?
};
Expand Down
Loading