Skip to content
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 .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ permissions:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RISC0_TOOLCHAIN_VERSION: 1.85.0
RISC0_TOOLCHAIN_VERSION: 1.88.0
FOUNDRY_VERSION: v1.0.0
RISC0_MONOREPO_REF: "main"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ permissions:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RISC0_TOOLCHAIN_VERSION: 1.85.0
RISC0_TOOLCHAIN_VERSION: 1.88.0
FOUNDRY_VERSION: v1.0.0
RISC0_MONOREPO_REF: "main"
# CARGO_LOCKED is defined as the string '--locked' in PRs targeting release branches and '' elsewhere.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/steel-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:
cancel-in-progress: true

env:
RISC0_TOOLCHAIN_VERSION: 1.85.0
RISC0_TOOLCHAIN_VERSION: 1.88.0
RISC0_MONOREPO_REF: "main"

jobs:
Expand Down
16 changes: 7 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,15 @@ risc0-zkvm = { git = "https://github.com/risc0/risc0", branch = "main", default-
# Alloy guest dependencies
alloy-consensus = { version = "1.0" }
alloy-eips = { version = "1.0" }
alloy-evm = { version = "0.8" }
alloy-evm = { version = "0.15" }
alloy-rlp = { version = "0.3.8" }
alloy-primitives = { version = "1.0" }
alloy-primitives = { version = "1.3" }
alloy-rpc-types = { version = "1.0" }
alloy-sol-types = { version = "1.0" }
# TODO: Update op-alloy-network to 0.18 to remove this requirement.
alloy-network = { version = "<1.0.14,>=1.0.0" }
alloy-sol-types = { version = "1.3" }

# OP Steel
alloy-op-evm = { version = "0.8" }
op-alloy-network = { version = "0.16" }
alloy-op-evm = { version = "0.15" }
op-alloy-network = { version = "0.18" }

# Alloy host dependencies
alloy = { version = "1.0" }
Expand All @@ -58,8 +56,8 @@ itertools = "0.14"
log = "0.4"
rand = "0.9"
reqwest = "0.12"
revm = { version = "23.1", default-features = false, features = ["std"] }
op-revm = { version = "4.0", default-features = false, features = ["std"] }
revm = { version = "27.0.3", default-features = false, features = ["std"] }
op-revm = { version = "8.0.3", default-features = false, features = ["std"] }
rkyv = "0.8"
serde = "1.0"
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/groth16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ mod tests {

fn parse_digest(file_path: &str, name: &str) -> Result<String, anyhow::Error> {
let content = fs::read_to_string(file_path)?;
let re_digest = Regex::new(&format!(r#"{}\s*=\s*hex"([0-9a-fA-F]+)""#, name))?;
let re_digest = Regex::new(&format!(r#"{name}\s*=\s*hex"([0-9a-fA-F]+)""#))?;
re_digest
.captures(&content)
.and_then(|caps| caps.get(1).map(|m| m.as_str().to_string()))
Expand Down
2 changes: 1 addition & 1 deletion crates/aggregation/guest/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ fn main() {
.with_elf_sol_path(SOLIDITY_ELF_PATH);

if let Err(e) = generate_solidity_files(guests.as_slice(), &solidity_opts) {
println!("cargo:warning=Failed to generate Solidity files: {}", e);
println!("cargo:warning=Failed to generate Solidity files: {e}");
}
}
4 changes: 2 additions & 2 deletions crates/ffi/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use risc0_zkvm::{FakeReceipt, InnerReceipt, Receipt, ReceiptClaim};
fn basic_usage() {
let exe_path = env!("CARGO_BIN_EXE_risc0-forge-ffi");
let args = ["prove", ECHO_PATH, "0xdeadbeef"];
println!("{} {:?}", exe_path, args);
println!("{exe_path} {args:?}");
let output = Command::new(exe_path)
.env_clear()
// PATH is required so r0vm can be found.
Expand Down Expand Up @@ -59,7 +59,7 @@ fn basic_usage() {
fn basic_usage_with_rust_log() {
let exe_path = env!("CARGO_BIN_EXE_risc0-forge-ffi");
let args = ["prove", ECHO_PATH, "0xdeadbeef"];
println!("{} {:?}", exe_path, args);
println!("{exe_path} {args:?}");
let output = Command::new(exe_path)
.env_clear()
// PATH is required so r0vm can be found.
Expand Down
3 changes: 1 addition & 2 deletions crates/op-steel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
alloy = { workspace = true, optional = true, features = ["contract", "providers"] }
alloy-eips = { workspace = true }
alloy-evm = { workspace = true }
# TODO: Update op-alloy-network to 0.18 to remove this requirement.
alloy-network = { workspace = true }
alloy-op-evm = { workspace = true }
alloy-primitives = { workspace = true, features = ["rlp", "serde"] }
alloy-sol-types = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/op-steel/src/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ pub mod host {
.await
.context("eth_getBlockByNumber failed")?;
let block =
block_response.with_context(|| format!("block not found: {}", block_number))?;
block_response.with_context(|| format!("block not found: {block_number}"))?;
let header = block.header;

let proof = provider
Expand Down
2 changes: 1 addition & 1 deletion crates/op-steel/src/l1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ where
.await?;
let timestamp = block_response.unwrap().header.timestamp;

log::debug!("OP timestamp of beacon commit: {}", timestamp);
log::debug!("OP timestamp of beacon commit: {timestamp}");

Ok(EthEvmInput::Beacon(BeaconInput::new(
input,
Expand Down
34 changes: 28 additions & 6 deletions crates/op-steel/src/optimism/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@
// limitations under the License.

use crate::game::DisputeGameInput;
use alloy_eips::{eip4844, eip7691};
use alloy_evm::{Database, EvmFactory as AlloyEvmFactory};
use alloy_op_evm::OpEvmFactory as AlloyOpEvmFactory;
use alloy_primitives::{Address, BlockNumber, Bytes, ChainId, Sealable, TxKind, B256};
use alloy_primitives::{Address, BlockNumber, Bytes, ChainId, Sealable, TxKind, B256, U256};
use op_alloy_network::{Network, Optimism};
use op_revm::{spec::OpSpecId, OpTransaction};
use revm::{
context::{BlockEnv, CfgEnv, TxEnv},
context_interface::block::BlobExcessGasAndPrice,
inspector::NoOpInspector,
primitives::hardfork::SpecId,
};
use risc0_steel::{
config::{ChainSpec, ForkCondition},
Expand Down Expand Up @@ -171,17 +173,37 @@ impl EvmBlockHeader for OpBlockHeader {
fn to_block_env(&self, spec: OpSpecId) -> BlockEnv {
let header = self.0.inner();

let blob_excess_gas_and_price =
header
.excess_blob_gas
.map(|excess_blob_gas| match spec.into_eth_spec() {
SpecId::CANCUN => BlobExcessGasAndPrice::new(
excess_blob_gas,
eip4844::BLOB_GASPRICE_UPDATE_FRACTION as u64,
),
SpecId::PRAGUE => BlobExcessGasAndPrice::new(
excess_blob_gas,
eip7691::BLOB_GASPRICE_UPDATE_FRACTION_PECTRA as u64,
),
SpecId::OSAKA => BlobExcessGasAndPrice::new(
excess_blob_gas,
eip7691::BLOB_GASPRICE_UPDATE_FRACTION_PECTRA as u64,
),
_ => unimplemented!(
"unsupported spec with `excess_blob_gas`: {}",
<&'static str>::from(spec)
),
});
Comment on lines +176 to +196
Copy link
Contributor

Choose a reason for hiding this comment

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

I ran into this with a bit of my work. Can we have a public utility function for this, or do you think that would be a bad idea?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There actually is https://docs.rs/alloy-eips/1.0.23/alloy_eips/eip7840/struct.BlobParams.html#method.calc_blob_fee which exactly does that.
Probably, eventually when this gets more complicated we should add https://docs.rs/alloy-eips/1.0.23/alloy_eips/eip7892/struct.BlobScheduleBlobParams.html to our config. But I tried to avoid this at this level because it would be a breaking change effecting config IDs and such.


BlockEnv {
number: header.number,
number: U256::from(header.number),
beneficiary: header.beneficiary,
timestamp: header.timestamp,
timestamp: U256::from(header.timestamp),
gas_limit: header.gas_limit,
basefee: header.base_fee_per_gas.unwrap_or_default(),
difficulty: header.difficulty,
prevrandao: (spec >= OpSpecId::BEDROCK).then_some(header.mix_hash),
blob_excess_gas_and_price: header.excess_blob_gas.map(|excess_blob_gas| {
BlobExcessGasAndPrice::new(excess_blob_gas, spec >= OpSpecId::ISTHMUS)
}),
blob_excess_gas_and_price,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/steel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ alloy = { workspace = true, optional = true, features = ["full"] }
alloy-consensus = { workspace = true }
alloy-eips = { workspace = true }
alloy-evm = { workspace = true }
alloy-primitives = { workspace = true, features = ["rlp", "serde"] }
alloy-primitives = { workspace = true, features = ["rlp", "serde", "map"] }
alloy-rlp = { workspace = true }
alloy-rpc-types = { workspace = true }
alloy-sol-types = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions crates/steel/src/beacon/host/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ where
let response = beacon_client
.get_header_for_parent_root(parent_root)
.await
.with_context(|| format!("failed to get header for parent root {}", parent_root))?;
.with_context(|| format!("failed to get header for parent root {parent_root}"))?;
ensure!(
response.header.message.parent_root.0 == parent_root.0,
"API returned invalid beacon header"
Expand Down Expand Up @@ -210,7 +210,7 @@ async fn create_execution_payload_proof(
let signed_beacon_block = client
.get_block(beacon_root)
.await
.with_context(|| format!("failed to get block {}", beacon_root))?;
.with_context(|| format!("failed to get block {beacon_root}"))?;
// create the inclusion proof of the execution block hash depending on the fork version
let (proof, _) = match signed_beacon_block {
SignedBeaconBlock::Phase0(_)
Expand Down
4 changes: 2 additions & 2 deletions crates/steel/src/beacon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ impl fmt::Display for BeaconBlockId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
BeaconBlockId::Eip4788(timestamp) => {
write!(f, "eip4788-timestamp: {}", timestamp)
write!(f, "eip4788-timestamp: {timestamp}")
}
BeaconBlockId::Slot(slot) => write!(f, "slot: {}", slot),
BeaconBlockId::Slot(slot) => write!(f, "slot: {slot}"),
}
}
}
Expand Down
9 changes: 3 additions & 6 deletions crates/steel/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,14 +468,11 @@ where
if reason == SuccessReason::Return {
Ok(output)
} else {
Err(format!(
"succeeded but did not return (reason: {:?})",
reason
))
Err(format!("succeeded but did not return (reason: {reason:?})"))
}
}
ExecutionResult::Revert { output, .. } => Err(format!("reverted with output: {}", output)),
ExecutionResult::Halt { reason, .. } => Err(format!("halted: {:?}", reason)),
ExecutionResult::Revert { output, .. } => Err(format!("reverted with output: {output}")),
ExecutionResult::Halt { reason, .. } => Err(format!("halted: {reason:?}")),
}?;

// decode the successful return output
Expand Down
27 changes: 21 additions & 6 deletions crates/steel/src/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ use crate::{
serde::RlpHeader,
EvmBlockHeader, EvmEnv, EvmFactory, EvmInput,
};
use alloy_eips::{eip4844, eip7691};
use alloy_evm::{Database, EthEvmFactory as AlloyEthEvmFactory, EvmFactory as AlloyEvmFactory};
use alloy_primitives::{Address, BlockNumber, Bytes, TxKind, B256};
use alloy_primitives::{Address, BlockNumber, Bytes, TxKind, B256, U256};
use revm::{
context::{BlockEnv, CfgEnv, TxEnv},
context_interface::block::BlobExcessGasAndPrice,
Expand Down Expand Up @@ -151,17 +152,31 @@ impl EvmBlockHeader for EthBlockHeader {
fn to_block_env(&self, spec: SpecId) -> BlockEnv {
let header = self.inner();

let blob_excess_gas_and_price = header.excess_blob_gas.map(|excess_blob_gas| match spec {
SpecId::CANCUN => BlobExcessGasAndPrice::new(
excess_blob_gas,
eip4844::BLOB_GASPRICE_UPDATE_FRACTION as u64,
),
SpecId::PRAGUE => BlobExcessGasAndPrice::new(
excess_blob_gas,
eip7691::BLOB_GASPRICE_UPDATE_FRACTION_PECTRA as u64,
),
SpecId::OSAKA => BlobExcessGasAndPrice::new(
excess_blob_gas,
eip7691::BLOB_GASPRICE_UPDATE_FRACTION_PECTRA as u64,
),
_ => unimplemented!("unsupported spec with `excess_blob_gas`: {spec}"),
});

BlockEnv {
number: header.number,
number: U256::from(header.number),
beneficiary: header.beneficiary,
timestamp: header.timestamp,
timestamp: U256::from(header.timestamp),
gas_limit: header.gas_limit,
basefee: header.base_fee_per_gas.unwrap_or_default(),
difficulty: header.difficulty,
prevrandao: (spec >= SpecId::MERGE).then_some(header.mix_hash),
blob_excess_gas_and_price: header.excess_blob_gas.map(|excess_blob_gas| {
BlobExcessGasAndPrice::new(excess_blob_gas, spec >= SpecId::PRAGUE)
}),
blob_excess_gas_and_price,
}
}
}
14 changes: 7 additions & 7 deletions crates/steel/src/history/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ mod host {

// loop backwards until we link to `execution_header`'s beacon root
loop {
log::debug!("Processing state for block: {}", current_state_block_hash);
log::debug!("Processing state for block: {current_state_block_hash}");

// 2a. Query the beacon roots contract *within the current state* for the timestamp
// in the slot that the execution commit will eventually occupy,
Expand Down Expand Up @@ -212,8 +212,7 @@ mod host {
.await
.with_context(|| {
format!(
"Failed to get execution payload block hash for beacon block {}",
parent_beacon_root
"Failed to get execution payload block hash for beacon block {parent_beacon_root}"
)
})?;
// create the beacon commitment for the next state
Expand All @@ -227,8 +226,7 @@ mod host {
.await
.with_context(|| {
format!(
"Failed to create beacon commit for new state block hash {}",
current_state_block_hash
"Failed to create beacon commit for new state block hash {current_state_block_hash}"
)
})?;
}
Expand All @@ -246,8 +244,10 @@ mod host {
#[cfg(test)]
mod tests {
use super::*;
use crate::ethereum::EthBlockHeader;
use crate::test_utils::{get_cl_url, get_el_url};
use crate::{
ethereum::EthBlockHeader,
test_utils::{get_cl_url, get_el_url},
};
use alloy::providers::{Provider, ProviderBuilder};
use alloy_primitives::Sealable;

Expand Down
4 changes: 2 additions & 2 deletions crates/steel/src/host/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl<P, F, S, B> EvmEnvBuilder<P, F, S, B> {
.get_block(block)
.await
.context("eth_getBlock1 failed")?
.with_context(|| format!("block {} not found", block))?;
.with_context(|| format!("block {block} not found"))?;

let rpc_header = rpc_block.header().clone();
let header: F::Header = rpc_header
Expand Down Expand Up @@ -443,9 +443,9 @@ impl<P> EvmEnvBuilder<P, EthEvmFactory, &ChainSpec<<EthEvmFactory as EvmFactory>
#[cfg(test)]
mod tests {
use super::*;
use crate::test_utils::{get_cl_url, get_el_url};
use crate::{
ethereum::{EthEvmEnv, ETH_MAINNET_CHAIN_SPEC},
test_utils::{get_cl_url, get_el_url},
BlockHeaderCommit, Commitment, CommitmentVersion,
};
use test_log::test;
Expand Down
Loading
Loading