react-native-zcash 0.6.10 → 0.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/android/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/2460000.json +8 -0
  3. package/ios/ZCashLightClientKit/Block/CompactBlockProcessor.swift +937 -425
  4. package/ios/ZCashLightClientKit/Block/Download/BlockDownloader.swift +17 -31
  5. package/ios/ZCashLightClientKit/Block/Download/BlockDownloaderService.swift +2 -2
  6. package/ios/ZCashLightClientKit/Block/Enhance/BlockEnhancer.swift +15 -46
  7. package/ios/ZCashLightClientKit/Block/FetchUnspentTxOutputs/UTXOFetcher.swift +15 -4
  8. package/ios/ZCashLightClientKit/Block/FilesystemStorage/FSCompactBlockRepository.swift +4 -4
  9. package/ios/ZCashLightClientKit/Block/Scan/BlockScanner.swift +35 -10
  10. package/ios/ZCashLightClientKit/Block/Utils/InternalSyncProgress.swift +200 -0
  11. package/ios/ZCashLightClientKit/Block/Validate/BlockValidator.swift +51 -0
  12. package/ios/ZCashLightClientKit/ClosureSynchronizer.swift +2 -1
  13. package/ios/ZCashLightClientKit/CombineSynchronizer.swift +5 -2
  14. package/ios/ZCashLightClientKit/Constants/ZcashSDK.swift +26 -13
  15. package/ios/ZCashLightClientKit/DAO/BlockDao.swift +112 -0
  16. package/ios/ZCashLightClientKit/DAO/TransactionDao.swift +42 -40
  17. package/ios/ZCashLightClientKit/DAO/UnspentTransactionOutputDao.swift +4 -13
  18. package/ios/ZCashLightClientKit/Entity/AccountEntity.swift +0 -9
  19. package/ios/ZCashLightClientKit/Entity/BlockProgress.swift +24 -0
  20. package/ios/ZCashLightClientKit/Entity/TransactionEntity.swift +10 -7
  21. package/ios/ZCashLightClientKit/Error/Sourcery/generateErrorCode.sh +1 -1
  22. package/ios/ZCashLightClientKit/Error/ZcashError.swift +12 -121
  23. package/ios/ZCashLightClientKit/Error/ZcashErrorCode.swift +5 -43
  24. package/ios/ZCashLightClientKit/Error/ZcashErrorCodeDefinition.swift +6 -72
  25. package/ios/ZCashLightClientKit/Initializer.swift +26 -47
  26. package/ios/ZCashLightClientKit/Metrics/SDKMetrics.swift +12 -0
  27. package/ios/ZCashLightClientKit/Model/Checkpoint.swift +0 -12
  28. package/ios/ZCashLightClientKit/Modules/Service/GRPC/LightWalletGRPCService.swift +0 -15
  29. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/compact_formats.pb.swift +46 -150
  30. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proto/compact_formats.proto +16 -30
  31. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/proto/service.proto +6 -32
  32. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/service.grpc.swift +22 -259
  33. package/ios/ZCashLightClientKit/Modules/Service/GRPC/ProtoBuf/service.pb.swift +7 -193
  34. package/ios/ZCashLightClientKit/Modules/Service/LightWalletService.swift +0 -8
  35. package/ios/ZCashLightClientKit/Providers/LatestBlocksDataProvider.swift +28 -18
  36. package/ios/ZCashLightClientKit/Repository/CompactBlockRepository.swift +1 -1
  37. package/ios/ZCashLightClientKit/Repository/TransactionRepository.swift +6 -2
  38. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2460000.json +8 -0
  39. package/ios/ZCashLightClientKit/Rust/ZcashRustBackend.swift +158 -293
  40. package/ios/ZCashLightClientKit/Rust/ZcashRustBackendWelding.swift +64 -58
  41. package/ios/ZCashLightClientKit/Rust/zcashlc.h +513 -619
  42. package/ios/ZCashLightClientKit/Synchronizer/ClosureSDKSynchronizer.swift +8 -2
  43. package/ios/ZCashLightClientKit/Synchronizer/CombineSDKSynchronizer.swift +15 -3
  44. package/ios/ZCashLightClientKit/Synchronizer/Dependencies.swift +30 -11
  45. package/ios/ZCashLightClientKit/Synchronizer/SDKSynchronizer.swift +50 -41
  46. package/ios/ZCashLightClientKit/Synchronizer.swift +65 -51
  47. package/ios/ZCashLightClientKit/Transaction/TransactionEncoder.swift +2 -2
  48. package/ios/ZCashLightClientKit/Transaction/WalletTransactionEncoder.swift +7 -7
  49. package/ios/ZCashLightClientKit/Utils/OSLogger.swift +3 -3
  50. package/ios/libzcashlc.xcframework/Info.plist +0 -4
  51. package/ios/libzcashlc.xcframework/ios-arm64/libzcashlc.a +0 -0
  52. package/ios/libzcashlc.xcframework/ios-arm64_x86_64-simulator/libzcashlc.a +0 -0
  53. package/package.json +1 -1
  54. package/ios/ZCashLightClientKit/Block/Actions/Action.swift +0 -98
  55. package/ios/ZCashLightClientKit/Block/Actions/ClearAlreadyScannedBlocksAction.swift +0 -35
  56. package/ios/ZCashLightClientKit/Block/Actions/ClearCacheAction.swift +0 -30
  57. package/ios/ZCashLightClientKit/Block/Actions/DownloadAction.swift +0 -67
  58. package/ios/ZCashLightClientKit/Block/Actions/EnhanceAction.swift +0 -97
  59. package/ios/ZCashLightClientKit/Block/Actions/FetchUTXOsAction.swift +0 -33
  60. package/ios/ZCashLightClientKit/Block/Actions/MigrateLegacyCacheDBAction.swift +0 -70
  61. package/ios/ZCashLightClientKit/Block/Actions/ProcessSuggestedScanRangesAction.swift +0 -60
  62. package/ios/ZCashLightClientKit/Block/Actions/RewindAction.swift +0 -48
  63. package/ios/ZCashLightClientKit/Block/Actions/SaplingParamsAction.swift +0 -33
  64. package/ios/ZCashLightClientKit/Block/Actions/ScanAction.swift +0 -95
  65. package/ios/ZCashLightClientKit/Block/Actions/UpdateChainTipAction.swift +0 -55
  66. package/ios/ZCashLightClientKit/Block/Actions/UpdateSubtreeRootsAction.swift +0 -58
  67. package/ios/ZCashLightClientKit/Block/Actions/ValidateServerAction.swift +0 -60
  68. package/ios/ZCashLightClientKit/Block/Utils/CompactBlockProgress.swift +0 -24
  69. package/ios/ZCashLightClientKit/Block/Utils/SyncControlData.swift +0 -25
  70. package/ios/ZCashLightClientKit/Extensions/Bool+ToData.swift +0 -15
  71. package/ios/ZCashLightClientKit/Extensions/Data+ToOtherTypes.swift +0 -18
  72. package/ios/ZCashLightClientKit/Extensions/Int+ToData.swift +0 -15
  73. package/ios/ZCashLightClientKit/Model/ScanProgress.swift +0 -29
  74. package/ios/ZCashLightClientKit/Model/ScanRange.swift +0 -31
  75. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2092500.json +0 -8
  76. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2095000.json +0 -8
  77. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2097500.json +0 -8
  78. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2102500.json +0 -8
  79. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2105000.json +0 -8
  80. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2107500.json +0 -8
  81. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2112500.json +0 -8
  82. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2115000.json +0 -8
  83. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2117500.json +0 -8
  84. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2122500.json +0 -8
  85. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2125000.json +0 -8
  86. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2127500.json +0 -8
  87. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2132500.json +0 -8
  88. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2135000.json +0 -8
  89. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2137500.json +0 -8
  90. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2142500.json +0 -8
  91. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2145000.json +0 -8
  92. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2147500.json +0 -8
  93. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2152500.json +0 -8
  94. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2155000.json +0 -8
  95. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2157500.json +0 -8
  96. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2162500.json +0 -8
  97. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2165000.json +0 -8
  98. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2167500.json +0 -8
  99. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2172500.json +0 -8
  100. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2175000.json +0 -8
  101. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2177500.json +0 -8
  102. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2182500.json +0 -8
  103. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2185000.json +0 -8
  104. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2187500.json +0 -8
  105. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2192500.json +0 -8
  106. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2195000.json +0 -8
  107. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2197500.json +0 -8
  108. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2202500.json +0 -8
  109. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2205000.json +0 -8
  110. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2207500.json +0 -8
  111. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2212500.json +0 -8
  112. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2215000.json +0 -8
  113. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2217500.json +0 -8
  114. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2222500.json +0 -8
  115. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2225000.json +0 -8
  116. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2227500.json +0 -8
  117. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2232500.json +0 -8
  118. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2235000.json +0 -8
  119. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2237500.json +0 -8
  120. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2242500.json +0 -8
  121. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2245000.json +0 -8
  122. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2247500.json +0 -8
  123. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2252500.json +0 -8
  124. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2255000.json +0 -8
  125. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2257500.json +0 -8
  126. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2262500.json +0 -8
  127. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2265000.json +0 -8
  128. package/ios/ZCashLightClientKit/Resources/checkpoints/mainnet/2267500.json +0 -8
  129. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2350000.json +0 -8
  130. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2360000.json +0 -8
  131. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2370000.json +0 -8
  132. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2380000.json +0 -8
  133. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2390000.json +0 -8
  134. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2400000.json +0 -8
  135. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2410000.json +0 -8
  136. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2420000.json +0 -8
  137. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2430000.json +0 -8
  138. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2440000.json +0 -8
  139. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2450000.json +0 -8
  140. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2460000.json +0 -8
  141. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2470000.json +0 -8
  142. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2480000.json +0 -8
  143. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2490000.json +0 -8
  144. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2500000.json +0 -8
  145. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2510000.json +0 -8
  146. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2520000.json +0 -8
  147. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2530000.json +0 -8
  148. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2540000.json +0 -8
  149. package/ios/ZCashLightClientKit/Resources/checkpoints/testnet/2550000.json +0 -8
  150. package/ios/ZCashLightClientKit/Utils/ZcashFileManager.swift +0 -16
@@ -7,7 +7,7 @@
7
7
  // For information on using the generated types, please see the documentation:
8
8
  // https://github.com/apple/swift-protobuf/
9
9
 
10
- // Copyright (c) 2019-2021 The Zcash developers
10
+ // Copyright (c) 2019-2020 The Zcash developers
11
11
  // Distributed under the MIT software license, see the accompanying
12
12
  // file COPYING or https://www.opensource.org/licenses/mit-license.php .
13
13
 
@@ -24,23 +24,6 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP
24
24
  typealias Version = _2
25
25
  }
26
26
 
27
- /// ChainMetadata represents information about the state of the chain as of a given block.
28
- struct ChainMetadata {
29
- // SwiftProtobuf.Message conformance is added in an extension below. See the
30
- // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
31
- // methods supported on all messages.
32
-
33
- /// the size of the Sapling note commitment tree as of the end of this block
34
- var saplingCommitmentTreeSize: UInt32 = 0
35
-
36
- /// the size of the Orchard note commitment tree as of the end of this block
37
- var orchardCommitmentTreeSize: UInt32 = 0
38
-
39
- var unknownFields = SwiftProtobuf.UnknownStorage()
40
-
41
- init() {}
42
- }
43
-
44
27
  /// CompactBlock is a packaging of ONLY the data from a block that's needed to:
45
28
  /// 1. Detect a payment to your shielded Sapling address
46
29
  /// 2. Detect a spend of your shielded Sapling notes
@@ -57,35 +40,23 @@ struct CompactBlock {
57
40
  var height: UInt64 = 0
58
41
 
59
42
  /// the ID (hash) of this block, same as in block explorers
60
- var hash: Data = Data()
43
+ var hash: Data = SwiftProtobuf.Internal.emptyData
61
44
 
62
45
  /// the ID (hash) of this block's predecessor
63
- var prevHash: Data = Data()
46
+ var prevHash: Data = SwiftProtobuf.Internal.emptyData
64
47
 
65
48
  /// Unix epoch time when the block was mined
66
49
  var time: UInt32 = 0
67
50
 
68
51
  /// (hash, prevHash, and time) OR (full header)
69
- var header: Data = Data()
52
+ var header: Data = SwiftProtobuf.Internal.emptyData
70
53
 
71
54
  /// zero or more compact transactions from this block
72
55
  var vtx: [CompactTx] = []
73
56
 
74
- /// information about the state of the chain as of this block
75
- var chainMetadata: ChainMetadata {
76
- get {return _chainMetadata ?? ChainMetadata()}
77
- set {_chainMetadata = newValue}
78
- }
79
- /// Returns true if `chainMetadata` has been explicitly set.
80
- var hasChainMetadata: Bool {return self._chainMetadata != nil}
81
- /// Clears the value of `chainMetadata`. Subsequent reads from it will return its default value.
82
- mutating func clearChainMetadata() {self._chainMetadata = nil}
83
-
84
57
  var unknownFields = SwiftProtobuf.UnknownStorage()
85
58
 
86
59
  init() {}
87
-
88
- fileprivate var _chainMetadata: ChainMetadata? = nil
89
60
  }
90
61
 
91
62
  /// CompactTx contains the minimum information for a wallet to know if this transaction
@@ -96,23 +67,23 @@ struct CompactTx {
96
67
  // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
97
68
  // methods supported on all messages.
98
69
 
99
- /// Index and hash will allow the receiver to call out to chain
100
- /// explorers or other data structures to retrieve more information
101
- /// about this transaction.
70
+ /// the index within the full block
102
71
  var index: UInt64 = 0
103
72
 
104
73
  /// the ID (hash) of this transaction, same as in block explorers
105
- var hash: Data = Data()
74
+ var hash: Data = SwiftProtobuf.Internal.emptyData
106
75
 
107
76
  /// The transaction fee: present if server can provide. In the case of a
108
77
  /// stateless server and a transaction with transparent inputs, this will be
109
78
  /// unset because the calculation requires reference to prior transactions.
110
- /// If there are no transparent inputs, the fee will be calculable as:
111
- /// valueBalanceSapling + valueBalanceOrchard + sum(vPubNew) - sum(vPubOld) - sum(tOut)
79
+ /// in a pure-Sapling context, the fee will be calculable as:
80
+ /// valueBalance + (sum(vPubNew) - sum(vPubOld) - sum(tOut))
112
81
  var fee: UInt32 = 0
113
82
 
83
+ /// inputs
114
84
  var spends: [CompactSaplingSpend] = []
115
85
 
86
+ /// outputs
116
87
  var outputs: [CompactSaplingOutput] = []
117
88
 
118
89
  var actions: [CompactOrchardAction] = []
@@ -130,31 +101,28 @@ struct CompactSaplingSpend {
130
101
  // methods supported on all messages.
131
102
 
132
103
  /// nullifier (see the Zcash protocol specification)
133
- var nf: Data = Data()
104
+ var nf: Data = SwiftProtobuf.Internal.emptyData
134
105
 
135
106
  var unknownFields = SwiftProtobuf.UnknownStorage()
136
107
 
137
108
  init() {}
138
109
  }
139
110
 
140
- /// output encodes the `cmu` field, `ephemeralKey` field, and a 52-byte prefix of the
141
- /// `encCiphertext` field of a Sapling Output Description. These fields are described in
142
- /// section 7.4 of the Zcash protocol spec:
143
- /// https://zips.z.cash/protocol/protocol.pdf#outputencodingandconsensus
144
- /// Total size is 116 bytes.
111
+ /// output is a Sapling Output Description as described in section 7.4 of the
112
+ /// Zcash protocol spec. Total size is 948.
145
113
  struct CompactSaplingOutput {
146
114
  // SwiftProtobuf.Message conformance is added in an extension below. See the
147
115
  // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
148
116
  // methods supported on all messages.
149
117
 
150
118
  /// note commitment u-coordinate
151
- var cmu: Data = Data()
119
+ var cmu: Data = SwiftProtobuf.Internal.emptyData
152
120
 
153
121
  /// ephemeral public key
154
- var ephemeralKey: Data = Data()
122
+ var epk: Data = SwiftProtobuf.Internal.emptyData
155
123
 
156
124
  /// first 52 bytes of ciphertext
157
- var ciphertext: Data = Data()
125
+ var ciphertext: Data = SwiftProtobuf.Internal.emptyData
158
126
 
159
127
  var unknownFields = SwiftProtobuf.UnknownStorage()
160
128
 
@@ -169,73 +137,26 @@ struct CompactOrchardAction {
169
137
  // methods supported on all messages.
170
138
 
171
139
  /// [32] The nullifier of the input note
172
- var nullifier: Data = Data()
140
+ var nullifier: Data = SwiftProtobuf.Internal.emptyData
173
141
 
174
142
  /// [32] The x-coordinate of the note commitment for the output note
175
- var cmx: Data = Data()
143
+ var cmx: Data = SwiftProtobuf.Internal.emptyData
176
144
 
177
145
  /// [32] An encoding of an ephemeral Pallas public key
178
- var ephemeralKey: Data = Data()
146
+ var ephemeralKey: Data = SwiftProtobuf.Internal.emptyData
179
147
 
180
- /// [52] The first 52 bytes of the encCiphertext field
181
- var ciphertext: Data = Data()
148
+ /// [52] The note plaintext component of the encCiphertext field
149
+ var ciphertext: Data = SwiftProtobuf.Internal.emptyData
182
150
 
183
151
  var unknownFields = SwiftProtobuf.UnknownStorage()
184
152
 
185
153
  init() {}
186
154
  }
187
155
 
188
- #if swift(>=5.5) && canImport(_Concurrency)
189
- extension ChainMetadata: @unchecked Sendable {}
190
- extension CompactBlock: @unchecked Sendable {}
191
- extension CompactTx: @unchecked Sendable {}
192
- extension CompactSaplingSpend: @unchecked Sendable {}
193
- extension CompactSaplingOutput: @unchecked Sendable {}
194
- extension CompactOrchardAction: @unchecked Sendable {}
195
- #endif // swift(>=5.5) && canImport(_Concurrency)
196
-
197
156
  // MARK: - Code below here is support for the SwiftProtobuf runtime.
198
157
 
199
158
  fileprivate let _protobuf_package = "cash.z.wallet.sdk.rpc"
200
159
 
201
- extension ChainMetadata: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
202
- static let protoMessageName: String = _protobuf_package + ".ChainMetadata"
203
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
204
- 1: .same(proto: "saplingCommitmentTreeSize"),
205
- 2: .same(proto: "orchardCommitmentTreeSize"),
206
- ]
207
-
208
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
209
- while let fieldNumber = try decoder.nextFieldNumber() {
210
- // The use of inline closures is to circumvent an issue where the compiler
211
- // allocates stack space for every case branch when no optimizations are
212
- // enabled. https://github.com/apple/swift-protobuf/issues/1034
213
- switch fieldNumber {
214
- case 1: try { try decoder.decodeSingularUInt32Field(value: &self.saplingCommitmentTreeSize) }()
215
- case 2: try { try decoder.decodeSingularUInt32Field(value: &self.orchardCommitmentTreeSize) }()
216
- default: break
217
- }
218
- }
219
- }
220
-
221
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
222
- if self.saplingCommitmentTreeSize != 0 {
223
- try visitor.visitSingularUInt32Field(value: self.saplingCommitmentTreeSize, fieldNumber: 1)
224
- }
225
- if self.orchardCommitmentTreeSize != 0 {
226
- try visitor.visitSingularUInt32Field(value: self.orchardCommitmentTreeSize, fieldNumber: 2)
227
- }
228
- try unknownFields.traverse(visitor: &visitor)
229
- }
230
-
231
- static func ==(lhs: ChainMetadata, rhs: ChainMetadata) -> Bool {
232
- if lhs.saplingCommitmentTreeSize != rhs.saplingCommitmentTreeSize {return false}
233
- if lhs.orchardCommitmentTreeSize != rhs.orchardCommitmentTreeSize {return false}
234
- if lhs.unknownFields != rhs.unknownFields {return false}
235
- return true
236
- }
237
- }
238
-
239
160
  extension CompactBlock: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
240
161
  static let protoMessageName: String = _protobuf_package + ".CompactBlock"
241
162
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
@@ -246,33 +167,24 @@ extension CompactBlock: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
246
167
  5: .same(proto: "time"),
247
168
  6: .same(proto: "header"),
248
169
  7: .same(proto: "vtx"),
249
- 8: .same(proto: "chainMetadata"),
250
170
  ]
251
171
 
252
172
  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
253
173
  while let fieldNumber = try decoder.nextFieldNumber() {
254
- // The use of inline closures is to circumvent an issue where the compiler
255
- // allocates stack space for every case branch when no optimizations are
256
- // enabled. https://github.com/apple/swift-protobuf/issues/1034
257
174
  switch fieldNumber {
258
- case 1: try { try decoder.decodeSingularUInt32Field(value: &self.protoVersion) }()
259
- case 2: try { try decoder.decodeSingularUInt64Field(value: &self.height) }()
260
- case 3: try { try decoder.decodeSingularBytesField(value: &self.hash) }()
261
- case 4: try { try decoder.decodeSingularBytesField(value: &self.prevHash) }()
262
- case 5: try { try decoder.decodeSingularUInt32Field(value: &self.time) }()
263
- case 6: try { try decoder.decodeSingularBytesField(value: &self.header) }()
264
- case 7: try { try decoder.decodeRepeatedMessageField(value: &self.vtx) }()
265
- case 8: try { try decoder.decodeSingularMessageField(value: &self._chainMetadata) }()
175
+ case 1: try decoder.decodeSingularUInt32Field(value: &self.protoVersion)
176
+ case 2: try decoder.decodeSingularUInt64Field(value: &self.height)
177
+ case 3: try decoder.decodeSingularBytesField(value: &self.hash)
178
+ case 4: try decoder.decodeSingularBytesField(value: &self.prevHash)
179
+ case 5: try decoder.decodeSingularUInt32Field(value: &self.time)
180
+ case 6: try decoder.decodeSingularBytesField(value: &self.header)
181
+ case 7: try decoder.decodeRepeatedMessageField(value: &self.vtx)
266
182
  default: break
267
183
  }
268
184
  }
269
185
  }
270
186
 
271
187
  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
272
- // The use of inline closures is to circumvent an issue where the compiler
273
- // allocates stack space for every if/case branch local when no optimizations
274
- // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
275
- // https://github.com/apple/swift-protobuf/issues/1182
276
188
  if self.protoVersion != 0 {
277
189
  try visitor.visitSingularUInt32Field(value: self.protoVersion, fieldNumber: 1)
278
190
  }
@@ -294,9 +206,6 @@ extension CompactBlock: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
294
206
  if !self.vtx.isEmpty {
295
207
  try visitor.visitRepeatedMessageField(value: self.vtx, fieldNumber: 7)
296
208
  }
297
- try { if let v = self._chainMetadata {
298
- try visitor.visitSingularMessageField(value: v, fieldNumber: 8)
299
- } }()
300
209
  try unknownFields.traverse(visitor: &visitor)
301
210
  }
302
211
 
@@ -308,7 +217,6 @@ extension CompactBlock: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementat
308
217
  if lhs.time != rhs.time {return false}
309
218
  if lhs.header != rhs.header {return false}
310
219
  if lhs.vtx != rhs.vtx {return false}
311
- if lhs._chainMetadata != rhs._chainMetadata {return false}
312
220
  if lhs.unknownFields != rhs.unknownFields {return false}
313
221
  return true
314
222
  }
@@ -327,16 +235,13 @@ extension CompactTx: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementation
327
235
 
328
236
  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
329
237
  while let fieldNumber = try decoder.nextFieldNumber() {
330
- // The use of inline closures is to circumvent an issue where the compiler
331
- // allocates stack space for every case branch when no optimizations are
332
- // enabled. https://github.com/apple/swift-protobuf/issues/1034
333
238
  switch fieldNumber {
334
- case 1: try { try decoder.decodeSingularUInt64Field(value: &self.index) }()
335
- case 2: try { try decoder.decodeSingularBytesField(value: &self.hash) }()
336
- case 3: try { try decoder.decodeSingularUInt32Field(value: &self.fee) }()
337
- case 4: try { try decoder.decodeRepeatedMessageField(value: &self.spends) }()
338
- case 5: try { try decoder.decodeRepeatedMessageField(value: &self.outputs) }()
339
- case 6: try { try decoder.decodeRepeatedMessageField(value: &self.actions) }()
239
+ case 1: try decoder.decodeSingularUInt64Field(value: &self.index)
240
+ case 2: try decoder.decodeSingularBytesField(value: &self.hash)
241
+ case 3: try decoder.decodeSingularUInt32Field(value: &self.fee)
242
+ case 4: try decoder.decodeRepeatedMessageField(value: &self.spends)
243
+ case 5: try decoder.decodeRepeatedMessageField(value: &self.outputs)
244
+ case 6: try decoder.decodeRepeatedMessageField(value: &self.actions)
340
245
  default: break
341
246
  }
342
247
  }
@@ -384,11 +289,8 @@ extension CompactSaplingSpend: SwiftProtobuf.Message, SwiftProtobuf._MessageImpl
384
289
 
385
290
  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
386
291
  while let fieldNumber = try decoder.nextFieldNumber() {
387
- // The use of inline closures is to circumvent an issue where the compiler
388
- // allocates stack space for every case branch when no optimizations are
389
- // enabled. https://github.com/apple/swift-protobuf/issues/1034
390
292
  switch fieldNumber {
391
- case 1: try { try decoder.decodeSingularBytesField(value: &self.nf) }()
293
+ case 1: try decoder.decodeSingularBytesField(value: &self.nf)
392
294
  default: break
393
295
  }
394
296
  }
@@ -412,19 +314,16 @@ extension CompactSaplingOutput: SwiftProtobuf.Message, SwiftProtobuf._MessageImp
412
314
  static let protoMessageName: String = _protobuf_package + ".CompactSaplingOutput"
413
315
  static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
414
316
  1: .same(proto: "cmu"),
415
- 2: .same(proto: "ephemeralKey"),
317
+ 2: .same(proto: "epk"),
416
318
  3: .same(proto: "ciphertext"),
417
319
  ]
418
320
 
419
321
  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
420
322
  while let fieldNumber = try decoder.nextFieldNumber() {
421
- // The use of inline closures is to circumvent an issue where the compiler
422
- // allocates stack space for every case branch when no optimizations are
423
- // enabled. https://github.com/apple/swift-protobuf/issues/1034
424
323
  switch fieldNumber {
425
- case 1: try { try decoder.decodeSingularBytesField(value: &self.cmu) }()
426
- case 2: try { try decoder.decodeSingularBytesField(value: &self.ephemeralKey) }()
427
- case 3: try { try decoder.decodeSingularBytesField(value: &self.ciphertext) }()
324
+ case 1: try decoder.decodeSingularBytesField(value: &self.cmu)
325
+ case 2: try decoder.decodeSingularBytesField(value: &self.epk)
326
+ case 3: try decoder.decodeSingularBytesField(value: &self.ciphertext)
428
327
  default: break
429
328
  }
430
329
  }
@@ -434,8 +333,8 @@ extension CompactSaplingOutput: SwiftProtobuf.Message, SwiftProtobuf._MessageImp
434
333
  if !self.cmu.isEmpty {
435
334
  try visitor.visitSingularBytesField(value: self.cmu, fieldNumber: 1)
436
335
  }
437
- if !self.ephemeralKey.isEmpty {
438
- try visitor.visitSingularBytesField(value: self.ephemeralKey, fieldNumber: 2)
336
+ if !self.epk.isEmpty {
337
+ try visitor.visitSingularBytesField(value: self.epk, fieldNumber: 2)
439
338
  }
440
339
  if !self.ciphertext.isEmpty {
441
340
  try visitor.visitSingularBytesField(value: self.ciphertext, fieldNumber: 3)
@@ -445,7 +344,7 @@ extension CompactSaplingOutput: SwiftProtobuf.Message, SwiftProtobuf._MessageImp
445
344
 
446
345
  static func ==(lhs: CompactSaplingOutput, rhs: CompactSaplingOutput) -> Bool {
447
346
  if lhs.cmu != rhs.cmu {return false}
448
- if lhs.ephemeralKey != rhs.ephemeralKey {return false}
347
+ if lhs.epk != rhs.epk {return false}
449
348
  if lhs.ciphertext != rhs.ciphertext {return false}
450
349
  if lhs.unknownFields != rhs.unknownFields {return false}
451
350
  return true
@@ -463,14 +362,11 @@ extension CompactOrchardAction: SwiftProtobuf.Message, SwiftProtobuf._MessageImp
463
362
 
464
363
  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
465
364
  while let fieldNumber = try decoder.nextFieldNumber() {
466
- // The use of inline closures is to circumvent an issue where the compiler
467
- // allocates stack space for every case branch when no optimizations are
468
- // enabled. https://github.com/apple/swift-protobuf/issues/1034
469
365
  switch fieldNumber {
470
- case 1: try { try decoder.decodeSingularBytesField(value: &self.nullifier) }()
471
- case 2: try { try decoder.decodeSingularBytesField(value: &self.cmx) }()
472
- case 3: try { try decoder.decodeSingularBytesField(value: &self.ephemeralKey) }()
473
- case 4: try { try decoder.decodeSingularBytesField(value: &self.ciphertext) }()
366
+ case 1: try decoder.decodeSingularBytesField(value: &self.nullifier)
367
+ case 2: try decoder.decodeSingularBytesField(value: &self.cmx)
368
+ case 3: try decoder.decodeSingularBytesField(value: &self.ephemeralKey)
369
+ case 4: try decoder.decodeSingularBytesField(value: &self.ciphertext)
474
370
  default: break
475
371
  }
476
372
  }
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2019-2021 The Zcash developers
1
+ // Copyright (c) 2019-2020 The Zcash developers
2
2
  // Distributed under the MIT software license, see the accompanying
3
3
  // file COPYING or https://www.opensource.org/licenses/mit-license.php .
4
4
 
@@ -6,50 +6,39 @@ syntax = "proto3";
6
6
  package cash.z.wallet.sdk.rpc;
7
7
  option go_package = "lightwalletd/walletrpc";
8
8
  option swift_prefix = "";
9
-
10
9
  // Remember that proto3 fields are all optional. A field that is not present will be set to its zero value.
11
10
  // bytes fields of hashes are in canonical little-endian format.
12
11
 
13
- // ChainMetadata represents information about the state of the chain as of a given block.
14
- message ChainMetadata {
15
- uint32 saplingCommitmentTreeSize = 1; // the size of the Sapling note commitment tree as of the end of this block
16
- uint32 orchardCommitmentTreeSize = 2; // the size of the Orchard note commitment tree as of the end of this block
17
- }
18
-
19
12
  // CompactBlock is a packaging of ONLY the data from a block that's needed to:
20
13
  // 1. Detect a payment to your shielded Sapling address
21
14
  // 2. Detect a spend of your shielded Sapling notes
22
15
  // 3. Update your witnesses to generate new Sapling spend proofs.
23
16
  message CompactBlock {
24
- uint32 protoVersion = 1; // the version of this wire format, for storage
25
- uint64 height = 2; // the height of this block
26
- bytes hash = 3; // the ID (hash) of this block, same as in block explorers
27
- bytes prevHash = 4; // the ID (hash) of this block's predecessor
28
- uint32 time = 5; // Unix epoch time when the block was mined
29
- bytes header = 6; // (hash, prevHash, and time) OR (full header)
30
- repeated CompactTx vtx = 7; // zero or more compact transactions from this block
31
- ChainMetadata chainMetadata = 8; // information about the state of the chain as of this block
17
+ uint32 protoVersion = 1; // the version of this wire format, for storage
18
+ uint64 height = 2; // the height of this block
19
+ bytes hash = 3; // the ID (hash) of this block, same as in block explorers
20
+ bytes prevHash = 4; // the ID (hash) of this block's predecessor
21
+ uint32 time = 5; // Unix epoch time when the block was mined
22
+ bytes header = 6; // (hash, prevHash, and time) OR (full header)
23
+ repeated CompactTx vtx = 7; // zero or more compact transactions from this block
32
24
  }
33
25
 
34
26
  // CompactTx contains the minimum information for a wallet to know if this transaction
35
27
  // is relevant to it (either pays to it or spends from it) via shielded elements
36
28
  // only. This message will not encode a transparent-to-transparent transaction.
37
29
  message CompactTx {
38
- // Index and hash will allow the receiver to call out to chain
39
- // explorers or other data structures to retrieve more information
40
- // about this transaction.
41
30
  uint64 index = 1; // the index within the full block
42
31
  bytes hash = 2; // the ID (hash) of this transaction, same as in block explorers
43
32
 
44
33
  // The transaction fee: present if server can provide. In the case of a
45
34
  // stateless server and a transaction with transparent inputs, this will be
46
35
  // unset because the calculation requires reference to prior transactions.
47
- // If there are no transparent inputs, the fee will be calculable as:
48
- // valueBalanceSapling + valueBalanceOrchard + sum(vPubNew) - sum(vPubOld) - sum(tOut)
36
+ // in a pure-Sapling context, the fee will be calculable as:
37
+ // valueBalance + (sum(vPubNew) - sum(vPubOld) - sum(tOut))
49
38
  uint32 fee = 3;
50
39
 
51
- repeated CompactSaplingSpend spends = 4;
52
- repeated CompactSaplingOutput outputs = 5;
40
+ repeated CompactSaplingSpend spends = 4; // inputs
41
+ repeated CompactSaplingOutput outputs = 5; // outputs
53
42
  repeated CompactOrchardAction actions = 6;
54
43
  }
55
44
 
@@ -59,14 +48,11 @@ message CompactSaplingSpend {
59
48
  bytes nf = 1; // nullifier (see the Zcash protocol specification)
60
49
  }
61
50
 
62
- // output encodes the `cmu` field, `ephemeralKey` field, and a 52-byte prefix of the
63
- // `encCiphertext` field of a Sapling Output Description. These fields are described in
64
- // section 7.4 of the Zcash protocol spec:
65
- // https://zips.z.cash/protocol/protocol.pdf#outputencodingandconsensus
66
- // Total size is 116 bytes.
51
+ // output is a Sapling Output Description as described in section 7.4 of the
52
+ // Zcash protocol spec. Total size is 948.
67
53
  message CompactSaplingOutput {
68
54
  bytes cmu = 1; // note commitment u-coordinate
69
- bytes ephemeralKey = 2; // ephemeral public key
55
+ bytes epk = 2; // ephemeral public key
70
56
  bytes ciphertext = 3; // first 52 bytes of ciphertext
71
57
  }
72
58
 
@@ -76,5 +62,5 @@ message CompactOrchardAction {
76
62
  bytes nullifier = 1; // [32] The nullifier of the input note
77
63
  bytes cmx = 2; // [32] The x-coordinate of the note commitment for the output note
78
64
  bytes ephemeralKey = 3; // [32] An encoding of an ephemeral Pallas public key
79
- bytes ciphertext = 4; // [52] The first 52 bytes of the encCiphertext field
65
+ bytes ciphertext = 4; // [52] The note plaintext component of the encCiphertext field
80
66
  }
@@ -31,7 +31,7 @@ message TxFilter {
31
31
  bytes hash = 3; // transaction ID (hash, txid)
32
32
  }
33
33
 
34
- // RawTransaction contains the complete transaction data. It also optionally includes
34
+ // RawTransaction contains the complete transaction data. It also optionally includes
35
35
  // the block height in which the transaction was included, or, when returned
36
36
  // by GetMempoolStream(), the latest block height.
37
37
  message RawTransaction {
@@ -110,28 +110,11 @@ message Exclude {
110
110
 
111
111
  // The TreeState is derived from the Zcash z_gettreestate rpc.
112
112
  message TreeState {
113
- string network = 1; // "main" or "test"
114
- uint64 height = 2; // block height
115
- string hash = 3; // block id
116
- uint32 time = 4; // Unix epoch time when the block was mined
117
- string saplingTree = 5; // sapling commitment tree state
118
- string orchardTree = 6; // orchard commitment tree state
119
- }
120
-
121
- enum ShieldedProtocol {
122
- sapling = 0;
123
- orchard = 1;
124
- }
125
-
126
- message GetSubtreeRootsArg {
127
- uint32 startIndex = 1; // Index identifying where to start returning subtree roots
128
- ShieldedProtocol shieldedProtocol = 2; // Shielded protocol to return subtree roots for
129
- uint32 maxEntries = 3; // Maximum number of entries to return, or 0 for all entries.
130
- }
131
- message SubtreeRoot {
132
- bytes rootHash = 2; // The 32-byte Merkle root of the subtree.
133
- bytes completingBlockHash = 3; // The hash of the block that completed this subtree.
134
- uint64 completingBlockHeight = 4; // The height of the block that completed this subtree in the main chain.
113
+ string network = 1; // "main" or "test"
114
+ uint64 height = 2;
115
+ string hash = 3; // block id
116
+ uint32 time = 4; // Unix epoch time when the block was mined
117
+ string tree = 5; // sapling commitment tree state
135
118
  }
136
119
 
137
120
  // Results are sorted by height, which makes it easy to issue another
@@ -158,12 +141,8 @@ service CompactTxStreamer {
158
141
  rpc GetLatestBlock(ChainSpec) returns (BlockID) {}
159
142
  // Return the compact block corresponding to the given block identifier
160
143
  rpc GetBlock(BlockID) returns (CompactBlock) {}
161
- // Same as GetBlock except actions contain only nullifiers
162
- rpc GetBlockNullifiers(BlockID) returns (CompactBlock) {}
163
144
  // Return a list of consecutive compact blocks
164
145
  rpc GetBlockRange(BlockRange) returns (stream CompactBlock) {}
165
- // Same as GetBlockRange except actions contain only nullifiers
166
- rpc GetBlockRangeNullifiers(BlockRange) returns (stream CompactBlock) {}
167
146
 
168
147
  // Return the requested full (not compact) transaction (as from zcashd)
169
148
  rpc GetTransaction(TxFilter) returns (RawTransaction) {}
@@ -195,11 +174,6 @@ service CompactTxStreamer {
195
174
  // values also (even though they can be obtained using GetBlock).
196
175
  // The block can be specified by either height or hash.
197
176
  rpc GetTreeState(BlockID) returns (TreeState) {}
198
- rpc GetLatestTreeState(Empty) returns (TreeState) {}
199
-
200
- // Returns a stream of information about roots of subtrees of the Sapling and Orchard
201
- // note commitment trees.
202
- rpc GetSubtreeRoots(GetSubtreeRootsArg) returns (stream SubtreeRoot) {}
203
177
 
204
178
  rpc GetAddressUtxos(GetAddressUtxosArg) returns (GetAddressUtxosReplyList) {}
205
179
  rpc GetAddressUtxosStream(GetAddressUtxosArg) returns (stream GetAddressUtxosReply) {}