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

Miner block budget spend down #5433

Closed
kantai opened this issue Nov 7, 2024 · 3 comments
Closed

Miner block budget spend down #5433

kantai opened this issue Nov 7, 2024 · 3 comments

Comments

@kantai
Copy link
Member

kantai commented Nov 7, 2024

The current default behavior of miners is to include as many transactions they can in the early block of the tenure within some “time limit” that they measure from wall clock time. This leads to spikiness in the block budget consumption, because miners are mostly able to fill their budgets in one or two blocks.

An alternative miner heuristic would reserve some block space for transactions arriving later with higher fees. In this model, the miner sets a target budget when mining equal to, e.g., 50% of the tenure budget (measured in any dimension). Afterwards, the next time they build a block, they set a target budget of 75% of the tenure budget (i.e., the next block will by itself have up to 25% of the tenure budget), and the next time they build a block, they set a target budget of 87.5%, etc. The reason to use an exponential target curve here is that on each block assembly, the miner is faced with the same trade-off (i.e., it is a recursive choice): how much of the block budget do I consume now, versus waiting for the possibility of a higher fee transaction? 50% is probably too “present weighted” – something like 25% could be better (i.e., consume 25% of the remaining budget with each block).

@vini-btc
Copy link

Hey @kantai ! First, thank you and everyone working in core for the great effort in the Nakamoto release and all the follow-up performance improvements I see coming.

I have one question: what impact on larger transactions would you expect from this change in the heuristic?

@jferrant
Copy link
Collaborator

jferrant commented Dec 17, 2024

Hey @kantai ! First, thank you and everyone working in core for the great effort in the Nakamoto release and all the follow-up performance improvements I see coming.

I have one question: what impact on larger transactions would you expect from this change in the heuristic?

So sorry for not seeing this sooner!

This change is a "soft limit" so it shouldn't have too too much of an impact I.e. a large transaction will still be included if they exceed the soft limit (but do not exceed the hard limit) if they have a sufficient transaction fee.

However, it does mean that if the mempool is full of a lot of large transactions, they may not be included in the most immediate block unless they are the top of the queue (have the highest set tx fee). For example, suppose the mempool is full of ONLY large transactions and each one alone exceeds this soft limit imposed by the spend down...then only one of these transactions can be included per block. This will continue until the hard limit is reached at which point a tenure extend will have to be issued for any further contract/function call txs to be included in a block.

I hope that explains, but please feel free to ask more questions!

@jferrant jferrant closed this as completed Jan 8, 2025
@github-project-automation github-project-automation bot moved this from Status: 💻 In Progress to Status: ✅ Done in Stacks Core Eng Jan 8, 2025
@blockstack-devops
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@stacks-network stacks-network locked as resolved and limited conversation to collaborators Jan 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Status: ✅ Done
Development

No branches or pull requests

5 participants