-
Notifications
You must be signed in to change notification settings - Fork 300
SIMD-0061: Fair congestion control with intra-block exponential local base fee #61
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
Changes from all commits
7d44f76
2bd5351
f864599
3dd3f6d
e49a63c
da4724f
59c98f5
1e7b9aa
5f0c74c
1bfda18
dad9b5d
48b4504
cad6027
c894a72
97c9ff2
007db4c
f5b2f4d
30de97f
7e90dbd
40f6cd4
686fd08
d90f9cd
6c6e694
c30f359
7ce2535
686e34f
2db8d93
d258524
4a91e2e
6c92109
75652ab
c3bf6a1
8ef9764
8b86721
1abf39d
13f2140
9dd03eb
7175e35
5a51fa6
d3853d0
8f09a5c
b192781
753c002
abf5f22
723914e
9a2e9f2
25d64a9
84165e5
cac4398
750d5d3
f7ee07b
6e54692
040fb2a
74213a7
82dc9be
1de4905
5a8c77a
19d3f9d
01b6d12
41ca9c3
17ba8aa
aef465d
5a87682
746a7d0
8663a99
95c598b
2050d17
970e535
9ff200b
96ba8c4
e78a111
73d895c
2fc579c
3772b44
51b5be2
e47bee6
22011ab
a8c4ec9
dcccbc3
4d9dbf5
b17bb17
d48ac6a
3c461ec
29d3005
fe19636
d0acf01
53ac79e
621c21e
79266d8
4f650d3
e5cf4da
eb25106
da46be2
a094b27
6f99167
a68f430
d5e0373
f397a33
937ac58
9c4bc50
c315abc
9aaa368
d08c4f4
36d2f6e
a75229e
97cfdd5
6741109
05893dc
046d20a
c5f653b
46c16d1
a1204fc
21ed169
d2c36f5
8dd1504
d1a7656
e752a03
e5cdd3f
5bd8d50
f7f16ce
3f928c9
04bee63
2503983
8c5374c
e9b0e8c
d2acc06
59bb565
9371b1e
07c103b
b07780f
316a63f
886303c
048a6f0
a59f6ca
7d65ac8
56c9a32
313021b
a1dd5f6
0acd39d
ca02f2f
bfb7633
0b55baa
64382b1
16efebf
62fbdbc
755140a
f5a34dc
01f7fe1
7fe16f7
5c5f9cc
e1109df
46b8a4a
e4694f7
54dd44a
47cd21f
30c6cbe
d88ccaa
3934373
28d50dc
7e59f68
7386a6b
471e46f
f099bc5
d5b6cf8
7d6843d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,258 @@ | ||
| --- | ||
| simd: '0061' | ||
| title: Fair congestion control with intra-block exponential local base fee | ||
| authors: | ||
| - Ryo Onodera (Solana Labs) | ||
| category: Standard/Meta | ||
| type: Core | ||
| status: Draft | ||
| created: 2023-07-05 | ||
| feature: (fill in with feature tracking issues once accepted) | ||
| --- | ||
|
|
||
| ## Summary | ||
|
|
||
| This feature is a fair congestion-control mechanism in the form of an extension | ||
| to local fee markets while leaving their locality of transaction fee dynamics | ||
| intact. | ||
|
|
||
| To that end, it introduces a exponentially-scaled dynamic base fees to | ||
| individual local fee markets. It also attains very short feedback loop of | ||
| per-tx frequency to maintain full efficacy of Solana's peculiar execution | ||
| model compared to other blockchains: multi-threaded and low latency. | ||
|
|
||
| This is realized by means of some incentive tweaks to combat against the | ||
| obvious base fee manipulation with such short intervals. | ||
|
|
||
| ## Motivation | ||
|
|
||
| (still in half-finished...) | ||
|
|
||
| - Write lock cu limit is bad (bot can lock out at the very first of block for | ||
| the entire duration of whole blocktime (400ms) | ||
| - Increased Defi activities around any volatile financial markets could starve | ||
| payment transactions for extended time | ||
| - Inter-block and linear Voluntary fee escalation with vanilla fee market | ||
| auction can't guarantee the scheduling deadline of casual payment txes (which | ||
| needs 99.99% sub-second confirmation at very minimum). | ||
|
|
||
| ## Overview of the Design | ||
|
|
||
| This proposal tries to localize congestions by means of increasing minimum | ||
| required `cu_price`s for each write-locked addresses (= `base_cu_price`), which | ||
| is newly introduced by this proposal. This increase will be calculated | ||
| exponentially, measured by the CU consumed by each addresses at the moment. | ||
| This means a transaction must cost the sum of `requested_cu * base_cu_price` | ||
| for all of its write-locked addresses at least. This results in selectively | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
yes.
no, there shouldn't be no such thing as written below in the proposal. |
||
| pricing out crowded subset of transactions waiting for block inclusion, while | ||
| allowing other transactions to be processed for block inclusion. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not perfectly clear the particular scenario trying to solve, but my intuition would be make base fee dynamic while leave priority ass is.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. assume block is saturated like this: L highly lucrative trading pairs like sol/usdc, btc/usdc, eth/usdc and banking thread N. and so, normal spl transfers will cost at least 1 cents (assuming quoting and transfer consume around same amount of cu). also, when market gets volatile for some economic news, normal spl transfers wil need to pay the more priority fee during that period, than normal days. I think these are bad.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. If all defi transactions take up block space (after taking up all write-lock account limit), one might be able to say to transfer transaction that "block limit is reached" therefore indeed time to use priority fee. There probably room in scheduler to optimize it. |
||
|
|
||
| In this way, under-capitalized usage demand like spl-token transfers among | ||
| wallets will still find its way for _timely_ block inclusion, accomplishing | ||
| this mechanism's advertised _fairness_ in the sense of blockspace allocation | ||
| and transaction fee isolation for each independent local fee markets even at | ||
| the time of financial market's volatility, which entices well-capitalized usage | ||
| demand in DeFi activities on chain. | ||
|
|
||
| This rate-limiting gets enforced only when the cluster deemed to be congested, | ||
| meaning no idling block space is wasted when not congested. Also, those | ||
| exponentially-increased `base_cu_price`s will be decreased exponentially | ||
| likewise in terms of consumed CUs in a block (= `block_cu`), as long as its | ||
| address-specific CUs (= `address_cu`) remain to be unchanged due to the | ||
| temporal stalemate of relevant transaction processing. Collectively, each | ||
| addresses get equal amount of opportunity to execute transactions in | ||
| round-robin fashion while contributing to the decrease of other | ||
| `base_cu_price`s, assuming no exponential priority-fee premium is paid among | ||
| users to interrupt the orderly processing with such a high economical | ||
| justification. | ||
|
|
||
| On top of the direct appreciation of aforementioned fairness, this proposal | ||
| also obsoletes both the existing block-wide CU limit and the account-write CU | ||
| limit to overcome their inherent unfairness and problems. Also, no global | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will the dynamic
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm no? being not bankless, leaders are responsible and incentivised to generate block which should be replayed around 400ms. otherwise, they just risk missed block rewards. likewise, replay should discard long-running blocks, assuming others won't vote as well. |
||
| `base_cu_price` is introduced for simplicity, relying on natural block-wide | ||
| market-rate ceiling from individual active `base_cu_prices`s. | ||
|
|
||
| Also, this proposal was conceived with the intent of reinforcement of Solana's | ||
| multi-threaded, real-time, and low-latency transaction execution. Towards that | ||
| high-achieving objective, rather drastic technical and economical changes are | ||
| needed for the introduction of this consensus-level congestion control as | ||
| described below in detail. | ||
|
|
||
| ## Detailed Design | ||
|
|
||
| ### Introductory example | ||
|
|
||
| Due to this proposal's inherent complexities, the following very-simplified | ||
| example is presented at first before diving into each design topic: | ||
|
|
||
| Assume all transactions request 100k CU and always succeed after consuming 100k | ||
| CU. Also assume the cluster is always congested. | ||
|
|
||
| Available transactions for block inclusion (= `bufferd transactions`): | ||
|
|
||
| - `Tx1_AB@9` (read: transaction numbered as `1`, which write-locks both address `A` | ||
| and address `B` with `cu_price == 9`) | ||
| - `Tx2_A@8` | ||
| - `Tx3_C@8` | ||
|
|
||
| (1) | ||
|
|
||
| #### update freq | ||
|
|
||
| why block interval is bad? | ||
| this proposal's primary objective is for congestion control, not like EIP 1559's price discovery | ||
| so non-interactiveness is desired for little or no room of active auctioning | ||
| so, quick and acute is desired much like tcp's rwin. | ||
|
|
||
| ### Incentive alignment | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| ### `base_cu_price` Calculation and block reward adjustment | ||
|
|
||
| processing model is transactions are linearized by the order of appearance in ledger entries. | ||
|
|
||
| ### `reserved_fee` calculation and its accruing | ||
|
|
||
|
|
||
| ### Congestion Detection | ||
|
|
||
| thread count or runnable/scheduled tx queue len? | ||
|
|
||
|
|
||
| ### Nonconflicting transaction group | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| (i jotted this down in 10min before going to bed! pardon for being so random | ||
| writings...) | ||
|
|
||
| to *determiniscally* define active thread count (`TC_a`), additionally record | ||
| transaction termination events into poh stream. | ||
|
|
||
| also, derive stake-weighted average transaction execution thread count | ||
| (`TC_stake_weighted`). | ||
|
|
||
| so, full is defined as the duration when `TC_a == TC_stake_weighted` (this is | ||
| updated at ~10ms intervals). | ||
|
|
||
| when not full, maximize throughput of each of any single threaded transaction | ||
| executions. note that, this mode exponentially cools down any hot addresses if | ||
| any. | ||
|
|
||
| when full, effectively pause any txes touching the hot state by exponentially | ||
| increasing the local base fees. so casual txes can be executed. | ||
|
|
||
| so, leaders are incentivised to manipulate in this naive form. | ||
|
|
||
| so, split priority fee into two parts: (1) collected, (2) accrued for the next | ||
| tx's base fee payment. The portion of (1) is calculated as if tx's cu * | ||
| `TC_stake_weighted`. (i.e. as if validator stuffed spam txes to capture the | ||
| exessive part (2) of prirotiy fee) | ||
|
|
||
| in this way, there's no meaning to spam blocks by leaders. at the same time, | ||
| it's still incentivied to pack txes according to p.f. desceding order, because | ||
| leaders and clients alike are want to increse of their single threaded tps) | ||
|
|
||
| also requested fee is basis for fee cals, block fullness calc, not the actual | ||
| cu. | ||
| - to prevent bad behavior, rebate 50% of (requested CU - actual CU)? | ||
| - so that leaders want txes success (want to increase actual CU) => usually | ||
| execute in the order | ||
| - specified by user | ||
| - so that users want txes fail fast (want to decrease actual CU) | ||
| - 25% is burntd and 25% is collected to leaders | ||
| - so, avoid too much requested cu. | ||
|
|
||
| finally, when substantial blocks are full for extended duration, the global base-fee | ||
| will naturally starts ceiling up. That's unavoidable no matter what. | ||
|
|
||
| priority fee isn't collected at all. | ||
| banking can implement this congenstion mechanism without forced consensus rules if disired for experiment | ||
|
|
||
| ### Example | ||
|
|
||
| `TC_stake_weighted == 10` | ||
|
|
||
| 100 kcu | ||
|
|
||
| tx1a -- tx2a -- tx3a | ||
|
|
||
| tx1a: | ||
| cu 100kcu | ||
| base fee: | ||
|
|
||
| tx2a: | ||
| cu 200kcu | ||
|
|
||
| tx3a: | ||
| cu 300kcu | ||
|
|
||
| why leaders are incentized for picking more prioritized txes even if they only receive fixed base fees? | ||
| predictable auction mechanism and ceiling base fee as much as possible | ||
| compound reserve from firstly-executed txes? | ||
|
|
||
|
|
||
| ## Impact | ||
|
|
||
| How will the implemented proposal impacts dapp developers, validators, and core contributors? | ||
|
|
||
| ## Security Considerations | ||
|
|
||
| What security implications/considerations come with implementing this feature? | ||
| Are there any implementation-specific guidance or pitfalls? | ||
|
|
||
| ## Drawbacks *(Optional)* | ||
|
|
||
| Why should we not do this? | ||
|
|
||
| ## Backwards Compatibility *(Optional)* | ||
|
|
||
| Does the feature introduce any breaking changes? All incompatibilities and | ||
| consequences should be listed. | ||
|
|
||
| ## Alternatives Considered | ||
|
|
||
| Related proposals: | ||
|
|
||
| (TODO: add any relation of this to them) | ||
|
|
||
| dynamic base fees | ||
| https://github.com/solana-foundation/solana-improvement-documents/pull/4 | ||
|
|
||
| program rebatable account write fees: | ||
| https://github.com/solana-foundation/solana-improvement-documents/pull/16 | ||
|
|
||
| asynchronous program execution: | ||
| https://github.com/solana-foundation/solana-improvement-documents/pull/45 | ||
|
|
||
| increase prioritization fee: | ||
| https://github.com/solana-foundation/solana-improvement-documents/pull/50 | ||
|
|
||
| bankless | ||
| https://github.com/solana-foundation/solana-improvement-documents/pull/5 | ||
|
|
||
| ## New Terminology | ||
|
|
||
| Is there any new terminology introduced with this proposal? | ||
|
|
||
| casual tx: | ||
| fairness: | ||
| block fullness in terms of number of actively-execution threads | ||
| dark/filler tx: | ||
| tx base fee: | ||
| address base fee: | ||
| reserve <=> reward | ||
| requested <=> required | ||
| buffered | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /target |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [package] | ||
| name = "fair-congestion-control-simulation" | ||
| version = "0.1.0" | ||
| edition = "2021" |
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.
In order to lock out an account for entire slot, wouldn't bot need to time they 10M cu txs are at the top of the queue when a block starts, by paying the highest priority fee for that account? If SIMD #50 is approved, bot would be economically disincentivized, wouldn't it?
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.
(thanks for peeking into this half-based proposal)
yes. i think this is problem per se. this creates uneven value of time only around block boundaries. ideally, there should be some measure to unlock the limit if economically desired by users.
i guess that's limited. with 10M cus, it's just auction by the increments of 10_000 lamports? I think it's still cheap, considering arb's profits could be unbounded.
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.
it really depends on who you asking 😉