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

epoching: Wrapped messages and AnteHandler implementation #18

Merged
merged 27 commits into from
Jun 28, 2022

Conversation

SebastianElvis
Copy link
Member

@SebastianElvis SebastianElvis commented Jun 21, 2022

Depends on #15 (for DropValidatorMsgDecorator) and the checkpointing module (for CreateValidatorBLS API)

Fixes BM-25.

This PR implements the DropValidatorMsgDecorator AnteHandler that rejects all non-wrapped validator-related messages, and introduces wrapped variants of these validator-related messages.

Base automatically changed from epoching-antehandler to main June 21, 2022 09:37
Copy link
Contributor

@aakoshh aakoshh left a comment

Choose a reason for hiding this comment

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

Cool, I see you decided to go with the version where all the non-BLS related stuff will stay in the epoching module, and only the MsgCreateValidator will appear under checkpointing, and users will just have to pick the right command on the CLI.

So, signing for the MsgCreateValidator will have the validator and delegator signatures over the content - the question will be what the content should be. It will have to include the BLS parts, so nobody can replace a validator's BSL key with something else. That won't be exactly as it is here, where the signature excludes the bytes of the wrapper.

I wonder how the workflow of signing will differ in those two cases. Looking forward to see your next PR on that 👍


return next(ctx, tx, simulate)
}

func (qmd DropValidatorMsgDecorator) IsValidatorRelatedMsg(msg sdk.Msg) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

When I see IsValidatorRelatedMsg, or anything starting with Is, I expect it to return bool.
It would be more idiomatic, and then for AnteHandle to return the error.

func noOpAnteDecorator() sdk.AnteHandler {
return func(ctx sdk.Context, _ sdk.Tx, _ bool) (sdk.Context, error) {
return ctx, nil
func TestDropValidatorMsgDecorator(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Comment on lines +41 to +48
func (msg MsgWrappedDelegate) GetSigners() []sdk.AccAddress {
return msg.Msg.GetSigners()
}

// GetSignBytes returns the message bytes to sign over.
func (msg MsgWrappedDelegate) GetSignBytes() []byte {
return msg.Msg.GetSignBytes()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, so in this case users will have to do the exact same signing procedure, sign just the staking messages, and just send a wrapped version.

Does the outer transaction get signed at all?

Copy link
Member Author

@SebastianElvis SebastianElvis Jun 28, 2022

Choose a reason for hiding this comment

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

I think so. The outer transaction has to be signed in order to get accepted by Tendermint. Signing inner transactions seems unnecessary as it will be used only in the staking module and the staking module does not need to verify the inner transactions.

@SebastianElvis
Copy link
Member Author

Thanks Akosh! I have fixed or replied your comments. As this PR blocks CI of other PRs and you have approved this PR, I merged it directly.

@SebastianElvis SebastianElvis merged commit 8a98a35 into main Jun 28, 2022
@SebastianElvis SebastianElvis deleted the epoching-wrapped-msg-and-antehandler branch June 28, 2022 04:27
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