Skip to content

Commit

Permalink
fix(lib): temporarily disable kzg check in sgx/sp1 provers (#157)
Browse files Browse the repository at this point in the history
* temporarily disable kzg check in sgx/sp1 provers

* fix typo
  • Loading branch information
Brechtpd authored May 5, 2024
1 parent 9cebd36 commit 039d2fa
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 15 deletions.
4 changes: 2 additions & 2 deletions host/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"prover_args": {
"sgx": {
"instance_id": 456,
"setup": false,
"bootstrap": false,
"setup": true,
"bootstrap": true,
"prove": true,
"input_path": null
},
Expand Down
3 changes: 3 additions & 0 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ std = [
"dep:serde_with",
# "dep:tokio",
]
sgx = []
sp1 = []
risc0 = []
29 changes: 19 additions & 10 deletions lib/src/protocol_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,25 @@ pub fn assemble_protocol_instance(
) -> Result<ProtocolInstance> {
let blob_used = input.taiko.block_proposed.meta.blobUsed;
let tx_list_hash = if blob_used {
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
#[cfg(not(any(feature = "sgx", 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
}
#[cfg(any(feature = "sgx", feature = "sp1"))]
{
println!("kzg check disabled!");
input.taiko.tx_blob_hash.unwrap()
}
} else {
TxHash::from(keccak(input.taiko.tx_data.as_slice()))
};
Expand Down
2 changes: 1 addition & 1 deletion provers/risc0/guest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
raiko-primitives = { path = "../../../primitives" }
raiko-lib = { path = "../../../lib", features = ["std"] }
raiko-lib = { path = "../../../lib", features = ["std", "risc0"] }
risc0-zkvm = { version = "0.21.0", default-features = false, features = ['std', "getrandom"] }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion provers/sgx/guest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
raiko-lib = { workspace = true }
raiko-lib = { workspace = true, features = ["sgx"] }
raiko-primitives = { workspace = true }
tokio = { workspace = true }
anyhow = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion provers/sp1/guest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
raiko-lib = { path = "../../../lib", features = ["std"] }
raiko-lib = { path = "../../../lib", features = ["std", "sp1"] }
sp1-zkvm ={ git = "https://github.com/succinctlabs/sp1.git", branch = "main" }

[dev-dependencies]
Expand Down

0 comments on commit 039d2fa

Please sign in to comment.