feat(zcoin): allow ARRR to sync using a start date#1922
Conversation
…s optimization Signed-off-by: borngraced <samuelonoja970@gmail.com>
Signed-off-by: borngraced <samuelonoja970@gmail.com>
Signed-off-by: borngraced <samuelonoja970@gmail.com>
Signed-off-by: borngraced <samuelonoja970@gmail.com>
Signed-off-by: borngraced <samuelonoja970@gmail.com>
|
@borngraced please fix wasm clippy warnings and merge to latest dev to pass the adex-cli tests. |
shamardy
left a comment
There was a problem hiding this comment.
Thanks a lot for the fast PR @borngraced! First review iteration, I believe there will be 2 more review iterations after this :)
Signed-off-by: borngraced <samuelonoja970@gmail.com>
Signed-off-by: borngraced <samuelonoja970@gmail.com>
… calculate_starting_height_from_date and WalletDbShared init Signed-off-by: borngraced <samuelonoja970@gmail.com>
Signed-off-by: borngraced <samuelonoja970@gmail.com>
shamardy
left a comment
There was a problem hiding this comment.
Thanks for the fixes! Next review iteration!
Can you please add a test to test zcoin initialization using date, height or default behaviour. All zcoin tests using light client are ignored, you can try default behaviour for this test and remove the ignore flag https://github.com/KomodoPlatform/komodo-defi-framework/blob/a1fc8f7c92819f68c0dcdf7b1c650d86cdf945ad/mm2src/mm2_main/tests/mm2_tests/z_coin_tests.rs#L473 No need to use date or height, you just need to remove checkpoint block from pirate configuration
| }, | ||
| } | ||
| }, | ||
| ZcoinRpcMode::Native => zcoin_builder.protocol_info.check_point_block.clone(), |
There was a problem hiding this comment.
Native should be the same as light client as discussed.
There was a problem hiding this comment.
This can be done in another PR as we agreed. Please don't forget to open an issue for it.
Signed-off-by: borngraced <samuelonoja970@gmail.com>
Signed-off-by: borngraced <samuelonoja970@gmail.com>
Yes, @naezith and I concluded on using the earliest date incase bad |
shamardy
left a comment
There was a problem hiding this comment.
@Alrighttt @ca333 @DeckerSU To help with security review, I marked the places where I think it's required. You can ofcourse check the whole PR for other things :)
| pub(crate) async fn get_earliest_block(&self) -> Result<u32, ZcashClientError> { | ||
| Ok(query_single_row( | ||
| &self.db.lock().unwrap(), | ||
| "SELECT MIN(height) from compactblocks", | ||
| [], | ||
| |row| row.get::<_, Option<u32>>(0), | ||
| )? | ||
| .flatten() | ||
| .unwrap_or(0)) | ||
| } |
| run: | | ||
| Invoke-WebRequest -Uri https://github.com/KomodoPlatform/komodo/raw/d456be35acd1f8584e1e4f971aea27bd0644d5c5/zcutil/wget64.exe -OutFile \wget64.exe | ||
| Invoke-WebRequest -Uri https://raw.githubusercontent.com/KomodoPlatform/komodo/master/zcutil/fetch-params-alt.bat -OutFile \cmd.bat && \cmd.bat | ||
| cargo test --test 'mm2_tests_main' --no-fail-fast |
| run: | | ||
| wget -O - https://raw.githubusercontent.com/KomodoPlatform/komodo/master/zcutil/fetch-params-alt.sh | bash | ||
| cargo test --test 'mm2_tests_main' --no-fail-fast |
Signed-off-by: borngraced <samuelonoja970@gmail.com>
|
@borngraced can you please resolve the git conflicts in this PR? |
# Conflicts: # mm2src/coins/utxo/utxo_builder/utxo_coin_builder.rs # mm2src/coins/z_coin.rs # mm2src/coins/z_coin/storage/walletdb/mod.rs # mm2src/mm2_main/tests/integration_tests_common/mod.rs # mm2src/mm2_main/tests/mm2_tests/z_coin_tests.rs # mm2src/mm2_test_helpers/src/for_tests.rs
Signed-off-by: borngraced <samuelonoja970@gmail.com>
laruh
left a comment
There was a problem hiding this comment.
Good job!
As we are going to prepare our code base for missing_docs lint in CI, its necessary to add doc comments for all pub items, bcz lint will deny pub items without them.
For the current PR please do it at least for items, which were added or changed.
Signed-off-by: borngraced <samuelonoja970@gmail.com>
Signed-off-by: borngraced <samuelonoja970@gmail.com>
laruh
left a comment
There was a problem hiding this comment.
Thank you for your work!
I have just a note for the future. Perhaps you have already discussed this in conversations above, if so, what decision did you make?
|
|
||
| /// Asynchronously retrieve the tree state for a specific block height from the Zcoin network. | ||
| #[cfg(not(target_arch = "wasm32"))] | ||
| async fn get_tree_state(&mut self, height: u64) -> Result<TreeState, MmError<UpdateBlocksCacheErr>>; |
There was a problem hiding this comment.
NativeClient doesnt support grpc client (i mean you return TreeState here, which is protobuf message), but as get_tree_state is in todo (in NativeClient) and we are going to use this functionality on LightRpcClient for now, I think its fine.
There was a problem hiding this comment.
plan to implement a get_tree_state, LightdInfo rpc methods for native client.
Improve ARRR synchronization based on a user-selected date. This feature will enable users to specify a specific date as the starting point for synchronization as a substitute for the checkpoint block from config or syncing from the first block.
Tasks
LightWalletSyncParams.date, 'earliestandheight` param for synchronising blocks based on user-selected date, earliest or height for light client#1900