Compare commits

...

4 Commits

Author SHA1 Message Date
Lukas Korba 31a5848013
Merge pull request #1419 from LukasKorba/1418-Release-2-1-5
[#1418] Release 2.1.5
2024-04-18 15:43:58 +02:00
Lukas Korba 1c483dcb7f [#1418] Release 2.1.5
- Changelog updated
2024-04-18 15:29:52 +02:00
Lukas Korba c460121254
Merge pull request #1417 from Electric-Coin-Company/release-2.2.0
Update to zcash-light-client-ffi version 0.8.0.
2024-04-18 15:27:53 +02:00
Kris Nuttycombe 0cf08c6a59 Update to zcash-light-client-ffi version 0.8.0. 2024-04-17 17:21:37 -06:00
10 changed files with 54 additions and 44 deletions

View File

@ -6,13 +6,22 @@ and this library adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
# Unreleased # Unreleased
# 2.1.5 - 2024-04-18
## 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 # 2.1.4 - 2024-04-17
## Changed ## Changed
- The database locking mechanism has been changed to use async/await concurrency approach - the DBActor. - The database locking mechanism has been changed to use async/await concurrency approach - the DBActor.
## Fixed ## Fixed
- Call of wipe() resets local (in memory) values. - Call of wipe() resets local (in memory) values.
## Checkpoints ## Checkpoints
@ -131,7 +140,7 @@ Sources/ZcashLightClientKit/Resources/checkpoints/testnet/2740000.json
## Added ## Added
### [#1153] Allow runtime switch of lightwalletd servers ### [#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: 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. - `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`. - Switching endpoints causes a call to `synchronizer.Start()`, which may throw a `ZcashError`.
@ -139,7 +148,7 @@ Possible errors:
## Changed ## Changed
### [#1369] SynchronizerState refactor and balances cleanup ### [#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 ## Removed
@ -159,14 +168,14 @@ Possible errors:
## Added ## Added
### [#1153] Allow runtime switch of lightwalletd servers ### [#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: Possible errors:
- `ZcashError.synchronizerServerSwitch`: endpoint fails, check the address, port and format address:port, - `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. - 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 # 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. broke shielding.
# 2.0.7 - 2024-01-29 # 2.0.7 - 2024-01-29

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", exact: "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 }