Skip to content

Commit 20d68df

Browse files
authored
Remove finality cert table constraint in observer (#1030)
Remove the primary key constraint in finality certs in observer to avoid an edge-case where multiple certs for the same instance may be discovered in conjunction with using duckdb appender to insert them. Appender does not offer the ability to insert or ignore records. And even if it did, we probably want to capture all and any certs, since certs are validated before insertion. While at it, also fix a typo in cert JSON struct tags.
1 parent d13dac1 commit 20d68df

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

observer/model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ type FinalityCertificate struct {
5757
Timestamp time.Time `json:"Timestamp"`
5858
NetworkName string `json:"NetworkName"`
5959
Instance uint64 `json:"Instance"`
60-
ECChain []TipSet `json:"Value"`
60+
ECChain []TipSet `json:"ECChain"`
6161
SupplementalData SupplementalData `json:"SupplementalData"`
6262
Signers []uint64 `json:"Signers"`
6363
Signature []byte `json:"Signature"`

observer/schema.sql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ CREATE TABLE IF NOT EXISTS latest_messages (
6565
ALTER TABLE latest_messages
6666
ADD COLUMN IF NOT EXISTS VoteValueKey BLOB;
6767

68-
6968
CREATE TABLE IF NOT EXISTS finality_certificates (
7069
Timestamp TIMESTAMP,
7170
NetworkName VARCHAR,
@@ -87,7 +86,6 @@ CREATE TABLE IF NOT EXISTS finality_certificates (
8786
PowerDelta BIGINT,
8887
SigningKey BLOB
8988
)[],
90-
PRIMARY KEY (NetworkName, Instance)
9189
);
9290

9391
CREATE TABLE IF NOT EXISTS chain_exchanges (

0 commit comments

Comments
 (0)