Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple oracle inputs #94

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>]>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since all other arguments use &[u8] instead of Vec<u8> i guess maybe we should do that here. I'm not sure it makes any difference to the caller since its inside a reference to an array. So probably can leave it as it is.

) -> 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
Loading