From da00d5d38b24201fbe5b55d74c3df25b1b892037 Mon Sep 17 00:00:00 2001 From: Victor Graf Date: Mon, 5 Feb 2024 17:15:34 -0800 Subject: [PATCH] fix error leftover from working on the guest interface --- cli/src/interface.rs | 4 ++-- sdk/src/cli.rs | 8 +++----- sdk/src/eth.rs | 5 +++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/cli/src/interface.rs b/cli/src/interface.rs index 6f2406e1..2ef3604c 100644 --- a/cli/src/interface.rs +++ b/cli/src/interface.rs @@ -16,7 +16,7 @@ use std::str::FromStr; use alloy_primitives::{FixedBytes, U256}; use alloy_sol_types::{sol, SolInterface, SolValue}; -use anyhow::Result; +use anyhow::{Context, Result}; use risc0_ethereum_sdk::cli::GuestInterface; // You can modify this file to implement the `GuestInterface` trait @@ -53,7 +53,7 @@ impl GuestInterface for EvenNumberInterface { seal: Vec, ) -> Result> { // Decode the journal. Must match what was written in the guest with `env::commit_slice` - let x = U256::abi_decode(&journal, true)?; + let x = U256::abi_decode(&journal, true).context("decoding journal data")?; // Encode the function call for `IEvenNumber.set(x)` Ok(IEvenNumber::IEvenNumberCalls::set(IEvenNumber::setCall { diff --git a/sdk/src/cli.rs b/sdk/src/cli.rs index 74371cf4..4ed8185b 100644 --- a/sdk/src/cli.rs +++ b/sdk/src/cli.rs @@ -103,6 +103,7 @@ pub fn query( // No input. Return the Ethereum ABI encoded bytes32 image ID. None => format!("0x{}", hex::encode(image_id)), }; + // Forge test FFI calls expect hex encoded bytes sent to stdout print!("{output}"); std::io::stdout() .flush() @@ -130,11 +131,8 @@ pub fn publish( post_state_digest, seal, } = prover::generate_proof(&elf, input)?; - let calldata = guest_interface.encode_calldata( - risc0_zkvm::serde::from_slice(journal.as_slice())?, - post_state_digest, - seal, - )?; + + let calldata = guest_interface.encode_calldata(journal, post_state_digest, seal)?; let runtime = tokio::runtime::Runtime::new()?; runtime.block_on(tx_sender.send(calldata))?; diff --git a/sdk/src/eth.rs b/sdk/src/eth.rs index 11eee9b6..ef5f1051 100644 --- a/sdk/src/eth.rs +++ b/sdk/src/eth.rs @@ -47,11 +47,12 @@ impl TxSender { .from(self.client.address()) .data(calldata); - eprintln!("Transaction request: {:?}", &tx); + // TODO: Add these back as proper log lines istead of print statements + //eprintln!("Transaction request: {:?}", &tx); let tx = self.client.send_transaction(tx, None).await?.await?; - eprintln!("Transaction receipt: {:?}", &tx); + //eprintln!("Transaction receipt: {:?}", &tx); Ok(tx) }