-
Notifications
You must be signed in to change notification settings - Fork 111
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
Pass the mempool config to the mempool #2861
Conversation
Also: - expand config docs - clean up mempool imports
This simplifies all the code that calls the mempool. Also: - update the mempool enabled state before returning the new mempool - add some test module doc comments
Also: - update the setup function to handle the latest mempool changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
_config: &Config, | ||
outbound: Outbound, | ||
state: State, | ||
tx_verifier: TxVerifier, | ||
sync_status: SyncStatus, | ||
latest_chain_tip: zs::LatestChainTip, | ||
chain_tip_change: ChainTipChange, | ||
transaction_sender: watch::Sender<HashSet<UnminedTxId>>, | ||
) -> Self { | ||
Mempool { | ||
) -> (Self, watch::Receiver<HashSet<UnminedTxId>>) { | ||
let (transaction_sender, transaction_receiver) = | ||
tokio::sync::watch::channel(HashSet::new()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
// Make sure `is_enabled` is accurate. | ||
// Otherwise, it is only updated in `poll_ready`, right before each service call. | ||
service.update_state(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
/// The mempool transaction cost limit. | ||
/// | ||
/// This limits the total serialized byte size of all transactions in the mempool. | ||
/// | ||
/// This corresponds to `mempooltxcostlimit` from [ZIP-401](https://zips.z.cash/zip-0401#specification). | ||
pub tx_cost_limit: u32, | ||
|
||
/// The mempool transaction eviction age limit. | ||
/// | ||
/// This limits the maximum amount of time evicted transaction IDs stay in the mempool rejection list. | ||
/// Transactions are randomly evicted from the mempool when the mempool reaches [`tx_cost_limit`]. | ||
/// | ||
/// (Transactions can also be rejected by the mempool for other reasons. | ||
/// Different rejection reasons can have different age limits.) | ||
/// | ||
/// This corresponds to `mempoolevictionmemoryminutes` from | ||
/// [ZIP-401](https://zips.z.cash/zip-0401#specification). | ||
pub eviction_memory_time: Duration, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💖
/// Consensus rules: | ||
/// | ||
/// > There MUST be a configuration option mempooltxcostlimit, | ||
/// > which SHOULD default to 80000000. | ||
/// > | ||
/// > There MUST be a configuration option mempoolevictionmemoryminutes, | ||
/// > which SHOULD default to 60 [minutes]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
async fn setup( | ||
network: Network, | ||
) -> ( | ||
Mempool, | ||
MockPeerSet, | ||
StateService, | ||
MockTxVerifier, | ||
RecentSyncLengths, | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😻
Motivation
To implement ZIP-401, we need to pass the mempool config to the mempool.
This is a high priority, because ZIP-401 is on the critical path.
This PR is unexpected work - it wasn't done as part of creating the mempool config.
Solution
Functionality:
Refactors:
Review
@dconnolly might want to review this PR, because the config is needed for ticket #2780.
Reviewer Checklist
Follow Up Work