Skip to content

Commit 0bd3f2f

Browse files
committed
Extend gnosis keyper tables
Add tables to store - the current decryption trigger - decryption slot signatures
1 parent 3a426c3 commit 0bd3f2f

File tree

4 files changed

+169
-1
lines changed

4 files changed

+169
-1
lines changed

rolling-shutter/keyperimpl/gnosis/database/gnosiskeyper.sqlc.gen.go

Lines changed: 115 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rolling-shutter/keyperimpl/gnosis/database/models.sqlc.gen.go

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rolling-shutter/keyperimpl/gnosis/database/sql/queries/gnosiskeyper.sql

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,24 @@ ON CONFLICT DO NOTHING;
5151
INSERT INTO tx_pointer (eon, block, value)
5252
VALUES ($1, $2, $3)
5353
ON CONFLICT (eon) DO UPDATE
54-
SET block = $2, value = $3;
54+
SET block = $2, value = $3;
55+
56+
-- name: SetCurrentDecryptionTrigger :exec
57+
INSERT INTO current_decryption_trigger (eon, block, tx_pointer, identities_hash)
58+
VALUES ($1, $2, $3, $4)
59+
ON CONFLICT (eon) DO UPDATE
60+
SET block = $2, tx_pointer = $3, identities_hash = $4;
61+
62+
-- name: GetCurrentDecryptionTrigger :one
63+
SELECT * FROM current_decryption_trigger
64+
WHERE eon = $1;
65+
66+
-- name: InsertSlotDecryptionSignature :exec
67+
INSERT INTO slot_decryption_signatures (eon, block, keyper_index, tx_pointer, identities_hash, signature)
68+
VALUES ($1, $2, $3, $4, $5, $6);
69+
70+
-- name: GetSlotDecryptionSignatures :many
71+
SELECT * FROM slot_decryption_signatures
72+
WHERE eon = $1 AND block = $2 AND tx_pointer = $3 AND identities_hash = $4
73+
ORDER BY keyper_index ASC
74+
LIMIT $5;

rolling-shutter/keyperimpl/gnosis/database/sql/schemas/gnosiskeyper.sql

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,21 @@ CREATE TABLE tx_pointer(
2929
eon bigint PRIMARY KEY,
3030
block bigint NOT NULL DEFAULT 0,
3131
value bigint NOT NULL DEFAULT 0
32+
);
33+
34+
CREATE TABLE current_decryption_trigger(
35+
eon bigint PRIMARY KEY CHECK (eon >= 0),
36+
block bigint NOT NULL CHECK (block >= 0),
37+
tx_pointer bigint NOT NULL CHECK (tx_pointer >= 0),
38+
identities_hash bytea NOT NULL
39+
);
40+
41+
CREATE TABLE slot_decryption_signatures(
42+
eon bigint NOT NULL CHECK (eon >= 0),
43+
block bigint NOT NULL CHECK (block >= 0),
44+
keyper_index bigint NOT NULL,
45+
tx_pointer bigint NOT NULL CHECK (tx_pointer >= 0),
46+
identities_hash bytea NOT NULL,
47+
signature bytea NOT NULL,
48+
PRIMARY KEY (eon, block, keyper_index)
3249
);

0 commit comments

Comments
 (0)