-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure db tables for TEE proof generation
Make them more flexible to allow multiple proofs for each (batch_number, tee_type) pair.
- Loading branch information
Showing
22 changed files
with
299 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...lib/dal/.sqlx/query-184573db68b82c15ad5a647b4784b4a0c11d0a45774fade80e88cb902104fe28.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
...lib/dal/.sqlx/query-1ef09a1df23f8dea9779f34350b38dbd01af9068af4059b53fe79a6f2505b0a5.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
...lib/dal/.sqlx/query-7b11e9d71ba1b19a4976e574286304afac6fc7b4c3e5bed2ff4f7da248523e33.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
...lib/dal/.sqlx/query-94eefcf763d8a4bc6a6c1860be17042743766d7fc2c231bb699bef005b81a7fc.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
...lib/dal/.sqlx/query-eddef3ecd6cdc205e91ae9ceaa23521353d37863bad59cc4c364b83d02e63db1.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
core/lib/dal/migrations/20240325133100_add_tee_verifier_input_producer_jobs_table.down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
core/lib/dal/migrations/20240523085604_add_tee_proof_generation_details_table.down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
DROP TABLE IF EXISTS tee_attestations; | ||
DROP TABLE IF EXISTS tee_proof_generation_details; | ||
DROP INDEX IF EXISTS idx_proofs_number_per_batch_number_and_tee_type; | ||
|
||
DROP INDEX IF EXISTS idx_tee_proof_generation_details_status_prover_taken_at; | ||
DROP TABLE IF EXISTS tee_attestations; | ||
DROP TABLE IF EXISTS tee_proofs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use serde::{Deserialize, Serialize}; // TODO needed? | ||
use zksync_types::{tee_types::TeeType, L1BatchNumber}; | ||
|
||
/// Represents a proof generated within a TEE enclave | ||
/// TODO move it to core/lib/types/src/api/mod.rs and call TeeProof? | ||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct StorageTeeProof { | ||
// batch number for which the proof was generated | ||
pub l1_batch_number: L1BatchNumber, | ||
// type of TEE used for attestation | ||
pub tee_type: Option<TeeType>, | ||
// pubkey used for signature verification; each key pair is attested by the TEE attestation | ||
// stored in the db | ||
pub pubkey: Option<Vec<u8>>, | ||
// signature generated within the TEE enclave, using the privkey corresponding to the pubkey | ||
pub signature: Option<Vec<u8>>, | ||
// data that was signed | ||
pub proof: Option<Vec<u8>>, | ||
// attestation quote generated within the TEE enclave | ||
pub attestation: Option<Vec<u8>>, | ||
// timestamp when the proof was generated | ||
pub proved_at: chrono::DateTime<chrono::Utc>, | ||
} | ||
|
||
/// TODO rename it TeeProof once StorageTeeProof is moved to api/mod.rs? | ||
#[derive(Debug, Clone, sqlx::FromRow)] | ||
pub struct TmpStorageTeeProof { | ||
#[allow(dead_code)] | ||
pub id: i64, | ||
pub pubkey: Option<Vec<u8>>, | ||
pub signature: Option<Vec<u8>>, | ||
pub proof: Option<Vec<u8>>, | ||
pub proved_at: chrono::DateTime<chrono::Utc>, | ||
pub attestation: Option<Vec<u8>>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.