Commit Graph

1014 Commits

Author SHA1 Message Date
Michal Fousek d1dd251423 Make linter happy 2023-05-19 11:03:12 +02:00
Lukas Korba a2df207f3e [#1046] Implement SaplingParamsAction
- SaplingParamsAction tests
- added TODO for TestCoordinator reset()
- SaplingParametersHandler mock added

[#1046] Implement SaplingParamsAction

- SaplingParamsAction tests
- added TODO for TestCoordinator reset()
- SaplingParametersHandler mock added

[#1046] Implement SaplingParamsAction

- rebased so I get functionality of improved mock checks
- enhanced SaplingParamsAction tests
- enhanced ValidateAction tests
- enhanced ScanAction tests

[#1046] Implement SaplingParamsAction

- scanAction tests more checks added
2023-05-19 10:56:13 +02:00
Lukas Korba 960583b00c [#1045] Implement FetchUTXOsAction
- FetchUTXOsAction tests
- UTXOFetcher mocks

[#1045] Implement FetchUTXOsAction

- enhanced with mocked values and more checks
2023-05-19 10:56:13 +02:00
Michal Fousek 228b63af85 Improve mocks generating 2023-05-19 10:56:13 +02:00
Lukas Korba 907bf1db84 [#1047] Implement ScanAction
- ScanAction tests
- refactor of validateAction -> validateServerAction
- generated few more mocks for the DI
2023-05-19 10:56:13 +02:00
Lukas Korba d4abae7fa2 [#1049] Implement ValidateAction
- synchronizer offline tests updated so it compiles, review is requested in a different ticket
- ValidateAction tests added
- BlockValidator mock generated
2023-05-19 10:56:13 +02:00
Lukas Korba 1b0e9e00f5 [#1051] Update how progress is computed after switch to state machine
Closes #1051

- new proposal for the progress computation
- OverallProgress value is passed to the Synchronizer as a Float
- OverallProgress is a result of fetch, scan and enhance operations
- Order of actions no longer influences the computation
- Actions report partial updates, CompactBlockProgress actor holds current state and computes the OverallProgress
2023-05-19 10:56:13 +02:00
Lukas Korba 1d1dedd26e [#1050] Implement ValidateServerAction
- broken tests commented out and tracked in the tickets
- new test for ValidateServerAction
2023-05-19 10:56:13 +02:00
Michal Fousek e480b95cfa [#700] Make CBP state machine work 2023-05-19 10:56:12 +02:00
Michal Fousek a403fa9f1f [#1039] Implement ChecksBeforeSyncAction
Closes #1039
2023-05-19 10:54:15 +02:00
Michal Fousek b82b068a4f [#1040] Implement ClearAlreadyScannedBlocksAction
Closes #1040
2023-05-19 10:54:15 +02:00
Michal Fousek 89f311b1c0 [#1041] Implement ClearCacheAction
Closes #1041
2023-05-19 10:54:15 +02:00
Michal Fousek f2d15b2989 [#1044] Implement EnhanceAction
Closes #1044
2023-05-19 10:54:15 +02:00
Michal Fousek d7aca1fae2 Fix compilation 2023-05-19 10:54:15 +02:00
Lukas Korba 7f1535310a [#1047] Implement ScanAction
- scan action with the proper ranges computed

[#1047] Implement ScanAction (#1085)

- fixed logger message
2023-05-19 10:54:15 +02:00
Lukas Korba c127735ec3 [#1048] Implement ScanDownloadedButUnscannedAction
- scan downloaded but unscanned blocks
2023-05-19 10:54:15 +02:00
Lukas Korba 3193d025b4 [#1046] Implement SaplingParamsAction
- action for sapling param files finished
2023-05-19 10:54:15 +02:00
Michal Fousek c76c0cd2d6 [#1043] Fix batch range computation in DownloadAction 2023-05-19 10:54:15 +02:00
Michal Fousek 69a0336c90 [#700] Implement cache clearing when some actions fail 2023-05-19 10:54:15 +02:00
Michal Fousek 9117f91ae6 [#1042] Implement ComputeSyncRangesAction
Closes #1042
2023-05-19 10:54:15 +02:00
Lukas Korba c3db5a1c2d [#1045] Implement FetchUTXOsAction
- draft of the fetching

[#1045] Implement FetchUTXOsAction

- updated the way Actions communicate data back to the CBP
- used this mechanism to pass result of utxos fetch so it's passed to the SDKSynchronizer as an Event
2023-05-19 10:54:15 +02:00
Michal Fousek a9dec21f39 [#700] Implement progress reporting in state machine CBP 2023-05-19 10:54:15 +02:00
Michal Fousek 85643e598c [#700] Implement sending of some events from CompactBlockProcessorNG 2023-05-19 10:54:15 +02:00
Michal Fousek bc9fbe7e7d [#700] Add idle state to CBP state machine
This is required so the CBP can detect start of the sync process.
2023-05-19 10:54:15 +02:00
Michal Fousek 3f513e9c6d [#1059] Implement rewind for state machine CBP
Closes #1059
2023-05-19 10:54:15 +02:00
Michal Fousek 70026af582 [#1060] Implement wipe for state machine CBP
Closes #1060
2023-05-19 10:54:15 +02:00
Michal Fousek 9aba16b69d [#1052] Implement AfterSyncHooksManager when using state machine CBP
Closes #1052
2023-05-19 10:54:15 +02:00
Michal Fousek e1ee62403f [#1058] Implement stop for state machine CBP
Closes #1058
2023-05-19 10:54:15 +02:00
Michal Fousek 268cc8ce6f [#1057] Implement start for state machine CBP
Closes #1057
2023-05-19 10:54:15 +02:00
Michal Fousek f8ea5bb859 [#1055] Implement retry timer to state machine CBP
Closes #1055
2023-05-19 10:54:15 +02:00
Michal Fousek 15680e7b64 [#1061] Add failure methods for state machine CBP
Closes #1061
2023-05-19 10:54:15 +02:00
Michal Fousek eda8977d5d [#1056] Add constructors to state machine CBP
Closes #1056
2023-05-19 10:54:15 +02:00
Michal Fousek 7ded055ef7 [#1050] Implement ValidateServerAction
Closes #1050
2023-05-19 10:54:15 +02:00
Michal Fousek 4b366b68c0 [#1049] Implement ValidateAction
Closes #1049
2023-05-19 10:54:15 +02:00
Michal Fousek 3737b841ef [#1043] Implement DownloadAction
Closes #1043
2023-05-19 10:54:14 +02:00
Michal Fousek 66cdde4a28 Fix docs 2023-05-19 10:53:43 +02:00
Michal Fousek 553b938836 [#1054] Add config to state machine CBP
Closes #1054
2023-05-19 10:53:43 +02:00
Michal Fousek 47386086d7 Action.stop is now async 2023-05-19 10:53:43 +02:00
Michal Fousek 304fcc341f [#700] Add documentation for CompactBlockProcessor state machine
- plantuml tool is used to generate diagram.
2023-05-19 10:53:43 +02:00
Michal Fousek 2501cea4b4 Small updates 2023-05-19 10:53:43 +02:00
Michal Fousek 92994b067e [#700] CompactBlockProcessor as state machine proof of concept
- For now I created `CompactBlockProcessorNG` where I started with
  implementation of the state machine. I did it to not break the rest of
  the SDK. This change will be merged to the feature branch. And before
  it is merged to `main` branch code from `CompactBlockProcessorNG` will
  be moved to `CompactBlockProcessor`.
- The new code is not used. It just shows and explains how it is done.
  It is proof of concept.
- I did put either commented current code or comment to some places to
  explain what should be done there.
- New important data types:
  - `ActionContext` is context that can hold any data that needs to be
    shared between actions. For example sync ranges or current state.
  - `CBPState` is state of the `CompactBlockProcessor`. Each state is
    handled by one action. This doesn't apply to terminal states like
    `finished` or `failed`.
  - `ActionProgress` is very similar to `CompactBlockProgress`.
    Different actions reports progress differently and `ActionProgress`
    represents this.
  - `Action` is protocol that defines API of an action. It has one run
    method that executes the code of the action
- CBP first creates actions for (almost) each state in `makeActions()`
  method. Then the "magic" is done in `CompactBlockProcessorNG.run()` method.
  Here is main loop which takes action for current state and execute it.
  It's expected that action does it's work and then updates the context
  with new state. And this happens until some terminal state
  (`finished`, `failed`, `stopped`) is reached.
- After the transition to state machine API of the
  `CompactBlockProcessor` should stay the same. No changes should be
  required in `SDKSynchronizer`.
2023-05-19 10:53:43 +02:00
Michal Fousek ea4da6e0e6
Merge pull request #1093 from Chlup/1016_stream_per_batch_parallel
[#1016] Rebuild download stream periodically while downloading
2023-05-17 17:00:55 +02:00
Francisco Gindre 630737e511
fix typo on log 2023-05-17 11:22:25 -03:00
Michal Fousek d091660b79 [#1016] Rebuild download stream periodically while downloading
- Rebuild download stream in `BlockDownloaderImpl` each 10 batches. So
  currently stream downloads 1000 blocks and then new stream is created.
- Memory stays between 60MB and 70MB during sync in the Sample app.
2023-05-17 10:36:02 +02:00
Francisco Gindre bb3d7d06c5
[#780] part of Adopt green policy (#1064)
fixes docs and deletes fixme for [#783]

closes #783

[#785]: Fix test testSingleNoteNoChangeTransaction

[#786] fix testVerifyChangeTransaction

Closes #786

[#790] mark as fixed testRewindAfterSendingTransaction

Closes #790

[#865] Fix test testStoringTenSandblastedBlocks

Closes #865

[#791] Fix test testRewindAfterSendingTransaction

Closes #791

[#783]: Fix test testMaxAmountSendBroadcast

Closes #783
2023-05-11 08:13:20 -03:00
Francisco Gindre f98692c0ea
[#781] This fixes test `testMaxAmountMinusOneSend` by creating two se… (#1034)
* [#781] This fixes test `testMaxAmountMinusOneSend` by creating two separate
tests:
  - testMaxAmountMinusOneSendFails
  - testMaxAmountSend

Also includes new functionality that tracks sent transactions so
that users can be notified specifically when they are mined and uses "idea B" of
issue #1033.

closes #1033
closes #781

* Fix tests
2023-05-10 17:13:29 -03:00
Francisco Gindre cf53edb3b8
[#1037] Empty string memo throws `ZcashError.memoTextInputEndsWithNullBytes` (#1038)
Fixes the case where the SDK would read an empty string from the Db and would
throw this error incorrectly
closes #1037
2023-05-10 12:39:34 -03:00
Lukas Korba 355a3fc4f5
Merge pull request #1036 from LukasKorba/1035-Create-ZcashError.unknown
- new ZcashError.unknown that wraps and handles any Error addedCreate ZcashError.unknown
2023-05-10 14:49:03 +02:00
Lukas Korba 9c611b31e3 [#1035] Create ZcashError.unknown
- new ZcashError.unknown that wraps and handles any Error added

[#1035] Create ZcashError.unknown (#1036)

- improved the conversion of error -> ZcashError

[#1035] Create ZcashError.unknown (#1036)

- detailed comments of the unknown case
2023-05-10 14:48:16 +02:00
Lukas Korba c477e483ff
Merge pull request #1010 from LukasKorba/843-Simplify-Synchronizer-Status-internal
[#843] Simplify Synchronizer Status
2023-05-09 16:45:36 +02:00