diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f336439..81bd27ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Example/ZcashLightClientSample/ZcashLightClientSample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Example/ZcashLightClientSample/ZcashLightClientSample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 2cc78dbb..3681b337 100644 --- a/Example/ZcashLightClientSample/ZcashLightClientSample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Example/ZcashLightClientSample/ZcashLightClientSample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -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" } } ], diff --git a/Package.resolved b/Package.resolved index 30efaf66..c8615efd 100644 --- a/Package.resolved +++ b/Package.resolved @@ -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" } } ], diff --git a/Package.swift b/Package.swift index 58644946..8dbf116a 100644 --- a/Package.swift +++ b/Package.swift @@ -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( diff --git a/Sources/ZcashLightClientKit/Rust/ZcashKeyDerivationBackend.swift b/Sources/ZcashLightClientKit/Rust/ZcashKeyDerivationBackend.swift index fb7ed96e..2ecaabc9 100644 --- a/Sources/ZcashLightClientKit/Rust/ZcashKeyDerivationBackend.swift +++ b/Sources/ZcashLightClientKit/Rust/ZcashKeyDerivationBackend.swift @@ -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 { diff --git a/Sources/ZcashLightClientKit/Rust/ZcashRustBackend.swift b/Sources/ZcashLightClientKit/Rust/ZcashRustBackend.swift index bc69afe7..6377fd4d 100644 --- a/Sources/ZcashLightClientKit/Rust/ZcashRustBackend.swift +++ b/Sources/ZcashLightClientKit/Rust/ZcashRustBackend.swift @@ -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 } diff --git a/Sources/ZcashLightClientKit/Rust/ZcashRustBackendWelding.swift b/Sources/ZcashLightClientKit/Rust/ZcashRustBackendWelding.swift index 011135e8..35fb701e 100644 --- a/Sources/ZcashLightClientKit/Rust/ZcashRustBackendWelding.swift +++ b/Sources/ZcashLightClientKit/Rust/ZcashRustBackendWelding.swift @@ -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 diff --git a/Tests/TestUtils/Sourcery/GeneratedMocks/AutoMockable.generated.swift b/Tests/TestUtils/Sourcery/GeneratedMocks/AutoMockable.generated.swift index 655c250a..2baa2e47 100644 --- a/Tests/TestUtils/Sourcery/GeneratedMocks/AutoMockable.generated.swift +++ b/Tests/TestUtils/Sourcery/GeneratedMocks/AutoMockable.generated.swift @@ -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 } } diff --git a/Tests/TestUtils/Sourcery/generateMocks.sh b/Tests/TestUtils/Sourcery/generateMocks.sh index b25143e5..4f735d58 100755 --- a/Tests/TestUtils/Sourcery/generateMocks.sh +++ b/Tests/TestUtils/Sourcery/generateMocks.sh @@ -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 diff --git a/Tests/TestUtils/Stubs.swift b/Tests/TestUtils/Stubs.swift index 93ee7f54..62c70d3e 100644 --- a/Tests/TestUtils/Stubs.swift +++ b/Tests/TestUtils/Stubs.swift @@ -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 }