noir-lang/noir

Audit preparedness: listing key cases

Closed this issue · 0 comments

Problem

  • List ACIR opcodes
  • List black-box functions
  • List acir-gen cases
  • List SSA passes
  • List monomorphizer key cases

Assorted TODO's:

  • Make dummy-ID for (monomorphizer) FuncId (other than 0)
  • Make monomorphizer AST's Program::take_function_body error when called twice on the same function (FuncId)

List

pub enum Opcode<F> {
  • AssertZero
  • BlackBoxFuncCall
  • Directive
  • MemoryOp
  • MemoryInit
  • BrilligCall
  • Call
pub enum Directive<F> {
  • ToLeRadix
pub enum BlackBoxFunc {
  • AES128Encrypt
  • AND
  • XOR
  • RANGE
  • SHA256
  • Blake2s
  • Blake3
  • SchnorrVerify
  • PedersenCommitment
  • PedersenHash
  • EcdsaSecp256k1
  • EcdsaSecp256r1
  • MultiScalarMul
  • Keccak256
  • Keccakf1600
  • RecursiveAggregation
  • EmbeddedCurveAdd
  • BigIntAdd
  • BigIntSub
  • BigIntMul
  • BigIntDiv
  • BigIntFromLeBytes
  • BigIntToLeBytes
  • Poseidon2Permutation
  • Sha256Compression

acir-gen Cases:

  • Ssa::into_acir(self, brillig: &Brillig)
  • convert_acir_main
  • convert_brillig_main
  • convert_ssa_block_params (test against behavior from docstring)
  • add_numeric_input_var (check range constraint)
  • handle_constant_index (ensure equivalent to when not used / slow-version of adding a constant, constraining to equivalent with var, etc. see docstring)
  • handle_array_operation get/set
  • convert_array_operation_inputs (test with a couple types of nesting / included tuples/struct-types)
  • array_get / array_set (get gets last set value)
  • array_get_value / array_set_value (get gets last set value)
  • init_element_type_sizes_array (check_array_is_initialized on result)
  • copy_dynamic_array (check_array_is_initialized on result)
  • initialize_array (check_array_is_initialized on result)
  • flattened_slice_size / flattened_value_size (various nesting)
  • convert_ssa_binary (test expected operation occurs)
  • check_unsigned_overflow (1. test key successful/failing cases, 2. ensure non-tested operations cannot exceed size) ((consider adding a bool argument to unconditionally range-constrain var, then test that both versions are equivalent))
  • type_of_binary_operation (see docstring for cases)
  • convert_ssa_intrinsic_call
  • array_element_type (test docstring properties)

SSA Passes:

  • Ssa::defunctionalize
  • Ssa::remove_paired_rc
  • Ssa::separate_runtime
  • Ssa::resolve_is_unconstrained
  • Ssa::inline_functions
  • Ssa::mem2reg
  • Ssa::as_slice_optimization
  • Ssa::evaluate_static_assert_and_assert_constant
  • Ssa::unroll_loops_iteratively
  • Ssa::simplify_cfg
  • Ssa::flatten_cfg
  • Ssa::remove_bit_shifts
  • Ssa::mem2reg
  • Ssa::inline_functions_with_no_predicates
  • Ssa::remove_if_else
  • Ssa::fold_constants
  • Ssa::remove_enable_side_effects
  • Ssa::fold_constants_using_constraints
  • Ssa::dead_instruction_elimination
  • Ssa::array_set_optimization

Monomorphizer:

  • constructor
  • unpack_pattern / unpack_tuple_pattern (ensure they convert key examples to expected accesses)
  • resolve_trait_method_reference (ensure it handles assumed traits)
  • function_call
  • try_evaluate_call
  • try_evaluate_call: "modulus_num_bits"
  • try_evaluate_call: "zeroed"
  • try_evaluate_call: "modulus_le_bits"
  • try_evaluate_call: "modulus_be_bits"
  • try_evaluate_call: "modulus_be_bytes"
  • try_evaluate_call: "modulus_le_bytes"
  • lambda_with_setup (test key cases of zero/trivial/two-var env, as well as 2-3 lambdas in a row / nested)
  • zeroed_value_of_type
  • create_zeroed_function (ensure it behaves as described in docstring)
  • perform_instantiation_bindings
  • undo_instantiation_bindings (ensure it reverses the effect of perform_instantiation_bindings)

Happy Case

Add the list to the next issue: #5361

Project Impact

None

Impact Context

No response

Workaround

None

Workaround Description

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response