Skip to content

Commit d0d8c70

Browse files
committed
Merge remote-tracking branch 'origin' into ddepta/multitest/helhetsdok
2 parents 23faa34 + 828a3f8 commit d0d8c70

File tree

4 files changed

+200
-2
lines changed

4 files changed

+200
-2
lines changed
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"setup": "Set Up Your Local Environment",
33
"run-node": "Run A Node",
4-
"cli": "Interact via the CLI"
4+
"cli": "Interact via the CLI",
5+
"proposals": "Proposals",
6+
"permissions": "Permissions"
57
}

src/pages/wasmd/getting-started/permissions.mdx

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
# Proposals
2+
3+
Proposals are a fundamental part of the governance process in the Cosmos ecosystem. They enable
4+
validators to vote on important decisions that impact the network, such as software upgrades,
5+
parameter changes, and the allocation of community funds.
6+
7+
## Overview of the Proposal Process
8+
9+
1. Submission: A proposal is submitted along with a deposit to the network.
10+
2. Deposit Period: Other participants can contribute to the deposit. If the minimum deposit is met,
11+
the proposal moves to the voting stage.
12+
3. Voting Period: Validators and delegators vote on the proposal.
13+
4. Tallying: After the voting period ends, the votes are tallied to determine whether the proposal
14+
has passed or failed.
15+
5. Execution: If the proposal passes, it is executed according to the details specified in the
16+
proposal, such as implementing a parameter change or initiating a software upgrade.
17+
18+
In this section, we'll dive into how to submit CosmWasm proposals. The submission process is a bit
19+
different from the Cosmos SDK, but the rest, including the deposit period, voting, tallying, and
20+
execution, follows the usual Cosmos SDK governance process.
21+
22+
For more details on the `gov` module, check out the
23+
[Cosmos SDK Governance Documentation](https://docs.cosmos.network/v0.50/build/modules/gov) and the
24+
[Cosmos SDK Proposal Tutorial](https://tutorials.cosmos.network/tutorials/8-understand-sdk-modules/4-gov.html).
25+
26+
## Submit a CosmWasm proposal
27+
28+
You can submit a CosmWasm proposal using the `wasmd tx wasm submit-proposal` command. To see a full
29+
list of available proposal types, simply add the `--help` flag. Many of these commands, like
30+
`wasm-store`, `instantiate-contract`, `execute-contract`, `migrate-contract`, are similar to the
31+
standard `tx` commands and won't be covered in detail here. Instead, we'll focus on the commands
32+
that are only available through a proposal such as `pin-codes`, `unpin-codes` and `sudo-contract`.
33+
34+
### Pin Codes
35+
36+
Pinning a code means keeping a specific WASM code stored in the cache. This improves the performance
37+
of frequently used contracts by avoiding the need to reload the code from the blockchain, which
38+
leads to lower gas costs during contract execution. For more details about code pinning you can
39+
check the [Contract pinning section](../../core/architecture/pinning.mdx).
40+
41+
To submit a proposal for pinning a code, you can use the following command:
42+
43+
```sh
44+
wasmd tx wasm submit-proposal pin-codes $CODE_ID \
45+
--title "Pin Code $CODE_ID" \
46+
--summary "Pin Code $CODE_ID Proposal" \
47+
--from alice \
48+
--gas 1500000 \
49+
-y \
50+
--chain-id=docs-chain-1 \
51+
-o json \
52+
--keyring-backend=test \
53+
--deposit 100000stake
54+
```
55+
56+
You can pin multiple codes by providing a list of code IDs instead of just a single `code_id`. The
57+
`title` flag specifies the title of the proposal, which should be descriptive and concise, while the
58+
`summary` flag provides a brief explanation of what the proposal aims to achieve. The `deposit` flag
59+
indicates the amount of tokens required to submit the proposal, avoiding spam proposals submissions.
60+
61+
To check the details of a submitted proposal, you can query the transaction using the `txhash`
62+
provided in the command output. This allows you to inspect the emitted events and retrieve the
63+
`proposal ID`, as shown in the following example:
64+
65+
```json
66+
{
67+
...
68+
"events": [
69+
...
70+
{
71+
"type": "submit_proposal",
72+
"attributes": [
73+
{
74+
"key": "proposal_id",
75+
"value": "2",
76+
"index": true
77+
},
78+
{
79+
"key": "proposal_proposer",
80+
"value": "wasm10gftgfm8my3f3hymne8327rrzyvy7dqrkucej5",
81+
"index": true
82+
},
83+
{
84+
"key": "proposal_messages",
85+
"value": ",/cosmwasm.wasm.v1.MsgPinCodes",
86+
"index": true
87+
},
88+
{
89+
"key": "msg_index",
90+
"value": "0",
91+
"index": true
92+
}
93+
]
94+
}
95+
]
96+
}
97+
```
98+
99+
Once you have the `proposal ID`, you can fetch the full proposal details using the following
100+
command:
101+
102+
```sh
103+
wasmd q gov proposal 2 -o json
104+
```
105+
106+
The command will return a JSON object similar to the following:
107+
108+
```json
109+
{
110+
"proposal": {
111+
"id": "2",
112+
"messages": [
113+
{
114+
"type": "wasm/MsgPinCodes",
115+
"value": {
116+
"authority": "wasm10d07y265gmmuvt4z0w9aw880jnsr700js7zslc",
117+
"code_ids": ["1"]
118+
}
119+
}
120+
],
121+
"status": 1,
122+
"final_tally_result": {
123+
"yes_count": "0",
124+
"abstain_count": "0",
125+
"no_count": "0",
126+
"no_with_veto_count": "0"
127+
},
128+
"submit_time": "2024-08-08T16:48:32.640792888Z",
129+
"deposit_end_time": "2024-08-10T16:48:32.640792888Z",
130+
"total_deposit": [
131+
{
132+
"denom": "stake",
133+
"amount": "100000"
134+
}
135+
],
136+
"title": "Pin Code 1",
137+
"summary": "Pin Code 1 Proposal",
138+
"proposer": "wasm10gftgfm8my3f3hymne8327rrzyvy7dqrkucej5"
139+
}
140+
}
141+
```
142+
143+
- `id`: This is the unique identifier for the proposal.
144+
- `messages`: This array contains the specific actions or commands the proposal intends to execute.
145+
- `status`: Indicates the current status of the proposal.
146+
- `final_tally_result`: Shows the results of the voting on the proposal.
147+
- `submit_time`: The timestamp indicating when the proposal was submitted.
148+
- `deposit_end_time`: The timestamp indicating when the deposit period ends.
149+
- `total_deposit`: This is the amount of tokens that has been deposited to support the proposal.
150+
- `title`: Title of the proposal.
151+
- `summary`: Summary of the proposal.
152+
- `proposer`: The address of the entity that submitted the proposal.
153+
154+
After the deposit period and voting period, if the proposal passes and is executed, the code is then
155+
pinned. You can verify the pinned codes by querying them with the following command:
156+
157+
```sh
158+
wasmd q wasm pinned -o json
159+
```
160+
161+
The command will return a JSON object similar to the following:
162+
163+
```json
164+
{
165+
"code_ids": [1, 2, 3],
166+
"pagination": {
167+
"next_key": null,
168+
"total": "0"
169+
}
170+
}
171+
```
172+
173+
The `code_ids` array lists all the code IDs that are currently pinned.
174+
175+
### Unpin codes
176+
177+
To remove a code from the cache and unpin it, you can submit an unpin proposal using the following
178+
command:
179+
180+
```sh
181+
wasmd tx wasm submit-proposal unpin-codes $CODE_ID \
182+
--title "Pin Code $CODE_ID" \
183+
--summary "Pin Code $CODE_ID Proposal" \
184+
--from alice \
185+
--gas 1500000 \
186+
-y \
187+
--chain-id=docs-chain-1 \
188+
-o json \
189+
--keyring-backend=test \
190+
--deposit 100000stake
191+
```
192+
193+
The rest of the process follows the same steps as pinning codes, so we won't go into detail again.
194+
After the proposal is executed, you can confirm that the code is no longer pinned by using the
195+
`wasmd q wasm pinned` command.

src/pages/wasmd/getting-started/setup.mdx

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ wasmd version
3636
```
3737

3838
<Callout type="warning">
39-
Running a node on Windows OS is not supported yet. You can build a wasmd client for Windows using
39+
Running a node on Windows OS is not supported yet. However, you can use WSL (Windows Subsystem for
40+
Linux) to run a node on Windows. Alternatively, you can build a Wasmd client for Windows with:
4041
`make build-windows-client`.
4142
</Callout>

0 commit comments

Comments
 (0)