KomodoPlatform / komodo-wallet

Komodo Wallet
https://app.komodoplatform.com
239 stars 206 forks source link

Use rounded derived height sync param #2364

Closed smk762 closed 1 year ago

smk762 commented 1 year ago

This PR is a further improvement on Z coin activation. Previously we used the "date" sync param, which would be effectively changed in the API to a derived height based on the average block time. As blocktime varies, this potentially resulted in the derived height not being a constant value, and in cases where it did not return the same height as calculated during a prior sync, could force a long resync. The simplest mitigation for this was to use the height param in the RPC instead, derived by the GUI and rounding the height to the nearest 1000 so that the same date selection would be much more likely to return the same value as in the past.

To Test:

[14:55:02] [info] [mm2.service.cpp:1495] [2605136]: ARRR Activation Status: {"id":null,"mmrpc":"2.0","result":{"details":{"UpdatingBlocksCache":{"current_scanned_block":2521275,"first_sync_block":{"actual":2448000,"is_pre_sapling":false,"requested":2448000},"latest_block":2575728}},"status":"InProgress"}}

the requested value should be divisible by 1000.

Note: This relies on updated data in coins_config.json, so please delete your local %appdata%/0.6.1 folder and the coins file used for your wallet before launch

borngraced commented 1 year ago

Great! Thanks for the quick resolution @smk762

kivqa commented 1 year ago

@smk762 I did installation from 0 (with removing old app data). But for some reason Asset list is not displaying:

image

In case click on DEX button app crashed.

Logs file contains only one exception: [json.exception.parse_error.101] parse error at line 44053, column 3: syntax error while parsing object key - unexpected number literal; expected string literal

14:59:35] [info] [mm2.service.cpp:205] [43926]: Retrieving Wallet information of /Users/ivankiseleiv/Library/Application Support/Komodo Wallet/config/0.6.1-coins.imp2.json
[14:59:35] [error] [mm2.service.cpp:232] [43926]: exception caught: [json.exception.parse_error.101] parse error at line 44053, column 3: syntax error while parsing object key - unexpected number literal; expected string literal
[14:59:35] [debug] [mm2.service.cpp:235] [43926]: Coins file does not exist!
[14:59:35] [debug] [mm2.service.cpp:235] [43926]: Coins file does not exist!
[14:59:35] [info] [qt.global.coins.cfg.model.cpp:213] [43926]: Initializing global coin cfg model with size 1
[14:59:35] [info] [global.provider.cpp:418] [43926]: Forcing update providers
[14:59:35] [info] [qt.addressbook.page.cpp:66] [43926]: post_login: filling addressbook from cfg
[14:59:35] [warning] [main.prerequisites.hpp:93] [43926]: QIODevice::read (QFile, "/Users/ivankiseleiv/Library/Application Support/Komodo Wallet/addressbook/imp2"): device not open
[14:59:35] [warning] [addressbook.cfg.cpp:48] [43926]: Addressbook config file was invalid, use empty configuration: [json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal. Content was: 
kivqa commented 1 year ago

@smk762 Problem releated to issue in this PR: https://github.com/KomodoPlatform/coins/pull/821 I fixed it locally and do retest for ARRR activation

kivqa commented 1 year ago

Test 1: Activation ARRR coin with default Activation date - 2 days in the past During activation of ARRR coin I observed such logs: ActivatingCoin stage:

[15:24:32] [info] [mm2.service.cpp:1479] [76356]: ARRR enable_z_coin Task ID: 0
[15:24:32] [info] [mm2.service.cpp:1495] [76356]: ARRR Activation Status: {"id":null,"mmrpc":"2.0","result":{"details":"ActivatingCoin","status":"InProgress"}}
[15:24:32] [info] [mm2.service.cpp:1555] [76356]: Waiting for ARRR to enable [InProgress: ActivatingCoin]...

UpdatingBlocksCache stage:

[15:24:42] [info] [mm2.service.cpp:1495] [76356]: ARRR Activation Status: {"id":null,"mmrpc":"2.0","result":{"details":{"UpdatingBlocksCache":{"current_scanned_block":2556581,"first_sync_block":{"actual":2554000,"is_pre_sapling":false,"requested":2554000},"latest_block":2576044}},"status":"InProgress"}}

BuildingWalletDb stage:

[15:25:07] [info] [mm2.service.cpp:1495] [76356]: ARRR Activation Status: {"id":null,"mmrpc":"2.0","result":{"details":{"BuildingWalletDb":{"current_scanned_block":2554000,"first_sync_block":{"actual":2554000,"is_pre_sapling":false,"requested":2554000},"latest_block":2576044}},"status":"InProgress"}}

RequestingWalletBalance stage:

[15:28:23] [info] [mm2.service.cpp:1495] [76356]: ARRR Activation Status: {"id":null,"mmrpc":"2.0","result":{"details":"RequestingWalletBalance","status":"InProgress"}}
[15:28:28] [info] [mm2.service.cpp:1495] [76356]: ARRR Activation Status: {"id":null,"mmrpc":"2.0","result":{"details":{"current_block":2576046,"first_sync_block":{"actual":2554000,"is_pre_sapling":false,"requested":2554000},"ticker":"ARRR","wallet_balance":{"address":"zs1gn3mxk493yyvyu8ffsgj6kt3luajdezwr6t7lzzfjf34u4nzztze3r44wplm0ry95tp4uang9yg","balance":{"spendable":"0.998969","unspendable":"0"},"wallet_type":"Iguana"}},"status":"Ok"}}

After app restart ARRR coin activation takes about 1 minute. Activation started from RequestingWalletBalance stage:

 [15:48:34] [info] [mm2.service.cpp:1495] [104360]: ARRR Activation Status: {"id":null,"mmrpc":"2.0","result":{"details":"RequestingWalletBalance","status":"InProgress"}}
[15:48:34] [info] [app.cpp:808] [104244]: Application inactive
[15:48:39] [info] [mm2.service.cpp:1495] [104360]: ARRR Activation Status: {"id":null,"mmrpc":"2.0","result":{"details":{"current_block":2576090,"first_sync_block":{"actual":2554000,"is_pre_sapling":false,"requested":2554000},"ticker":"ARRR","wallet_balance":{"address":"zs1gn3mxk493yyvyu8ffsgj6kt3luajdezwr6t7lzzfjf34u4nzztze3r44wplm0ry95tp4uang9yg","balance":{"spendable":"0.998969","unspendable":"0"},"wallet_type":"Iguana"}},"status":"Ok"}}
kivqa commented 1 year ago

Test 2: Activate ARRR using exact Activation date. I selected 8/30/2023 ARRR coin was successfully activated. Balance and transactions are correct. Logs example:

[16:54:26] [info] [mm2.service.cpp:1495] [172348]: ARRR Activation Status: {"id":null,"mmrpc":"2.0","result":{"details":{"BuildingWalletDb":{"current_scanned_block":2573000,"first_sync_block":{"actual":2528000,"is_pre_sapling":false,"requested":2528000},"latest_block":2576128}},"status":"InProgress"}}

After app restart ARRR activation takes less 1 minute.

NOTE: There is incorrect percentage calculation, probably it's related to rounded height

image