TritonVM / tasm-lib

A collection of functions written in Triton VM assembly (tasm)
Apache License 2.0
11 stars 2 forks source link

Feature Request: derive proc_macro for automatically generating associated Tasm snippets for struct #45

Open aszepieniec opened 1 year ago

aszepieniec commented 1 year ago

Suppose we have a struct

#[derive(BFieldCodec)]
pub struct StructuredWitness {
    pub field : Type,
    pub meadow: Kind,
}

that we use inside of a program that is written in rust and that needs to be converted to Tasm. The rust code can just dot its way into the right fields to access them. But the encoding of this object is passed to the VM's secret input as a list of BFieldElements. We then need to manually implement getters for every field in Tasm. It would be nice to automatically derive the getters in Tasm from a proc_macro derive

#[derive(BFieldCodec, TasmObject)]

which, for example, adds methods