Update to zcash-light-client-ffi version 0.8.0.

This commit is contained in:
Kris Nuttycombe 2024-04-17 13:58:49 -06:00
parent 6bbb4a9e42
commit 55cc320ac1
10 changed files with 45 additions and 39 deletions

View File

@ -6,6 +6,11 @@ and this library adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
# Unreleased # Unreleased
## Changed
- Updated to `zcash-light-client-ffi` version 0.8.0.
- `ZcashRustBackend.getMemo` now takes an additional `outputPool` argument that identifies
the shielded pool for the decrypted output.
# 2.1.4 - 2024-04-17 # 2.1.4 - 2024-04-17
## Changed ## Changed

View File

@ -5,8 +5,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/grpc/grpc-swift.git", "location" : "https://github.com/grpc/grpc-swift.git",
"state" : { "state" : {
"revision" : "6ade19f0b57f5fc436dfecfced83f3c84d1095b9", "revision" : "393b02b1c39cc82fb24e57f24fa446f43e8124c9",
"version" : "1.21.0" "version" : "1.22.0"
} }
}, },
{ {
@ -59,8 +59,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/stephencelis/SQLite.swift.git", "location" : "https://github.com/stephencelis/SQLite.swift.git",
"state" : { "state" : {
"revision" : "7a2e3cd27de56f6d396e84f63beefd0267b55ccb", "revision" : "e5e833921a8f98870e547e428df017c266cd98f2",
"version" : "0.14.1" "version" : "0.15.2"
} }
}, },
{ {
@ -77,8 +77,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git", "location" : "https://github.com/apple/swift-collections.git",
"state" : { "state" : {
"revision" : "d029d9d39c87bed85b1c50adee7c41795261a192", "revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb",
"version" : "1.0.6" "version" : "1.1.0"
} }
}, },
{ {
@ -113,8 +113,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git", "location" : "https://github.com/apple/swift-nio.git",
"state" : { "state" : {
"revision" : "635b2589494c97e48c62514bc8b37ced762e0a62", "revision" : "fc63f0cf4e55a4597407a9fc95b16a2bc44b4982",
"version" : "2.63.0" "version" : "2.64.0"
} }
}, },
{ {
@ -122,8 +122,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-extras.git", "location" : "https://github.com/apple/swift-nio-extras.git",
"state" : { "state" : {
"revision" : "363da63c1966405764f380c627409b2f9d9e710b", "revision" : "a3b640d7dc567225db7c94386a6e71aded1bfa63",
"version" : "1.21.0" "version" : "1.22.0"
} }
}, },
{ {
@ -158,8 +158,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-protobuf.git", "location" : "https://github.com/apple/swift-protobuf.git",
"state" : { "state" : {
"revision" : "65e8f29b2d63c4e38e736b25c27b83e012159be8", "revision" : "9f0c76544701845ad98716f3f6a774a892152bcb",
"version" : "1.25.2" "version" : "1.26.0"
} }
}, },
{ {
@ -176,8 +176,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/zcash-hackworks/zcash-light-client-ffi", "location" : "https://github.com/zcash-hackworks/zcash-light-client-ffi",
"state" : { "state" : {
"revision" : "e2d8763f3a963fb0026b6160af2d211b527453cd", "revision" : "9314c83d7a09d88e1c0bd3ff3738a50833325059",
"version" : "0.7.4" "version" : "0.8.0"
} }
} }
], ],

View File

@ -122,8 +122,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/zcash-hackworks/zcash-light-client-ffi", "location" : "https://github.com/zcash-hackworks/zcash-light-client-ffi",
"state" : { "state" : {
"revision" : "e2d8763f3a963fb0026b6160af2d211b527453cd", "revision" : "9314c83d7a09d88e1c0bd3ff3738a50833325059",
"version" : "0.7.4" "version" : "0.8.0"
} }
} }
], ],

View File

@ -16,7 +16,7 @@ let package = Package(
dependencies: [ dependencies: [
.package(url: "https://github.com/grpc/grpc-swift.git", from: "1.19.1"), .package(url: "https://github.com/grpc/grpc-swift.git", from: "1.19.1"),
.package(url: "https://github.com/stephencelis/SQLite.swift.git", from: "0.14.1"), .package(url: "https://github.com/stephencelis/SQLite.swift.git", from: "0.14.1"),
.package(url: "https://github.com/zcash-hackworks/zcash-light-client-ffi", exact: "0.7.4") .package(url: "https://github.com/zcash-hackworks/zcash-light-client-ffi", from: "0.8.0")
], ],
targets: [ targets: [
.target( .target(

View File

@ -68,7 +68,7 @@ struct ZcashKeyDerivationBackend: ZcashKeyDerivationBackendWelding {
return false return false
} }
return zcashlc_is_valid_shielded_address([CChar](address.utf8CString), networkType.networkId) return zcashlc_is_valid_sapling_address([CChar](address.utf8CString), networkType.networkId)
} }
func isValidSaplingExtendedFullViewingKey(_ key: String) -> Bool { func isValidSaplingExtendedFullViewingKey(_ key: String) -> Bool {

View File

@ -255,7 +255,7 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
} }
@DBActor @DBActor
func getMemo(txId: Data, outputIndex: UInt16) async throws -> Memo? { func getMemo(txId: Data, outputPool: UInt32, outputIndex: UInt16) async throws -> Memo? {
guard txId.count == 32 else { guard txId.count == 32 else {
throw ZcashError.rustGetMemoInvalidTxIdLength throw ZcashError.rustGetMemoInvalidTxIdLength
} }
@ -264,7 +264,7 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
var success = false var success = false
contiguousMemoBytes.withUnsafeMutableBufferPointer { memoBytePtr in contiguousMemoBytes.withUnsafeMutableBufferPointer { memoBytePtr in
success = zcashlc_get_memo(dbData.0, dbData.1, txId.bytes, outputIndex, memoBytePtr.baseAddress, networkType.networkId) success = zcashlc_get_memo(dbData.0, dbData.1, txId.bytes, outputPool, outputIndex, memoBytePtr.baseAddress, networkType.networkId)
} }
guard success else { return nil } guard success else { return nil }

View File

@ -85,8 +85,9 @@ protocol ZcashRustBackendWelding {
/// Get memo from note. /// Get memo from note.
/// - parameter txId: ID of transaction containing the note /// - parameter txId: ID of transaction containing the note
/// - parameter outputPool: output pool identifier (2 = Sapling, 3 = Orchard)
/// - parameter outputIndex: output index of note /// - parameter outputIndex: output index of note
func getMemo(txId: Data, outputIndex: UInt16) async throws -> Memo? func getMemo(txId: Data, outputPool: UInt32, outputIndex: UInt16) async throws -> Memo?
/// Get the verified cached transparent balance for the given address /// Get the verified cached transparent balance for the given address
/// - parameter account; the account index to query /// - parameter account; the account index to query

View File

@ -1,4 +1,4 @@
// Generated using Sourcery 2.1.7 https://github.com/krzysztofzablocki/Sourcery // Generated using Sourcery 2.2.3 https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT // DO NOT EDIT
import Combine import Combine
@testable import ZcashLightClientKit @testable import ZcashLightClientKit
@ -2434,25 +2434,25 @@ class ZcashRustBackendWeldingMock: ZcashRustBackendWelding {
// MARK: - getMemo // MARK: - getMemo
var getMemoTxIdOutputIndexThrowableError: Error? var getMemoTxIdOutputPoolOutputIndexThrowableError: Error?
var getMemoTxIdOutputIndexCallsCount = 0 var getMemoTxIdOutputPoolOutputIndexCallsCount = 0
var getMemoTxIdOutputIndexCalled: Bool { var getMemoTxIdOutputPoolOutputIndexCalled: Bool {
return getMemoTxIdOutputIndexCallsCount > 0 return getMemoTxIdOutputPoolOutputIndexCallsCount > 0
} }
var getMemoTxIdOutputIndexReceivedArguments: (txId: Data, outputIndex: UInt16)? var getMemoTxIdOutputPoolOutputIndexReceivedArguments: (txId: Data, outputPool: UInt32, outputIndex: UInt16)?
var getMemoTxIdOutputIndexReturnValue: Memo? var getMemoTxIdOutputPoolOutputIndexReturnValue: Memo?
var getMemoTxIdOutputIndexClosure: ((Data, UInt16) async throws -> Memo?)? var getMemoTxIdOutputPoolOutputIndexClosure: ((Data, UInt32, UInt16) async throws -> Memo?)?
func getMemo(txId: Data, outputIndex: UInt16) async throws -> Memo? { func getMemo(txId: Data, outputPool: UInt32, outputIndex: UInt16) async throws -> Memo? {
if let error = getMemoTxIdOutputIndexThrowableError { if let error = getMemoTxIdOutputPoolOutputIndexThrowableError {
throw error throw error
} }
getMemoTxIdOutputIndexCallsCount += 1 getMemoTxIdOutputPoolOutputIndexCallsCount += 1
getMemoTxIdOutputIndexReceivedArguments = (txId: txId, outputIndex: outputIndex) getMemoTxIdOutputPoolOutputIndexReceivedArguments = (txId: txId, outputPool: outputPool, outputIndex: outputIndex)
if let closure = getMemoTxIdOutputIndexClosure { if let closure = getMemoTxIdOutputPoolOutputIndexClosure {
return try await closure(txId, outputIndex) return try await closure(txId, outputPool, outputIndex)
} else { } else {
return getMemoTxIdOutputIndexReturnValue return getMemoTxIdOutputPoolOutputIndexReturnValue
} }
} }

View File

@ -3,11 +3,11 @@
scriptDir=${0:a:h} scriptDir=${0:a:h}
cd "${scriptDir}" cd "${scriptDir}"
sourcery_version=2.1.7 sourcery_version=2.2.3
if which sourcery >/dev/null; then if which sourcery >/dev/null; then
if [[ $(sourcery --version) != $sourcery_version ]]; then if [[ $(sourcery --version) != $sourcery_version ]]; then
echo "warning: Compatible sourcery version not installed. Install sourcer $sourcery_version. Currently installed version is $(sourcery --version)" echo "warning: Compatible sourcery version not installed. Install sourcery $sourcery_version. Currently installed version is $(sourcery --version)"
exit 1 exit 1
fi fi

View File

@ -79,7 +79,7 @@ class RustBackendMockHelper {
rustBackendMock.getCurrentAddressAccountThrowableError = ZcashError.rustGetCurrentAddress("mocked error") rustBackendMock.getCurrentAddressAccountThrowableError = ZcashError.rustGetCurrentAddress("mocked error")
rustBackendMock.getNextAvailableAddressAccountThrowableError = ZcashError.rustGetNextAvailableAddress("mocked error") rustBackendMock.getNextAvailableAddressAccountThrowableError = ZcashError.rustGetNextAvailableAddress("mocked error")
rustBackendMock.createAccountSeedTreeStateRecoverUntilThrowableError = ZcashError.rustInitAccountsTableViewingKeyCotainsNullBytes rustBackendMock.createAccountSeedTreeStateRecoverUntilThrowableError = ZcashError.rustInitAccountsTableViewingKeyCotainsNullBytes
rustBackendMock.getMemoTxIdOutputIndexReturnValue = nil rustBackendMock.getMemoTxIdOutputPoolOutputIndexReturnValue = nil
rustBackendMock.initDataDbSeedReturnValue = .seedRequired rustBackendMock.initDataDbSeedReturnValue = .seedRequired
rustBackendMock.getNearestRewindHeightHeightReturnValue = -1 rustBackendMock.getNearestRewindHeightHeightReturnValue = -1
rustBackendMock.putUnspentTransparentOutputTxidIndexScriptValueHeightClosure = { _, _, _, _, _ in } rustBackendMock.putUnspentTransparentOutputTxidIndexScriptValueHeightClosure = { _, _, _, _, _ in }