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

Removed note details from sync responses #462

Merged
merged 2 commits into from
Aug 30, 2024

Conversation

polydez
Copy link
Contributor

@polydez polydez commented Aug 26, 2024

Resolves #309

Introduced NoteSyncRecord domain type which omits note details unnecessary for state synchronizations. Refactored code, removed excessive function (select_notes_since_block_by_tag_and_sender can work as select_notes_since_block_by_tag if we provide empty sender list).

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@polydez polydez marked this pull request as ready for review August 27, 2024 06:54
Copy link
Contributor

@Mirko-von-Leipzig Mirko-von-Leipzig left a comment

Choose a reason for hiding this comment

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

LGTM, left a couple of suggestions

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you! I left one potential improvement suggestion inline.

Comment on lines +996 to +997
let tip = select_block_header_by_block_num(conn, None)?
.ok_or(NoteSyncError::EmptyBlockHeadersTable)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we know the latest block number in the state - we may be able to pass chain_tip_num into this function and potentially avoid this database query (i.e., we can always do just 1 query here instead of sometimes doing 2 queries and sometimes 1).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't store latest block number in the State in-memory by now or I can't find a place you mean. Should I update our in-memory state in order to save the current block number?

Copy link
Contributor

Choose a reason for hiding this comment

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

We do have latest_block_num() function on the State. Let's create an issue for this optimization (could be a "good first issue").

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bobbinth ah, thank you, I forgot about this feature of chain mmr. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bobbinth done: #477

@polydez polydez merged commit dae92dd into next Aug 30, 2024
8 checks passed
@polydez polydez deleted the polydez-sync-remove-note-details branch August 30, 2024 10:36
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.

None yet

3 participants