Skip to content

Commit

Permalink
Merge pull request #836 from oasisprotocol/ptrus/feature/block-propos…
Browse files Browse the repository at this point in the history
…er-idx

storage: Update block proposer index to include height
  • Loading branch information
ptrus authored Dec 19, 2024
2 parents 702abf4 + fa85199 commit 60879b1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions .changelog/836.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
storage: Update block proposer index to include height
5 changes: 3 additions & 2 deletions storage/migrations/00_consensus.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ CREATE TABLE chain.blocks
namespace TEXT NOT NULL,
version UINT63 NOT NULL,
state_root HEX64 NOT NULL,

proposer_entity_id base64_ed25519_pubkey,
signer_entity_ids base64_ed25519_pubkey[]
);
CREATE INDEX ix_blocks_time ON chain.blocks (time);
CREATE INDEX ix_blocks_block_hash ON chain.blocks (block_hash); -- Needed to lookup blocks by hash.
CREATE INDEX ix_blocks_proposer_entity_id ON chain.blocks (proposer_entity_id);
CREATE INDEX ix_blocks_proposer_entity_id ON chain.blocks (proposer_entity_id); -- Removed in 11_blocks_proposer_enitity_height_idx.up.sql
-- CREATE INDEX ix_blocks_proposer_entity_id_height ON chain.blocks (proposer_entity_id, height); -- Added in 11_blocks_proposer_enitity_height_idx.up.sql
CREATE INDEX ix_blocks_signer_entity_ids ON chain.blocks USING gin(signer_entity_ids);

CREATE TABLE chain.transactions
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BEGIN;

CREATE INDEX IF NOT EXISTS ix_blocks_proposer_entity_id_height ON chain.blocks (proposer_entity_id, height);

DROP INDEX IF EXISTS chain.ix_blocks_proposer_entity_id;

COMMIT;

0 comments on commit 60879b1

Please sign in to comment.