Skip to content

Commit 856c2b8

Browse files
author
Marcos Pernambuco Motta
committed
wip
1 parent d7a8f7e commit 856c2b8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

risc0/cpp/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ EMULATOR_OBJS = $(patsubst %.c,%.emulator_c.o,$(patsubst %.cpp,%.emulator_cpp.o,
9393

9494
all: risc0-replay-steps.o
9595

96-
# Generated headers must exist before any emulator source compiles (-j safe)
9796
GENERATED_HEADERS := $(EMULATOR_SRC_DIR)/machine-c-version.h $(EMULATOR_SRC_DIR)/interpret-jump-table.h
9897

9998
%.emulator_cpp.o: $(EMULATOR_SRC_DIR)/%.cpp | $(GENERATED_HEADERS)

risc0/rust/cartesi-risc0/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ pub fn encode_seal_and_journal(receipt: &Receipt) -> (Vec<u8>, Vec<u8>) {
102102
(seal, receipt.journal.bytes.clone())
103103
}
104104

105-
/// Reconstruct and verify a Groth16 receipt from seal and journal bytes.
106-
/// Accepts seal with (260 bytes) or without (256 bytes) the 4-byte selector prefix.
105+
/// Reconstruct and verify a Groth16 receipt from seal (260 bytes) and journal bytes.
106+
/// The seal must include the 4-byte verifier selector prefix used by the on-chain
107+
/// Verifier Router to dispatch to the correct proof system.
107108
pub fn verify_seal(
108109
image_id: &[u32; 8],
109110
seal: &[u8],
@@ -112,7 +113,8 @@ pub fn verify_seal(
112113
mcycle_count: u64,
113114
root_hash_after: &MachineHash,
114115
) -> (MachineHash, u64, MachineHash) {
115-
let raw_seal = if seal.len() == 260 { &seal[4..] } else { seal };
116+
assert!(seal.len() == 260, "seal must be 260 bytes (4-byte selector + 256-byte proof), got {}", seal.len());
117+
let raw_seal = &seal[4..];
116118
let image_id_digest: Digest = (*image_id).into();
117119
let claim = ReceiptClaim::ok(image_id_digest, journal_bytes.to_vec());
118120
let verifier_parameters = Groth16ReceiptVerifierParameters::default().digest();

0 commit comments

Comments
 (0)