From c689ad3d8114eff88bc646d9b200c71f6e14f436 Mon Sep 17 00:00:00 2001 From: JesseAbram <33698952+JesseAbram@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:29:56 -0500 Subject: [PATCH] Allow multiple oracle inputs (#94) --- examples/barebones-with-auxilary/src/lib.rs | 2 +- examples/barebones/src/lib.rs | 2 +- examples/basic-transaction/src/lib.rs | 2 +- examples/custom-hash/src/lib.rs | 2 +- examples/device-key-proxy/src/lib.rs | 2 +- examples/infinite-loop/src/lib.rs | 2 +- examples/private-acl/src/lib.rs | 2 +- examples/risczero-zkvm-verification/src/lib.rs | 2 +- examples/siwe/src/lib.rs | 2 +- runtime/src/lib.rs | 2 +- templates/basic-template/src/lib.rs | 2 +- wit/application.wit | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/barebones-with-auxilary/src/lib.rs b/examples/barebones-with-auxilary/src/lib.rs index 95b644d..13356ff 100644 --- a/examples/barebones-with-auxilary/src/lib.rs +++ b/examples/barebones-with-auxilary/src/lib.rs @@ -31,7 +31,7 @@ impl Program for BarebonesWithAuxilary { fn evaluate( signature_request: SignatureRequest, _config: Option>, - _oracle_data: Option>, + _oracle_data: Option>>, ) -> Result<(), Error> { let SignatureRequest { message, diff --git a/examples/barebones/src/lib.rs b/examples/barebones/src/lib.rs index 4d0d757..2692d79 100644 --- a/examples/barebones/src/lib.rs +++ b/examples/barebones/src/lib.rs @@ -29,7 +29,7 @@ impl Program for BarebonesProgram { fn evaluate( signature_request: SignatureRequest, _config: Option>, - _oracle_data: Option>, + _oracle_data: Option>>, ) -> Result<(), Error> { let message: Vec = signature_request.message; diff --git a/examples/basic-transaction/src/lib.rs b/examples/basic-transaction/src/lib.rs index 54a98b7..02c4fdd 100644 --- a/examples/basic-transaction/src/lib.rs +++ b/examples/basic-transaction/src/lib.rs @@ -40,7 +40,7 @@ impl Program for BasicTransaction { fn evaluate( signature_request: SignatureRequest, config: Option>, - _oracle_data: Option>, + _oracle_data: Option>>, ) -> Result<(), CoreError> { // parse the raw tx into some type supported by the Acl check let parsed_tx = ::TransactionRequest::try_parse( diff --git a/examples/custom-hash/src/lib.rs b/examples/custom-hash/src/lib.rs index 799d1a3..1c25fb0 100644 --- a/examples/custom-hash/src/lib.rs +++ b/examples/custom-hash/src/lib.rs @@ -30,7 +30,7 @@ impl Program for CustomHashExample { fn evaluate( signature_request: SignatureRequest, _config: Option>, - _oracle_data: Option>, + _oracle_data: Option>>, ) -> Result<(), Error> { if signature_request.message.len() < 1 { return Err(Error::Evaluation( diff --git a/examples/device-key-proxy/src/lib.rs b/examples/device-key-proxy/src/lib.rs index a3d1062..1edf4eb 100644 --- a/examples/device-key-proxy/src/lib.rs +++ b/examples/device-key-proxy/src/lib.rs @@ -250,7 +250,7 @@ impl Program for DeviceKeyProxy { fn evaluate( signature_request: SignatureRequest, raw_config: Option>, - _oracle_data: Option>, + _oracle_data: Option>>, ) -> Result<(), Error> { let config_json = serde_json::from_slice::( raw_config diff --git a/examples/infinite-loop/src/lib.rs b/examples/infinite-loop/src/lib.rs index b67ce6a..ece8ff4 100644 --- a/examples/infinite-loop/src/lib.rs +++ b/examples/infinite-loop/src/lib.rs @@ -27,7 +27,7 @@ impl Program for InfiniteLoop { fn evaluate( _signature_request: SignatureRequest, _config: Option>, - _oracle_data: Option>, + _oracle_data: Option>>, ) -> Result<(), Error> { loop {} #[allow(unreachable_code)] diff --git a/examples/private-acl/src/lib.rs b/examples/private-acl/src/lib.rs index adbd20b..e6fbad7 100644 --- a/examples/private-acl/src/lib.rs +++ b/examples/private-acl/src/lib.rs @@ -38,7 +38,7 @@ impl Program for PrivateTransactionAcl { fn evaluate( signature_request: SignatureRequest, _config: Option>, - _oracle_data: Option>, + _oracle_data: Option>>, ) -> Result<(), CoreError> { // parse the raw tx into some type let parsed_tx = ::TransactionRequest::try_parse( diff --git a/examples/risczero-zkvm-verification/src/lib.rs b/examples/risczero-zkvm-verification/src/lib.rs index 5c805e8..6bcce36 100644 --- a/examples/risczero-zkvm-verification/src/lib.rs +++ b/examples/risczero-zkvm-verification/src/lib.rs @@ -17,7 +17,7 @@ register_custom_getrandom!(always_fail); pub struct ZkVmVerificationProgram; impl Program for ZkVmVerificationProgram { - fn evaluate(signature_request: SignatureRequest, _config: Option>, _oracle_data: Option>) -> Result<(), Error> { + fn evaluate(signature_request: SignatureRequest, _config: Option>, _oracle_data: Option>>) -> Result<(), Error> { let image_id: [u32; 8] = bincode::deserialize(&signature_request.message) .map_err(|_| Error::InvalidSignatureRequest("Could not parse image_id".to_string()))?; diff --git a/examples/siwe/src/lib.rs b/examples/siwe/src/lib.rs index d1abce1..79463a6 100644 --- a/examples/siwe/src/lib.rs +++ b/examples/siwe/src/lib.rs @@ -38,7 +38,7 @@ impl Program for Siwe { fn evaluate( signature_request: SignatureRequest, _config: Option>, - _oracle_data: Option>, + _oracle_data: Option>>, ) -> Result<(), Error> { let string_message = String::from_utf8(signature_request.message) .map_err(|err| Error::Evaluation(err.to_string()))?; diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index e1d3194..98d3fe8 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -85,7 +85,7 @@ impl Runtime { program: &[u8], signature_request: &SignatureRequest, config: Option<&[u8]>, - oracle_data: Option<&[u8]>, + oracle_data: Option<&[Vec]>, ) -> Result<(), RuntimeError> { if program.len() == 0 { return Err(RuntimeError::EmptyBytecode); diff --git a/templates/basic-template/src/lib.rs b/templates/basic-template/src/lib.rs index 217b067..77df903 100644 --- a/templates/basic-template/src/lib.rs +++ b/templates/basic-template/src/lib.rs @@ -33,7 +33,7 @@ impl Program for {{project-name | upper_camel_case}} { fn evaluate( signature_request: SignatureRequest, _config: Option>, - _oracle_data: Option>, + _oracle_data: Option>>, ) -> Result<(), Error> { if signature_request.message.is_empty() { return Err(Error::Evaluation( diff --git a/wit/application.wit b/wit/application.wit index bfdf9ec..fd26ac1 100644 --- a/wit/application.wit +++ b/wit/application.wit @@ -8,7 +8,7 @@ world program { evaluation(string) } /// Evaluates the program given the user's signature request and the program's configuration. - export evaluate: func(signature-request: signature-request, config: option>, oracle-data: option>) -> result<_, error> + export evaluate: func(signature-request: signature-request, config: option>, oracle-data: option>>) -> result<_, error> /// Programs that use custom hash functions can a custom 32-byte curve point to be signed. export custom-hash: func(data: list) -> option>