mimblewimble / grin

Minimal implementation of the Mimblewimble protocol.
https://grin.mw/
Apache License 2.0
5.04k stars 991 forks source link

missing verify_weight on transaction #1341

Closed antiochp closed 6 years ago

antiochp commented 6 years ago

We have a verify_weight() on block but no corresponding rule on transactions. We could build a "valid" transaction that would push a block over its weight limit, the tx would in effect be un-mineable.

Related: #1327.

Proposal: add a verify_weight() to transaction that matches the existing block validation rule. We may need to take coinbase outputs and kernels into account when getting these rules to align correctly.

Also: revisit the input|output|kernel vec size limits on both blocks and transactions in the context of the verify_weight() rule. These should all be reasonably consistent with each other (no point having large size limits if the overall weight is in violation).

Do we even need size limits if we have a higher level weight limit? Might make sense to have two layers of checks here, so probably?

hashmap commented 6 years ago

Now we have it https://github.com/mimblewimble/grin/blob/master/core/src/core/transaction.rs#L499 it is also checked in read. And we switched from size validation to weight validation only.

antiochp commented 6 years ago

:+1: