Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: missing wallet history #150

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

8lecramm
Copy link
Contributor

@8lecramm 8lecramm commented Dec 6, 2023

Description

Please include a summary of the changes and the related issue.

NOTE: The process is the following:

  • Your pull request should be directed to dev branch.
  • When it will be merged in dev, we will merge it to testnet for tests, and then into main for final release.

Fixes # (issue)

Type of change

Please select the right one.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • This will require a HardFork to be enabled

Which part is impacted ?

  • Wallet
  • Daemon
  • Miner
  • Explorer
  • Simulator
  • Misc (documentation, comments, text...)

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

License

I'm am contributing & releasing the code under DERO Research License (which can be found here).

Summary

This pull request is a fix for issue #118 (also related to TradeOgre deposit issues)
When syncing into a side block, at least 2 entries are removed from the history instead of only one entry. An "out of range" error occurs and the sync loop terminates.

06/12 22:35:24  INFO    syncing loop    {"total_entries": 74158}
06/12 22:35:24  INFO    syncing loop from pos   {"i": 74157, "start_topo": 2983743, "end_topo": 2983754}
06/12 22:35:24  INFO    syncing loop  starting internal         {"start_topo": 2983743, "end_topo": 2983754}
06/12 22:35:24  INFO    syncing loop completed  {"total_entries": 74159}

06/12 22:35:51  INFO    syncing loop    {"total_entries": 74159}
06/12 22:35:51  INFO    syncing loop from pos   {"i": 74158, "start_topo": 2983755, "end_topo": 2983755}
06/12 22:35:51  INFO    syncing loop  starting internal         {"start_topo": 2983755, "end_topo": 2983755}
06/12 22:35:51  INFO    syncing loop completed  {"total_entries": 74160}

06/12 22:39:15  INFO    syncing loop    {"total_entries": 74160}
06/12 22:39:15  INFO    syncing loop header mismatch    {"i": 74159, "block_hash": "ca72e98477ed2897a12d56aceecdb5c3e014dd9e678467504915d0b1aba44204"}
06/12 22:39:15  INFO    syncing loop skipped    {"i": 74159, "skip": 1}
06/12 22:39:15  INFO    syncing loop completed  {"total_entries": 74158}
06/12 22:39:15  ERROR   Recovered while syncing connecting      {"r": "runtime error: index out of range [74159] with length 74158", "stack": "Z29yb3V0aW5lIDY5IFtydW5uaW5nXToKcnVudGltZ..........6NDM5ICsweDY5Cg=="}

06/12 22:46:30  INFO    syncing loop    {"total_entries": 74158}
06/12 22:46:30  INFO    syncing loop from pos   {"i": 74157, "start_topo": 2983743, "end_topo": 2983788}
06/12 22:46:30  INFO    syncing loop  starting internal         {"start_topo": 2983743, "end_topo": 2983788}
06/12 22:46:31  INFO    syncing loop completed  {"total_entries": 74162}

1 entry is skipped, but 2 are removed from the history (from 74160 to 74158 entries)
Twice as many entries as necessary are always deleted.
The entries 74159, 74160 and the failed sync of entry 74161 disappear until the wallet balance changes again.
There are many coinbase rewards for this example wallet. It took only 7 minutes for the balance to change again.
In certain circumstances, the removed entries won't be restored, particularly if the transaction of the last entry involved more than one transfer.

Here is an example after the fix is applied. 8 transfers in block 2980293 were removed due to an orphaned block and re-synced in the same sync loop run.

06/12 04:01:46  INFO    syncing loop    {"total_entries": 73470}
06/12 04:01:46  INFO    syncing loop header mismatch    {"i": 73469, "block_hash": "86e53e02179b2c55aa6b0ef6bf0a2ee2852ead1670777611e27988a6de9c9dfc"}
06/12 04:01:46  INFO    syncing loop skipped    {"i": 73461, "skip": 8}
06/12 04:01:46  INFO    syncing loop from pos   {"i": 73461, "start_topo": 2980290, "end_topo": 2980294}
06/12 04:01:46  INFO    syncing loop  starting internal         {"start_topo": 2980290, "end_topo": 2980294}
06/12 04:01:49  INFO    syncing loop completed  {"total_entries": 73470}

@8lecramm 8lecramm changed the base branch from main to dev April 14, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant