provekit_acir 1.0.0-beta.11-alpha.2

ACIR is the IR that the VM processes, it is analogous to LLVM IR
Documentation
syntax = "proto3";

package acvm.acir.circuit;

import "acir/native.proto";

message Circuit {
  uint32 current_witness_index = 1;
  repeated Opcode opcodes = 2;
  ExpressionWidth expression_width = 3;
  repeated native.Witness private_parameters = 4;
  repeated native.Witness public_parameters = 5;
  repeated native.Witness return_values = 6;
  repeated AssertMessage assert_messages = 7;
}

message ExpressionWidth {
  oneof value {
    Unbounded unbounded = 1;
    Bounded bounded = 2;
  }
  message Unbounded {}
  message Bounded { uint64 width = 1; }
}

message AssertMessage {
  OpcodeLocation location = 1;
  AssertionPayload payload = 2;
}

message OpcodeLocation {
  oneof value {
    uint64 acir = 1;
    BrilligLocation brillig = 2;
  }
  message BrilligLocation {
    uint64 acir_index = 1;
    uint64 brillig_index = 2;
  }
}

message AssertionPayload {
  uint64 error_selector = 1;
  repeated ExpressionOrMemory payload = 2;
}

message ExpressionOrMemory {
  oneof value {
    native.Expression expression = 1;
    uint32 memory = 2;
  }
}

message Opcode {
  oneof value {
    native.Expression assert_zero = 1;
    BlackBoxFuncCall blackbox_func_call = 2;
    MemoryOp memory_op = 3;
    MemoryInit memory_init = 4;
    BrilligCall brillig_call = 5;
    Call call = 6;
  }
  message MemoryOp {
    uint32 block_id = 1;
    MemOp op = 2;
    optional native.Expression predicate = 3;
  }
  message MemoryInit {
    uint32 block_id = 1;
    repeated native.Witness init = 2;
    BlockType block_type = 3;
  }
  message BrilligCall {
    uint32 id = 1;
    repeated BrilligInputs inputs = 2;
    repeated BrilligOutputs outputs = 3;
    optional native.Expression predicate = 4;
  }
  message Call {
    uint32 id = 1;
    repeated native.Witness inputs = 2;
    repeated native.Witness outputs = 3;
    optional native.Expression predicate = 4;
  }
}

message BlackBoxFuncCall {
  oneof value {
    AES128Encrypt aes128_encrypt = 1;
    AND and = 2;
    XOR xor = 3;
    RANGE range = 4;
    Blake2s blake2s = 5;
    Blake3 blake3 = 6;
    EcdsaSecp256k1 ecdsa_secp256k1 = 7;
    EcdsaSecp256r1 ecdsa_secp256r1 = 8;
    MultiScalarMul multi_scalar_mul = 9;
    EmbeddedCurveAdd embedded_curve_add = 10;
    Keccakf1600 keccak_f1600 = 11;
    RecursiveAggregation recursive_aggregation = 12;
    BigIntAdd big_int_add = 13;
    BigIntSub big_int_sub = 14;
    BigIntMul big_int_mul = 15;
    BigIntDiv big_int_div = 16;
    BigIntFromLeBytes big_int_from_le_bytes = 17;
    BigIntToLeBytes big_int_to_le_bytes = 18;
    Poseidon2Permutation poseidon2_permutation = 19;
    Sha256Compression sha256_compression = 20;
  }
  message AES128Encrypt {
    repeated FunctionInput inputs = 1;
    repeated FunctionInput iv = 2;
    repeated FunctionInput key = 3;
    repeated native.Witness outputs = 4;
  }
  message AND {
    FunctionInput lhs = 1;
    FunctionInput rhs = 2;
    native.Witness output = 3;
  }
  message XOR {
    FunctionInput lhs = 1;
    FunctionInput rhs = 2;
    native.Witness output = 3;
  }
  message RANGE { FunctionInput input = 1; }
  message Blake2s {
    repeated FunctionInput inputs = 1;
    repeated native.Witness outputs = 2;
  }
  message Blake3 {
    repeated FunctionInput inputs = 1;
    repeated native.Witness outputs = 2;
  }
  message EcdsaSecp256k1 {
    repeated FunctionInput public_key_x = 1;
    repeated FunctionInput public_key_y = 2;
    repeated FunctionInput signature = 3;
    repeated FunctionInput hashed_message = 4;
    native.Witness output = 5;
  }
  message EcdsaSecp256r1 {
    repeated FunctionInput public_key_x = 1;
    repeated FunctionInput public_key_y = 2;
    repeated FunctionInput signature = 3;
    repeated FunctionInput hashed_message = 4;
    native.Witness output = 5;
  }
  message MultiScalarMul {
    repeated FunctionInput points = 1;
    repeated FunctionInput scalars = 2;
    repeated native.Witness outputs = 3;
  }
  message EmbeddedCurveAdd {
    repeated FunctionInput input1 = 1;
    repeated FunctionInput input2 = 2;
    repeated native.Witness outputs = 3;
  }
  message Keccakf1600 {
    repeated FunctionInput inputs = 1;
    repeated native.Witness outputs = 2;
  }
  message RecursiveAggregation {
    repeated FunctionInput verification_key = 1;
    repeated FunctionInput proof = 2;
    repeated FunctionInput public_inputs = 3;
    FunctionInput key_hash = 4;
    uint32 proof_type = 5;
  }
  message BigIntAdd {
    uint32 lhs = 1;
    uint32 rhs = 2;
    uint32 output = 3;
  }
  message BigIntSub {
    uint32 lhs = 1;
    uint32 rhs = 2;
    uint32 output = 3;
  }
  message BigIntMul {
    uint32 lhs = 1;
    uint32 rhs = 2;
    uint32 output = 3;
  }
  message BigIntDiv {
    uint32 lhs = 1;
    uint32 rhs = 2;
    uint32 output = 3;
  }
  message BigIntFromLeBytes {
    repeated FunctionInput inputs = 1;
    bytes modulus = 2;
    uint32 output = 3;
  }
  message BigIntToLeBytes {
    uint32 input = 1;
    repeated native.Witness outputs = 2;
  }
  message Poseidon2Permutation {
    repeated FunctionInput inputs = 1;
    repeated native.Witness outputs = 2;
    uint32 len = 3;
  }
  message Sha256Compression {
    repeated FunctionInput inputs = 1;
    repeated FunctionInput hash_values = 2;
    repeated native.Witness outputs = 3;
  }
}

message FunctionInput {
  ConstantOrWitnessEnum input = 1;
  uint32 num_bits = 2;
}

message ConstantOrWitnessEnum {
  oneof value {
    native.Field constant = 1;
    native.Witness witness = 2;
  }
}

message MemOp {
  native.Expression operation = 1;
  native.Expression index = 2;
  native.Expression value = 3;
}

message BlockType {
  oneof value {
    Memory memory = 1;
    CallData call_data = 2;
    ReturnData return_data = 3;
  }
  message Memory {}
  message CallData { uint32 value = 1; }
  message ReturnData {}
}

message BrilligInputs {
  oneof value {
    native.Expression single = 1;
    Array array = 2;
    uint32 memory_array = 3;
  }
  message Array { repeated native.Expression values = 2; }
}

message BrilligOutputs {
  oneof value {
    native.Witness simple = 1;
    Array array = 2;
  }
  message Array { repeated native.Witness values = 1; }
}