diff --git a/Cargo.toml b/Cargo.toml index ffbd2d52..38d4373b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,15 +22,15 @@ risc0-zkp = { git = "https://github.com/risc0/risc0", branch = "main", default-f risc0-zkvm = { git = "https://github.com/risc0/risc0", branch = "main", default-features = false } # Alloy guest dependencies -alloy-consensus = { version = "0.2.1" } -alloy-primitives = { version = "0.7" } +alloy-consensus = { version = "0.3" } +alloy-primitives = { version = "0.8" } alloy-rlp = { version = "0.3.8" } alloy-rlp-derive = { version = "0.3.8" } -alloy-sol-types = { version = "0.7" } +alloy-sol-types = { version = "0.8" } # Alloy host dependencies -alloy = { version = "0.2.1" } -alloy-trie = { version = "0.4.0" } +alloy = { version = "0.3" } +alloy-trie = { version = "0.5" } # Beacon chain support beacon-api-client = { git = "https://github.com/ralexstokes/ethereum-consensus.git", rev = "cf3c404043230559660810bc0c9d6d5a8498d819" } @@ -42,7 +42,7 @@ clap = { version = "4.5", features = ["derive", "env"] } log = "0.4" nybbles = { version = "0.2.1" } once_cell = "1.19" -revm = { version = "13.0", default-features = false, features = ["std"] } +revm = { version = "14.0", default-features = false, features = ["std"] } serde = "1.0" serde_json = "1.0" sha2 = { version = "0.10" } diff --git a/examples/erc20-counter/Cargo.toml b/examples/erc20-counter/Cargo.toml index e1e37659..175d32e8 100644 --- a/examples/erc20-counter/Cargo.toml +++ b/examples/erc20-counter/Cargo.toml @@ -18,9 +18,9 @@ risc0-build = { git = "https://github.com/risc0/risc0", branch = "main", feature risc0-zkvm = { git = "https://github.com/risc0/risc0", branch = "main", default-features = false } risc0-zkp = { git = "https://github.com/risc0/risc0", branch = "main", default-features = false } -alloy = { version = "0.2.1", features = ["full"] } -alloy-primitives = { version = "0.7", features = ["rlp", "serde", "std"] } -alloy-sol-types = { version = "0.7" } +alloy = { version = "0.3", features = ["full"] } +alloy-primitives = { version = "0.8", features = ["rlp", "serde", "std"] } +alloy-sol-types = { version = "0.8" } anyhow = { version = "1.0.75" } bincode = { version = "1.3" } bytemuck = { version = "1.14" } diff --git a/examples/erc20-counter/methods/guest/Cargo.toml b/examples/erc20-counter/methods/guest/Cargo.toml index 395db206..4934e26e 100644 --- a/examples/erc20-counter/methods/guest/Cargo.toml +++ b/examples/erc20-counter/methods/guest/Cargo.toml @@ -10,11 +10,8 @@ path = "src/bin/balance_of.rs" [workspace] [dependencies] - -# Force the `compile-time-rng` feature, to prevent `getrandom` from being used. -ahash = { version = "0.8", default-features = false, features = ["compile-time-rng"] } -alloy-primitives = { version = "0.7" } -alloy-sol-types = { version = "0.7" } +alloy-primitives = { version = "0.8" } +alloy-sol-types = { version = "0.8" } risc0-steel = { path = "../../../../steel" } risc0-zkvm = { git = "https://github.com/risc0/risc0", branch = "main", default-features = false, features = ["std"] } diff --git a/examples/erc20/Cargo.toml b/examples/erc20/Cargo.toml index 4d7a1a1f..9001d7db 100644 --- a/examples/erc20/Cargo.toml +++ b/examples/erc20/Cargo.toml @@ -11,8 +11,8 @@ risc0-build = { git = "https://github.com/risc0/risc0", branch = "main" } risc0-zkvm = { git = "https://github.com/risc0/risc0", branch = "main", default-features = false } risc0-zkp = { git = "https://github.com/risc0/risc0", branch = "main", default-features = false } -alloy-primitives = { version = "0.7" } -alloy-sol-types = { version = "0.7" } +alloy-primitives = { version = "0.8" } +alloy-sol-types = { version = "0.8" } anyhow = "1.0" clap = { version = "4.5", features = ["derive", "env"] } erc20-methods = { path = "methods" } diff --git a/examples/erc20/host/Cargo.toml b/examples/erc20/host/Cargo.toml index 0f714f2e..3f207370 100644 --- a/examples/erc20/host/Cargo.toml +++ b/examples/erc20/host/Cargo.toml @@ -9,7 +9,7 @@ alloy-sol-types = { workspace = true } anyhow = { workspace = true } clap = { workspace = true } erc20-methods = { workspace = true } -risc0-steel = { path = "../../../steel", features = ["host"] } +risc0-steel = { workspace = true, features = ["host"] } risc0-zkvm = { workspace = true, features = ["client"] } tokio = { workspace = true } tracing-subscriber = { workspace = true } diff --git a/examples/erc20/methods/guest/Cargo.toml b/examples/erc20/methods/guest/Cargo.toml index 0054e9e6..a08d430f 100644 --- a/examples/erc20/methods/guest/Cargo.toml +++ b/examples/erc20/methods/guest/Cargo.toml @@ -6,11 +6,8 @@ edition = "2021" [workspace] [dependencies] - -# Force the `compile-time-rng` feature, to prevent `getrandom` from being used. -ahash = { version = "0.8", default-features = false, features = ["compile-time-rng"] } -alloy-primitives = { version = "0.7" } -alloy-sol-types = { version = "0.7" } +alloy-primitives = { version = "0.8" } +alloy-sol-types = { version = "0.8" } risc0-steel = { path = "../../../../steel" } risc0-zkvm = { git = "https://github.com/risc0/risc0", branch = "main", default-features = false, features = ["std"] } diff --git a/examples/token-stats/Cargo.toml b/examples/token-stats/Cargo.toml index 465c48e5..1b5af6c7 100644 --- a/examples/token-stats/Cargo.toml +++ b/examples/token-stats/Cargo.toml @@ -11,16 +11,15 @@ risc0-build = { git = "https://github.com/risc0/risc0", branch = "main" } risc0-zkvm = { git = "https://github.com/risc0/risc0", branch = "main", default-features = false } risc0-zkp = { git = "https://github.com/risc0/risc0", branch = "main", default-features = false } -alloy-primitives = { version = "0.7", features = ["serde", "rlp", "std"] } +alloy-primitives = { version = "0.8", features = ["serde", "rlp", "std"] } alloy-rlp = { version = "0.3", default-features = false } alloy-rlp-derive = { version = "0.3", default-features = false } -alloy-sol-types = { version = "0.7" } +alloy-sol-types = { version = "0.8" } anyhow = "1.0" clap = { version = "4.4", features = ["derive", "env"] } log = "0.4" methods = { path = "methods" } once_cell = "1.19" -revm = { version = "9.0", default-features = false, features = ["std"] } rlp = "0.5.2" serde = "1.0" thiserror = "1.0" diff --git a/examples/token-stats/methods/guest/Cargo.toml b/examples/token-stats/methods/guest/Cargo.toml index b6de88fa..6f46ca82 100644 --- a/examples/token-stats/methods/guest/Cargo.toml +++ b/examples/token-stats/methods/guest/Cargo.toml @@ -6,14 +6,11 @@ edition = "2021" [workspace] [dependencies] -alloy-sol-types = { version = "0.7" } +alloy-sol-types = { version = "0.8" } core = { path = "../../core" } risc0-steel = { path = "../../../../steel" } risc0-zkvm = { git = "https://github.com/risc0/risc0", branch = "main", default-features = false, features = ["std"] } -# Force the `compile-time-rng` feature, to prevent `getrandom` from being used. -ahash = { version = "0.8", default-features = false, features = ["compile-time-rng"] } - [patch.crates-io] # use optimized risc0 circuit crypto-bigint = { git = "https://github.com/risc0/RustCrypto-crypto-bigint", tag = "v0.5.5-risczero.0" } diff --git a/steel/src/beacon.rs b/steel/src/beacon.rs index e7c0eb8a..1cb6580a 100644 --- a/steel/src/beacon.rs +++ b/steel/src/beacon.rs @@ -119,7 +119,7 @@ mod host { // first get the header of the parent and then the actual block header let parent_beacon_header = client - .get_beacon_header(BlockId::Root(parent_beacon_block_root)) + .get_beacon_header(BlockId::Root(parent_beacon_block_root.0.into())) .await .with_context(|| { format!("failed to get block header {}", parent_beacon_block_root) @@ -155,7 +155,7 @@ mod host { .try_into() .context("proof derived from API is invalid")?; ensure!( - proof.process(block_hash) == beacon_root, + proof.process(block_hash).0 == beacon_root.0, "proof derived from API does not verify", ); @@ -215,7 +215,7 @@ mod host { ensure!(proof.branch.len() == depth as usize, "index is invalid"); Ok(MerkleProof { - path: proof.branch, + path: proof.branch.iter().map(|n| n.0.into()).collect(), index: index.try_into().context("index too large")?, }) } diff --git a/steel/src/block.rs b/steel/src/block.rs index fe7ad956..a3dfe64e 100644 --- a/steel/src/block.rs +++ b/steel/src/block.rs @@ -79,10 +79,7 @@ pub mod host { }, EvmBlockHeader, }; - use alloy::{ - network::Network, providers::Provider, rpc::types::Header as RpcHeader, - transports::Transport, - }; + use alloy::{network::Network, providers::Provider, transports::Transport}; use anyhow::{anyhow, ensure}; use log::debug; @@ -95,8 +92,8 @@ pub mod host { T: Transport + Clone, N: Network, P: Provider, - H: EvmBlockHeader + TryFrom, - >::Error: Display, + H: EvmBlockHeader + TryFrom<::HeaderResponse>, + ::HeaderResponse>>::Error: Display, { let mut db = env.db.unwrap(); assert_eq!( diff --git a/steel/src/host/db/alloy.rs b/steel/src/host/db/alloy.rs index fcd3cbc1..124d068e 100644 --- a/steel/src/host/db/alloy.rs +++ b/steel/src/host/db/alloy.rs @@ -16,7 +16,7 @@ use std::{collections::HashMap, future::IntoFuture, marker::PhantomData}; use super::provider::{ProviderConfig, ProviderDb}; use alloy::{ - network::Network, + network::{BlockResponse, HeaderResponse, Network}, providers::Provider, transports::{Transport, TransportError}, }; @@ -146,7 +146,8 @@ impl> Database for AlloyDb> ProofDb Result> { + pub async fn ancestor_proof( + &self, + block_number: BlockNumber, + ) -> Result::HeaderResponse>> { let mut ancestors = Vec::new(); if let Some(&block_hash_min_number) = self.block_hash_numbers.iter().min() { assert!(block_hash_min_number <= block_number); @@ -127,7 +130,7 @@ impl> ProofDb, - H: EvmBlockHeader + TryFrom, - >::Error: Display, + H: EvmBlockHeader + TryFrom<::HeaderResponse>, + ::HeaderResponse>>::Error: Display, { /// Creates a new provable [EvmEnv] from an alloy [Provider]. #[deprecated(since = "0.12.0", note = "use `EvmEnv::builder().provider()` instead")] @@ -78,8 +77,8 @@ where T: Transport + Clone, N: Network, P: Provider, - H: EvmBlockHeader + TryFrom, - >::Error: Display, + H: EvmBlockHeader + TryFrom<::HeaderResponse>, + ::HeaderResponse>>::Error: Display, { /// Converts the environment into a [EvmInput] committing to a block hash. pub async fn into_input(self) -> Result> { @@ -138,8 +137,8 @@ impl EvmEnvBuilder { T: Transport + Clone, N: Network, P: Provider, - H: EvmBlockHeader + TryFrom, - >::Error: Display, + H: EvmBlockHeader + TryFrom<::HeaderResponse>, + ::HeaderResponse>>::Error: Display, { EvmEnvBuilder { provider, @@ -177,8 +176,8 @@ impl EvmEnvBuilder { T: Transport + Clone, N: Network, P: Provider, - H: EvmBlockHeader + TryFrom, - >::Error: Display, + H: EvmBlockHeader + TryFrom<::HeaderResponse>, + ::HeaderResponse>>::Error: Display, { let rpc_block = self .provider @@ -186,8 +185,8 @@ impl EvmEnvBuilder { .await .context("eth_getBlockByNumber failed")? .with_context(|| format!("block {} not found", self.block))?; - let header: H = rpc_block - .header + let header = rpc_block.header().clone(); + let header: H = header .try_into() .map_err(|err| anyhow!("header invalid: {}", err))?; let sealed_header = header.seal_slow();