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

fix(group): migrate group policy account to base accounts with credentials #13742

Merged
merged 8 commits into from
Nov 21, 2022

Conversation

julienrbrt
Copy link
Member

Description

Closes: #13445


Author Checklist

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.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@julienrbrt julienrbrt changed the title fix: set group policy name properly fix: do not set group policy account name Nov 3, 2022
server/start.go Fixed Show fixed Hide fixed
@codecov
Copy link

codecov bot commented Nov 3, 2022

Codecov Report

Merging #13742 (0a2c2d3) into main (c7d4921) will increase coverage by 0.11%.
The diff coverage is 57.98%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #13742      +/-   ##
==========================================
+ Coverage   56.26%   56.37%   +0.11%     
==========================================
  Files         664      676      +12     
  Lines       56484    56989     +505     
==========================================
+ Hits        31780    32129     +349     
- Misses      22130    22243     +113     
- Partials     2574     2617      +43     
Impacted Files Coverage Δ
server/mock/tx.go 53.33% <0.00%> (ø)
x/group/keeper/migrations.go 0.00% <0.00%> (ø)
x/group/module/module.go 48.14% <40.00%> (+0.09%) ⬆️
x/auth/types/credentials.go 62.50% <62.50%> (ø)
x/group/keeper/msg_server.go 68.26% <66.66%> (-0.49%) ⬇️
x/group/migrations/v2/migrate.go 72.72% <72.72%> (ø)
x/auth/types/codec.go 100.00% <100.00%> (ø)
tx/textual/valuerenderer/int.go 50.00% <0.00%> (ø)
tx/textual/valuerenderer/bytes.go 62.50% <0.00%> (ø)
tx/textual/valuerenderer/valuerenderer.go 72.41% <0.00%> (ø)
... and 7 more

x/group/keeper/msg_server.go Show resolved Hide resolved
x/group/keeper/msg_server.go Outdated Show resolved Hide resolved
julienrbrt added a commit that referenced this pull request Nov 4, 2022
julienrbrt added a commit that referenced this pull request Nov 7, 2022
…, `v{Consensus}` (#13772)

* chore: rename migrations from v42, v43 to v1, v2

* group migration should be in #13742

* updates
@julienrbrt julienrbrt marked this pull request as ready for review November 10, 2022 15:06
@julienrbrt julienrbrt requested a review from a team as a code owner November 10, 2022 15:06
@julienrbrt julienrbrt added the T: State Machine Breaking State machine breaking changes (impacts consensus). label Nov 10, 2022
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

I'm not sure this is my preferred direction for this PR.

My preference:

  1. Do the most correct way, i.e convert from ModuleAccount to GroupPolicyInfo
  2. A totally new PR, which simply removes these 3 lines. They are anyways wrong. And it solves group: validate genesis failing after creating group policy account #13445.
  3. Convert from ModuleAccount to BaseAccount, i.e. this PR.

If our immediate goal is to fix #13445, and 1 might delay v0.47 release, then I would actually prefer 2 over 3.

x/group/keeper/msg_server.go Outdated Show resolved Hide resolved
@julienrbrt
Copy link
Member Author

I'm not sure this is my preferred direction for this PR.

My preference:

  1. Do the most correct way, i.e convert from ModuleAccount to GroupPolicyInfo
  2. A totally new PR, which simply removes these 3 lines. They are anyways wrong. And it solves group: validate genesis failing after creating group policy account #13445.
  3. Convert from ModuleAccount to BaseAccount, i.e. this PR.

If our immediate goal is to fix #13445, and 1 might delay v0.47 release, then I would actually prefer 2 over 3.

As discussed on Slack, I'll continue with 3, but set an unclaimable pubkey to the account.

crypto/codec/proto.go Outdated Show resolved Hide resolved
x/group/types.go Fixed Show fixed Hide fixed
@aaronc
Copy link
Member

aaronc commented Nov 11, 2022

If we're going to the trouble of creating this unclaimable pubkey, why can't we just create something specific for groups, i.e. GroupAccountCredential as outlined in #13211? Since we're going to this much effort I'd rather move towards the right solution

@julienrbrt julienrbrt added the backport/v0.47.x PR scheduled for inclusion in the v0.47's next stable release label Nov 11, 2022
@github-actions github-actions bot removed C:Rosetta Issues and PR related to Rosetta C:CLI labels Nov 17, 2022
@julienrbrt julienrbrt changed the title fix: do not set group policy account name fix(group): migrate group policy account to base accounts with credentials Nov 17, 2022
Copy link
Contributor

@likhita-809 likhita-809 left a comment

Choose a reason for hiding this comment

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

nice work!

Copy link
Member

@aaronc aaronc left a comment

Choose a reason for hiding this comment

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

Good work @julienrbrt. Generally LGTM. Left a few small comments for things I think should be addressed

proto/cosmos/auth/v1beta1/auth.proto Outdated Show resolved Hide resolved
proto/cosmos/auth/v1beta1/auth.proto Outdated Show resolved Hide resolved
proto/cosmos/auth/v1beta1/auth.proto Outdated Show resolved Hide resolved
proto/cosmos/auth/v1beta1/auth.proto Show resolved Hide resolved
x/auth/types/credentials.go Outdated Show resolved Hide resolved
x/auth/types/credentials.go Outdated Show resolved Hide resolved
return false
}

func (m *ModuleCredential) Type() string {
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated to this PR, but is this method on PubKey even used anymore? Maybe we should get rid of it

Copy link
Member Author

Choose a reason for hiding this comment

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

After a brief look, it is used for comparison (easy to remove) and in keyring

return crypto.ArmorPubKeyBytes(bz, key.Type()), nil
.

x/auth/types/credentials.go Outdated Show resolved Hide resolved
x/group/migrations/v2/migrate_test.go Show resolved Hide resolved
x/group/migrations/v2/migrate_test.go Show resolved Hide resolved
x/auth/types/credentials.go Outdated Show resolved Hide resolved
@julienrbrt julienrbrt enabled auto-merge (squash) November 21, 2022 22:19
@sonarcloud
Copy link

sonarcloud bot commented Nov 21, 2022

[Cosmos SDK] SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

66.3% 66.3% Coverage
0.0% 0.0% Duplication

@julienrbrt julienrbrt merged commit d6da703 into main Nov 21, 2022
@julienrbrt julienrbrt deleted the julien/group-policy branch November 21, 2022 22:46
mergify bot pushed a commit that referenced this pull request Nov 21, 2022

for i := range m.DerivationKeys {
for j := range m.DerivationKeys[i] {
if m.DerivationKeys[i][j] != om.DerivationKeys[i][j] {
Copy link
Collaborator

Choose a reason for hiding this comment

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

you should use bytes.Compare here

tac0turtle pushed a commit that referenced this pull request Nov 22, 2022
…tials (backport #13742) (#13962)

* fix(group): migrate group policy account to base accounts with credentials (#13742)

(cherry picked from commit d6da703)

* update changelog

* updates

Co-authored-by: Julien Robert <julien@rbrt.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.47.x PR scheduled for inclusion in the v0.47's next stable release C:x/auth C:x/crisis C:x/distribution distribution module related C:x/group C:x/slashing C:x/staking T: State Machine Breaking State machine breaking changes (impacts consensus). Type: ADR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

group: validate genesis failing after creating group policy account
7 participants