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

feat(adr-032): Add ResumeFinalityProposal and handler #242

Merged
merged 13 commits into from
Nov 20, 2024
Merged

Conversation

gitferry
Copy link
Member

@gitferry gitferry commented Oct 31, 2024

This PR introduces the ResumeFinalityProposal and implements the handler, which is part of ADR-32. This part is quite independent and the algorithm of choosing finality providers to jail can be implemented in the future

@gitferry gitferry marked this pull request as ready for review October 31, 2024 14:44
@gitferry gitferry requested a review from a team as a code owner October 31, 2024 14:44
@gitferry gitferry requested review from KonradStaniec and Lazar955 and removed request for a team October 31, 2024 14:44
}

func generateNFpPks(t *testing.T, r *rand.Rand, n int) []bbntypes.BIP340PubKey {
fpPks := make([]bbntypes.BIP340PubKey, 0)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fpPks := make([]bbntypes.BIP340PubKey, 0)
fpPks := make([]bbntypes.BIP340PubKey, 0, n)

Comment on lines 83 to 90
fpPks := make([]bbntypes.BIP340PubKey, len(fps.FinalityProviders))
for i, pkStr := range fps.FinalityProviders {
pk, err := bbntypes.NewBIP340PubKeyFromHex(pkStr)
if err != nil {
return nil, fmt.Errorf("invalid finality provider public key %s: %w", pkStr, err)
}
fpPks[i] = *pk
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fpPks := make([]bbntypes.BIP340PubKey, len(fps.FinalityProviders))
for i, pkStr := range fps.FinalityProviders {
pk, err := bbntypes.NewBIP340PubKeyFromHex(pkStr)
if err != nil {
return nil, fmt.Errorf("invalid finality provider public key %s: %w", pkStr, err)
}
fpPks[i] = *pk
}
fpPks := make([]bbntypes.BIP340PubKey, 0, len(fps.FinalityProviders)) // avoid wrangling indexes
for i, pkStr := range fps.FinalityProviders {
pk, err := bbntypes.NewBIP340PubKeyFromHex(pkStr)
if err != nil {
return nil, fmt.Errorf("invalid finality provider public key %s: %w", pkStr, err)
}
fpPks = append(fpPks, *pk)
}

)

// NewResumeFinalityProposalHandler is a handler for governance proposal on resume finality.
func NewResumeFinalityProposalHandler(k keeper.Keeper) govtypesv1.Handler {
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm why usage of the old way of handling proposals ? (which I think is discouraged)

Wouldn't it be better to have separate message on finality provider message server which can be only executed by governance module ? (similar to parameters updates)

@gitferry gitferry force-pushed the gai/gov-jail-fp branch 2 times, most recently from 8b76ab0 to 7213b30 Compare November 18, 2024 10:21
@gitferry gitferry merged commit d204d98 into main Nov 20, 2024
19 checks passed
@gitferry gitferry deleted the gai/gov-jail-fp branch November 20, 2024 12:47
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.

3 participants