add the protobuf files from the iden3 repo for reference

This commit is contained in:
Balazs Komuves 2025-03-13 17:56:06 +01:00
parent de29a073da
commit 53582a45e4
No known key found for this signature in database
GPG Key ID: F63B7AEF18435562
3 changed files with 143 additions and 0 deletions

4
protos/README.md Normal file
View File

@ -0,0 +1,4 @@
These protobuf definitions are taken from
the [`circom-witnesscalc`](https://github.com/iden3/circom-witnesscalc/tree/main/protos)
repository

85
protos/messages.proto Normal file
View File

@ -0,0 +1,85 @@
syntax = "proto3";
package circom_witnesscalc.proto;
enum DuoOp {
Mul = 0;
Div = 1;
Add = 2;
Sub = 3;
Pow = 4;
Idiv = 5;
Mod = 6;
Eq = 7;
Neq = 8;
Lt = 9;
Gt = 10;
Leq = 11;
Geq = 12;
Land = 13;
Lor = 14;
Shl = 15;
Shr = 16;
Bor = 17;
Band = 18;
Bxor = 19;
}
enum UnoOp {
Neg = 0;
Id = 1;
}
enum TresOp {
TernCond = 0;
}
message BigUInt {
bytes valueLE = 1;
}
message InputNode {
uint32 idx = 1;
}
message ConstantNode {
BigUInt value = 1;
}
message UnoOpNode {
UnoOp op = 1;
uint32 aIdx = 2;
}
message DuoOpNode {
DuoOp op = 1;
uint32 aIdx = 2;
uint32 bIdx = 3;
}
message TresOpNode {
TresOp op = 1;
uint32 aIdx = 2;
uint32 bIdx = 3;
uint32 cIdx = 4;
}
message Node {
oneof node {
InputNode input = 1;
ConstantNode constant = 2;
UnoOpNode unoOp = 3;
DuoOpNode duoOp = 4;
TresOpNode tresOp = 5;
}
}
message SignalDescription {
uint32 offset = 1;
uint32 len = 2;
}
message GraphMetadata {
repeated uint32 witnessSignals = 1;
map<string, SignalDescription> inputs = 2;
}

54
protos/vm.proto Normal file
View File

@ -0,0 +1,54 @@
syntax = "proto3";
package circom_witnesscalc.proto.vm;
import "protos/messages.proto";
// Virtual Machine metadata
message VmMd {
uint32 main_template_id = 1;
uint32 templates_num = 2;
uint32 functions_num = 3;
uint32 signals_num = 4;
uint32 constants_num = 5;
map<string, SignalDescription> inputs = 9;
repeated uint32 witness_signals = 7;
map<uint32, IoDefs> io_map = 8;
}
message ComponentTmpl {
string symbol = 1;
uint64 sub_cmp_idx = 2;
uint64 number_of_cmp = 3;
string name_subcomponent = 4;
uint64 signal_offset = 5;
uint64 signal_offset_jump = 6;
uint64 template_id = 7;
bool has_inputs = 8;
}
message Template {
string name = 1;
bytes code = 2;
repeated uint64 line_numbers = 3;
repeated ComponentTmpl components = 4;
uint64 var_stack_depth = 5;
uint64 number_of_inputs = 6;
}
message Function {
string name = 1;
string symbol = 2;
bytes code = 3;
repeated uint64 line_numbers = 4;
}
message IoDef {
uint32 code = 1;
uint32 offset = 2;
repeated uint32 lengths = 3;
}
message IoDefs {
repeated IoDef io_defs = 1;
}