From 44cba56d30b76143599df2f082334d4293532663 Mon Sep 17 00:00:00 2001 From: Dimitris Apostolou Date: Thu, 26 Mar 2020 13:00:04 +0200 Subject: [PATCH] Fix typos and cleanup --- README.md | 6 +++--- docs/ThreatModel.md | 2 +- samples/demo-app/README.md | 4 ++-- src/main/java/cash/z/wallet/sdk/Initializer.kt | 6 +++--- src/main/java/cash/z/wallet/sdk/SdkSynchronizer.kt | 4 ++-- src/main/java/cash/z/wallet/sdk/Synchronizer.kt | 4 ++-- .../java/cash/z/wallet/sdk/block/CompactBlockProcessor.kt | 6 +++--- src/main/java/cash/z/wallet/sdk/exception/Exceptions.kt | 4 ++-- src/main/java/cash/z/wallet/sdk/ext/CurrencyFormatter.kt | 4 ++-- src/main/java/cash/z/wallet/sdk/ext/WalletService.kt | 4 ++-- .../java/cash/z/wallet/sdk/ext/android/FlowPagedList.kt | 4 ++-- .../cash/z/wallet/sdk/ext/android/FlowPagedListBuilder.kt | 2 +- .../cash/z/wallet/sdk/transaction/TransactionManager.kt | 6 +++--- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 74d2bbd0..3f585fe8 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Thankfully, the only thing an app developer has to be concerned with is the foll ## Overview -At a high level, this SDK simply helps native Android codebases connect to Zcash's Rust crypto libraries without needing to know Rust or be a Cryptographer. Think of it as welding. The SDK takes separate things and tightly bonds them together such that each can remain as idiomatic as possible. It's goal is to make it easy for an app to incorporate shielded transactions while remaining a good citizen on mobile devices. +At a high level, this SDK simply helps native Android codebases connect to Zcash's Rust crypto libraries without needing to know Rust or be a Cryptographer. Think of it as welding. The SDK takes separate things and tightly bonds them together such that each can remain as idiomatic as possible. Its goal is to make it easy for an app to incorporate shielded transactions while remaining a good citizen on mobile devices. Given all the moving parts, making things easy requires coordination. The [Synchronizer](docs/-synchronizer/README.md) provides that layer of abstraction so that the primary steps to make use of this SDK are simply: @@ -111,7 +111,7 @@ synchronizer.sendToAddress(spendingKey, zatoshi, address, memo) In the event that you *do* want to compile the SDK from sources, follow these steps: 1. [Install rust](https://www.rust-lang.org/learn/get-started) -2. Then, add the android targets via: +2. Then, add the android targets via: ```bash rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android ``` @@ -128,7 +128,7 @@ rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-andro

7. [Create an emulator](https://developer.android.com/studio/run/managing-avds) if you don’t already have one (recommended target: API 29) - 8. Select your desired build variant. Currently, we recommend `zcashmainnetDebug` as the testnet variants are slower to sync to current height due to a lack of checkpoints. + 8. Select your desired build variant. Currently, we recommend `zcashmainnetDebug` as the testnet variants are slower to sync to current height due to a lack of checkpoints.

diff --git a/docs/ThreatModel.md b/docs/ThreatModel.md index 0db72c27..c1ea1859 100644 --- a/docs/ThreatModel.md +++ b/docs/ThreatModel.md @@ -56,7 +56,7 @@ In the UNTRUSTED scenario: ## Security Invariants Given these scenarios and adversaries, we can now state the security invariants -we stive to satisfy. While we pride ourselves on building high-quality software, +we strive to satisfy. While we pride ourselves on building high-quality software, all software contains bugs, and so this threat model must not be construed as any kind of warranty that our software satisfies these properties. diff --git a/samples/demo-app/README.md b/samples/demo-app/README.md index 7b6110ac..14312816 100644 --- a/samples/demo-app/README.md +++ b/samples/demo-app/README.md @@ -33,7 +33,7 @@ To explore the app, click on each menu item, in order, and also look at the asso ![The android demo app, running in Android Studio](assets/demo-app.png?raw=true "Demo App with Android Studio") -The demo app is not trying to show what's possible, but to present how to accomplish the building blocks of wallet functionality in a simple way in code. It is comprised of the following self-contained demos. All data is reset between demos in order to keep the behavior repeatable and independant of state. +The demo app is not trying to show what's possible, but to present how to accomplish the building blocks of wallet functionality in a simple way in code. It is comprised of the following self-contained demos. All data is reset between demos in order to keep the behavior repeatable and independent of state. ### Demos @@ -44,7 +44,7 @@ Get Address|[GetAddressFragment.kt](app/src/main/java/cash/z/wallet/sdk/demoapp/ Get Latest Height|[GetLatestHeightFragment.kt](app/src/main/java/cash/z/wallet/sdk/demoapp/demos/getlatestheight/GetLatestHeightFragment.kt)|Given a lightwalletd server, retrieve the latest block height Get Block|[GetBlockFragment.kt](app/src/main/java/cash/z/wallet/sdk/demoapp/demos/getblock/GetBlockFragment.kt)|Given a lightwalletd server, retrieve a compact block Get Block Range|[GetBlockRangeFragment.kt](app/src/main/java/cash/z/wallet/sdk/demoapp/demos/getblockrange/GetBlockRangeFragment.kt)|Given a lightwalletd server, retrieve a range of compact blocks -List Transactions|[ListTransactionsFragment.kt](app/src/main/java/cash/z/wallet/sdk/demoapp/demos/listtransactions/ListTransactionsFragment.kt)|Given a seed, list all related shielded transations +List Transactions|[ListTransactionsFragment.kt](app/src/main/java/cash/z/wallet/sdk/demoapp/demos/listtransactions/ListTransactionsFragment.kt)|Given a seed, list all related shielded transactions Send|[SendFragment.kt](app/src/main/java/cash/z/wallet/sdk/demoapp/demos/send/SendFragment.kt)|Send and monitor a transaction, the most complex demo [Back to contents](#contents) diff --git a/src/main/java/cash/z/wallet/sdk/Initializer.kt b/src/main/java/cash/z/wallet/sdk/Initializer.kt index f7230291..b91152a0 100644 --- a/src/main/java/cash/z/wallet/sdk/Initializer.kt +++ b/src/main/java/cash/z/wallet/sdk/Initializer.kt @@ -164,7 +164,7 @@ class Initializer( /** * Initializes the databases that the rust library uses for managing state. The "data db" is * created and a row is entered corresponding to the given birthday so that scanning does not - * need to start from the beginning of time. Lastly, the accounts table is initialized to + * need to start from the beginning of time. Lastly, the accounts table is initialized to * simply hold the address and viewing key for each account, which simplifies the process of * scanning and decrypting compact blocks. * @@ -174,7 +174,7 @@ class Initializer( * @param birthday the birthday to use for this wallet. This is used in order to seed the data * DB with the first sapling tree, which also determines where the SDK begins downloading and * scanning. Any blocks lower than the height represented by this birthday can safely be ignored - * since a wallet cannot have transactions prior to it's creation. + * since a wallet cannot have transactions prior to its creation. * @param numberOfAccounts the number of accounts to create. Only 1 account is tested and * supported at this time. It is possible, although unlikely that multiple accounts would behave * as expected. Due to the nature of shielded address, the official Zcash recommendation is to @@ -696,4 +696,4 @@ internal fun validateAlias(alias: String) { "ERROR: Invalid alias ($alias). For security, the alias must be shorter than 100 " + "characters and only contain letters, digits or underscores and start with a letter" } -} \ No newline at end of file +} diff --git a/src/main/java/cash/z/wallet/sdk/SdkSynchronizer.kt b/src/main/java/cash/z/wallet/sdk/SdkSynchronizer.kt index 99338230..ae9bd1a9 100644 --- a/src/main/java/cash/z/wallet/sdk/SdkSynchronizer.kt +++ b/src/main/java/cash/z/wallet/sdk/SdkSynchronizer.kt @@ -141,7 +141,7 @@ class SdkSynchronizer internal constructor( * * @param parentScope the scope to use for this synchronizer, typically something with a * lifecycle such as an Activity for single-activity apps or a logged in user session. This - * scope is only used for launching this synchronzer's job as a child. If no scope is provided, + * scope is only used for launching this synchronizer's job as a child. If no scope is provided, * then this synchronizer and all of its coroutines will run until stop is called, which is not * recommended since it can leak resources. That type of behavior is more useful for tests. * @@ -444,7 +444,7 @@ fun Synchronizer( * @param downloader the component responsible for downloading ranges of compact blocks. * @param manager the component that manages outbound transactions in order to report which ones are * still pending, particularly after failed attempts or dropped connectivity. The intent is to help - * monitor outbound transactions status through to completion. + * monitor outbound transactions status through to completion. * @param processor the component responsible for processing compact blocks. This is effectively the * brains of the synchronizer that implements most of the high-level business logic and determines * the current state of the wallet. diff --git a/src/main/java/cash/z/wallet/sdk/Synchronizer.kt b/src/main/java/cash/z/wallet/sdk/Synchronizer.kt index 8910f8ca..a1fcff18 100644 --- a/src/main/java/cash/z/wallet/sdk/Synchronizer.kt +++ b/src/main/java/cash/z/wallet/sdk/Synchronizer.kt @@ -277,7 +277,7 @@ interface Synchronizer { /** * An instance of [AddressType] corresponding to an invalid address. * - * @param reason a descrption of why the address was invalid. + * @param reason a description of why the address was invalid. */ class Invalid(val reason: String = "Invalid") : AddressType() @@ -287,4 +287,4 @@ interface Synchronizer { val isNotValid get() = this !is Valid } -} \ No newline at end of file +} diff --git a/src/main/java/cash/z/wallet/sdk/block/CompactBlockProcessor.kt b/src/main/java/cash/z/wallet/sdk/block/CompactBlockProcessor.kt index 26cd0a49..f3dcd7b3 100644 --- a/src/main/java/cash/z/wallet/sdk/block/CompactBlockProcessor.kt +++ b/src/main/java/cash/z/wallet/sdk/block/CompactBlockProcessor.kt @@ -267,7 +267,7 @@ class CompactBlockProcessor( * * @param range the range of blocks to validate. * - * @return -1 when there is not problem. Otherwise, return the lowest height where an error was + * @return -1 when there is no problem. Otherwise, return the lowest height where an error was * found. In other words, validation starts at the back of the chain and works toward the tip. */ private fun validateNewBlocks(range: IntRange?): Int { @@ -288,7 +288,7 @@ class CompactBlockProcessor( * * @param range the range of blocks to scan. * - * @return -1 when there is not problem. Otherwise, return the lowest height where an error was + * @return -1 when there is no problem. Otherwise, return the lowest height where an error was * found. In other words, scanning starts at the back of the chain and works toward the tip. */ private suspend fun scanNewBlocks(range: IntRange?): Boolean = withContext(IO) { @@ -570,4 +570,4 @@ class CompactBlockProcessor( } } -} \ No newline at end of file +} diff --git a/src/main/java/cash/z/wallet/sdk/exception/Exceptions.kt b/src/main/java/cash/z/wallet/sdk/exception/Exceptions.kt index b385d9f6..5a32c8ac 100644 --- a/src/main/java/cash/z/wallet/sdk/exception/Exceptions.kt +++ b/src/main/java/cash/z/wallet/sdk/exception/Exceptions.kt @@ -5,7 +5,7 @@ import java.lang.RuntimeException /** * Marker for all custom exceptions from the SDK. Making it an interface would result in more typing - * so its a supertype, instead. + * so it's a supertype, instead. */ open class SdkException(message: String, cause: Throwable?) : RuntimeException(message, cause) @@ -28,7 +28,7 @@ sealed class RepositoryException(message: String, cause: Throwable? = null) : Sd } /** - * High-level exceptions thrown by the synchronizer, which do not fall within the umbrealla of a + * High-level exceptions thrown by the synchronizer, which do not fall within the umbrella of a * child component. */ sealed class SynchronizerException(message: String, cause: Throwable? = null) : SdkException(message, cause) { diff --git a/src/main/java/cash/z/wallet/sdk/ext/CurrencyFormatter.kt b/src/main/java/cash/z/wallet/sdk/ext/CurrencyFormatter.kt index 9abf2fc5..99124667 100644 --- a/src/main/java/cash/z/wallet/sdk/ext/CurrencyFormatter.kt +++ b/src/main/java/cash/z/wallet/sdk/ext/CurrencyFormatter.kt @@ -133,7 +133,7 @@ inline fun BigDecimal?.toUsdString( /** * Create a number formatter for use with converting currency to strings. This probably isn't needed * externally since the other formatting functions leverage this, instead. Leverages the default - * rounding mode for zec found in ZEC_FORMATTER. + * rounding mode for ZEC found in ZEC_FORMATTER. * * @param maxDecimals the number of decimal places to use in the format. Default is 6 because ZEC is * glorious. @@ -358,4 +358,4 @@ internal inline fun String.masked(addressCharsToShow: Int = 4): String = * * @return true when this function starts with 'z' rather than 't'. */ -inline fun String?.isShielded() = this != null && startsWith('z') \ No newline at end of file +inline fun String?.isShielded() = this != null && startsWith('z') diff --git a/src/main/java/cash/z/wallet/sdk/ext/WalletService.kt b/src/main/java/cash/z/wallet/sdk/ext/WalletService.kt index 439098be..e7a023f4 100644 --- a/src/main/java/cash/z/wallet/sdk/ext/WalletService.kt +++ b/src/main/java/cash/z/wallet/sdk/ext/WalletService.kt @@ -64,7 +64,7 @@ inline fun retrySimple(retries: Int = 2, sleepTime: Long = 20L, block: (Int) -> * @param onErrorListener a callback that gets the first shot at processing any error and can veto * the retry behavior by returning false. * @param initialDelayMillis the initial delay before retrying. - * @param maxDelayMillis the maximum delay between retrys. + * @param maxDelayMillis the maximum delay between retries. * @param block the logic to run once and then run again if it fails. */ suspend inline fun retryWithBackoff(noinline onErrorListener: ((Throwable) -> Boolean)? = null, initialDelayMillis: Long = 1000L, maxDelayMillis: Long = MAX_BACKOFF_INTERVAL, block: () -> Unit) { @@ -99,4 +99,4 @@ suspend inline fun retryWithBackoff(noinline onErrorListener: ((Throwable) -> Bo */ internal fun dbExists(appContext: Context, dbFileName: String): Boolean { return File(appContext.getDatabasePath(dbFileName).absolutePath).exists() -} \ No newline at end of file +} diff --git a/src/main/java/cash/z/wallet/sdk/ext/android/FlowPagedList.kt b/src/main/java/cash/z/wallet/sdk/ext/android/FlowPagedList.kt index 308013bb..3171ac80 100644 --- a/src/main/java/cash/z/wallet/sdk/ext/android/FlowPagedList.kt +++ b/src/main/java/cash/z/wallet/sdk/ext/android/FlowPagedList.kt @@ -15,7 +15,7 @@ import kotlinx.coroutines.flow.Flow * Constructs a `Flow`, from this `DataSource.Factory`, convenience for * [FlowPagedListBuilder]. * - * No work (such as loading) is done immediately, the creation of the first PagedList is is + * No work (such as loading) is done immediately, the creation of the first PagedList is * deferred until the Flow is collected. * * @param config Paging configuration. @@ -39,7 +39,7 @@ fun DataSource.Factory.toFlowPagedList( * Constructs a `Flow`, from this `DataSource.Factory`, convenience for * [FlowPagedListBuilder]. * - * No work (such as loading) is done immediately, the creation of the first PagedList is is + * No work (such as loading) is done immediately, the creation of the first PagedList is * deferred until the Flow is collected. * * @param pageSize Page size. diff --git a/src/main/java/cash/z/wallet/sdk/ext/android/FlowPagedListBuilder.kt b/src/main/java/cash/z/wallet/sdk/ext/android/FlowPagedListBuilder.kt index bb97d598..eba7e9a0 100644 --- a/src/main/java/cash/z/wallet/sdk/ext/android/FlowPagedListBuilder.kt +++ b/src/main/java/cash/z/wallet/sdk/ext/android/FlowPagedListBuilder.kt @@ -39,7 +39,7 @@ class FlowPagedListBuilder( /** * Constructs the `Flow`. * - * No work (such as loading) is done immediately, the creation of the first PagedList is is + * No work (such as loading) is done immediately, the creation of the first PagedList is * deferred until the Flow is collected. * * @return The Flow of PagedLists diff --git a/src/main/java/cash/z/wallet/sdk/transaction/TransactionManager.kt b/src/main/java/cash/z/wallet/sdk/transaction/TransactionManager.kt index c33a4327..caf34a34 100644 --- a/src/main/java/cash/z/wallet/sdk/transaction/TransactionManager.kt +++ b/src/main/java/cash/z/wallet/sdk/transaction/TransactionManager.kt @@ -54,7 +54,7 @@ interface OutboundTransactionManager { * Given a transaction and the height at which it was mined, update the transaction to indicate * that it was mined. * - * @param pendingTx the pending transaction that has been mineed. + * @param pendingTx the pending transaction that has been mined. * @param minedHeight the height at which the given transaction was mined, according to the data * that has been processed from the blockchain. */ @@ -67,7 +67,7 @@ interface OutboundTransactionManager { * @param id the id to monitor. * * @return a flow of pending transactions that are emitted anytime the transaction associated - * withh the given id changes. + * with the given id changes. */ suspend fun monitorById(id: Long): Flow @@ -115,4 +115,4 @@ interface TransactionError { * The message associated with this error. */ val message: String -} \ No newline at end of file +}