Skip to content
This repository has been archived by the owner on Feb 10, 2025. It is now read-only.

Commit

Permalink
common, mock, aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
S1nus committed Dec 22, 2024
1 parent 6b3c720 commit d04492d
Show file tree
Hide file tree
Showing 15 changed files with 105 additions and 13 deletions.
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"rust-analyzer.linkedProjects": [
"program/Cargo.toml",
"script/Cargo.toml"
"script/Cargo.toml",
"blevm/Cargo.toml",
"blevm-mock/Cargo.toml",
"blevm-aggregator/Cargo.toml",
"common/Cargo.toml"
],
"rust-analyzer.check.overrideCommand": [
"cargo",
Expand Down
47 changes: 47 additions & 0 deletions Cargo.lock

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

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[workspace]
members = [
"program",
"program-mock",
"blevm",
"blevm-mock",
"script",
"blevm-aggregator",
"common",
]
resolver = "2"

Expand Down
8 changes: 6 additions & 2 deletions blevm-aggregator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ name = "blevm-aggregator"
edition = "2021"

[dependencies]
hex-literal = "0.4.1"
alloy-sol-types = { workspace = true }
sp1-zkvm = "3.0.0-rc4"
sp1-zkvm = { version = "3.0.0-rc4", features = ["verify"] }
rsp-client-executor = {workspace=true}
celestia-types = {workspace=true}
nmt-rs = "*"
reth-primitives = {workspace=true}
tendermint = {workspace=true}
tendermint-proto = {workspace=true}
bincode = {workspace=true}
hex = "0.4.3"
hex = "0.4.3"
sha2 = "0.10.8"
serde = { version = "1.0", default-features = false, features = ["derive", "std"] }
serde_cbor = "0.11.2"
30 changes: 24 additions & 6 deletions blevm-aggregator/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
#![no_main]
sp1_zkvm::entrypoint!(main);

mod buffer;
use buffer::Buffer;

use sha2::{Digest, Sha256};

// Verification key of blevm-mock (Dec 22 2024)
// 0x001a3232969a5caac2de9a566ceee00641853a058b1ce1004ab4869f75a8dc59

const BLEVM_MOCK_VERIFICATION_KEY: &[u8] =
hex::decode("001a3232969a5caac2de9a566ceee00641853a058b1ce1004ab4869f75a8dc59").unwrap();
const BLEVM_MOCK_VERIFICATION_KEY: [u32; 8] = [
0x001a3232, 0x969a5caa, 0xc2de9a56, 0x6ceee006, 0x41853a05, 0x8b1ce100, 0x4ab4869f, 0x75a8dc59,
];

pub fn main() {
let public_values1: Vec<u8> = sp1_zkvm::io::read();
let public_values2: Vec<u8> = sp1_zkvm::io::read();

let proof1_values_hash = Sha256::digest(&public_values1);
let proof2_values_hash = Sha256::digest(&public_values2);

sp1_zkvm::lib::verify::verify_sp1_proof(
&BLEVM_MOCK_VERIFICATION_KEY,
&proof1_values_hash.into(),
);
sp1_zkvm::lib::verify::verify_sp1_proof(
&BLEVM_MOCK_VERIFICATION_KEY,
&proof2_values_hash.into(),
);

pub fn main() {}
let buffer1 = Buffer::from(&public_values1);
let buffer2 = Buffer::from(&public_values2);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
version = "0.1.0"
name = "blevm-common"
edition = "2021"

[dependencies]
serde = { version = "1.0.200", default-features = false, features = ["derive"] }
bincode = { workspace = true }
10 changes: 10 additions & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pub struct BlevmOutput {
pub blob_commitment: [u8; 32],
pub header_hash: [u8; 32],
pub prev_header_hash: [u8; 32],
pub height: u64,
pub gas_used: u64,
pub beneficiary: [u8; 20],
pub state_root: [u8; 32],
pub celestia_header_hash: [u8; 32],
}
Binary file modified elf/riscv32im-succinct-zkvm-elf
Binary file not shown.
2 changes: 1 addition & 1 deletion script/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use sp1_helper::build_program_with_args;

fn main() {
build_program_with_args("../program", Default::default())
build_program_with_args("../blevm", Default::default())
}

0 comments on commit d04492d

Please sign in to comment.