Skip to content

Commit 9a375ce

Browse files
committed
tmp update contract to send journal digest direclty instead of computing it in solidity
1 parent 4d77ae9 commit 9a375ce

File tree

6 files changed

+14
-5
lines changed

6 files changed

+14
-5
lines changed

aggregation_mode/abi/AlignedProofAggregationService.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

aggregation_mode/src/aggregators/risc0_aggregator.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ pub(crate) fn aggregate_proofs(
7979
.map_err(|e| ProofAggregationError::Risc0Proving(e.to_string()))?
8080
.receipt;
8181

82+
receipt
83+
.verify(RISC0_AGGREGATOR_PROGRAM_ID)
84+
.map_err(|e| ProofAggregationError::Risc0Proving(e.to_string()))?;
85+
8286
let output = Risc0ProofReceiptAndImageId {
8387
image_id: RISC0_AGGREGATOR_PROGRAM_ID_BYTES,
8488
receipt,

aggregation_mode/src/backend/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use config::Config;
2525
use fetcher::{ProofsFetcher, ProofsFetcherError};
2626
use merkle_tree::compute_proofs_merkle_root;
2727
use risc0_ethereum_contracts::encode_seal;
28+
use risc0_zkvm::sha::Digestible;
2829
use sp1_sdk::HashableKey;
2930
use std::str::FromStr;
3031
use tracing::{error, info, warn};
@@ -191,12 +192,14 @@ impl ProofAggregator {
191192
let encoded_seal = encode_seal(&proof.receipt).map_err(|e| {
192193
AggregatedProofSubmissionError::Risc0EncodingSeal(e.to_string())
193194
})?;
195+
let journal_digest: [u8; 32] = proof.receipt.journal.digest().into();
194196
self.proof_aggregation_service
195197
.verifyRisc0(
196198
blob_versioned_hash.into(),
197199
encoded_seal.into(),
198200
proof.image_id.into(),
199201
proof.receipt.journal.bytes.into(),
202+
journal_digest.into(),
200203
)
201204
.sidecar(blob)
202205
.send()

contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

contracts/src/core/AlignedProofAggregationService.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,14 @@ contract AlignedProofAggregationService is
7575
bytes32 blobVersionedHash,
7676
bytes calldata risc0ReceiptSeal,
7777
bytes32 risc0ImageId,
78-
bytes calldata risc0JournalBytes
78+
bytes calldata risc0JournalBytes,
79+
bytes32 risc0JournalDigest
7980
) public onlyAlignedAggregator {
8081
(bytes32 merkleRoot) = abi.decode(risc0JournalBytes, (bytes32));
8182

8283
// In dev mode, poofs are mocked, so we skip the verification part
8384
if (_isRisc0VerificationEnabled()) {
84-
bytes32 risc0JournalDigest = sha256(risc0JournalBytes);
85+
//bytes32 risc0JournalDigest = sha256(risc0JournalBytes);
8586
IRiscZeroVerifier(risc0VerifierAddress).verify(risc0ReceiptSeal, risc0ImageId, risc0JournalDigest);
8687
}
8788

contracts/src/core/IAlignedProofAggregationService.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ interface IAlignedProofAggregationService {
1919
bytes32 blobVersionedHash,
2020
bytes calldata risc0ReceiptSeal,
2121
bytes32 risc0ImageId,
22-
bytes calldata risc0JournalBytes
22+
bytes calldata risc0JournalBytes,
23+
bytes32 risc0JournalDigest
2324
) external;
2425

2526
/// @notice event that gets emitted after a successful aggregated proof verification

0 commit comments

Comments
 (0)