aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

Add ability to self update to aptos CLI

Open banool opened this issue 2 years ago • 5 comments

Description

This adds to the CLI the ability to update itself.

Test Plan

First, I changed the version of the CLI in Cargo.toml from 1.0.4 to 1.0.3 to make the CLI think it needs to update itself:

$ cargo build-p aptos
$ mv target/debug/aptos /tmp/aptos
$ /tmp/aptos --version
aptos 1.0.3

Next, run the self update subcommand:

$ /tmp/aptos -- update
Checking target-arch... MacOSX-x86_64
Checking current version... v1.0.3
Looking for tag: aptos-cli-v1.0.4

aptos release status:
  * Current exe: "/Users/dport/a/core/target/debug/aptos"
  * New exe release: "aptos-cli-1.0.4-MacOSX-x86_64.zip"
  * New exe download url: "https://api.github.com/repos/aptos-labs/aptos-core/releases/assets/91367154"

The new release will be downloaded/extracted and the existing binary will be replaced.
Do you want to continue? [Y/n] y
Downloading...
Extracting archive... Done
Replacing binary file... Done
{
  "Result": "Successfully updated from v1.0.3 to v1.0.4"
}

Confirm that the CLI has updated:

$ /tmp/aptos --version
aptos 1.0.4

I ran this test successfully on the following systems:

  • MacOS (ARM)
  • Arch (x86_64)
  • Windows (NT) (x86_64)
  • Ubuntu 22 (x86_64)
  • Windows (WSL, Ubuntu 22)

banool avatar Jan 23 '23 19:01 banool

Forge is running suite compat on testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> d90015db4299148b92937f660b8ba1ddfd26861c

github-actions[bot] avatar Jan 26 '23 01:01 github-actions[bot]

Forge is running suite land_blocking on d90015db4299148b92937f660b8ba1ddfd26861c

github-actions[bot] avatar Jan 26 '23 01:01 github-actions[bot]

:white_check_mark: Forge suite compat success on testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> d90015db4299148b92937f660b8ba1ddfd26861c

Compatibility test results for testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> d90015db4299148b92937f660b8ba1ddfd26861c (PR)
1. Check liveness of validators at old version: testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b
compatibility::simple-validator-upgrade::liveness-check : 7466 TPS, 5163 ms latency, 8100 ms p99 latency,no expired txns
2. Upgrading first Validator to new version: d90015db4299148b92937f660b8ba1ddfd26861c
compatibility::simple-validator-upgrade::single-validator-upgrade : 4529 TPS, 9056 ms latency, 12100 ms p99 latency,no expired txns
3. Upgrading rest of first batch to new version: d90015db4299148b92937f660b8ba1ddfd26861c
compatibility::simple-validator-upgrade::half-validator-upgrade : 4454 TPS, 9539 ms latency, 12200 ms p99 latency,no expired txns
4. upgrading second batch to new version: d90015db4299148b92937f660b8ba1ddfd26861c
compatibility::simple-validator-upgrade::rest-validator-upgrade : 6180 TPS, 6397 ms latency, 9800 ms p99 latency,no expired txns
5. check swarm health
Compatibility test for testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> d90015db4299148b92937f660b8ba1ddfd26861c passed
Test Ok

github-actions[bot] avatar Jan 26 '23 01:01 github-actions[bot]

:white_check_mark: Forge suite land_blocking success on d90015db4299148b92937f660b8ba1ddfd26861c

performance benchmark with full nodes : 5911 TPS, 6709 ms latency, 10800 ms p99 latency,no expired txns
Test Ok

github-actions[bot] avatar Jan 26 '23 01:01 github-actions[bot]

Just tested on WSL (Ubuntu 22) too, it works correctly.

banool avatar Jan 26 '23 12:01 banool

well ... autolands aren't great....

davidiw avatar Jan 28 '23 17:01 davidiw

Yeah............. I'll fix up your comments in another PR.

banool avatar Jan 28 '23 18:01 banool