Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Governance indexing #4774

Closed
wants to merge 2 commits into from
Closed

Governance indexing #4774

wants to merge 2 commits into from

Conversation

cronokirby
Copy link
Contributor

This should supercede #4708, now that the event changes have landed.

I took the structure in there, and munged it a bit to fit the current framework we use in the reset of the indexer code.

Checklist before requesting a review

  • If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason:

    pindexer only

cronokirby and others added 2 commits July 25, 2024 20:29
Slightly redundant, but the governance indexer wants this, so we can
have it too.
Co-authored-by: plaidfinch <plaidfinch@users.noreply.github.com>
@hdevalence
Copy link
Member

Closing in favor of the original work in #4708 which powers the governance frontend.

@hdevalence hdevalence closed this Jul 26, 2024
Comment on lines +17 to +20
/// One of the possible events that we care about.
#[derive(Clone, Debug)]
enum Event {
ProposalSubmit {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to define an event enum here. Processing the events, as in the original code, works fine.

Comment on lines +1 to +55
CREATE TABLE IF NOT EXISTS governance_proposals (
proposal_id INTEGER PRIMARY KEY,
title TEXT NOT NULL,
description TEXT NOT NULL,
kind JSONB NOT NULL,
payload JSONB,
start_block_height BIGINT NOT NULL,
end_block_height BIGINT NOT NULL,
state JSONB NOT NULL,
proposal_deposit_amount BIGINT NOT NULL,
withdrawn BOOLEAN DEFAULT FALSE,
withdrawal_reason TEXT
);

CREATE INDEX ON governance_proposals (title text_pattern_ops);
CREATE INDEX ON governance_proposals (kind);
CREATE INDEX ON governance_proposals (start_block_height DESC);
CREATE INDEX ON governance_proposals (end_block_height DESC);
CREATE INDEX ON governance_proposals (state);
CREATE INDEX ON governance_proposals (withdrawn);


CREATE TABLE IF NOT EXISTS governance_validator_votes (
id SERIAL PRIMARY KEY,
proposal_id INTEGER NOT NULL,
identity_key TEXT NOT NULL,
vote JSONB NOT NULL,
voting_power BIGINT NOT NULL,
block_height BIGINT NOT NULL,
FOREIGN KEY (proposal_id) REFERENCES governance_proposals(proposal_id)
);

CREATE INDEX ON governance_validator_votes (proposal_id);
CREATE INDEX ON governance_validator_votes (identity_key);
CREATE INDEX ON governance_validator_votes (vote);
CREATE INDEX ON governance_validator_votes (voting_power);
CREATE INDEX ON governance_validator_votes (block_height);


CREATE TABLE IF NOT EXISTS governance_delegator_votes (
id SERIAL PRIMARY KEY,
proposal_id INTEGER NOT NULL,
identity_key TEXT NOT NULL,
vote JSONB NOT NULL,
voting_power BIGINT NOT NULL,
block_height BIGINT NOT NULL,
FOREIGN KEY (proposal_id) REFERENCES governance_proposals(proposal_id)
);

CREATE INDEX ON governance_delegator_votes (proposal_id);
CREATE INDEX ON governance_delegator_votes (identity_key);
CREATE INDEX ON governance_delegator_votes (vote);
CREATE INDEX ON governance_delegator_votes (voting_power);
CREATE INDEX ON governance_delegator_votes (block_height);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not doing this was already discussed in the original PR: #4708 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants