AleoNet / snarkOS

A Decentralized Operating System for ZK Applications
http://snarkos.org
Apache License 2.0
4.31k stars 2.62k forks source link

[Feature] Check transaction size limit in codec #3229

Closed niklaslong closed 5 months ago

niklaslong commented 5 months ago

Enforces the MAX_TRANSACTION_SIZE on the decode half of the router codec for unconfirmed transactions. See https://github.com/AleoHQ/snarkVM/pull/2437#discussion_r1570512045 and the corresponding PR in VM: https://github.com/AleoHQ/snarkVM/pull/2438 for context.

I chose to avoid modifying the FromBytes and ToBytes trait implementation on Message for now and instead read the ID bytes twice to keep special casing simple but I'd be happy to implement a decode_le that takes in the ID as well.

Can be merged once the corresponding PRs in VM are in.

niklaslong commented 5 months ago

Note, I've split the lock file changes out of the first commit for easier rebasing (originally by @d0cd, lmk if you have an email I can credit you with in the new commit).

niklaslong commented 5 months ago

(Rebased)