snarkVM icon indicating copy to clipboard operation
snarkVM copied to clipboard

[Refactor] bytecode `evaluate` and tests

Open howardwu opened this issue 3 years ago • 0 comments

🚀 Refactor

  1. The Instruction struct’s enum match cases should get turned into a macro (see match_count!) for an example there is a corner case for the indices (see the ToBytes & FromBytes impls): one needs to specify the index #, which can be done using a vec![] and getting its .len() in each iteration while pushing one new random thing to the vec

  2. The instruction tests are a little weak and verbose, we should consider redesigning it to optimize for two things: a. ensure the output matches against the circuit outputs direct (so no need to snapshot outputs like hashes and such) b. create snapshots of outputs of increasing complexity for each instruction (using expect_test, see the native Poseidon impl tests for example)

howardwu avatar May 13 '22 23:05 howardwu