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 @@ -60,7 +60,7 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features =
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
18 changes: 11 additions & 7 deletions bin/ops/src/core_contract/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ pub const MAINNET_RPC_URL: &str = "https://api.cartridge.gg/x/starknet/mainnet";

// Embed contract files into the binary.
//
// PILTOVER_CONTRACT_BYTES stays vendored: its class hash
// (`DEFAULT_PILTOVER_CLASS_HASH` below) is load-bearing for already-deployed
// Piltover on Sepolia/Mainnet, and piltover's current `feat/tee-persistent`
// branch has a modified `src/appchain.cairo` that would produce a different
// class hash. DO NOT rebuild this artifact from the submodule.
// PILTOVER_CONTRACT_BYTES is regenerated from the `piltover` submodule via
// `scarb build` and committed alongside the submodule pointer at
// `cartridge-gg/piltover#feat/tee-persistent` (`ebb714b`). The corresponding
// class hash is mirrored in `DEFAULT_PILTOVER_CLASS_HASH` below.
//
// Operators interacting with already-deployed Piltovers on Sepolia/Mainnet
// (whose class hash predates this rebuild) must pass `--class-hash` explicitly
// to commands that take a default class hash.
pub const PILTOVER_CONTRACT_BYTES: &[u8] =
include_bytes!("../../../../contracts/core_contract.json");

Expand All @@ -32,9 +35,10 @@ pub const TEE_REGISTRY_MOCK_BYTES: &[u8] =
/// The default class hash of the piltover core contract.
/// This class hash corresponds to the piltover contract compiled from
/// the source code at:
/// https://github.com/cartridge-gg/piltover/tree/67e65b8928b7ee3c2c188bf36c6b9eddc14addb2
/// https://github.com/cartridge-gg/piltover/tree/ebb714b3a0e63da8088ea4f371bcca2a1a3f74f0
/// (`feat/tee-persistent` post-PR-#16, with `ProgramInfo` enum split).
pub const DEFAULT_PILTOVER_CLASS_HASH: &str =
"0x777e9e5d8191c112d75551c5c323809ebb25e76d45d0ee9fcd7f95a9abf76fe";
"0x38a8e7e81744f89ae85d64c036101c124c19b4e6844c6d73f922f03d89487e6";

/// The StarknetOS program (SNOS) is the cairo program that executes the state
/// transition of a new Katana block from the previous block.
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 @@ -204,10 +204,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
30 changes: 15 additions & 15 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 @@ -18,14 +18,14 @@ repository.workspace = true

[dependencies]
saya-core = { path = "../../saya/core" }
katana_tee_client = { git = "https://github.com/cartridge-gg/katana-tee.git", rev = "56aa752d2e73e505c356c80b7a00eddd27d4d263" }
amd-sev-snp-attestation-prover = { git = "https://github.com/cartridge-gg/katana-tee.git", rev = "56aa752d2e73e505c356c80b7a00eddd27d4d263", default-features = false, features = ["sp1"] }
amd-sev-snp-attestation-verifier = { git = "https://github.com/cartridge-gg/katana-tee.git", rev = "56aa752d2e73e505c356c80b7a00eddd27d4d263" }
amd_tee_registry_client = { git = "https://github.com/cartridge-gg/katana-tee.git", rev = "56aa752d2e73e505c356c80b7a00eddd27d4d263" }
x509-verifier-rust-crypto = { git = "https://github.com/cartridge-gg/katana-tee.git", rev = "56aa752d2e73e505c356c80b7a00eddd27d4d263" }
katana_tee_client = { git = "https://github.com/cartridge-gg/katana-tee.git", rev = "649f0864434ea7895a977318e502b4e19666d10b" }
amd-sev-snp-attestation-prover = { git = "https://github.com/cartridge-gg/katana-tee.git", rev = "649f0864434ea7895a977318e502b4e19666d10b", default-features = false, features = ["sp1"] }
amd-sev-snp-attestation-verifier = { git = "https://github.com/cartridge-gg/katana-tee.git", rev = "649f0864434ea7895a977318e502b4e19666d10b" }
amd_tee_registry_client = { git = "https://github.com/cartridge-gg/katana-tee.git", rev = "649f0864434ea7895a977318e502b4e19666d10b" }
x509-verifier-rust-crypto = { git = "https://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 @@ -181,6 +181,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 @@ -213,6 +214,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 @@ -109,6 +109,7 @@ fn build_tee_calldata(proof: &TeeProof, mock_prove: bool) -> 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 @@ -27,7 +27,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
6 changes: 4 additions & 2 deletions compose.e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

services:
saya:
image: ${SAYA_IMAGE:-ghcr.io/dojoengine/saya:latest}
build:
context: .
dockerfile: Dockerfile
container_name: saya
networks: [saya_net]
restart: "no"
Expand All @@ -30,7 +32,7 @@ services:
persistent start \
--rollup-rpc http://katana_l3:5050 \
--settlement-rpc http://katana_l2:5050 \
--settlement-piltover-address 0x387f8d08b19b4f0b3809a3411eab4a27f804ad672a37faeab77bd99af2b9896 \
--settlement-piltover-address 0x5f8c60f1c40b63452d3b5cb39669d35b37ec57d0761ad12ecdadd00c3d90102 \
--settlement-account-address ${ADDRESS_KATANA0:-0x127fd5f1fe78a71f8bcd1fec63e3fe2f0486b6ecd5c86a0466c3a21fa5cfcec} \
--settlement-account-private-key ${PRIVATE_KEY_KATANA0:-0xc5b2fcab997346f3ea1c00b002ecf6f382c5f9c9659a3894eb783c5320f912} \
--mock-layout-bridge-program-hash 0x43c5c4cc37c4614d2cf3a833379052c3a38cd18d688b617e2c720e8f941cb8 \
Expand Down
8 changes: 5 additions & 3 deletions compose.l2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
# The saya_net network is created here and shared with compose.l3.yml / compose.e2e.yml.

x-saya-common: &saya-common
image: ghcr.io/dojoengine/saya:v0.2.2
build:
context: .
dockerfile: Dockerfile
dns: 127.0.0.11
networks: [saya_net]
restart: "no"
Expand Down Expand Up @@ -127,7 +129,7 @@ services:
- http://katana_l2:5050
- setup-program
- --core-contract-address
- "0x387f8d08b19b4f0b3809a3411eab4a27f804ad672a37faeab77bd99af2b9896"
- "0x5f8c60f1c40b63452d3b5cb39669d35b37ec57d0761ad12ecdadd00c3d90102"
- --chain-id
- ${L3_CHAIN_ID:-custom}
- --fact-registry-address
Expand All @@ -150,7 +152,7 @@ services:
sleep 2

sozo deploy 0x011dceea1eeb800a2a87454e424acb9158b5c649687d92a045c3eb6b73a182db \
--constructor-calldata 0x387f8d08b19b4f0b3809a3411eab4a27f804ad672a37faeab77bd99af2b9896 \
--constructor-calldata 0x5f8c60f1c40b63452d3b5cb39669d35b37ec57d0761ad12ecdadd00c3d90102 \
--salt 0x1234 \
--katana-account katana0 \
--rpc-url http://katana_l2:5050
Expand Down
2 changes: 1 addition & 1 deletion compose.l3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
--settlement-chain http://katana_l2:5050 \
--output-path /shared/katana_config \
--id ${L3_CHAIN_ID:-custom} \
--settlement-contract ${CORE_CONTRACT_ADDRESS:-0x387f8d08b19b4f0b3809a3411eab4a27f804ad672a37faeab77bd99af2b9896} \
--settlement-contract ${CORE_CONTRACT_ADDRESS:-0x5f8c60f1c40b63452d3b5cb39669d35b37ec57d0761ad12ecdadd00c3d90102} \
--settlement-contract-deployed-block ${CORE_CONTRACT_DEPLOYED_BLOCK:-1} \
--settlement-facts-registry ${FACT_REGISTRY_ADDRESS:-0x3eb0d510d1238120bf7f9d176faafe0c7066797a86be985855952f87769d3bd}

Expand Down
Loading
Loading