Skip to content

Commit

Permalink
fix error leftover from working on the guest interface
Browse files Browse the repository at this point in the history
  • Loading branch information
nategraf committed Feb 6, 2024
1 parent 7bcdd36 commit da00d5d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cli/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -53,7 +53,7 @@ impl GuestInterface for EvenNumberInterface {
seal: Vec<u8>,
) -> Result<Vec<u8>> {
// 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 {
Expand Down
8 changes: 3 additions & 5 deletions sdk/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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))?;
Expand Down
5 changes: 3 additions & 2 deletions sdk/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit da00d5d

Please sign in to comment.