snarkVM icon indicating copy to clipboard operation
snarkVM copied to clipboard

Don't verify transactions twice

Open ljedrz opened this issue 3 years ago • 2 comments

When running Ledger::add_next_block, the transactions are currently verified twice:

  • in Ledger::check_next_block (called at vm/compiler/src/ledger/mod.rs:508)
  • in VM::finalize (called at vm/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.

ljedrz avatar Aug 19 '22 11:08 ljedrz

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.

ljedrz avatar Aug 19 '22 11:08 ljedrz

Cc https://github.com/AleoHQ/snarkVM/issues/986

ljedrz avatar Aug 19 '22 12:08 ljedrz

This has been fixed in testnet3.2.

howardwu avatar Nov 03 '22 05:11 howardwu