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

feat(mempool): remove transaction for locally mined blocks that fail validation #4306

Conversation

sdbondi
Copy link
Member

@sdbondi sdbondi commented Jul 13, 2022

Description

On block validation failure submitted locally (i.e. via grpc), clear all associated transactions.

Motivation and Context

This is a failsafe that prevents transactions that passes transaction validation but fails block validation, preventing a miner from submitting a block until the mempool is manually cleared.

This should be rarely applied and be a last line of defense/failsafe against incorrect transaction validation and block template generation.

How Has This Been Tested?

@sdbondi sdbondi force-pushed the core-mempool-remove-rejected-block-txns branch from 3c1dddb to 4ec059f Compare July 14, 2022 05:30
@SWvheerden
Copy link
Collaborator

Why are even getting this?
Why would a transaction fail transaction validation but not block validation?
Surely the problem lies in the disconnect between the two?

@sdbondi
Copy link
Member Author

sdbondi commented Jul 14, 2022

@SWvheerden this change only applies to transactions already in the mempool (transactions validation passes) but block validation of a locally mined block fails. A failsafe, which kicks in to prevent the chain from stalling likely from some validation edge case that is not handled. In general, this should never happen (failsafe).

@SWvheerden
Copy link
Collaborator

Well, that's exactly kinda the point it's suppressing a potential vulnerability in the validation.
I would rather stop the testnet chain, than let an unknown validation bug go through to mainnet.

If a transaction fails block validation but passes mempool validation, we have a bug in validation or block construction. It's very important we fix those rather, especially edge cases.

@sdbondi
Copy link
Member Author

sdbondi commented Jul 14, 2022

Of course, you are right about fixing the issue. It's not "suppressing" anything though, just handing the case locally for the miner, instead of falling over and over - a miner may choose not to include transactions if it so wishes.

For sure, alarm bells should go off in this case, and nothing prevents you/the system/monitoring from recognising this case and raising them. In the meantime, the chain can progress.

@aviator-app aviator-app bot merged commit 15f41b3 into tari-project:development Jul 20, 2022
@sdbondi sdbondi deleted the core-mempool-remove-rejected-block-txns branch July 20, 2022 11:37
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.

None yet

3 participants