Rust PCZT update (#1780)

* Rust PCZT update

* Code cleanup
This commit is contained in:
Milan 2025-02-27 10:19:36 +01:00 committed by GitHub
parent fb85269f14
commit b6c85d22c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 1 deletions

View File

@ -16,6 +16,7 @@ and this application adheres to [Semantic Versioning](https://semver.org/spec/v2
- `Flexa` version has been bumped to 1.0.11
- Several non-FOSS dependencies has been removed for the new FOSS Zashi build type
- Keystone flows swapped the buttons for the better UX, the main CTA is the closes button for a thumb.
- `Synchronizer.redactPcztForSigner` is now called in order to generate pczt bytes to display as QR for Keystone
## [1.3.3 (839)] - 2025-01-23

View File

@ -57,10 +57,14 @@ interface ProposalDataSource {
proposal: Proposal,
usk: UnifiedSpendingKey
): SubmitResult
@Throws(PcztException.RedactPcztForSignerException::class)
suspend fun redactPcztForSigner(pczt: Pczt): Pczt
}
class TransactionProposalNotCreatedException(reason: Exception) : Exception(reason)
@Suppress("TooManyFunctions")
class ProposalDataSourceImpl(
private val synchronizerProvider: SynchronizerProvider,
) : ProposalDataSource {
@ -172,6 +176,12 @@ class ProposalDataSourceImpl(
)
}
override suspend fun redactPcztForSigner(pczt: Pczt): Pczt =
withContext(Dispatchers.IO) {
synchronizerProvider.getSynchronizer()
.redactPcztForSigner(pczt)
}
private suspend inline fun submitTransactionInternal(
crossinline block: suspend (Synchronizer) -> Flow<TransactionSubmitResult>
): SubmitResult =

View File

@ -146,8 +146,9 @@ class KeystoneProposalRepositoryImpl(
override suspend fun createPCZTEncoder(): UREncoder =
withContext(Dispatchers.IO) {
val pczt = proposalPczt ?: throw IllegalStateException("Proposal not created")
val redactedPczt = proposalDataSource.redactPcztForSigner(pczt.clonePczt())
keystoneZcashSDK.generatePczt(
pczt = pczt.clonePczt().toByteArray()
pczt = redactedPczt.toByteArray()
)
}