-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
umbrella document for cost model #20517
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
title: Cost Model | ||
--- | ||
|
||
## Motivation | ||
|
||
Needs a method to calculate transaction's cost that captures the work required by validator to process it. | ||
|
||
## Solution | ||
|
||
### Transaction Cost calculation | ||
Cost is measured in `compute unit`, which describes required computational work (eg., CPU). | ||
|
||
Transaction cost is closely echoing proposed Comprehensive Fee Structure (#16984), it is the sum of following components: | ||
1. signature cost, is the number of signatures in a transaction multiplied with fixed signature cost; | ||
2. write lock cost, is number of writable accounts in transaction multiplied with fixed write_lock cost; | ||
3. data byte cost, is transaction's data size multiple by fixed cost per bytes rate; | ||
4. instruction execution cost, is the sum of cost of instructions in transaction. System built in instruction has fixed cost, while bpf instructions are collected in runtime. | ||
|
||
Methods to determine fixed cost for above components are described in issue #19627. | ||
å | ||
### Transaction Cost composition | ||
*** subject to change *** | ||
In addition to above components, Transaction Cost also tracks the writable accounts in transactions. This additional information could be used by block producers to limit the number of transactions for the same account, by limiting cost allowed per account, hence improving block's parallelism. | ||
|
||
## | ||
|
||
|
||
~ | ||
~ | ||
~ | ||
~ | ||
~ | ||
~ |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@jackcmay pointed out that signature cost should not be used in block packing decision since signature verification is done outside slot.