Skip to content

Commit

Permalink
switch journal bytes to be serialized more compact (#16)
Browse files Browse the repository at this point in the history
* switch journal bytes to be serialized more compact

* sort deps
  • Loading branch information
austinabell authored Jul 15, 2024
1 parent 0c705b5 commit 411c5dc
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions batch-guest/guest/Cargo.lock

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

1 change: 1 addition & 0 deletions batch-guest/guest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ light-client-guest = { path = "../../light-client-guest" }
blobstream0-primitives = { path = "../../primitives" }
alloy-sol-types = "0.7"
alloy-primitives = "0.7"
serde_bytes = "0.11"

[patch.crates-io]
sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.8-risczero.0" }
7 changes: 4 additions & 3 deletions batch-guest/guest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@

use alloy_primitives::U256;
use alloy_sol_types::SolValue;
use light_client_guest::TM_LIGHT_CLIENT_ID;
use blobstream0_primitives::{
IBlobstream::{DataRootTuple, RangeCommitment},
LightClientCommit, MerkleTree,
};
use light_client_guest::TM_LIGHT_CLIENT_ID;
use risc0_zkvm::{guest::env, serde::from_slice};
use serde_bytes::ByteBuf;

// TODO by default this will serialize poorly, optimize
type JournalBytes = Vec<u8>;
/// Alias to represent the bytes from the journals being recursively proven.
type JournalBytes = ByteBuf;

fn main() {
// Input the vector of proofs to batch.
Expand Down
12 changes: 6 additions & 6 deletions contracts/artifacts/Blobstream0.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/src/ImageID.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
pragma solidity ^0.8.20;

library ImageID {
bytes32 public constant BATCH_GUEST_ID = bytes32(0xf75fe9a787f9010e6a60a35271fbf7901d0afd27faff3c3dfe708582afae9af2);
bytes32 public constant BATCH_GUEST_ID = bytes32(0x54c5a4b5dcef9cc6febc08d59d9892b0b36be5fd15ef365c7a9c126a8864e494);
}
1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ciborium = { workspace = true }
light-client-guest = { path = "../light-client-guest" }
risc0-ethereum-contracts = { git = "https://github.com/risc0/risc0-ethereum", tag = "v1.0.0" }
risc0-zkvm = { version = "=1.0.1" }
serde_bytes = "0.11"
tendermint = { workspace = true }
tendermint-light-client-verifier = { workspace = true }
tendermint-rpc = { workspace = true, features = ["http-client"] }
Expand Down
3 changes: 2 additions & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use risc0_ethereum_contracts::groth16;
use risc0_zkvm::{
default_prover, is_dev_mode, sha::Digestible, ExecutorEnv, Prover, ProverOpts, Receipt,
};
use serde_bytes::ByteBuf;
use std::ops::Range;
use tendermint::{block::Height, node::Id, validator::Set};
use tendermint_light_client_verifier::types::LightBlock;
Expand Down Expand Up @@ -124,7 +125,7 @@ pub async fn prove_block_range(client: &HttpClient, range: Range<u64>) -> anyhow
light_block,
} = prove_block(prover.as_ref(), client, &previous_block, height).await?;

batch_receipts.push(receipt.journal.bytes.clone());
batch_receipts.push(ByteBuf::from(receipt.journal.bytes.clone()));
batch_env_builder.add_assumption(receipt);
previous_block = light_block;
}
Expand Down

0 comments on commit 411c5dc

Please sign in to comment.