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

Update Output Manager UTXO query to split into multiple queries #1949

Merged
merged 1 commit into from
Jun 5, 2020

Conversation

philipr-za
Copy link
Contributor

@philipr-za philipr-za commented Jun 4, 2020

Description

Previously when the output manager service would send its UTXO validity query to its Base Node it would send a single query with all the UTXO hashes in it. The Base Node then responds with a single response message with all the valid UTXO’s that match a hash in the queries list. In large wallets this caused a problem where the response message could become large enough to be rejected by the frame size limits in the comms stack.

In order to mitigate this issue the Output Manager service will now send queries consisting of up to a maximum number of outputs (specified in the config) and will send multiple queries until all the outputs have been queried so that any one response does not hit the frame size limit.

How Has This Been Tested?

test_startup_utxo_scan was updated to have more UTXO's than the max query limit and tested response to the 2 part query that was generated.

Types of changes

  • 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 change)
  • Feature refactor (No new feature or functional changes, but performance or technical debt improvements)
  • New Tests
  • Documentation

Checklist:

  • I'm merging against the development branch.
  • I ran cargo-fmt --all before pushing.
  • I have squashed my commits into a single commit.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@philipr-za philipr-za force-pushed the philip-split-utxo-query branch 3 times, most recently from b59a1ce to 34502d3 Compare June 4, 2020 08:10
Copy link
Member

@sdbondi sdbondi left a comment

Choose a reason for hiding this comment

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

This should be pretty efficient because requests and responses are sent/received as fast as each side is able. Unfortunately, the code complexity to do this is rather high - something to improve on in the lower layer.

Just one comment which I think points out a bug.

}

impl Default for OutputManagerServiceConfig {
fn default() -> Self {
Self {
base_node_query_timeout: Duration::from_secs(30),
max_utxo_query_size: 5000,
Copy link
Member

Choose a reason for hiding this comment

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

Noting the max request message size would be 160kb and each response would be roughly less than 2Mb

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that lines up with what I observed.

base_layer/wallet/src/output_manager_service/service.rs Outdated Show resolved Hide resolved
base_layer/wallet/src/output_manager_service/service.rs Outdated Show resolved Hide resolved
base_layer/wallet/src/output_manager_service/service.rs Outdated Show resolved Hide resolved
@philipr-za philipr-za force-pushed the philip-split-utxo-query branch 2 times, most recently from 188b656 to 0d2c07c Compare June 5, 2020 10:09
Previously when the output manager service would send its UTXO validity query to its Base Node it would send a single query with all the UTXO hashes in it. The Base Node then responds with a single response message with all the valid UTXO’s that match a hash in the queries list. In large wallets this caused a problem where the response message could become large enough to be rejected by the frame size limits in the comms stack.

In order to mitigate this issue the Output Manager service will now send queries consisting of up to a maximum number of outputs (specified in the config) and will send multiple queries until all the outputs have been queried so that any one response does not hit the frame size limit.
@philipr-za philipr-za force-pushed the philip-split-utxo-query branch from 0d2c07c to 7ca23d6 Compare June 5, 2020 10:15
Copy link
Member

@sdbondi sdbondi left a comment

Choose a reason for hiding this comment

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

LGTM

@sdbondi sdbondi merged commit 7959736 into development Jun 5, 2020
@sdbondi sdbondi deleted the philip-split-utxo-query branch June 5, 2020 12:27
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.

2 participants