Skip to content
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

Add ability to remove "Parent" transactions from the mempool #582

Merged
merged 5 commits into from
Nov 19, 2021

Conversation

evan-forbes
Copy link
Member

@evan-forbes evan-forbes commented Nov 18, 2021

Description

For problem statement, please see #581. This PR introduces a wrapper around the types.Tx type to attach the hash of the "parent" transaction, in this case of the WirePayForMessage, so that after the "child" transaction is confirmed, the parent can easily be removed from the mempool.

There are some meaningful downsides to this approach, mainly that we add an extra hash to each PayForMessage transaction that gets included in the block, and that we add a small amount of overhead when checking for wrapper. Unfortunately, the way that the mempool is currently designed requires the hash of the transaction in order to be removed.

This PR also requires a PR to be made in the app that modifies the transaction decoder to unwrap these transactions, along with wrapping them during the Preprocess step

@evan-forbes evan-forbes marked this pull request as draft November 18, 2021 16:41
Copy link
Member

@liamsi liamsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trajectory looks good. I'm just wondering how this works in abci++ in general? I mean the Block.Data can be modified arbitrarily there. So there should be a way without modifying tendermint if I am not mistaken.

@evan-forbes evan-forbes marked this pull request as ready for review November 18, 2021 17:47
@evan-forbes
Copy link
Member Author

AFAICT, all transactions are referenced using their hashes, so we will have to have the hash of the parent WirePayForMessage somehow.
https://github.com/tendermint/tendermint/blob/53565cb815e2d04343818c9cff38ed108f234c2b/internal/mempool/v0/clist_mempool.go#L341

We have the alternative to manage the hashes another way, which I think is preferable, as we won't include an extra hash in each PayForMessage tx

@evan-forbes evan-forbes removed the request for review from tac0turtle November 18, 2021 21:09
@evan-forbes
Copy link
Member Author

This solution is working, but we should use something else after devnet. In theory, this shouldn't be an issue, as the transactions in the mempool are rechecked by default, and therefore should be removed as they have the same nonce as the PayForMessage tx that is getting confirmed. They aren't being removed though, and I'm still unsure as to why.

Copy link
Member

@liamsi liamsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

devnetooooooor

@evan-forbes evan-forbes merged commit aa0e2a4 into v0.34.x-celestia Nov 19, 2021
@evan-forbes evan-forbes deleted the evan/wfpm-removal-from-mempool branch November 19, 2021 10:26
evan-forbes added a commit that referenced this pull request Apr 26, 2022
* add the new transaction wrapper

* export and move DecodeChildTx

* return a more precise type (Tx instead of []byte) for DecodeChildTx

* add test and helper function

* linter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants