From 69c83c5adb10c7dcdda231739ba87c8b846cf97f Mon Sep 17 00:00:00 2001 From: fekt Date: Fri, 22 Sep 2023 23:02:07 -0400 Subject: [PATCH 1/4] Performance and param URL tweaks --- .../java/cash/z/ecc/android/sdk/ext/ZcashSdk.kt | 16 +++++++++------- .../ecc/android/sdk/internal/SaplingParamTool.kt | 3 ++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/ext/ZcashSdk.kt b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/ext/ZcashSdk.kt index 7292295..36f7766 100644 --- a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/ext/ZcashSdk.kt +++ b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/ext/ZcashSdk.kt @@ -37,24 +37,24 @@ object ZcashSdk { // Because blocks are buffered in memory upon download and storage into SQLite, there is an upper bound // above which OutOfMemoryError is thrown. Experimentally, this value is below 50 blocks. // Back of the envelope calculation says the maximum block size is ~100kb. - const val DOWNLOAD_BATCH_SIZE = 10 + const val DOWNLOAD_BATCH_SIZE = 50 /** * Default size of batches of blocks to scan via librustzcash. The smaller this number the more granular information * can be provided about scan state. Unfortunately, it may also lead to a lot of overhead during scanning. */ - val SCAN_BATCH_SIZE = 150 + val SCAN_BATCH_SIZE = 500 /** * Default amount of time, in milliseconds, to poll for new blocks. Typically, this should be about half the average * block time. */ - val POLL_INTERVAL = 20_000L + val POLL_INTERVAL = 18_000L /** * Estimate of the time between blocks. */ - val BLOCK_INTERVAL_MILLIS = 75_000L + val BLOCK_INTERVAL_MILLIS = 36_000L /** * Default attempts at retrying. @@ -87,11 +87,13 @@ object ZcashSdk { val OUTPUT_PARAM_FILE_NAME = "sapling-output.params" /** - * The Url that is used by default in zcashd. + * The Url that is used by default in hushd. * We'll want to make this externally configurable, rather than baking it into the SDK but - * this will do for now, since we're using a cloudfront URL that already redirects. + * this will do for now */ - val CLOUD_PARAM_DIR_URL = "https://z.cash/downloads/" + val CLOUD_PARAM_DIR_URL = listOf("https://git.hush.is/hush/hush3/raw/branch/master/", + "https://github.com/hushmirror/hush3/raw/dev/") + /** * The default memo to use when shielding transparent funds. diff --git a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/SaplingParamTool.kt b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/SaplingParamTool.kt index ecf5e41..58e2676 100644 --- a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/SaplingParamTool.kt +++ b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/SaplingParamTool.kt @@ -57,7 +57,8 @@ class SaplingParamTool { ZcashSdk.SPEND_PARAM_FILE_NAME, ZcashSdk.OUTPUT_PARAM_FILE_NAME ).forEach { paramFileName -> - val url = "${ZcashSdk.CLOUD_PARAM_DIR_URL}/$paramFileName" + val url = "${ZcashSdk.CLOUD_PARAM_DIR_URL.random()}/$paramFileName" + twig("Downloading Sapling params from ${url}...") val request = Request.Builder().url(url).build() val response = withContext(Dispatchers.IO) { client.newCall(request).execute() } if (response.isSuccessful) { From a60f2379ce5c31a69732c108405713adb3845156 Mon Sep 17 00:00:00 2001 From: fekt Date: Fri, 22 Sep 2023 23:11:20 -0400 Subject: [PATCH 2/4] Checkpoint --- .../co.electriccoin.zcash/checkpoint/mainnet/750000.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 sdk-lib/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/750000.json diff --git a/sdk-lib/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/750000.json b/sdk-lib/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/750000.json new file mode 100644 index 0000000..0090be7 --- /dev/null +++ b/sdk-lib/src/main/assets/co.electriccoin.zcash/checkpoint/mainnet/750000.json @@ -0,0 +1,7 @@ +{ + "network": "main", + "height": "750000", + "hash": "000045d2c9dbf992768e4855d0b533c8066a636c72773c4e9de29c167f255f6b", + "time": 1695413943, + "saplingTree": "010cf0121dd552c6ef902817d014abe5b5396830513ed10232e3c89ee579b4a41c0155d7f612a022bd3bee60239dadba69a02ae597d6dd6b85652edb4811df818b461001fe437ec50581d7b60020311414db508b7b26d94880314416b14b2f04850ac90d000001b458fb1c303f0d3ae829134c67522af0d22994d75b851f780e452959523df73f00011ed5753c2256ef302447c68356a466f3041325f9ffcd18d645a853c7c587064800000186fac1d30cf867832fdfe58737665cd68c93a0ad7702ab316905c3d842532c16013ecde153cf2109b6583a36d6b69d2aaff9f31f6208794eebc2fa538fce2f056200000000000112a0aa9338eb060de79e24135b51343f8c996aba1044c19926bff3ec913d8401" +} From 33323a6cada1c0b07a13a72bc642dd1830ff1b28 Mon Sep 17 00:00:00 2001 From: fekt Date: Tue, 26 Sep 2023 18:55:56 -0400 Subject: [PATCH 3/4] Additional params URL --- .../src/main/java/cash/z/ecc/android/sdk/ext/ZcashSdk.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/ext/ZcashSdk.kt b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/ext/ZcashSdk.kt index 36f7766..7cee83f 100644 --- a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/ext/ZcashSdk.kt +++ b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/ext/ZcashSdk.kt @@ -91,10 +91,10 @@ object ZcashSdk { * We'll want to make this externally configurable, rather than baking it into the SDK but * this will do for now */ - val CLOUD_PARAM_DIR_URL = listOf("https://git.hush.is/hush/hush3/raw/branch/master/", + val CLOUD_PARAM_DIR_URL = listOf("https://storage.hush.land/hush3/", + "https://git.hush.is/hush/hush3/raw/branch/master/", "https://github.com/hushmirror/hush3/raw/dev/") - - + /** * The default memo to use when shielding transparent funds. */ From 86dd1ed88e3232304ae6d77d5d954ee19d946538 Mon Sep 17 00:00:00 2001 From: fekt Date: Sun, 22 Oct 2023 11:02:26 -0400 Subject: [PATCH 4/4] Update ZcashSdk.kt --- sdk-lib/src/main/java/cash/z/ecc/android/sdk/ext/ZcashSdk.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/ext/ZcashSdk.kt b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/ext/ZcashSdk.kt index 7cee83f..9b59ced 100644 --- a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/ext/ZcashSdk.kt +++ b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/ext/ZcashSdk.kt @@ -94,7 +94,7 @@ object ZcashSdk { val CLOUD_PARAM_DIR_URL = listOf("https://storage.hush.land/hush3/", "https://git.hush.is/hush/hush3/raw/branch/master/", "https://github.com/hushmirror/hush3/raw/dev/") - + /** * The default memo to use when shielding transparent funds. */