Skip to content

Commit

Permalink
Feature: deserialize AIR private input
Browse files Browse the repository at this point in the history
Added an implementation of `From<AirPrivateInputSerializable>` for
AirPrivateInput.
  • Loading branch information
odesenfans committed Jan 19, 2024
1 parent 0e0f868 commit e0f3574
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions vm/src/air_private_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,20 @@ impl AirPrivateInput {
}
}

impl From<AirPrivateInputSerializable> for AirPrivateInput {
fn from(private_input: AirPrivateInputSerializable) -> Self {
Self(HashMap::from([
("pedersen", private_input.pedersen),
("range_check", private_input.range_check),
("ecdsa", private_input.ecdsa),
("bitwise", private_input.bitwise),
("ec_op", private_input.ec_op),
("keccak", private_input.keccak),
("poseidon", private_input.poseidon),
]))
}
}

impl AirPrivateInputSerializable {
pub fn serialize_json(&self) -> Result<String, serde_json::Error> {
serde_json::to_string_pretty(&self)
Expand Down

0 comments on commit e0f3574

Please sign in to comment.