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(sequencer): set/update reward addr #510

Merged
merged 118 commits into from
Aug 25, 2024

Conversation

danwt
Copy link
Contributor

@danwt danwt commented Aug 15, 2024

PR Standards

Closes #509 #508


I will follow up with some improvements in other PRs

Opening a pull request should be able to meet the following requirements


All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow-up issues.

For Author:

  • Targeted PR against correct branch
  • included the correct type prefix in the PR title
  • Linked to Github issue with discussion and accepted design
  • Targets only one github issue
  • Wrote unit and integration tests
  • All CI checks have passed
  • Added relevant godoc comments

For Reviewer:

  • confirmed the correct type prefix in the PR title
  • Reviewers assigned
  • confirmed all author checklist items have been addressed

After reviewer approval:

  • In case targets main branch, PR should be squashed and merged.
  • In case PR targets a release branch, PR should be rebased.

x/sequencers/keeper/msg_server.go Fixed Show fixed Hide fixed
x/sequencers/keeper/msg_server.go Fixed Show fixed Hide fixed
x/sequencers/keeper/msg_server.go Fixed Show fixed Hide fixed
x/sequencers/keeper/msg_server.go Fixed Show fixed Hide fixed
proto/sequencers/tx.proto Outdated Show resolved Hide resolved
proto/sequencers/tx.proto Outdated Show resolved Hide resolved
x/dist/keeper/allocation.go Show resolved Hide resolved
x/dist/keeper/allocation.go Show resolved Hide resolved
x/sequencers/keeper/msg_server.go Outdated Show resolved Hide resolved
x/sequencers/keeper/msg_server.go Outdated Show resolved Hide resolved
x/sequencers/keeper/params.go Show resolved Hide resolved
x/sequencers/keeper/dymint.go Outdated Show resolved Hide resolved
x/sequencers/keeper/msg_server.go Show resolved Hide resolved
@danwt danwt requested a review from mtsitrin August 23, 2024 15:17
@danwt
Copy link
Contributor Author

danwt commented Aug 23, 2024

I realised I overcomplicated a lot before @mtsitrin , it's much simpler now, and still secure


msgs := make([]sdk.Msg, 1)

msg, err := types.BuildMsgCreateSequencer(func(msg []byte) ([]byte, cryptotypes.PubKey, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

msg []byte is actaully the payload to sign right? not to be confused with the msg created


consAddr, err := v.GetConsAddr()
if err != nil {
panic(err) // it must be ok because we used it to check sig
Copy link
Collaborator

@mtsitrin mtsitrin Aug 25, 2024

Choose a reason for hiding this comment

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

why not return err?
I think it checked in validateBasic anyway

Copy link
Contributor

@omritoptix omritoptix left a comment

Choose a reason for hiding this comment

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

Looks good! few minor comments. plus:

  1. the module readme is outdated
  2. did we test it with ledger (i.e the consensus address signing) ?

func NewUpdateCmd() *cobra.Command {
short := "Update a sequencer object, to claim rewards etc."
long := strings.TrimSpace(short +
`Requires signature from consensus address public key. Specify consensus key in keyring uid.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's wrong long. we don't require sig over consesus pubkey here.

)

// NewHandler returns a new msg handler.
func NewHandler(k keeper.Keeper) sdk.Handler {
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this file is redundant. in sdk 0.46 you simply need to simply register your msg server infront of your keeper and implement the corresponding methods in the keeper.

// The reasoning is as follows:
//
// We know from the SDK TX signing mechanism that the account originates from the operator, and on this chain ID.
// Therefore, we just need to check that the consensus private key also signed over this account and chain ID.
Copy link
Contributor

Choose a reason for hiding this comment

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

I blv this godoc is wrong as we're only checking if signed on validator address.

@omritoptix
Copy link
Contributor

omritoptix commented Aug 25, 2024

to not block testing, gonna merge it and open technical debt with @mtsitrin and myself comments.

@omritoptix omritoptix merged commit 28628bc into main Aug 25, 2024
7 checks passed
@omritoptix omritoptix deleted the danwt/509-do-not-require-rewards-addr-on-genesis branch August 25, 2024 10:50
@danwt
Copy link
Contributor Author

danwt commented Aug 27, 2024

followup #526

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

Successfully merging this pull request may close these issues.

Remove the need to supply proposer reward address on genesis
3 participants