snarkVM
snarkVM copied to clipboard
Don't verify transactions twice
When running Ledger::add_next_block, the transactions are currently verified twice:
- in
Ledger::check_next_block(called atvm/compiler/src/ledger/mod.rs:508) - in
VM::finalize(called atvm/compiler/src/ledger/mod.rs:556)
Since this isn't a fast operation, we should only be doing it once, likely just in Ledger::check_next_block.
If extra safety is desired, we should instead use types, e.g. introduce a VerifiedBlock and/or a VerifiedTransaction that have the same contents as their unverified counterparts and are returned by e.g. Ledger::check_next_block (or, alternatively introduce some Verified<T> wrapper struct). They would later used by methods that require verified input, and thus don't need to verify it on their own anymore.
Cc https://github.com/AleoHQ/snarkVM/issues/986
This has been fixed in testnet3.2.