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

docs(x/accounts): improve comments #22339

Merged
merged 4 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions api/cosmos/accounts/defaults/lockup/v1/tx.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 17 additions & 7 deletions api/cosmos/accounts/defaults/multisig/v1/multisig.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/v2/api/telemetry/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package telemetry
func DefaultConfig() *Config {
return &Config{
Enable: true,
Address: "localhost:1318",
Address: "localhost:1327",
ServiceName: "",
EnableHostname: false,
EnableHostnameLabel: false,
Expand Down
9 changes: 3 additions & 6 deletions simapp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ require (
cosmossdk.io/store v1.1.1
cosmossdk.io/tools/confix v0.0.0-20230613133644-0a778132a60f
cosmossdk.io/x/accounts v0.0.0-20240913065641-0064ccbce64e
cosmossdk.io/x/accounts/defaults/base v0.0.0-00010101000000-000000000000
cosmossdk.io/x/accounts/defaults/lockup v0.0.0-20240417181816-5e7aae0db1f5
cosmossdk.io/x/accounts/defaults/multisig v0.0.0-00010101000000-000000000000
cosmossdk.io/x/authz v0.0.0-00010101000000-000000000000
cosmossdk.io/x/bank v0.0.0-20240226161501-23359a0b6d91
cosmossdk.io/x/circuit v0.0.0-20230613133644-0a778132a60f
Expand Down Expand Up @@ -43,13 +45,8 @@ require (
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
go.uber.org/mock v0.5.0
google.golang.org/protobuf v1.35.1
)

require (
cosmossdk.io/x/accounts/defaults/base v0.0.0-00010101000000-000000000000
cosmossdk.io/x/accounts/defaults/multisig v0.0.0-00010101000000-000000000000
google.golang.org/grpc v1.67.1
google.golang.org/protobuf v1.35.1
)

require (
Expand Down
2 changes: 1 addition & 1 deletion tools/confix/data/v2-app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ skip-fast-storage-upgrade = true
# Enable enables the application telemetry functionality. When enabled, an in-memory sink is also enabled by default. Operators may also enabled other sinks such as Prometheus.
enable = true
# Address defines the metrics server address to bind to.
address = 'localhost:1318'
address = 'localhost:1327'
# Prefixed with keys to separate services.
service-name = ''
# Enable prefixing gauge values with hostname.
Expand Down
4 changes: 3 additions & 1 deletion x/accounts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,9 @@ To implement the `Authentication` interface in x/accounts, an account must expos

The key message type for authentication is `MsgAuthenticate`, which is defined in the module's protocol buffer files:

[interfaces/account_abstraction/v1/interface.proto](./proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto)
```go reference
https://github.com/cosmos/cosmos-sdk/blob/main/x/accounts/proto/cosmos/accounts/interfaces/account_abstraction/v1/interface.proto#L9-L24
```

### Authentication Mechanism

Expand Down
11 changes: 6 additions & 5 deletions x/accounts/defaults/lockup/TUTORIAL.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Using lockup account on Cosmos sdk

* [Setup](#setup)
* [Init](#init)
* [Execution](#execution)
* [Using lockup account on Cosmos sdk](#using-lockup-account-on-cosmos-sdk)
* [Setup](#setup)
* [Init](#init)
* [Execution](#execution)
* [Delegate](#delegate)
* [Undelegate](#undelegate)
* [Withdraw reward](#withdraw-reward)
* [Withdraw unlocked token](#withdraw-unlocked-token)
* [Send coins](#send-coins)
* [Query](#query)
* [Query](#query)
Comment on lines +3 to +12
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix table of contents indentation for better readability.

The table of contents structure needs consistent indentation to properly reflect the document hierarchy.

Apply these changes to fix the indentation:

- * [Using lockup account on Cosmos sdk](#using-lockup-account-on-cosmos-sdk)
-   * [Setup](#setup)
-   * [Init](#init)
-   * [Execution](#execution)
-     * [Delegate](#delegate)
-     * [Undelegate](#undelegate)
-     * [Withdraw reward](#withdraw-reward)
-     * [Withdraw unlocked token](#withdraw-unlocked-token)
-     * [Send coins](#send-coins)
-   * [Query](#query)
-     * [Query account info](#query-account-info)
-     * [Query periodic lockup account locking periods](#query-periodic-lockup-account-locking-periods)
+ * [Using lockup account on Cosmos sdk](#using-lockup-account-on-cosmos-sdk)
+     * [Setup](#setup)
+     * [Init](#init)
+     * [Execution](#execution)
+         * [Delegate](#delegate)
+         * [Undelegate](#undelegate)
+         * [Withdraw reward](#withdraw-reward)
+         * [Withdraw unlocked token](#withdraw-unlocked-token)
+         * [Send coins](#send-coins)
+     * [Query](#query)
+         * [Query account info](#query-account-info)
+         * [Query periodic lockup account locking periods](#query-periodic-lockup-account-locking-periods)

Committable suggestion was skipped due to low confidence.

🧰 Tools
🪛 LanguageTool

[duplication] ~12-~12: Possible typo: you repeated a word
Context: ...n) * Send coins * Query * Query account info ...

(ENGLISH_WORD_REPEAT_RULE)

🪛 Markdownlint

4-4: Expected: 4; Actual: 2
Unordered list indentation

(MD007, ul-indent)


5-5: Expected: 4; Actual: 2
Unordered list indentation

(MD007, ul-indent)


6-6: Expected: 4; Actual: 2
Unordered list indentation

(MD007, ul-indent)


7-7: Expected: 8; Actual: 4
Unordered list indentation

(MD007, ul-indent)


8-8: Expected: 8; Actual: 4
Unordered list indentation

(MD007, ul-indent)


9-9: Expected: 8; Actual: 4
Unordered list indentation

(MD007, ul-indent)


10-10: Expected: 8; Actual: 4
Unordered list indentation

(MD007, ul-indent)


11-11: Expected: 8; Actual: 4
Unordered list indentation

(MD007, ul-indent)


12-12: Expected: 4; Actual: 2
Unordered list indentation

(MD007, ul-indent)

* [Query account info](#query-account-info)
* [Query periodic lockup account locking periods](#query-periodic-lockup-account-locking-periods)

Expand Down Expand Up @@ -207,7 +208,7 @@ To query a lockup account state, we can use the command below:

```bash
querycontents=$(cat query.json)
simd tx accounts query <account_address> <query-request-type-url> $querycontents --from owner
simd tx accounts query <account_address> <query-request-type-url> $querycontents
```

### Query account info
Expand Down
7 changes: 3 additions & 4 deletions x/accounts/defaults/lockup/v1/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 17 additions & 7 deletions x/accounts/defaults/multisig/v1/multisig.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 10 additions & 21 deletions x/accounts/proto/cosmos/accounts/defaults/lockup/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,17 @@ import "google/protobuf/timestamp.proto";

option go_package = "cosmossdk.io/x/accounts/defaults/lockup/v1";

//-------------------------------------- INIT --------------------------------------

// MsgInitLockupAccount defines a message that enables creating a lockup
// account.
// MsgInitLockupAccount defines a message that enables creating a lockup account.
message MsgInitLockupAccount {
option (amino.name) = "cosmos-sdk/MsgInitLockupAccount";

option (amino.name) = "cosmos-sdk/MsgInitLockupAccount";
option (gogoproto.equal) = true;

// owner of the vesting account
string owner = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// end of lockup
// end_time is end of lockup
google.protobuf.Timestamp end_time = 2
[(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true];
// start of lockup
// start_time is start of lockup
google.protobuf.Timestamp start_time = 3
[(gogoproto.nullable) = false, (amino.dont_omitempty) = true, (gogoproto.stdtime) = true];
}
Expand All @@ -38,8 +33,7 @@ message MsgInitLockupAccountResponse {}
// MsgInitPeriodicLockingAccount defines a message that enables creating a periodic locking
// account.
message MsgInitPeriodicLockingAccount {
option (amino.name) = "cosmos-sdk/MsgInitPeriodLockupAccount";

option (amino.name) = "cosmos-sdk/MsgInitPeriodLockupAccount";
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix typo in amino name option

The amino name contains a typo: MsgInitPeriodLockupAccount should be MsgInitPeriodicLockupAccount to match the message name.

-  option (amino.name)      = "cosmos-sdk/MsgInitPeriodLockupAccount";
+  option (amino.name)      = "cosmos-sdk/MsgInitPeriodicLockupAccount";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
option (amino.name) = "cosmos-sdk/MsgInitPeriodLockupAccount";
option (amino.name) = "cosmos-sdk/MsgInitPeriodicLockupAccount";

option (gogoproto.equal) = false;

// owner of the lockup account
Expand All @@ -56,8 +50,7 @@ message MsgInitPeriodicLockingAccountResponse {}

// MsgDelegate defines a message that enable lockup account to execute delegate message
message MsgDelegate {
option (cosmos.msg.v1.signer) = "sender";

option (cosmos.msg.v1.signer) = "sender";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

Expand All @@ -69,8 +62,7 @@ message MsgDelegate {

// MsgUndelegate defines a message that enable lockup account to execute undelegate message
message MsgUndelegate {
option (cosmos.msg.v1.signer) = "sender";

option (cosmos.msg.v1.signer) = "sender";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

Expand All @@ -81,8 +73,7 @@ message MsgUndelegate {

// MsgWithdrawReward defines a message that enable lockup account to execute withdraw reward message
message MsgWithdrawReward {
option (cosmos.msg.v1.signer) = "sender";

option (cosmos.msg.v1.signer) = "sender";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

Expand All @@ -92,8 +83,7 @@ message MsgWithdrawReward {

// MsgSend defines a message that enable lockup account to execute send message
message MsgSend {
option (cosmos.msg.v1.signer) = "sender";

option (cosmos.msg.v1.signer) = "sender";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

Expand All @@ -115,8 +105,7 @@ message MsgExecuteMessagesResponse {
// MsgWithdraw defines a message that the owner of the lockup can perform to withdraw unlocked token to an account of
// choice
message MsgWithdraw {
option (cosmos.msg.v1.signer) = "withdrawer";

option (cosmos.msg.v1.signer) = "withdrawer";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ option go_package = "cosmossdk.io/x/accounts/defaults/multisig/v1";

// MsgInit is used to initialize a multisig account.
message MsgInit {
// members are the members of the multisig account.
repeated Member members = 1;
Config config = 2;
// config is the configuration of the multisig account.
Config config = 2;
}

// MsgInitResponse is the response returned after account initialization.
Expand Down Expand Up @@ -68,8 +70,10 @@ message Member {

// Config defines the configuration of the multisig account.
message Config {
// threshold is the minimum weight required for a proposal to pass.
int64 threshold = 1;

// quorum is the minimum number of members that need to vote for a proposal to pass.
int64 quorum = 2;

// voting_period is the duration in seconds for the voting period.
Expand All @@ -84,13 +88,19 @@ message Config {

// Proposal defines the structure of a proposal.
message Proposal {
string title = 1;
string summary = 2;
// title is the title of the proposal.
string title = 1;

// summary is the summary of the proposal.
string summary = 2;

// messages are the messages that will be executed
repeated google.protobuf.Any messages = 3;

// voting_period_end will be set by the account when the proposal is created.
int64 voting_period_end = 4;

// status is the current status of the proposal.
ProposalStatus status = 5;
}

Expand All @@ -108,8 +118,10 @@ message QueryConfig {}

// QueryConfigResponse returns the config of the account.
message QueryConfigResponse {
// members are the current members of the account.
repeated Member members = 1;

// config is the current config of the account.
Config config = 2;
}

Expand Down
Loading