This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72848be
commit 58b2437
Showing
1 changed file
with
34 additions
and
0 deletions.
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. | ||
|
||
## | ||
|
||
|
||
~ | ||
~ | ||
~ | ||
~ | ||
~ | ||
~ |