Acir
Add blake2s and pedersen as opcodes
pub enum OPCODE {
AES,
SHA256,
+ Blake2s,
MerkleRoot,
MerkleMembership,
SchnorrVerify,
+ Pedersen,
}
impl std::fmt::Display for OPCODE {
@@ -21,6 +23,8 @@ impl OPCODE{
OPCODE::MerkleRoot => 2,
OPCODE::MerkleMembership => 3,
OPCODE::SchnorrVerify => 4,
+ OPCODE::Blake2s => 5,
+ OPCODE::Pedersen => 6,
}
}
pub fn name(&self) -> &str {
@@ -29,7 +33,9 @@ impl OPCODE{
OPCODE::SHA256 => "sha256",
OPCODE::MerkleRoot => "merkle_root",
OPCODE::MerkleMembership => "merkle_membership",
- OPCODE::SchnorrVerify => "schnorr_verify"
+ OPCODE::SchnorrVerify => "schnorr_verify",
+ OPCODE::Blake2s => "blake2s",
+ OPCODE::Pedersen => "pedersen"
}
}
pub fn lookup(op_name : &str) -> Option<OPCODE> {
@@ -38,6 +44,8 @@ impl OPCODE{
"merkle_root" => Some(OPCODE::MerkleRoot),
"merkle_membership" => Some(OPCODE::MerkleMembership),
"schnorr_verify" => Some(OPCODE::SchnorrVerify),
+ "blake2s" => Some(OPCODE::Blake2s),
+ "pedersen" => Some(OPCODE::Pedersen),
_=> None,
}
}
@@ -52,6 +60,11 @@ impl OPCODE{
input_size : InputSize::Variable,
output_size: OutputSize(2),
},
+ OPCODE::Blake2s => GadgetDefinition {
+ name : self.name().into(),
+ input_size : InputSize::Variable,
+ output_size: OutputSize(2),
+ },
OPCODE::MerkleRoot => GadgetDefinition {
name : self.name().into(),
input_size : InputSize::Variable,
@@ -69,6 +82,11 @@ impl OPCODE{
input_size : InputSize::Variable,
output_size: OutputSize(1),
},
+ OPCODE::Pedersen => GadgetDefinition {
+ name : self.name().into(),
+ input_size : InputSize::Variable,
+ output_size: OutputSize(1),
+ },
}
}
}
