-
Notifications
You must be signed in to change notification settings - Fork 11
Add g rpc #66
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
Draft
zancas
wants to merge
5
commits into
zcash:main
Choose a base branch
from
zingolabs:add_gRPC
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Add g rpc #66
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
17f88fb
"src" is incorrect for a dir that contains bins
zancas fbd222e
add proto files, and python language bindings for StateService gRPC t…
zancas 0b973d0
makes names more coherent, zainod_json and zainod_grpc
zancas 43618c9
fix call site to match
zancas 9638d10
unify stop to ensure that both grpc and json interfaces are deleted
zancas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |
| qa/pull-tester/tests_config.py | ||
| qa/pull-tester/tests_config.ini | ||
| qa/cache/* | ||
| src/* | ||
| bin/* | ||
|
|
||
| poetry.lock | ||
| .venv | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| This directory is "INTENTIONALLY LEFT BLANK". Its purpose is to hold binaries for users that prefer to keep those references in the working directory. The contents of this directory are not intended to be tracked by git. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
130 changes: 130 additions & 0 deletions
130
qa/rpc-tests/test_framework/proto/compact_formats.proto
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| // Copyright (c) 2019-2021 The Zcash developers | ||
| // Distributed under the MIT software license, see the accompanying | ||
| // file COPYING or https://www.opensource.org/licenses/mit-license.php . | ||
|
|
||
| syntax = "proto3"; | ||
| package cash.z.wallet.sdk.rpc; | ||
| option go_package = "lightwalletd/walletrpc"; | ||
| option swift_prefix = ""; | ||
|
|
||
| // REMINDER: proto3 fields are all optional. A field that is not present will be set to its zero/false/empty | ||
| // value. | ||
|
|
||
| // Information about the state of the chain as of a given block. | ||
| message ChainMetadata { | ||
| uint32 saplingCommitmentTreeSize = 1; // the size of the Sapling note commitment tree as of the end of this block | ||
| uint32 orchardCommitmentTreeSize = 2; // the size of the Orchard note commitment tree as of the end of this block | ||
| } | ||
|
|
||
| // A compact representation of a Zcash block. | ||
| // | ||
| // CompactBlock is a packaging of ONLY the data from a block that's needed to: | ||
| // 1. Detect a payment to your Shielded address | ||
| // 2. Detect a spend of your Shielded notes | ||
| // 3. Update your witnesses to generate new spend proofs. | ||
| // 4. Spend UTXOs associated to t-addresses of your wallet. | ||
| // | ||
| // Currently, the `header` field should always be unset (empty). In the future, | ||
| // the presence or absence of header data may be made dependent on request | ||
| // parameters, although it is likely that such flexibility will only be provided via | ||
| // newly-added service methods, not via existing APIs. | ||
| message CompactBlock { | ||
| uint32 protoVersion = 1; // the version of this wire format, for storage | ||
| uint64 height = 2; // the height of this block | ||
| bytes hash = 3; // if present, the ID (hash) of this block | ||
| bytes prevHash = 4; // if present, the ID (hash) of this block's predecessor | ||
| uint32 time = 5; // if non-zero, Unix epoch time when the block was mined | ||
| bytes header = 6; // if present, full header (as returned by the getblock RPC) | ||
| repeated CompactTx vtx = 7; // zero or more compact transactions from this block | ||
| ChainMetadata chainMetadata = 8; // information about the state of the chain as of this block | ||
| } | ||
|
|
||
| // A compact representation of a Zcash transaction. | ||
| // | ||
| // CompactTx contains the minimum information for a wallet to know if this transaction | ||
| // is relevant to it (either pays to it or spends from it) via shielded elements. Additionally, | ||
| // it can optionally include the minimum necessary data to detect payments to transparent addresses | ||
| // related to your wallet. | ||
| message CompactTx { | ||
| // The index of the transaction within the block. | ||
| uint64 index = 1; | ||
|
|
||
| // The id of the transaction as defined in | ||
| // [§ 7.1.1 'Transaction Identifiers'](https://zips.z.cash/protocol/protocol.pdf#txnidentifiers) | ||
| // This byte array MUST be in protocol order and MUST NOT be reversed | ||
| // or hex-encoded; the byte-reversed and hex-encoded representation is | ||
| // exclusively a textual representation of a txid. | ||
| bytes txid = 2; | ||
|
|
||
| // The transaction fee: present if server can provide. In the case of a | ||
| // stateless server and a transaction with transparent inputs, this will be | ||
| // unset because the calculation requires reference to prior transactions. | ||
| // If there are no transparent inputs, the fee will be calculable as: | ||
| // valueBalanceSapling + valueBalanceOrchard + sum(vPubNew) - sum(vPubOld) - sum(tOut) | ||
| uint32 fee = 3; | ||
|
|
||
| repeated CompactSaplingSpend spends = 4; | ||
| repeated CompactSaplingOutput outputs = 5; | ||
| repeated CompactOrchardAction actions = 6; | ||
|
|
||
| // `CompactTxIn` values corresponding to the `vin` entries of the full transaction. | ||
| // | ||
| // Note: the single null-outpoint input for coinbase transactions is omitted. Light | ||
| // clients can test `CompactTx.index == 0` to determine whether a `CompactTx` | ||
| // represents a coinbase transaction, as the coinbase transaction is always the | ||
| // first transaction in any block. | ||
| repeated CompactTxIn vin = 7; | ||
|
|
||
| // A sequence of transparent outputs being created by the transaction. | ||
| repeated TxOut vout = 8; | ||
| } | ||
|
|
||
| // A compact representation of a transparent transaction input. | ||
| message CompactTxIn { | ||
| // The id of the transaction that generated the output being spent. This | ||
| // byte array must be in protocol order and MUST NOT be reversed or | ||
| // hex-encoded. | ||
| bytes prevoutTxid = 1; | ||
|
|
||
| // The index of the output being spent in the `vout` array of the | ||
| // transaction referred to by `prevoutTxid`. | ||
| uint32 prevoutIndex = 2; | ||
| } | ||
|
|
||
| // A transparent output being created by the transaction. | ||
| // | ||
| // This contains identical data to the `TxOut` type in the transaction itself, and | ||
| // thus it is not "compact". | ||
| message TxOut { | ||
| // The value of the output, in Zatoshis. | ||
| uint64 value = 1; | ||
|
|
||
| // The script pubkey that must be satisfied in order to spend this output. | ||
| bytes scriptPubKey = 2; | ||
| } | ||
|
|
||
| // A compact representation of a [Sapling Spend](https://zips.z.cash/protocol/protocol.pdf#spendencodingandconsensus). | ||
| // | ||
| // CompactSaplingSpend is a Sapling Spend Description as described in 7.3 of the Zcash | ||
| // protocol specification. | ||
| message CompactSaplingSpend { | ||
| bytes nf = 1; // Nullifier (see the Zcash protocol specification) | ||
| } | ||
|
|
||
| // A compact representation of a [Sapling Output](https://zips.z.cash/protocol/protocol.pdf#outputencodingandconsensus). | ||
| // | ||
| // It encodes the `cmu` field, `ephemeralKey` field, and a 52-byte prefix of the | ||
| // `encCiphertext` field of a Sapling Output Description. Total size is 116 bytes. | ||
| message CompactSaplingOutput { | ||
| bytes cmu = 1; // Note commitment u-coordinate. | ||
| bytes ephemeralKey = 2; // Ephemeral public key. | ||
| bytes ciphertext = 3; // First 52 bytes of ciphertext. | ||
| } | ||
|
|
||
| // A compact representation of an [Orchard Action](https://zips.z.cash/protocol/protocol.pdf#actionencodingandconsensus). | ||
| 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 first 52 bytes of the encCiphertext field | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
qa/rpc-tests/test_framework/proto/compact_formats_pb2_grpc.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! | ||
| """Client and server classes corresponding to protobuf-defined services.""" | ||
| import grpc | ||
| import warnings | ||
|
|
||
|
|
||
| GRPC_GENERATED_VERSION = '1.78.0' | ||
| GRPC_VERSION = grpc.__version__ | ||
| _version_not_supported = False | ||
|
|
||
| try: | ||
| from grpc._utilities import first_version_is_lower | ||
| _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION) | ||
| except ImportError: | ||
| _version_not_supported = True | ||
|
|
||
| if _version_not_supported: | ||
| raise RuntimeError( | ||
| f'The grpc package installed is at version {GRPC_VERSION},' | ||
| + ' but the generated code in compact_formats_pb2_grpc.py depends on' | ||
| + f' grpcio>={GRPC_GENERATED_VERSION}.' | ||
| + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' | ||
| + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When creating stacked PRs, note the PR you are building on top of in the top comment, so that reviewers know to ignore those commits. (I originally asked to separate this out into a separate PR because it makes review harder, then I realised this was stacked on #47.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will unstack.