fix: transaction validation excess signature check #4314
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently, only the transaction validator checks the rules that a transaction kernel must have a unique excess signature. But it only checks the first signature in the transaction. Transactions can have more than one kernel.
This check is also not currently checked in block validation checks.
This means that if a block with a duplicate excess signature is submitted, it will fail with an LMDB::error(duplicate key) and not with a validation error, although this is a validation constraint as per RFC 120.
Motivation and Context
We need to check the kernel excess signature for uniqueness because this ensures that every kernel in the blockchain is unique. By enforcing this, we ensure that replay attacks are impossible as the same kernel cannot be added to the blockchain again.
The excess signature is also used as a key index for the lookup of the kernels.