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 0cf08c6a59
10 changed files with 52 additions and 44 deletions

View File

@ -6,13 +6,20 @@ and this library adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
# Unreleased
## Changed
- Updated to `zcash-light-client-ffi` version 0.8.0. This includes a migration to
ensure that the default Unified Address for existing wallets contains an Orchard
receiver.
- This release includes a workaround for build and deployment issues related to
a bug in XCode 15.3.
# 2.1.4 - 2024-04-17
## Changed
- The database locking mechanism has been changed to use async/await concurrency approach - the DBActor.
## Fixed
- Call of wipe() resets local (in memory) values.
- Call of wipe() resets local (in memory) values.
## Checkpoints
@ -131,7 +138,7 @@ Sources/ZcashLightClientKit/Resources/checkpoints/testnet/2740000.json
## Added
### [#1153] Allow runtime switch of lightwalletd servers
New API implemented that allows clients to change the `mainnet` endpoint. Use `func switchTo(endpoint: LightWalletEndpoint) async throws`.
New API implemented that allows clients to change the `mainnet` endpoint. Use `func switchTo(endpoint: LightWalletEndpoint) async throws`.
Possible errors:
- `ZcashError.synchronizerServerSwitch` will perform a check to ensure that it's possible to communicate with the specified lightwalletd server, which may result in an an error. If this check fails, the user should be prompted to check the address, port and verify that the `address:port` format is respected.
- Switching endpoints causes a call to `synchronizer.Start()`, which may throw a `ZcashError`.
@ -139,7 +146,7 @@ Possible errors:
## Changed
### [#1369] SynchronizerState refactor and balances cleanup
`SynchronizerState` cleaned up and changed to provide only `AccountBalance`. This struct holds `saplingBalance: PoolBalance` which represents shielded balance for both total and spendable. Also holds `unshielded: Zatoshi` which represents transparent balance.
`SynchronizerState` cleaned up and changed to provide only `AccountBalance`. This struct holds `saplingBalance: PoolBalance` which represents shielded balance for both total and spendable. Also holds `unshielded: Zatoshi` which represents transparent balance.
## Removed
@ -159,14 +166,14 @@ Possible errors:
## Added
### [#1153] Allow runtime switch of lightwalletd servers
New API implemented that allows clients to change the `mainnet` endpoint. Use `func switchTo(endpoint: LightWalletEndpoint) async throws`.
New API implemented that allows clients to change the `mainnet` endpoint. Use `func switchTo(endpoint: LightWalletEndpoint) async throws`.
Possible errors:
- `ZcashError.synchronizerServerSwitch`: endpoint fails, check the address, port and format address:port,
- Some `ZcashError` related to `synchronizer.Start()`: the switch calls `start()` at the end and that is the only throwing function except the validation.
# 2.0.8 - 2024-01-30
Adopt `zcash-light-client-ffi 0.5.1`. This fixes a serialization problem
Adopt `zcash-light-client-ffi 0.5.1`. This fixes a serialization problem
broke shielding.
# 2.0.7 - 2024-01-29

View File

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

View File

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

View File

@ -16,7 +16,7 @@ let package = Package(
dependencies: [
.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/zcash-hackworks/zcash-light-client-ffi", exact: "0.7.4")
.package(url: "https://github.com/zcash-hackworks/zcash-light-client-ffi", exact: "0.8.0")
],
targets: [
.target(

View File

@ -68,7 +68,7 @@ struct ZcashKeyDerivationBackend: ZcashKeyDerivationBackendWelding {
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 {

View File

@ -255,7 +255,7 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
}
@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 {
throw ZcashError.rustGetMemoInvalidTxIdLength
}
@ -264,7 +264,7 @@ struct ZcashRustBackend: ZcashRustBackendWelding {
var success = false
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 }

View File

@ -85,8 +85,9 @@ protocol ZcashRustBackendWelding {
/// Get memo from note.
/// - parameter txId: ID of transaction containing the note
/// - parameter outputPool: output pool identifier (2 = Sapling, 3 = Orchard)
/// - 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
/// - 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
import Combine
@testable import ZcashLightClientKit
@ -2434,25 +2434,25 @@ class ZcashRustBackendWeldingMock: ZcashRustBackendWelding {
// MARK: - getMemo
var getMemoTxIdOutputIndexThrowableError: Error?
var getMemoTxIdOutputIndexCallsCount = 0
var getMemoTxIdOutputIndexCalled: Bool {
return getMemoTxIdOutputIndexCallsCount > 0
var getMemoTxIdOutputPoolOutputIndexThrowableError: Error?
var getMemoTxIdOutputPoolOutputIndexCallsCount = 0
var getMemoTxIdOutputPoolOutputIndexCalled: Bool {
return getMemoTxIdOutputPoolOutputIndexCallsCount > 0
}
var getMemoTxIdOutputIndexReceivedArguments: (txId: Data, outputIndex: UInt16)?
var getMemoTxIdOutputIndexReturnValue: Memo?
var getMemoTxIdOutputIndexClosure: ((Data, UInt16) async throws -> Memo?)?
var getMemoTxIdOutputPoolOutputIndexReceivedArguments: (txId: Data, outputPool: UInt32, outputIndex: UInt16)?
var getMemoTxIdOutputPoolOutputIndexReturnValue: Memo?
var getMemoTxIdOutputPoolOutputIndexClosure: ((Data, UInt32, UInt16) async throws -> Memo?)?
func getMemo(txId: Data, outputIndex: UInt16) async throws -> Memo? {
if let error = getMemoTxIdOutputIndexThrowableError {
func getMemo(txId: Data, outputPool: UInt32, outputIndex: UInt16) async throws -> Memo? {
if let error = getMemoTxIdOutputPoolOutputIndexThrowableError {
throw error
}
getMemoTxIdOutputIndexCallsCount += 1
getMemoTxIdOutputIndexReceivedArguments = (txId: txId, outputIndex: outputIndex)
if let closure = getMemoTxIdOutputIndexClosure {
return try await closure(txId, outputIndex)
getMemoTxIdOutputPoolOutputIndexCallsCount += 1
getMemoTxIdOutputPoolOutputIndexReceivedArguments = (txId: txId, outputPool: outputPool, outputIndex: outputIndex)
if let closure = getMemoTxIdOutputPoolOutputIndexClosure {
return try await closure(txId, outputPool, outputIndex)
} else {
return getMemoTxIdOutputIndexReturnValue
return getMemoTxIdOutputPoolOutputIndexReturnValue
}
}

View File

@ -3,11 +3,11 @@
scriptDir=${0:a:h}
cd "${scriptDir}"
sourcery_version=2.1.7
sourcery_version=2.2.3
if which sourcery >/dev/null; 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
fi

View File

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