Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ tokio-util = { version = "0.7.13", default-features = false }
url = { version = "2.5.4", default-features = false }
zip = { version = "2.2.2", default-features = false, features = ["deflate"] }
sqlx = { version = "0.8.2", features = [ "chrono", "macros", "regexp", "runtime-async-std", "runtime-tokio", "sqlite", "uuid" ] }
piltover = {package = "piltover", git = "https://github.com/cartridge-gg/piltover.git", rev = "dc86b13de0713c172153c4833fd7b3d14a855351" }
piltover = {package = "piltover", git = "https://github.com/cartridge-gg/piltover.git", branch = "feat/tee-persistent" }
cainome = { version = "0.10.1", features = ["abigen-rs"] }
generate-pie = {git = "https://github.com/keep-starknet-strange/snos.git",rev = "6cf7040"}

Expand Down
5 changes: 5 additions & 0 deletions bin/ops/src/core_contract/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,15 @@ pub async fn set_program_info(
let txn_config = TxnConfig::default();
let invoker = Invoker::new(account, txn_config);

// `ProgramInfo` is a Cairo enum (StarknetOs / KatanaTee). Cairo serializes an enum
// as `[variant_index, ...inner_struct_fields]`. `ops` only deploys for the
// validity-proof path, so always emit the `StarknetOs` variant (index 0) followed
// by the four `StarknetOsProgramInfo` fields in declaration order.
let call = Call {
to: contract_address,
selector: selector!("set_program_info"),
calldata: vec![
Felt::ZERO, // ProgramInfo::StarknetOs variant index
BOOTLOADER_PROGRAM_HASH,
snos_config_hash,
SNOS_PROGRAM_HASH,
Expand Down
32 changes: 16 additions & 16 deletions bin/persistent-tee/Cargo.lock

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

12 changes: 6 additions & 6 deletions bin/persistent-tee/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ repository.workspace = true

[dependencies]
saya-core = { path = "../../saya/core" }
katana_tee_client = { git = "ssh://git@github.com/cartridge-gg/katana-tee.git", rev = "56aa752d2e73e505c356c80b7a00eddd27d4d263" }
amd-sev-snp-attestation-prover = { git = "ssh://git@github.com/cartridge-gg/katana-tee.git", rev = "56aa752d2e73e505c356c80b7a00eddd27d4d263", features = ["sp1"] }
amd-sev-snp-attestation-verifier = { git = "ssh://git@github.com/cartridge-gg/katana-tee.git", rev = "56aa752d2e73e505c356c80b7a00eddd27d4d263" }
amd_tee_registry_client = { git = "ssh://git@github.com/cartridge-gg/katana-tee.git", rev = "56aa752d2e73e505c356c80b7a00eddd27d4d263" }
x509-verifier-rust-crypto = { git = "ssh://git@github.com/cartridge-gg/katana-tee.git", rev = "56aa752d2e73e505c356c80b7a00eddd27d4d263" }
katana_tee_client = { git = "ssh://git@github.com/cartridge-gg/katana-tee.git", rev = "649f0864434ea7895a977318e502b4e19666d10b" }
amd-sev-snp-attestation-prover = { git = "ssh://git@github.com/cartridge-gg/katana-tee.git", rev = "649f0864434ea7895a977318e502b4e19666d10b", features = ["sp1"] }
amd-sev-snp-attestation-verifier = { git = "ssh://git@github.com/cartridge-gg/katana-tee.git", rev = "649f0864434ea7895a977318e502b4e19666d10b" }
amd_tee_registry_client = { git = "ssh://git@github.com/cartridge-gg/katana-tee.git", rev = "649f0864434ea7895a977318e502b4e19666d10b" }
x509-verifier-rust-crypto = { git = "ssh://git@github.com/cartridge-gg/katana-tee.git", rev = "649f0864434ea7895a977318e502b4e19666d10b" }
alloy-primitives = "1.3.1"

piltover = { package = "piltover", git = "https://github.com/cartridge-gg/piltover.git", rev = "dc86b13de0713c172153c4833fd7b3d14a855351" }
piltover = { package = "piltover", git = "https://github.com/cartridge-gg/piltover.git", branch = "feat/tee-persistent" }
cainome = { version = "0.10.1", features = ["abigen-rs"] }
sha3 = "0.10"

Expand Down
1 change: 1 addition & 0 deletions bin/persistent-tee/src/attestor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ impl TeeAttestor {
messages_commitment: attestation.messages_commitment,
l2_to_l1_messages,
l1_to_l2_messages,
katana_tee_config_hash: attestation.katana_tee_config_hash,
})
}
}
2 changes: 2 additions & 0 deletions bin/persistent-tee/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ impl TeeProver {
messages_commitment: attestation.messages_commitment,
l2_to_l1_messages: vec![],
l1_to_l2_messages: vec![],
katana_tee_config_hash: attestation.katana_tee_config_hash,
};

let tee = TeeAttestationProver::from_response(&response)?;
Expand Down Expand Up @@ -167,6 +168,7 @@ impl TeeProver {
messages_commitment: attestation.messages_commitment,
l2_to_l1_messages: attestation.l2_to_l1_messages,
l1_to_l2_messages: attestation.l1_to_l2_messages,
katana_tee_config_hash: attestation.katana_tee_config_hash,
})
}
}
1 change: 1 addition & 0 deletions bin/persistent-tee/src/settlement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ fn build_tee_calldata(proof: &TeeProof) -> Result<Vec<Felt>> {
messages_to_starknet: messages_to_starknet(&proof.l2_to_l1_messages),
messages_to_appchain: messages_to_appchain(&proof.l1_to_l2_messages),
l1_to_l2_msg_hashes,
katana_tee_config_hash: proof.katana_tee_config_hash,
};

Ok(PiltoverInput::cairo_serialize(&PiltoverInput::TeeInput(
Expand Down
2 changes: 1 addition & 1 deletion bin/persistent/Cargo.lock

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

2 changes: 1 addition & 1 deletion bin/persistent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ generate-pie = { git = "https://github.com/keep-starknet-strange/snos.git", rev
hex = { version = "0.4.3", default-features = false }
integrity = { git = "https://github.com/chudkowsky/integrity-rs.git", rev = "9729be1", default-features = false, features = ["recursive_with_poseidon", "keccak_160_lsb", "stone6"] }
num-traits = { version = "0.2.19", default-features = false }
piltover = { package = "piltover", git = "https://github.com/cartridge-gg/piltover.git", rev = "67e65b8928b7ee3c2c188bf36c6b9eddc14addb2" }
piltover = { package = "piltover", git = "https://github.com/cartridge-gg/piltover.git", branch = "feat/tee-persistent" }
cainome = { version = "0.10.1", features = ["abigen-rs"] }
reqwest = { version = "0.12.12", default-features = false, features = ["json", "multipart", "rustls-tls"] }
serde = { version = "1.0.217", default-features = false, features = ["derive"] }
Expand Down
4 changes: 4 additions & 0 deletions saya/core/src/prover/tee/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ pub struct TeeProof {
pub l2_to_l1_messages: Vec<L2ToL1Message>,
/// All L1→L2 messages processed in the attested block range.
pub l1_to_l2_messages: Vec<L1ToL2Message>,
/// Versioned environment config hash carried through from the attestation.
/// Bound into Piltover's `TEEInput.katana_tee_config_hash` at settlement time.
pub katana_tee_config_hash: Felt,
}

impl HasBlockNumber for TeeProof {
Expand Down Expand Up @@ -152,6 +155,7 @@ impl TeeProver {
messages_commitment: attestation.messages_commitment,
l2_to_l1_messages: attestation.l2_to_l1_messages,
l1_to_l2_messages: attestation.l1_to_l2_messages,
katana_tee_config_hash: attestation.katana_tee_config_hash,
}
}
}
5 changes: 5 additions & 0 deletions saya/core/src/tee/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ pub struct TeeAttestation {
pub l2_to_l1_messages: Vec<L2ToL1Message>,
/// All L1→L2 messages processed in the attested block range.
pub l1_to_l2_messages: Vec<L1ToL2Message>,
/// Versioned environment config hash bound into v1 SEV-SNP `report_data`.
/// Sourced from the Katana RPC response and threaded to the on-chain
/// `TEEInput.katana_tee_config_hash` so Piltover's runtime invariant
/// (`tee_input == KatanaTeeProgramInfo.katana_tee_config_hash`) holds.
pub katana_tee_config_hash: Felt,
}

impl HasBlockNumber for TeeAttestation {
Expand Down
22 changes: 12 additions & 10 deletions tests/e2e/tests/settlement.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use piltover::ProgramInfo;
use saya_e2e::{
compose_up, env, get_facts_registry, get_program_info, provider, wait_for_settlement,
ComposeGuard,
Expand Down Expand Up @@ -38,16 +39,17 @@ async fn test_program_info_and_fact_registry() {
env::fee_token_address(),
]);

assert_eq!(
program_info.bootloader_program_hash,
BOOTLOADER_PROGRAM_HASH
);
assert_eq!(program_info.snos_program_hash, SNOS_PROGRAM_HASH);
assert_eq!(
program_info.layout_bridge_program_hash,
LAYOUT_BRIDGE_PROGRAM_HASH
);
assert_eq!(program_info.snos_config_hash, snos_config_hash);
let info = match program_info {
ProgramInfo::StarknetOs(info) => info,
ProgramInfo::KatanaTee(_) => {
panic!("e2e settlement test expects StarknetOs config, got KatanaTee variant")
}
};

assert_eq!(info.bootloader_program_hash, BOOTLOADER_PROGRAM_HASH);
assert_eq!(info.snos_program_hash, SNOS_PROGRAM_HASH);
assert_eq!(info.layout_bridge_program_hash, LAYOUT_BRIDGE_PROGRAM_HASH);
assert_eq!(info.snos_config_hash, snos_config_hash);
assert_eq!(facts_registry, env::fact_registry_address());
}

Expand Down
Loading