Skip to content

Commit

Permalink
Merge pull request #170 from taikoxyz/fix-kzg-sp1
Browse files Browse the repository at this point in the history
fix(sp1): kzg compilation fix for sp1
  • Loading branch information
CeciliaZ030 authored May 8, 2024
2 parents ef08765 + d17977b commit a9fd25f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
26 changes: 10 additions & 16 deletions lib/src/protocol_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,16 @@ pub fn assemble_protocol_instance(
) -> Result<ProtocolInstance> {
let blob_used = input.taiko.block_proposed.meta.blobUsed;
let tx_list_hash = if blob_used {
if cfg!(not(feature = "sp1")) {
println!("kzg check enabled!");
let mut data = Vec::from(KZG_TRUST_SETUP_DATA);
let kzg_settings = KzgSettings::from_u8_slice(&mut data);
let kzg_commit = KzgCommitment::blob_to_kzg_commitment(
&Blob::from_bytes(&input.taiko.tx_data.as_slice()).unwrap(),
&kzg_settings,
)
.unwrap();
let versioned_hash = kzg_to_versioned_hash(kzg_commit);
assert_eq!(versioned_hash, input.taiko.tx_blob_hash.unwrap());
versioned_hash
} else {
println!("kzg check disabled!");
input.taiko.tx_blob_hash.unwrap()
}
let mut data = Vec::from(KZG_TRUST_SETUP_DATA);
let kzg_settings = KzgSettings::from_u8_slice(&mut data);
let kzg_commit = KzgCommitment::blob_to_kzg_commitment(
&Blob::from_bytes(&input.taiko.tx_data.as_slice()).unwrap(),
&kzg_settings,
)
.unwrap();
let versioned_hash = kzg_to_versioned_hash(kzg_commit);
assert_eq!(versioned_hash, input.taiko.tx_blob_hash.unwrap());
versioned_hash
} else {
TxHash::from(keccak(input.taiko.tx_data.as_slice()))
};
Expand Down
2 changes: 1 addition & 1 deletion provers/sp1/builder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Pipeline for Sp1Pipeline {
"panic=abort",
])
.cc_compiler("gcc".into())
.c_flags(&["/opt/riscv/bin/riscv32-unknown-elf-gcc"])
.c_flags(&["/opt/riscv/bin/riscv32-unknown-elf-gcc", "-mstrict-align"])
.custom_args(&["--ignore-rust-version"])
}

Expand Down
1 change: 0 additions & 1 deletion provers/sp1/driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ fn test_example() {

// // Still need to write the same input requried by main binary
// // Even though test itself desn't use it.
// let mut stdin = SP1Stdin::new();
// stdin.write(&GuestInput::default());

// let (pk, vk) = client.setup(TEST_ELF);
Expand Down

0 comments on commit a9fd25f

Please sign in to comment.