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 mempool config for minimum block inclusion fee per cost #19323

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Rigidity
Copy link
Contributor

Purpose:

This will allow farmers to decide what the minimum fee per cost ratio they want to include in blocks is, which prevents wasting resources building blocks with fee-less transactions (possibly useful on lower end hardware). Also, as was made clear by the recent fast forward mempool bug, it's important to have mempool diversity.

Current Behavior:

The mempool currently has no configuration options.

New Behavior:

You can now configure the minimum fee per cost for a transaction to be included into a block. However, lower fee transactions will still be received in the local mempool and propagated throughout the network. Fully blocking them from entering the mempool would have more adverse effects at scale.

Testing Notes:

Has not been tested yet, hence being in draft for now.

@Rigidity Rigidity added full_node Added Required label for PR that categorizes merge commit message as "Added" for changelog labels Feb 26, 2025
Copy link
Contributor

File Coverage Missing Lines
chia/full_node/mempool.py 88.9% lines 557
Total Missing Coverage
14 lines Unknown 92%

Copy link
Contributor

@arvidn arvidn left a comment

Choose a reason for hiding this comment

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

we should have tests for this too. Ideally one that uses create_block_generator() as I'm hoping well transition away from first creating the SpendBundle. Perhaps a parameterized one, to ensure a few different ratios work.

In case there isn't an obvious conflict, maybe you can try to rememeber to remind of of this new setting before #19270 lands too

@@ -543,14 +551,18 @@ async def create_bundle_from_mempool_items(
fee = int(row[1])
item = self._items[name]

assert item.conds is not None

if fee / item.conds.cost < self.config.minimum_fpc_for_block_inclusion:
Copy link
Contributor

Choose a reason for hiding this comment

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

probably not important; one option is to use the fee_per_cost column from the database, rather than recomputing the ratio. The only reason I can think of to prefer the database field is to be consistent with what actually matters for the purpose of ordering the items. Perhaps this ratio will be computed slightly different in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Added Required label for PR that categorizes merge commit message as "Added" for changelog coverage-diff full_node
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants