From 4ddb8bbf1b73a8717da3543ba3e00fcf1205b5f0 Mon Sep 17 00:00:00 2001 From: Olivier Desenfans Date: Fri, 19 Jan 2024 10:54:09 +0100 Subject: [PATCH] Feature: deserialize AIR private input Added an implementation of `From` for AirPrivateInput. --- vm/src/air_private_input.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/vm/src/air_private_input.rs b/vm/src/air_private_input.rs index 4ea30d0d44..9b8154d700 100644 --- a/vm/src/air_private_input.rs +++ b/vm/src/air_private_input.rs @@ -135,6 +135,20 @@ impl AirPrivateInput { } } +impl From for AirPrivateInput { + fn from(private_input: AirPrivateInputSerializable) -> Self { + Self(HashMap::from([ + (HASH_BUILTIN_NAME, private_input.pedersen), + (RANGE_CHECK_BUILTIN_NAME, private_input.range_check), + (SIGNATURE_BUILTIN_NAME, private_input.ecdsa), + (BITWISE_BUILTIN_NAME, private_input.bitwise), + (EC_OP_BUILTIN_NAME, private_input.ec_op), + (KECCAK_BUILTIN_NAME, private_input.keccak), + (POSEIDON_BUILTIN_NAME, private_input.poseidon), + ])) + } +} + impl AirPrivateInputSerializable { pub fn serialize_json(&self) -> Result { serde_json::to_string_pretty(&self)