diff --git a/catalyst-gateway/bin/src/db/index/schema/cql/cip509_registration.cql b/catalyst-gateway/bin/src/db/index/schema/cql/cip509_registration.cql new file mode 100644 index 0000000000..db23eb24d9 --- /dev/null +++ b/catalyst-gateway/bin/src/db/index/schema/cql/cip509_registration.cql @@ -0,0 +1,20 @@ +-- Index of CIP-509 registrations. Valid. +CREATE TABLE IF NOT EXISTS cip509_registration ( + -- Primary Key Data + vote_key blob, -- 32 Bytes of Vote Key. + stake_address blob, -- 32 Bytes of Stake Address. + nonce varint, -- Nonce that has been slot corrected. + slot_no varint, -- slot number when the key_was_registered/re-registered. + txn smallint, -- Index of the TX which holds the registration data. + + -- Non-Key Data + purpose blob, -- 16 Bytes of UUIDv4 Purpose. + txn_inputs_hash blob, -- 16 Bytes of TX inputs hash. + prv_txn_id blob, + -- WIP: what data is relevant for indexing + -- x509_chunks list, -- x509 chunks. + validation_signature blob, -- Validation signature. + + PRIMARY KEY ((vote_key, stake_address), nonce, slot_no, txn) +) +WITH CLUSTERING ORDER BY (nonce DESC, slot_no DESC, txn DESC); diff --git a/catalyst-gateway/bin/src/db/index/schema/mod.rs b/catalyst-gateway/bin/src/db/index/schema/mod.rs index 4bfd4725db..bfa62646a5 100644 --- a/catalyst-gateway/bin/src/db/index/schema/mod.rs +++ b/catalyst-gateway/bin/src/db/index/schema/mod.rs @@ -64,6 +64,11 @@ const SCHEMAS: &[(&str, &str)] = &[ include_str!("./cql/cip36_registration_for_vote_key.cql"), "Create Table CIP-36 Registration For a stake address", ), + ( + // CIP-509 Registration Table Schema + include_str!("./cql/cip509_registration.cql"), + "Create Table CIP-509 Registration", + ), ]; /// Get the namespace for a particular db configuration