@@ -59,7 +59,9 @@ compute-unit at a given condition.
59
59
- * write lock fee* : denominated in ` lamport ` , it is fee dedicated for write
60
60
lock an account, calculated as ` compute-unit-pricer.cost-rate() * transaction.requested_cu() ` .
61
61
62
- ## Design Highlights
62
+ ## Detailed Design
63
+
64
+ ### Design Highlights
63
65
64
66
- Account Association with Compute Unit Pricer:
65
67
- Accounts are associated with a * compute unit pricer* , and the * runtime*
@@ -77,15 +79,17 @@ lock an account, calculated as `compute-unit-pricer.cost-rate() * transaction.re
77
79
` alpha = 2 / (N+1) ` .
78
80
- # Algorithm:
79
81
- Adjusts write-lock * cost rate* based on an account's EMA * compute-unit
80
- utilization* . Initial write-lock cost rate is ` 1000 micro-lamport/CU ` .
82
+ utilization* .
81
83
- For each block, if an account's EMA * compute-unit utilization* is more than
82
- half of its max limit, its write-lock * cost rate* increases by 1%. If it's
83
- below half, the * cost rate* decreases by 1%.
84
+ half of its max limit, its write-lock * cost rate* increases by X%. If it's
85
+ below half, the * cost rate* decreases by X%.
86
+ - For V0, Initial write-lock cost rate is ` 1000 micro-lamport/CU ` ; and cost
87
+ rate set to 1%.
84
88
- Calculate * Write Lock Fee* :
85
89
- Fee required to write-lock an account is calculated by multiplying the
86
90
write-lock * cost rate* by the transaction's requested CU.
87
91
88
- ## Detailed Design
92
+ ### Detailed Design
89
93
90
94
- Initialization and Inheritance:
91
95
- Bank initializes an empty account_write_lock_fee_cache, an LRU Cache of
@@ -103,9 +107,14 @@ lock an account, calculated as `compute-unit-pricer.cost-rate() * transaction.re
103
107
- End of Block Processing:
104
108
- Identify write-locked accounts with * compute-unit utilization* > half of
105
109
account max CU limit. Add/update bank's account_write_lock_fee_cache.
106
- - Adding new account into LRU cache could push out eldest account;
107
- - LRU cache has capacity of 2048, which is 2* worst case block, should
108
- be enough to prevent cache attack.
110
+ - Evicting cheapest account before add new "hot" accounts into LRU cach;
111
+ - LRU cache has capacity set to 2* worst case eviction per block to prevent
112
+ cache attack.
113
+ - For v0, cache capacity set to 2048, as:
114
+ - Max number of tansactions with account 6M CU = 48M/6M = 8;
115
+ - Max number of accounts per tx: 128;
116
+ - worst case per block: 128 * 8 = 1024;
117
+ - 2 times worst case: 2048;
109
118
- Fee Handling:
110
119
- Collected write-lock fees are 100% burnt.
111
120
- Collected priority fees are 100% rewarded.
0 commit comments