Skip to content
Open
63 changes: 34 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ openvm-sdk = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0",
openvm-transpiler = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0", default-features = false }

# ceno guest lib
ceno_rt = { git = "https://github.com/scroll-tech/ceno", branch = "master" }
ceno_crypto = { git = "https://github.com/scroll-tech/ceno", branch = "master" }
ceno_rt = { git = "https://github.com/scroll-tech/ceno", rev = "f2007360e2dd334d514be2cfff0ae77911a04397" }
ceno_crypto = { git = "https://github.com/scroll-tech/ceno", rev = "f2007360e2dd334d514be2cfff0ae77911a04397" }

# ceno host lib
ceno_emul = { git = "https://github.com/scroll-tech/ceno", branch = "master" }
ceno_host = { git = "https://github.com/scroll-tech/ceno", branch = "master" }
ceno_zkvm = { git = "https://github.com/scroll-tech/ceno", branch = "master" }
ceno_sha2 = { git = "https://github.com/scroll-tech/ceno", branch = "master" }
gkr_iop = { git = "https://github.com/scroll-tech/ceno", branch = "master" }
ff_ext = { git = "https://github.com/scroll-tech/gkr-backend.git", tag = "v1.0.0-alpha.13" }
mpcs = { git = "https://github.com/scroll-tech/gkr-backend.git", tag = "v1.0.0-alpha.13" }
ceno_emul = { git = "https://github.com/scroll-tech/ceno", rev = "f2007360e2dd334d514be2cfff0ae77911a04397" }
ceno_host = { git = "https://github.com/scroll-tech/ceno", rev = "f2007360e2dd334d514be2cfff0ae77911a04397" }
ceno_zkvm = { git = "https://github.com/scroll-tech/ceno", rev = "f2007360e2dd334d514be2cfff0ae77911a04397" }
ceno_sha2 = { git = "https://github.com/scroll-tech/ceno", rev = "f2007360e2dd334d514be2cfff0ae77911a04397" }
gkr_iop = { git = "https://github.com/scroll-tech/ceno", rev = "f2007360e2dd334d514be2cfff0ae77911a04397" }
ff_ext = { git = "https://github.com/scroll-tech/gkr-backend.git", tag = "v1.0.0-alpha.15" }
mpcs = { git = "https://github.com/scroll-tech/gkr-backend.git", tag = "v1.0.0-alpha.15" }

# more openvm related libs
openvm-stark-sdk = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.0" }
Expand Down
1 change: 1 addition & 0 deletions crates/ceno-circuits/chunk-circuit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ceno_sha2.workspace = true
bincode.workspace = true
scroll-zkvm-types-chunk.workspace = true
rkyv.workspace = true
serde_json.workspace = true

[features]
default = []
Expand Down
34 changes: 31 additions & 3 deletions crates/ceno-circuits/chunk-circuit/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
extern crate ceno_rt;

// use ceno_crypto::secp256k1;
use ceno_crypto::ceno_crypto;
use rkyv::Archived;
use scroll_zkvm_types_chunk::{Address, ChunkWitness, alloy_consensus, execute, revm_precompile};
use scroll_zkvm_types_chunk::{Address, ChunkWitness, alloy_consensus, execute, revm_precompile, TxEnvelope};
use scroll_zkvm_types_chunk::sbv_primitives::{address, b256, Signature, B256};
use scroll_zkvm_types_chunk::alloy_consensus::transaction::SignerRecoverable;
use scroll_zkvm_types_chunk::alloy_consensus::{Signed, TxEip1559, TxLegacy};
use scroll_zkvm_types_chunk::revm_precompile::Crypto;
use scroll_zkvm_types_chunk::sbv_primitives::alloy_primitives::hex;

ceno_crypto!(
revm_precompile = revm_precompile,
Expand All @@ -13,14 +19,36 @@ ceno_crypto!(
fn main() {
CenoCrypto::install();

// let tx: Signed<TxEip1559> = serde_json::from_str(TX).unwrap();
// tx.recover_signer().ok();
// test ceno precompile call
// let (sig, recid, tx_hash, signer) = (
// &hex!(
// "004a0ac1306d096c06fb77f82b76f43fb2459638826f4846444686b3036b9a4b3d6bf124bf22f23b851adfa2c4bdc670b4ecb5129186a4e89032916a77a56b90"
// ),
// 0,
// b256!("83e5e11daa2d14736ab1d578c41250c6f6445782c215684a18f67b44686ccb90"),
// address!("0a6f0ed4896be1caa9e37047578e7519481f22ea"),
// );
// let try_ceno_crypto = CenoCrypto {};
// try_ceno_crypto.secp256k1_ecrecover(sig.try_into().unwrap(), recid, &tx_hash.0).unwrap();
// assert_eq!(&recovered[12..], &signer.0);

// // test alloy call directly
// let signature_hash = b256!("4da82bc12df24f77a4a136cbf0050cecfe8079e484a1754a7725bf96628d8c08");
// let signature = Signature::from_raw(&hex::decode("0xb44fa252d86bd16e029b5d5241bf382829db0339bb0f571d2444dc18b342e8cb324a5412cc85018661cdc8749fddd721b8db803fbad4a163ec9a152d1cad41851c").unwrap()).unwrap();
// let _result = alloy_consensus::crypto::secp256k1::recover_signer(&signature, signature_hash);

// secp256k1_ecrecover
let witness_bytes: &Archived<Vec<u8>> = ceno_rt::read();

let config = bincode::config::standard();
let (witness, _): (ChunkWitness, _) = bincode::serde::decode_from_slice(witness_bytes, config)
.expect("ChunkCircuit: deserialisation of witness bytes failed");
witness.blocks[0].transactions[0].recover_signer().ok();

// let _fork_name = witness.fork_name;
let _chunk_info = execute(witness).expect("execution failed");
// // let _fork_name = witness.fork_name;
// let _chunk_info = execute(witness).expect("execution failed");

// let pi_hash = (chunk_info, fork_name).pi_hash();
// ceno_rt::commit(&pi_hash);
Expand Down
Loading
Loading