Skip to content

Commit

Permalink
Allow multiple oracle inputs (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseAbram authored Nov 12, 2024
1 parent 95eeb23 commit c689ad3
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/barebones-with-auxilary/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Program for BarebonesWithAuxilary {
fn evaluate(
signature_request: SignatureRequest,
_config: Option<Vec<u8>>,
_oracle_data: Option<Vec<u8>>,
_oracle_data: Option<Vec<Vec<u8>>>,
) -> Result<(), Error> {
let SignatureRequest {
message,
Expand Down
2 changes: 1 addition & 1 deletion examples/barebones/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl Program for BarebonesProgram {
fn evaluate(
signature_request: SignatureRequest,
_config: Option<Vec<u8>>,
_oracle_data: Option<Vec<u8>>,
_oracle_data: Option<Vec<Vec<u8>>>,
) -> Result<(), Error> {
let message: Vec<u8> = signature_request.message;

Expand Down
2 changes: 1 addition & 1 deletion examples/basic-transaction/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl Program for BasicTransaction {
fn evaluate(
signature_request: SignatureRequest,
config: Option<Vec<u8>>,
_oracle_data: Option<Vec<u8>>,
_oracle_data: Option<Vec<Vec<u8>>>,
) -> Result<(), CoreError> {
// parse the raw tx into some type supported by the Acl check
let parsed_tx = <Evm as Architecture>::TransactionRequest::try_parse(
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-hash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Program for CustomHashExample {
fn evaluate(
signature_request: SignatureRequest,
_config: Option<Vec<u8>>,
_oracle_data: Option<Vec<u8>>,
_oracle_data: Option<Vec<Vec<u8>>>,
) -> Result<(), Error> {
if signature_request.message.len() < 1 {
return Err(Error::Evaluation(
Expand Down
2 changes: 1 addition & 1 deletion examples/device-key-proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ impl Program for DeviceKeyProxy {
fn evaluate(
signature_request: SignatureRequest,
raw_config: Option<Vec<u8>>,
_oracle_data: Option<Vec<u8>>,
_oracle_data: Option<Vec<Vec<u8>>>,
) -> Result<(), Error> {
let config_json = serde_json::from_slice::<UserConfig>(
raw_config
Expand Down
2 changes: 1 addition & 1 deletion examples/infinite-loop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Program for InfiniteLoop {
fn evaluate(
_signature_request: SignatureRequest,
_config: Option<Vec<u8>>,
_oracle_data: Option<Vec<u8>>,
_oracle_data: Option<Vec<Vec<u8>>>,
) -> Result<(), Error> {
loop {}
#[allow(unreachable_code)]
Expand Down
2 changes: 1 addition & 1 deletion examples/private-acl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Program for PrivateTransactionAcl {
fn evaluate(
signature_request: SignatureRequest,
_config: Option<Vec<u8>>,
_oracle_data: Option<Vec<u8>>,
_oracle_data: Option<Vec<Vec<u8>>>,
) -> Result<(), CoreError> {
// parse the raw tx into some type
let parsed_tx = <Evm as Architecture>::TransactionRequest::try_parse(
Expand Down
2 changes: 1 addition & 1 deletion examples/risczero-zkvm-verification/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ register_custom_getrandom!(always_fail);
pub struct ZkVmVerificationProgram;

impl Program for ZkVmVerificationProgram {
fn evaluate(signature_request: SignatureRequest, _config: Option<Vec<u8>>, _oracle_data: Option<Vec<u8>>) -> Result<(), Error> {
fn evaluate(signature_request: SignatureRequest, _config: Option<Vec<u8>>, _oracle_data: Option<Vec<Vec<u8>>>) -> Result<(), Error> {
let image_id: [u32; 8] = bincode::deserialize(&signature_request.message)
.map_err(|_| Error::InvalidSignatureRequest("Could not parse image_id".to_string()))?;

Expand Down
2 changes: 1 addition & 1 deletion examples/siwe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Program for Siwe {
fn evaluate(
signature_request: SignatureRequest,
_config: Option<Vec<u8>>,
_oracle_data: Option<Vec<u8>>,
_oracle_data: Option<Vec<Vec<u8>>>,
) -> Result<(), Error> {
let string_message = String::from_utf8(signature_request.message)
.map_err(|err| Error::Evaluation(err.to_string()))?;
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl Runtime {
program: &[u8],
signature_request: &SignatureRequest,
config: Option<&[u8]>,
oracle_data: Option<&[u8]>,
oracle_data: Option<&[Vec<u8>]>,
) -> Result<(), RuntimeError> {
if program.len() == 0 {
return Err(RuntimeError::EmptyBytecode);
Expand Down
2 changes: 1 addition & 1 deletion templates/basic-template/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl Program for {{project-name | upper_camel_case}} {
fn evaluate(
signature_request: SignatureRequest,
_config: Option<Vec<u8>>,
_oracle_data: Option<Vec<u8>>,
_oracle_data: Option<Vec<Vec<u8>>>,
) -> Result<(), Error> {
if signature_request.message.is_empty() {
return Err(Error::Evaluation(
Expand Down
2 changes: 1 addition & 1 deletion wit/application.wit
Original file line number Diff line number Diff line change
Expand Up @@ -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<list<u8>>, oracle-data: option<list<u8>>) -> result<_, error>
export evaluate: func(signature-request: signature-request, config: option<list<u8>>, oracle-data: option<list<list<u8>>>) -> result<_, error>

/// Programs that use custom hash functions can a custom 32-byte curve point to be signed.
export custom-hash: func(data: list<u8>) -> option<list<u8>>
Expand Down

0 comments on commit c689ad3

Please sign in to comment.