Skip to content

Commit f6fe1e1

Browse files
authored
Merge pull request 0LNetworkCommunity#129 from petticur/update-proposal-txs-doc
Update proposal txs doc
2 parents 52d185a + 75553f0 commit f6fe1e1

File tree

2 files changed

+12
-241
lines changed

2 files changed

+12
-241
lines changed

docs/tools/cli-tools/txs/user.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ description: "User transactions"
77

88
Generate transactions for V8 user vouches.
99

10-
## Assert that an address is a human founder
10+
## Assert that an address has re-joined the chain
1111

1212
```
13-
libra txs user human-founder
13+
libra txs user re-join
1414
```
1515

1616
## Vouch for another address

docs/validators/hot-upgrades.md

Lines changed: 10 additions & 239 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ If you already have this upgrades repo locally, you should run the command in th
175175

176176
### Upgrade Ceremony
177177

178-
#### 3. With `txs` anyone (no authority needed) can submit the proposal and metadata.
178+
#### 3. With `txs` a currently seated validator account can submit the proposal and metadata.
179+
180+
Note that the goveranance proposal transaction type can only be submitted by an account corresponding to a currently seated validator.
181+
Attempts to submit the transaction from any other type of account will fail.
179182

180183
You'll need to provide the actual script compiled path, and an optional URL which contains documentation of the proposal (e.g., GitHub).
181184

@@ -198,7 +201,11 @@ If this transaction succeeds, it will produce a proposal id, which is a number.
198201
libra query view --function-id 0x1::diem_governance::get_next_governance_proposal_id
199202
```
200203

201-
#### 4. With `libra txs` anyone with governance authority (the epoch's validators as of `V7`), can submit a vote in favor (or against it with `--should-fail`).
204+
#### 4. Voting
205+
206+
With `libra txs` anyone with governance authority (the epoch's validators as of `V7`), can submit a vote in favor (or against it with `--should-fail`).
207+
208+
Note that the proposer (account that submitted the proposal as set forth above) can and should vote too.
202209

203210
We assume the default is to vote in favor. To vote "approve" simply:
204211

@@ -236,240 +243,4 @@ libra txs governance resolve --proposal-script-dir <PROPOSAL_SCRIPT_DIR> --propo
236243
3. libra txs governance resolve --proposal-script-dir ~/framework_upgrade/3-libra-framework/ --proposal-id 0
237244
```
238245

239-
If this transaction is successful, the new bytecode will be written to the VM.--
240-
sidebar_position: 9
241-
sidebar_label: 'Hot Upgrades'
242-
description: 'Upgrading Framework Libraries'
243-
---
244-
245-
246-
247-
# Network Hot Upgrades
248-
249-
## Overview
250-
251-
The "framework" which contains all the consensus, account, econ policies, etc. for the network is written in Move. This code is stored in the network database, and effectively executed on demand. This means that framework upgrades can occur without redeploying the Move VM itself, or the supporting system code (network node software). It also means the state machine can upgrade without a coordinated halt.
252-
253-
- To do this we require the `libra` cli tool. The command `libra move framework` is used for building the artifacts, and `libra txs` for proposing, voting, and ultimately deploying the artifacts.
254-
255-
- Metadata with the upgrade artifacts and proposal documentation can be found at: https://github.com/0LNetworkCommunity/upgrades
256-
257-
258-
## Historical Upgrade Information and Proposing Upgrades
259-
Historical upgrade information since release 7.0.0 is canonically stored in the [upgrade repository](https://github.com/0LNetworkCommunity/upgrades). To submit an upgrade proposal, you should draft a PR with the relevant information detailing the upgrade using the provided [template](https://github.com/0LNetworkCommunity/upgrades/tree/main/proposals/template) and include the upgrade script packages.
260-
261-
262-
## TL;DR
263-
264-
- **Fetch the latest release**:
265-
```
266-
cd libra-framework
267-
git fetch --all
268-
git checkout release-x.x.x
269-
```
270-
- **Build framework**:
271-
```
272-
libra move framework upgrade --output-dir <path/to>/framework_upgrade --framework-local-dir <path/to>/libra-framework/framework/
273-
```
274-
275-
- **Propose**:
276-
```
277-
libra txs governance propose --proposal-script-dir <path/to>/framework_upgrade/1-move-stdlib/ --metadata-url https://github.com/0LNetworkCommunity/upgrades/tree/main/proposals/up-000<PROPOSAL_ID>.md
278-
279-
# NOTE: Do not repeat this step. Multistep (multiple modules) only need one proposal, and it should reference the first module, usually 1-move-stdlib
280-
```
281-
282-
- **Each Validator votes**:
283-
```
284-
libra txs governance vote --proposal-id <ID>
285-
```
286-
287-
- **After vote, one person can resolve each module in order**:
288-
```
289-
libra txs governance resolve --proposal-script-dir <path/to>/framework_upgrade/1-move-stdlib/ --proposal-id <ID>
290-
291-
libra txs governance resolve --proposal-script-dir <path/to>/framework_upgrade/2-vendor-stdlib/ --proposal-id <ID>
292-
293-
libra txs governance resolve --proposal-script-dir <path/to>/framework_upgrade/3-libra-framework/ --proposal-id <ID>
294-
```
295-
296-
## Upgrade Types: Single and Multiple
297-
298-
When performing upgrades within the network framework, two primary approaches can be employed: single and multiple module upgrades. The key distinction lies in how these upgrades are proposed, voted on, and executed, particularly with respect to handling multiple modules.
299-
300-
### Single Framework Upgrade
301-
A single framework upgrade involves updating a singular set of modules within the framework. This process is straightforward and includes the following steps:
302-
303-
- **Build Framework**: Generate the upgrade Move transaction scripts for the module.
304-
- **Proposal Submission**: Propose the upgrade for the specific framework module.
305-
- **Validator Voting**: Validators within the network vote for or against the proposed upgrade.
306-
- **Achieving Consensus**: The proposal moves forward once it receives support from at least 66% of active validators.
307-
- **Resolution and Deployment**: Resolve the proposal using the exact framework directory that matches the build of the proposed upgrade. This can be done by any validator using the same release branch from the `libra-framework` repository.
308-
309-
### Multiple Framework Upgrades
310-
Multiple framework upgrades require a more nuanced approach, especially regarding resolution stages, to ensure a coherent and secure update across several modules.
311-
312-
- **Build Framework**: Similar to a single upgrade, start by generating Move transaction scripts for all relevant modules.
313-
314-
- **Proposal for Initial Module**: Propose the upgrade by using the first module (`1-move-stdlib`). This initial proposal is critical as it kickstarts the governance process for the entire upgrade.
315-
316-
*WARN: Do not repeat proposals for subsequent modules, the three modules can be upgraded with a single instance.*
317-
318-
Importantly, the transaction script for upgrading this first module includes a significant addition: **the transaction hash for the subsequent modules** that needs upgrading. These hashes, produced during the artifact building phase, serve as secure identifiers for each module's upgrade script. Do not run this step twice.
319-
320-
- **Validator Voting**: As with single upgrades, validators vote for or against the proposed upgrade.
321-
- **Achieving Consensus and Sequential Resolution**: Once at least 66% of active validators support the proposal, the initial upgrade can be resolved.
322-
- **Sequential Upgrade Execution**: Execute the resolution process for all involved modules, following the order 1-3.
323-
324-
325-
## Upgrade Policy
326-
The diem framework has information in the metadata that controls the policy that a publisher can set for upgrading their modules. These are:
327-
- Arbitrary(0): Allows code upgrades without compatibility checks, for non-shared packages.
328-
- Compatible(1): Requires compatibility checks to ensure no breaking changes in public functions or resource layouts.
329-
- Immutable(2): Prevents any upgrades, ensuring the permanence of critical code.
330-
331-
Due to some circumstances, a publisher may want to downgrade the policy to allow changes to go through that a restrictive policy would not allow. We can do this by building the framework with a flag(`--danger-force-upgrade`) that sets the upgrade policy as Arbitrary
332-
333-
#### Example
334-
335-
```
336-
libra txs governance propose --proposal-script-dir <path/to>/framework_upgrade/3-libra-framework/ --metadata-url https://github.com/0LNetworkCommunity/upgrades/tree/main/proposals/up-000<PROPOSAL_ID> --danger-force-upgrade
337-
```
338-
339-
## Procedure
340-
341-
We will use this guide to do a multi-step upgrade as this is the most common upgrade that is done.
342-
343-
### Build Artifacts
344-
345-
##### 1. Build the upgrade Move transaction scripts
346-
347-
This will be a Move package which is machine-generated for a one-time execution. It contains bytecode which will be allowed to be executed (by anyone), once there is a vote and agreement on the proposal passing. The on-chain execution is guarded with a hash of this transaction, which the proposer provides in the proposal transaction (in advance of the vote).
348-
349-
An upgrade script that is tampered with will yield a different execution hash, and will be prevented from running (it is likely to be blocked by the transaction size limits before entering the mempool).
350-
351-
The `libra-framework upgrade` command will produce a newly compiled Move upgrade transaction script, its binary, and the hash.
352-
353-
You need to provide:
354-
- `--output-dir`: this directory the upgrade transaction files should be saved to. A new folder called `framework_upgrade` will be created under the output-dir path.
355-
356-
- `--framework-local-dir`: the source code for the framework so that the transaction script can import it as a dependency.
357-
358-
Optionally you could provide the flag `--danger-force-upgrade
359-
360-
#### Multi or Single Upgrade
361-
Know the difference between a single step, and multi-step upgrades.
362-
An upgrade that changes, all three (stdlib, vendor-stdlib, libra-framework) looks like this:
363-
https://github.com/0LNetworkCommunity/upgrades/blob/main/proposals/up-0004/
364-
365-
AN upgrade that changes only one module `libra-framework` can be seen here:
366-
https://github.com/0LNetworkCommunity/upgrades/tree/main/proposals/up-0009
367-
368-
### Default: Produce all three module upgrades
369-
Includes: stdlib, vendor-stdlib, libra-framework.
370-
371-
```
372-
# Note the paths
373-
libra-framework upgrade \
374-
--output-dir <OUTPUT_DIR> \
375-
--framework-local-dir <FRAMEWORK_PATH>
376-
377-
# Example
378-
libra-framework upgrade \
379-
--output-dir <path/to>/framework_upgrade \
380-
--framework-local-dir <path/to>/libra-framework/framework/
381-
```
382-
383-
384-
#### NOTE: This creates 3 separate library upgrade script directories
385-
- 1-move-stdlib
386-
- 2-vendor-stdlib
387-
- 3-libra-framework
388-
389-
All the artifacts are now created, the proposal transaction can be submitted. But it's a good idea to document this on github first.
390-
391-
# Light: Only update one of the modules
392-
If the code is backwards compatible you can update a single module. This can be true for `libra-framework`, when there are no changes to `stdlib` or `vendor-stdlib`.
393-
394-
In that case you can include the argument `--core-modules libra-framework`
395-
```
396-
# example:
397-
libra-framework upgrade --core-modules libra-framework \
398-
--output-dir <path/to>/framework_upgrade \
399-
--framework-local-dir <path/to>/libra-framework/framework/
400-
401-
# Note: --danger-force-upgrade can also be used here
402-
```
403-
##### 2. Share the output artifacts on Github.
404-
405-
A dedicated repository for upgrade proposals exists at:
406-
407-
https://github.com/0LNetworkCommunity/upgrades/
408-
409-
The proposer can add the files folder and documentation link to this Github repo, for example:
410-
https://github.com/0LNetworkCommunity/upgrades/tree/main/proposals/up-0005
411-
412-
#### PRO-TIP:
413-
If you already have this upgrades repo locally, you should run the command in the previous step (build artifacts) with `--output-dir` pointed to `./upgrades/proposals/up-000x`
414-
415-
416-
### Upgrade Ceremony
417-
418-
##### 3. With `txs` anyone (no authority needed) can submit the proposal and metadata.
419-
420-
You'll need to provide the actual script compiled path, and an optional URL which contains documentation of the proposal (e.g github).
421-
422-
```
423-
424-
# NOTE: multi-step upgrades (all modules) only need ONE proposal, and it should reference the first module, usually 1-move-stdlib
425-
426-
libra txs governance propose --proposal-script-dir <PROPOSAL_SCRIPT_DIR> --metadata-url <URL>
427-
428-
# Example
429-
libra txs governance propose \
430-
--proposal-script-dir <path/to>/framework_upgrade/1-move-stdlib/ \
431-
--metadata-url https://github.com/0LNetworkCommunity/upgrades/tree/main/proposals/up-000<PROPOSAL_ID>.md
432-
433-
```
434-
If this transaction succeeds it will produce a proposal id, which is a number. Now the proposal is open to voting.
435-
436-
#### NOTE: You can query the next proposal using this command:
437-
```
438-
libra query view --function-id 0x1::diem_governance::get_next_governance_proposal_id
439-
```
440-
:::
441-
442-
##### 4. With `libra txs` anyone with governance authority (the epoch's validators as of `V7`), can submit a vote in favor (or against it with `--should-fail`).
443-
444-
We assume the default is to vote in favor. To vote "approve" simply:
445-
```
446-
libra txs governance vote --proposal-id <PROPOSAL_ID>
447-
```
448-
449-
If voter would like the proposal to be rejected:
450-
```
451-
libra txs governance vote --proposal-id <PROPOSAL_ID> --should-fail
452-
```
453-
:::note
454-
You can query to see the for and against votes using this command:
455-
```
456-
libra query view --function-id 0x1::diem_governance::get_votes --args <proposal_number>
457-
```
458-
:::
459-
460-
After everyone has voted (to reach the consensus threshold of 66% as of `V7`), the proposal will be in a "Resolvable" state. Anyone can resolve it by submitting the upgrade transaction. This means the sender must have the source transaction script for the upgrade (step #1 above).
461-
462-
##### 6. Use `txs` to resolve a successfully approved proposal
463-
```
464-
# Note the actual path
465-
libra txs governance resolve --proposal-script-dir <PROPOSAL_SCRIPT_DIR> --proposal-id <PROPOSAL_ID>
466-
467-
# Example
468-
1. libra txs governance resolve --proposal-script-dir ~/framework_upgrade/1-move-stdlib/ --proposal-id 0
469-
470-
2. libra txs governance resolve --proposal-script-dir ~/framework_upgrade/2-vendor-stdlib/ --proposal-id 0
471-
472-
3. libra txs governance resolve --proposal-script-dir ~/framework_upgrade/3-libra-framework/ --proposal-id 0
473-
```
474-
475-
If this transaction is successful the new bytecode will be written to the VM
246+
If this transaction is successful, the new bytecode will be written to the VM.

0 commit comments

Comments
 (0)