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

[Morse->Shannon Migration] scaffold: MorseAccountState single #1045

Open
wants to merge 3 commits into
base: chore/migration/state-prep
Choose a base branch
from

Conversation

bryanchriswhite
Copy link
Contributor

@bryanchriswhite bryanchriswhite commented Jan 29, 2025

Summary

Scaffolds the on-chain MorseAccountState single as well as a create message/query handlers. Supersedes #1035.

Changes:

  • Scaffolds the on-chain data structure and KV store getters/setters.
  • Scaffolds a create message and query handlers for uploading the morse account state.

Issue

Type of change

Select one or more from the following:

Sanity Checklist

  • I have updated the GitHub Issue assignees, reviewers, labels, project, iteration and milestone
  • For docs, I have run make docusaurus_start
  • For code, I have run make go_develop_and_test and make test_e2e
  • For code, I have added the devnet-test-e2e label to run E2E tests in CI
  • For configurations, I have update the documentation
  • I added TODOs where applicable

@bryanchriswhite bryanchriswhite added on-chain On-chain business logic consensus-breaking IMPORTANT! If the PR with this tag is merged, next release WILL HAVE TO BE an upgrade. labels Jan 29, 2025
@bryanchriswhite bryanchriswhite self-assigned this Jan 29, 2025
@bryanchriswhite bryanchriswhite force-pushed the issues/1034/scaffold/morse_account_state branch from 89b83f7 to b720680 Compare January 29, 2025 12:58
@bryanchriswhite bryanchriswhite linked an issue Jan 29, 2025 that may be closed by this pull request
9 tasks
@bryanchriswhite bryanchriswhite force-pushed the issues/1034/scaffold/morse_account_state branch from b720680 to cf4a0c5 Compare January 29, 2025 13:16
@bryanchriswhite bryanchriswhite marked this pull request as ready for review January 29, 2025 13:54
@Olshansk Olshansk self-requested a review January 29, 2025 18:30
@Olshansk Olshansk added the migration Morse to Shannon migration related work label Jan 29, 2025

}

// Queries a MorseAccountState by index.
Copy link
Member

Choose a reason for hiding this comment

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

  1. It is not clear to be what/where/why this index is
  2. #PUC if this returns the entire MorseAccountState that was uploaded.

}

message QueryGetMorseAccountStateRequest {}
Copy link
Member

Choose a reason for hiding this comment

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

#PUC here and below

message MsgUpdateParamsResponse {}

message MsgCreateMorseAccountState {
Copy link
Member

Choose a reason for hiding this comment

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

Reminder to add comments everywhere.

It's fine if it's AI generated assuming you review/update after.

Keep it concise but clear.

message MsgCreateMorseAccountStateResponse {
bytes state_hash = 1 [(gogoproto.jsontag) = "state_hash"];
uint64 num_accounts = 2 [(gogoproto.jsontag) = "num_accounts"];
Copy link
Member

Choose a reason for hiding this comment

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

Not clear what kind of accounts these are.

  • Nodes/Suppliers?
  • Applications?
  • Validators?
  • Just token holders?

Consider adding TODOs if we're going to expand it

Copy link
Contributor Author

@bryanchriswhite bryanchriswhite Jan 30, 2025

Choose a reason for hiding this comment

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

Will #PUC, but I've been extremely consistent in my phrasing, which I've been careful to keep consitent with tendermint/comet/cosmos conventions. Account only refers to one on-chain concept, which encapsulates a token balance and a public key. While the concrete representation differs from tendermint to cosmos (and cosmos further isolates balance from public keys internally), this conceptualization is sufficient and consistent, in my view.

}

message MsgCreateMorseAccountStateResponse {
Copy link
Member

Choose a reason for hiding this comment

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

#PUC

"github.com/pokt-network/poktroll/x/migration/types"
)

func (k Keeper) MorseAccountState(goCtx context.Context, req *types.QueryGetMorseAccountStateRequest) (*types.QueryGetMorseAccountStateResponse, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Consider adding a req.ValidateBasic() like we do in other parts of the code.


val, found := k.GetMorseAccountState(ctx)
if !found {
return nil, status.Error(codes.NotFound, "not found")
Copy link
Member

Choose a reason for hiding this comment

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

Can we do some logging here as well?

@@ -0,0 +1,48 @@
package keeper_test
Copy link
Member

Choose a reason for hiding this comment

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

NOTE: I'm skiping reviewing unit tests in leu of time.

}
}

func (msg *MsgCreateMorseAccountState) ValidateBasic() error {
Copy link
Member

Choose a reason for hiding this comment

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

Do we not need to validate morseAccountState?

message QueryGetMorseAccountStateRequest {}

message QueryGetMorseAccountStateResponse {
Copy link
Member

Choose a reason for hiding this comment

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

E2E test for this? Doesn't have to be in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have unit/integration coverage over this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus-breaking IMPORTANT! If the PR with this tag is merged, next release WILL HAVE TO BE an upgrade. migration Morse to Shannon migration related work on-chain On-chain business logic
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

[Morse->Shannon Migration] Migration module
2 participants