Skip to content

Commit

Permalink
Merge branch 'main' into add-x-to-error-message
Browse files Browse the repository at this point in the history
  • Loading branch information
arturrez authored Sep 26, 2024
2 parents 4af7279 + 6f21bbd commit 6f73030
Show file tree
Hide file tree
Showing 210 changed files with 7,698 additions and 5,526 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-syntax

* @ava-labs/tooling
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Create a report to help us improve
title: '[Bug]: '
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Logs**
If applicable, please include the relevant logs that indicate a problem.

**Operating System**
Which OS you used to reveal the bug.

**Additional context**
Add any other context about the problem here.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Feature specification
about: Discussion on design and implementation of new features for the Avalanche CLI.
title: ''
labels: enhancement
assignees: ''

---

**Context and scope**
Include a short description of the context and scope of the suggested feature.
Include goals the change will accomplish if relevant.

**Discussion and alternatives**
Include a description of the changes to be made to the code along with alternatives that were considered.

**Open questions**
Questions that are still being discussed.
17 changes: 15 additions & 2 deletions .github/packer/aws-ubuntu-docker.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ source "amazon-ebs" "ubuntu_amd64" {
ami_description = "Avalanche-CLI Ubuntu 20.04 Docker"
instance_type = "t3.xlarge"
region = "us-east-1"
metadata_options {
http_endpoint = "enabled"
http_tokens = "required"
http_put_response_hop_limit = 1
}
imds_support = "v2.0"
source_ami_filter {
filters = {
name = "ubuntu/images/*ubuntu-focal-20.04-amd64-server-*"
Expand Down Expand Up @@ -64,6 +70,12 @@ source "amazon-ebs" "ubuntu_arm64" {
ami_description = "Avalanche-CLI Ubuntu 20.04 Docker"
instance_type = "t4g.xlarge" # Adjust the instance type for arm64
region = "us-east-1"
metadata_options {
http_endpoint = "enabled"
http_tokens = "required"
http_put_response_hop_limit = 1
}
imds_support = "v2.0"
source_ami_filter {
filters = {
name = "ubuntu/images/*ubuntu-focal-20.04-arm64-server-*" # Filter for arm64 AMIs
Expand Down Expand Up @@ -99,7 +111,7 @@ build {
inline = [
"export DEBIAN_FRONTEND=noninteractive",
"sudo add-apt-repository -y ppa:longsleep/golang-backports",
"sudo apt-get -y update && sudo apt-get -y dist-upgrade && sudo apt-get -y install ca-certificates curl gcc git golang-go=2:1.22~3longsleep1",
"sudo apt-get -y update && sudo apt-get -y dist-upgrade && sudo apt-get -y install ca-certificates curl gcc git golang-go",
"sudo install -m 0755 -d /etc/apt/keyrings && sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && sudo chmod a+r /etc/apt/keyrings/docker.asc",
"echo \"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo \"$VERSION_CODENAME\") stable\" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null",
"sudo apt-get -y update && sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-compose",
Expand All @@ -118,7 +130,8 @@ build {
"docker pull prom/node-exporter:v1.7.0",
"docker pull grafana/grafana:10.4.1",
"docker pull prom/prometheus:v2.51.2",
"docker pull avaplatform/awm-relayer"
"docker pull avaplatform/awm-relayer",
"docker pull golang:1.22.1-bullseye"
]
}

Expand Down
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Why this should be merged

## How this works

## How this was tested

## How is this documented
7 changes: 4 additions & 3 deletions .github/workflows/lint-and-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
go-version: ${{ matrix.go }}
- run: go mod download
- run: scripts/build.sh
- run: go test -v -coverprofile=coverage.out $(go list ./... | grep -v /tests/)
- run: go test -v -coverprofile=coverage.out $(go list ./... | grep -v /tests/ | grep -v '/sdk/')
env:
CGO_CFLAGS: "-O -D__BLST_PORTABLE__" # Set the CGO flags to use the portable version of BLST
- run: go tool cover -func=coverage.out
Expand Down Expand Up @@ -114,12 +114,13 @@ jobs:
run: |
npm install -g typescript
npm install -g ts-node
npm install -g tsx
- name: Install docker on macos
if: ${{ matrix.os == 'macos-13' }}
if: ${{ (matrix.os == 'macos-13') && (matrix.suite == '\\[Public Subnet\\]') }}
run: |
brew install docker
brew install colima
colima start
colima start --vm-type vz
sudo ln -s ~/.colima/default/docker.sock /var/run/docker.sock
- name: generate ssh token for e2e tests
run: |
Expand Down
22 changes: 12 additions & 10 deletions .github/workflows/release-public-ami.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ on:
tags:
- "*"

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout

env:
PACKER_VERSION: "1.10.2"
PACKER_VERSION: "1.11.2"

jobs:
build-public-ami-and-upload:
Expand All @@ -32,21 +36,19 @@ jobs:
- name: install npx aws-amicleaner
run: npm install -g aws-amicleaner

- name: clean up old AMIs
run: npx aws-amicleaner --include-name 'public-avalanchecli-ubuntu-*' --exclude-newest 1 --exclude-days 2 --region="*" --force
env:
AWS_ACCESS_KEY_ID: ${{ secrets.EXPERIMENTAL_AWS_ACCESS_KEY_PACKER }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.EXPERIMENTAL_AWS_SECRET_KEY_PACKER }}
AWS_REGION: us-east-1


- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.EXPERIMENTAL_AWS_ACCESS_KEY_PACKER }}
aws-secret-access-key: ${{ secrets.EXPERIMENTAL_AWS_SECRET_KEY_PACKER }}
#aws-session-token: ${{ secrets.EXPERIMENTAL_AWS_SESSION_TOKEN_PACKER }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: us-east-1

- name: clean up old AMIs
run: npx aws-amicleaner --include-name 'public-avalanchecli-ubuntu-*' --exclude-newest 1 --exclude-days 2 --region="*" --force
env:
AWS_REGION: us-east-1

- name: Configure GCP credentials
uses: google-github-actions/auth@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
go-version: ${{ matrix.go }}
- run: go mod download
- run: scripts/build.sh
- run: go test -v -coverprofile=coverage.out ./...
- run: go test -v -coverprofile=coverage.out $(go list ./... | grep -v /tests/ | grep -v '/sdk/')
env:
CGO_CFLAGS: "-O -D__BLST_PORTABLE__" # Set the CGO flags to use the portable version of BLST
- run: go tool cover -func=coverage.out
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.3
1.7.5
Binary file added assets/bootstrapSnapshot.PreDurango11.tar.gz
Binary file not shown.
Binary file modified assets/bootstrapSnapshot.tar.gz
Binary file not shown.
Binary file not shown.
Binary file modified assets/bootstrapSnapshotSingleNode.tar.gz
Binary file not shown.
1 change: 1 addition & 0 deletions assets/sha256sum.PreDurango11.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a8827a2c4e32cfd8a05287acae454e86f1cfab90c6f79a3411bed08f98fcea06 assets/bootstrapSnapshot.PreDurango11.tar.gz
2 changes: 1 addition & 1 deletion assets/sha256sum.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a8827a2c4e32cfd8a05287acae454e86f1cfab90c6f79a3411bed08f98fcea06 assets/bootstrapSnapshot.tar.gz
811e73be1ad9b56f05a14ca6d239ee50bc3882fa10fdb2f78d41b02fb81ac6fe assets/bootstrapSnapshot.tar.gz
1 change: 1 addition & 0 deletions assets/sha256sumSingleNode.PreDurango11.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1cb0fc4f458895623eb19e12ae580be5e4f23ef69ba557a71415bac01608983b assets/bootstrapSnapshotSingleNode.PreDurango11.tar.gz
2 changes: 1 addition & 1 deletion assets/sha256sumSingleNode.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1cb0fc4f458895623eb19e12ae580be5e4f23ef69ba557a71415bac01608983b assets/bootstrapSnapshotSingleNode.tar.gz
53ef0b4c6ef6bd54e07bd065d58164bd464cd46576d36230731c93d3cc254df9 assets/bootstrapSnapshotSingleNode.tar.gz
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (C) 2022, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package subnetcmd
package blockchaincmd

import (
"errors"
Expand All @@ -24,7 +24,12 @@ import (
)

var (
addValidatorSupportedNetworkOptions = []networkoptions.NetworkOption{networkoptions.Local, networkoptions.Devnet, networkoptions.Fuji, networkoptions.Mainnet}
addValidatorSupportedNetworkOptions = []networkoptions.NetworkOption{
networkoptions.Local,
networkoptions.Devnet,
networkoptions.Fuji,
networkoptions.Mainnet,
}

nodeIDStr string
weight uint64
Expand All @@ -43,20 +48,20 @@ var (
ErrNotPermissionedSubnet = errors.New("subnet is not permissioned")
)

// avalanche subnet addValidator
// avalanche blockchain addValidator
func newAddValidatorCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "addValidator [subnetName]",
Short: "Allow a validator to validate your subnet",
Long: `The subnet addValidator command whitelists a primary network validator to
validate the provided deployed Subnet.
Use: "addValidator [blockchainName]",
Short: "Allow a validator to validate your blockchain's subnet",
Long: `The blockchain addValidator command whitelists a primary network validator to
validate the subnet of the provided deployed Blockchain.
To add the validator to the Subnet's allow list, you first need to provide
the subnetName and the validator's unique NodeID. The command then prompts
the blockchainName and the validator's unique NodeID. The command then prompts
for the validation start time, duration, and stake weight. You can bypass
these prompts by providing the values with flags.
This command currently only works on Subnets deployed to either the Fuji
This command currently only works on Blockchains deployed to either the Fuji
Testnet or Mainnet.`,
RunE: addValidator,
Args: cobrautils.ExactArgs(1),
Expand Down Expand Up @@ -85,7 +90,7 @@ Testnet or Mainnet.`,
}

func addValidator(_ *cobra.Command, args []string) error {
subnetName := args[0]
blockchainName := args[0]
network, err := networkoptions.GetNetworkFromCmdLineFlags(
app,
"",
Expand All @@ -98,7 +103,7 @@ func addValidator(_ *cobra.Command, args []string) error {
if err != nil {
return err
}
fee := network.GenesisParams().AddSubnetValidatorFee
fee := network.GenesisParams().TxFeeConfig.StaticFeeConfig.AddSubnetValidatorFee
kc, err := keychain.GetKeychainFromCmdLineFlags(
app,
constants.PayTxsFeesMsg,
Expand All @@ -113,19 +118,19 @@ func addValidator(_ *cobra.Command, args []string) error {
return err
}
network.HandlePublicNetworkSimulation()
if err := UpdateKeychainWithSubnetControlKeys(kc, network, subnetName); err != nil {
if err := UpdateKeychainWithSubnetControlKeys(kc, network, blockchainName); err != nil {
return err
}
deployer := subnet.NewPublicDeployer(app, kc, network)
return CallAddValidator(deployer, network, kc, useLedger, subnetName, nodeIDStr, defaultValidatorParams, waitForTxAcceptance)
return CallAddValidator(deployer, network, kc, useLedger, blockchainName, nodeIDStr, defaultValidatorParams, waitForTxAcceptance)
}

func CallAddValidator(
deployer *subnet.PublicDeployer,
network models.Network,
kc *keychain.Keychain,
useLedgerSetting bool,
subnetName string,
blockchainName string,
nodeIDStr string,
defaultValidatorParamsSetting bool,
waitForTxAcceptanceSetting bool,
Expand Down Expand Up @@ -162,12 +167,12 @@ func CallAddValidator(
}
}

_, err = ValidateSubnetNameAndGetChains([]string{subnetName})
_, err = ValidateSubnetNameAndGetChains([]string{blockchainName})
if err != nil {
return err
}

sc, err := app.LoadSidecar(subnetName)
sc, err := app.LoadSidecar(blockchainName)
if err != nil {
return err
}
Expand All @@ -176,7 +181,6 @@ func CallAddValidator(
if subnetID == ids.Empty {
return errNoSubnetID
}
transferSubnetOwnershipTxID := sc.Networks[network.Name()].TransferSubnetOwnershipTxID

isPermissioned, controlKeys, threshold, err := txutils.GetOwners(network, subnetID)
if err != nil {
Expand Down Expand Up @@ -241,7 +245,6 @@ func CallAddValidator(
controlKeys,
subnetAuthKeys,
subnetID,
transferSubnetOwnershipTxID,
nodeID,
selectedWeight,
start,
Expand All @@ -254,7 +257,7 @@ func CallAddValidator(
if err := SaveNotFullySignedTx(
"Add Validator",
tx,
subnetName,
blockchainName,
subnetAuthKeys,
remainingSubnetAuthKeys,
outputTxPath,
Expand Down
Loading

0 comments on commit 6f73030

Please sign in to comment.