-
Notifications
You must be signed in to change notification settings - Fork 236
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
Implement the mempool #16
Comments
Problems that emerged when implementing mempool with sorted transactions:
|
Artur, please make sure that comments on a ticket can be understood without digging around Please elaborate on the following
|
Transactions in one block may depend on each other. We sort transactions based on fees, previously we added transactions to the end of list. Previously we could just try to apply new transaction on the end state of trees after all the others. Now It's not possible, because new transaction should be applied between other transactions and other transaction may conflict with it.
It's a good idea to stop listening to someone that provides us with invalid transactions and makes us waste resources.
Maybe code for generating a block to mine should be included in tx_pool module. I'm thinking about that, because that process includes full transaction validation and we need to add some process to remove invalid transactions from the pool.
That's an implementation detail. I added a wrapper like signed_tx to solve problem with accessing fee from mempool. I don't like my solution. |
Lets walk it step by step: Invalid transactions caused by fee-based re-ordering: invalid transactions penalizing the peer: general:
what is a good place to prevent replayed transactiones? Will they be caught by transaction validation (and nonces constraints?) @zp-sd @cytadela8 |
Another question: what should be done when a transaction is considered as invalid during mining (e.g. changes account's balance to negative value)? Such transaction is skipped when selecting set of transactions for a block to get mined. But should it be kicked out of the mempool as well? And - if yes - shall this information be propagated to another peers? Or maybe we we need to add a kind of TTL for invalid transactions in the mempool? |
@zp-sd the question. @cytadela8 what are your thoughts on that? I would avoid complications at the beginning. Just throw it away, don't sync about it, don't set TTL. |
+1 for doing it the simple way. |
First, sorry for late comment, my notifications on Github are flooded. I have to look for a way to get only the important updates there so I won't miss such important discussions My worries about transactions validity and that it may change when new transactions are put between others is not about problems with transactions not getting included or ordered as someone would like, but with potential invalid transactions spam. If we are not able to validate transactions that reach our mempool we leave ourselves vulnerable to a spam attack. Someone might create a lot of invalid transactions in such a way that we won't realize that they are invalid till we try to generate a block with them. This for example might cause as to run out of RAM or if we protect ourselves from that we just won't accept any new transactions. |
We can only validate that the transaction signature is valid before adding it to the mempool. We cannot execute the transaction and thus check the balance until the transaction is picked out of the mempool. The cannot distinguish between transaction spam, as described by @cytadela8, and a high volume of regular transactions. We can try to throttle a peer that sends a high volume of transactions, though. Also, do remember that transactions incur fees and we'll deduct these fees when picking transactions out of the pool, regardless of whether the transactions can be executed or not. |
I see we understand each other. As for the last comment: Keep in mind the fee may not be possible to be deducted as they may not be enough balance left to deduct it. (e.g. one account creates a 1 000 000 of transactions from which only one can be executed other's fail due to balance=0) |
The text was updated successfully, but these errors were encountered: