## Description Closes: #10565 Rename mentions of "group account" (in proto files, code, docs, etc.) to "group policy" in group module. --- ### 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](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] 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](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) 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)
3.8 KiB
State
The group module uses the orm package which provides table storage with support for
primary keys and secondary indexes. orm also defines Sequence which is a persistent unique key generator based on a counter that can be used along with Tables.
Here's the list of tables and associated sequences and indexes stored as part of the group module.
Group Table
The groupTable stores GroupInfo: 0x0 | BigEndian(GroupId) -> ProtocolBuffer(GroupInfo).
groupSeq
The value of groupSeq is incremented when creating a new group and corresponds to the new GroupId: 0x1 | 0x1 -> BigEndian.
The second 0x1 corresponds to the ORM sequenceStorageKey.
groupByAdminIndex
groupByAdminIndex allows to retrieve groups by admin address:
0x2 | len([]byte(group.Admin)) | []byte(group.Admin) | BigEndian(GroupId) -> []byte().
Group Member Table
The groupMemberTable stores GroupMembers: 0x10 | BigEndian(GroupId) | []byte(member.Address) -> ProtocolBuffer(GroupMember).
The groupMemberTable is a primary key table and its PrimaryKey is given by
BigEndian(GroupId) | []byte(member.Address) which is used by the following indexes.
groupMemberByGroupIndex
groupMemberByGroupIndex allows to retrieve group members by group id:
0x11 | BigEndian(GroupId) | PrimaryKey -> []byte().
groupMemberByMemberIndex
groupMemberByMemberIndex allows to retrieve group members by member address:
0x12 | len([]byte(member.Address)) | []byte(member.Address) | PrimaryKey -> []byte().
Group Policy Table
The groupPolicyTable stores GroupPolicyInfo: 0x20 | len([]byte(Address)) | []byte(Address) -> ProtocolBuffer(GroupPolicyInfo).
The groupPolicyTable is a primary key table and its PrimaryKey is given by
len([]byte(Address)) | []byte(Address) which is used by the following indexes.
groupPolicySeq
The value of groupPolicySeq is incremented when creating a new group policy and is used to generate the new group policy account Address:
0x21 | 0x1 -> BigEndian.
The second 0x1 corresponds to the ORM sequenceStorageKey.
groupPolicyByGroupIndex
groupPolicyByGroupIndex allows to retrieve group policies by group id:
0x22 | BigEndian(GroupId) | PrimaryKey -> []byte().
groupPolicyByAdminIndex
groupPolicyByAdminIndex allows to retrieve group policies by admin address:
0x23 | len([]byte(Address)) | []byte(Address) | PrimaryKey -> []byte().
Proposal Table
The proposalTable stores Proposals: 0x30 | BigEndian(ProposalId) -> ProtocolBuffer(Proposal).
proposalSeq
The value of proposalSeq is incremented when creating a new proposal and corresponds to the new ProposalId: 0x31 | 0x1 -> BigEndian.
The second 0x1 corresponds to the ORM sequenceStorageKey.
proposalByGroupPolicyIndex
proposalByGroupPolicyIndex allows to retrieve proposals by group policy account address:
0x32 | len([]byte(account.Address)) | []byte(account.Address) | BigEndian(ProposalId) -> []byte().
proposalByProposerIndex
proposalByProposerIndex allows to retrieve proposals by proposer address:
0x33 | len([]byte(proposer.Address)) | []byte(proposer.Address) | BigEndian(ProposalId) -> []byte().
Vote Table
The voteTable stores Votes: 0x40 | BigEndian(ProposalId) | []byte(voter.Address) -> ProtocolBuffer(Vote).
The voteTable is a primary key table and its PrimaryKey is given by
BigEndian(ProposalId) | []byte(voter.Address) which is used by the following indexes.
voteByProposalIndex
voteByProposalIndex allows to retrieve votes by proposal id:
0x41 | BigEndian(ProposalId) | PrimaryKey -> []byte().
voteByVoterIndex
voteByVoterIndex allows to retrieve votes by voter address:
0x42 | len([]byte(voter.Address)) | []byte(voter.Address) | PrimaryKey -> []byte().