entropyxyz/programs

Implement default custom hashing to return None

jakehemmerle opened this issue · 0 comments

Note, this first requires a refactor in the .wit file

Currently, every program (and every example) not using custom hashes still needs to implement custom_hash and return None. Ideally, we should be able to implement this with a derive procedural macro.

To do this, we should start with rewriting wit/application.wit to generate multiple worlds or something to change custom-hash implementation from

pub struct XYZProgram;

impl Program for XYZProgram {
   fn evaluate ...{
      ...
   }
   fn custom_hash... {
      ...
   }
}

to

pub struct XYZProgram;

impl Program for XYZProgram {
   fn evaluate ...{
      ...
   }
}

impl CustomHash for XYZProgram {
   fn custom_hash... {
      ...
   }
}

which in turn can be simplified to something like

#[derive(NoCustomHash]
pub struct XYZProgram;

impl Program for XYZ Program {
   fn evaluate ...{
      ...
   }
}