Skip to content

Changed the note scanning algorithm to not require additional context.#2458

Merged
tzemanovic merged 9 commits intomainfrom
murisi+jacob/masp-scanning
Feb 22, 2024
Merged

Changed the note scanning algorithm to not require additional context.#2458
tzemanovic merged 9 commits intomainfrom
murisi+jacob/masp-scanning

Conversation

@batconjurer
Copy link
Copy Markdown
Collaborator

@batconjurer batconjurer commented Jan 26, 2024

Describe your changes

Simplified the note scanning algorithm so that it does not require a merge operation when new keys are introduced into the wallet. Instead of having two paths in the fetching code: one for when the viewing keys are unchanged but there are new shielded transactions from the network, and the other for when new keys are introduced and transactions must be rescanned from the beginning. Instead of doing that, we now have a single path that starts scanning transactions from the most out of date viewing key going forward to the present. This change increases the set of valid states that a ShieldedContext can have and allows its (recoverable) state to be saved more frequently.

Indicate on which release or other PRs this topic is based on

Namada v0.30.2

Checklist before merging to draft

  • I have added a changelog
  • Git history is in acceptable state

@murisi murisi force-pushed the murisi+jacob/masp-scanning branch 2 times, most recently from 623aa1d to 5896be5 Compare January 27, 2024 15:55
@murisi murisi requested review from cwgoes and grarco January 27, 2024 15:55
grarco
grarco previously approved these changes Jan 29, 2024
Copy link
Copy Markdown
Collaborator Author

@batconjurer batconjurer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fetch commands in the client are still present, so this can't be merged as is. Also, this is missing the batching and caching. I've got that implemented now in another branch, but still needs a bit of debugging.

@batconjurer batconjurer force-pushed the murisi+jacob/masp-scanning branch from 0ae203f to b177507 Compare January 31, 2024 09:55
@batconjurer batconjurer requested a review from grarco January 31, 2024 13:25
let last_block_height = query_block(client)
.await?
.map_or_else(BlockHeight::first, |block| block.height);
let last_query_height = last_query_height.unwrap_or(last_block_height);
Copy link
Copy Markdown
Collaborator

@grarco grarco Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we query for the block height only if the arg is None? Just to avoid an extra RPC call since we only use last_block_height here. Anyway this is very minor, we could change it in another PR in case

grarco
grarco previously approved these changes Jan 31, 2024
@Fraccaman Fraccaman mentioned this pull request Feb 1, 2024
cwgoes
cwgoes previously approved these changes Feb 2, 2024
Copy link
Copy Markdown
Collaborator

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. In the future, we might want to consider additional algorithm improvements such as (possibly dependent on user configuration/instructions):

  • scanning from the most recent height backwards instead of from the oldest height forwards
  • trial decrypting with a specific viewing key as opposed to all of them, for example if a user knows where they should have received a payment (this applies mostly if we get to a point where this is compute-bound)

@tzemanovic tzemanovic mentioned this pull request Feb 5, 2024
@grarco grarco mentioned this pull request Feb 6, 2024
2 tasks
@brentstone brentstone mentioned this pull request Feb 8, 2024
@tzemanovic tzemanovic mentioned this pull request Feb 9, 2024
@batconjurer batconjurer dismissed stale reviews from cwgoes and grarco via 774bdf1 February 15, 2024 09:25
tzemanovic added a commit that referenced this pull request Feb 15, 2024
* origin/murisi+jacob/masp-scanning:
  [chore]: Fix integration masp test fixtures
  I don't know
  [chore] Rebase on main
  [fix] Some e2e test fixes
  Moved fetch calls completely from other calls. Updated cli. Fixed tests
  Added changelog entry.
  Changed the note scanning algorithm to not require additional context.
@tzemanovic tzemanovic merged commit 5816719 into main Feb 22, 2024
@tzemanovic tzemanovic deleted the murisi+jacob/masp-scanning branch February 22, 2024 14:40
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.

5 participants