-
Notifications
You must be signed in to change notification settings - Fork 251
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
Transaction priority research #150
Comments
I should extend:
|
Some preliminary thoughts. Just want to share; nothing should be taken as an authoritative direction for implementation at this point. There are 2 problems associated with tx prioritization:
Problem 1 analysisTransactions can be in one of 3 states determined by the current blockchain state (affected by previous transactions in a block proposal - more on that later):
With this classification in mind, rejected txs should never be in proposals (in fact, they can be removed from the mempool as described previously), neither should pending txs. Now, the tricky part is that the tx state can change after applying any tx in the block proposal (and we don't execute txs when forming a proposal). This leads to
Assuming this is solvable, it's inefficient to update statuses of all txs in mempool after applying a single tx. Fortunately, this seems somewhat solvable; a tx may declare in its interface which key(s) in the blockchain state its status depends on, so that only statuses of relevant txs may be updated after each tx execution. Notice that the amount of keys is quite small in many practical use cases; e.g., a counter CAS depends on a single key (the counter), a blockchain height-based timelock - too (assuming blockchain height is stored somewhere in the state), a coins transfer tx - too (the balance of the sender).
Problem 2 analysisWithin the composable tx model, there is a single endpoint that embeds all other transactions (e.g., authenticated tx in the most generic case). IMO, it's logical to introduce tx priority (e.g., numeric) to the interface of this entry endpoint. Notice that it may work in more complex use cases, say, when we have tx fees (implemented, say, as a batch tx, with the first component being payment to the validators). The aforementioned entry endpoint method may inspect that an embedded tx is a batch with a fee payment, and if not, drop the tx, and if it is assign the priority based on the fee. Of course, there is a room for more complex logic; e.g., there may be certain tx types without fees (say, configuration updates, as you mention earlier).
To reiterate again: these are preliminary thoughts only; feel free to ask questions and criticize. I assume (because I want to believe) that composable txs will be implemented in the observable future; to my mind, they will help tackle this and other problems significantly. |
@slowli Do i get possible state transitions for a transaction right
How's that? Pleaze be a bit more specific with a scenario.
|
No description provided.
The text was updated successfully, but these errors were encountered: