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

Add a debug config that enables the mempool #2862

Merged
merged 10 commits into from
Oct 13, 2021
Merged

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Oct 12, 2021

Motivation

We want to run acceptance tests on the mempool.

To do that, we need to be able to configure the mempool to start quickly.
(Rather than at the chain tip, which takes hours to sync.)

Closes #2690.

Solution

  • Add a mempool debug_enable_at_height config
  • Use debug_enable_at_height in the mempool service
  • Use debug_enable_at_height in the mempool crawler

Tests:

  • Add a basic mempool activation acceptance tests, using debug_enable_at_height

Bug fixes:

  • Propagate syncer channel errors through the crawler
  • Deny unknown fields and apply defaults for all configs

I'd like to leave the crawler refactor for my next PR, so we can bisect if it causes issues.

Review

@conradoplg can finish off the review for this PR.

This PR is based on PR #2861.

Reviewer Checklist

  • Code implements Specs and Designs
  • Tests for Expected Behaviour
  • Tests for Errors

Follow Up Work

Refactor the debug_enable_at_height checks - choose one of:
- move the debug_enable_at_height code into SyncStatus, so we don't have to copy it everywhere we use SyncStatus
- launch the mempool crawler task when the Mempool is enabled, and kill it when it is disabled

@teor2345 teor2345 added C-bug Category: This is a bug A-rust Area: Updates to Rust code C-enhancement Category: This is an improvement C-cleanup Category: This is a cleanup P-Medium labels Oct 12, 2021
@teor2345 teor2345 requested a review from conradoplg October 12, 2021 06:12
@teor2345 teor2345 self-assigned this Oct 12, 2021
@teor2345 teor2345 linked an issue Oct 12, 2021 that may be closed by this pull request
Base automatically changed from use-mempool-config to main October 12, 2021 17:31
@conradoplg conradoplg force-pushed the mempool-debug-config branch from f6b6f99 to ce51b29 Compare October 12, 2021 17:40
Copy link
Collaborator

@conradoplg conradoplg left a comment

Choose a reason for hiding this comment

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

I rebased this after #2861 was merged.

This seems good, the only thing lacking is already mentioned as TODO (moving flag into SyncStatus to avoid repetition, and tests).

Something that I realized now and may be useful here (or not, feel free to ignore): if we move the crawler inside Mempool, then it won't need to monitor the tip anymore, as it will be enabled/disabled with the mempool (though we'd need logic to re-spawn / kill the task when that happens)

@conradoplg
Copy link
Collaborator

(I've just realized that I probably shouldn't have rebased & force-pushed something that it's still a draft, apologies if this makes things a bit difficult on your end @teor2345 😬 )

@teor2345
Copy link
Contributor Author

(I've just realized that I probably shouldn't have rebased & force-pushed something that it's still a draft, apologies if this makes things a bit difficult on your end @teor2345 😬 )

I don't mind, but I'm glad you mentioned it, so I wasn't surprised when I went to push.
(I probably would have force-pushed my rebase over yours without noticing.)

I can just do git branch -f mempool-debug-config origin/pull/2862/head to pick up your rebase.

@teor2345
Copy link
Contributor Author

Something that I realized now and may be useful here (or not, feel free to ignore): if we move the crawler inside Mempool, then it won't need to monitor the tip anymore, as it will be enabled/disabled with the mempool (though we'd need logic to re-spawn / kill the task when that happens)

I really like this idea, and I think it could work.

And if we do it, we don't need to modify SyncStatus, because the mempool does the debug activation checks.

@teor2345 teor2345 force-pushed the mempool-debug-config branch from ce51b29 to abb83fe Compare October 13, 2021 01:40
@teor2345 teor2345 marked this pull request as ready for review October 13, 2021 01:40
@teor2345
Copy link
Contributor Author

This is now ready for review - I want to do the cleanup in a follow-up PR.

Copy link
Collaborator

@conradoplg conradoplg 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

@conradoplg conradoplg enabled auto-merge (squash) October 13, 2021 14:43
@conradoplg conradoplg merged commit b64ed62 into main Oct 13, 2021
@conradoplg conradoplg deleted the mempool-debug-config branch October 13, 2021 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rust Area: Updates to Rust code C-bug Category: This is a bug C-cleanup Category: This is a cleanup C-enhancement Category: This is an improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add debug configs for mempool acceptance tests
2 participants