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 support for pindexer #4708

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft

Governance support for pindexer #4708

wants to merge 15 commits into from

Conversation

plaidfinch
Copy link
Collaborator

@plaidfinch plaidfinch commented Jul 14, 2024

Describe your changes

This adds a governance module to pindexer, along with tiny changes to pd's governance events to fully support it.

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:

    The only changes to pd are changes to events emitted, which do not break consensus.

This adds the identity key to delegator votes and the voting power to validator votes, as well as
renaming EventEnactProposal to EventProposalPassed (because the former was a misnomer)
Copy link
Collaborator Author

@plaidfinch plaidfinch left a comment

Choose a reason for hiding this comment

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

This self-review attempts to explain the changes made, largely focusing on the changes made to pd, as changes to pindexer are self-contained and still in testing/development.

Copy link
Member

@hdevalence hdevalence left a comment

Choose a reason for hiding this comment

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

There are two high-level changes that need to be made before this can be merged:

  • There should be no changes, even refactorings, to consensus-critical code along the way to adding indexer support. At most, new data can be emitted in events. We don't have bandwidth to carefully review changes to consensus-critical logic along the way to adding this logic.

  • The data produced by the AppView implementation is expected to be consumed by third-party clients. Thus, the AppView impl should not be defining its own data formats ad-hoc. It should be using the canonical data formats we already have, which can be processed using standardized tooling from the Buf registry.

Copy link
Collaborator Author

@plaidfinch plaidfinch left a comment

Choose a reason for hiding this comment

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

All changes, even refactors, to consensus-critical code have been backed out, excepting alterations to emitted events.

Copy link
Collaborator Author

@plaidfinch plaidfinch left a comment

Choose a reason for hiding this comment

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

More self-review on the latest iteration, which I believe resolves the outstanding concerns above.

@@ -296,7 +296,7 @@ impl AppActionHandler for ProposalSubmit {
// state needed to vote as delegators
state.mark_proposal_started();

state.record_proto(event::proposal_submit(self));
state.record_proto(event::proposal_submit(self, current_block, voting_end));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Need to record this information for the indexer.

pb::ProposalKind::UnfreezeIbcClient => ProposalKind::UnfreezeIbcClient,
}
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ProposalKind now has a canonical proto serialization, so that it can be used in application code without ad-hoc serialization formats. It previously lacked one.

Comment on lines +326 to +334
enum ProposalKind {
SIGNALING = 0;
EMERGENCY = 1;
PARAMETER_CHANGE = 2;
COMMUNITY_POOL_SPEND = 3;
UPGRADE_PLAN = 4;
FREEZE_IBC_CLIENT = 5;
UNFREEZE_IBC_CLIENT = 6;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added canonical proto representation for a proposal kind, so that it can be serialized to a database. This is not used in consensus at this time.

Comment on lines +569 to +572
// The start height for the proposal.
uint64 start_height = 2;
// The end height for the proposal.
uint64 end_height = 3;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Need to record start and end heights for proposals when they are submitted.

@hdevalence
Copy link
Member

Running this, I get

Error: error returned from database: bind message supplies 0 parameters, but prepared statement "sqlx_s_2" requires 1

Caused by:
    bind message supplies 0 parameters, but prepared statement "sqlx_s_2" requires 1

@plaidfinch
Copy link
Collaborator Author

plaidfinch commented Jul 17, 2024 via email

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

Successfully merging this pull request may close these issues.

None yet

2 participants