Skip to content

Commit

Permalink
Upgrade to Avalanche v1.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mboben committed Feb 2, 2025
1 parent 10e9520 commit 3c23c20
Show file tree
Hide file tree
Showing 1,758 changed files with 106,204 additions and 54,056 deletions.
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# go-flare

go-flare is a modified version of [[email protected]](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.0) and [[email protected]](https://github.com/ava-labs/coreth/releases/tag/v0.11.0), incorporating specific features for Flare and Songbird networks. These features include prioritized contract handling and the invocation of the daemon contract.

All nodes should upgrade to the version 1.9.1 **before the following dates**:
- Coston2 network: November 26, 2024 at 12:00:00 UTC
- Flare network: December 17, 2024 at 12:00:00 UTC
- Coston network: January 7, 2025 at 12:00:00 UTC
- Songbird network: January 28, 2025 at 12:00:00 UTC
go-flare is a modified version of [[email protected]](https://github.com/ava-labs/avalanchego/releases/tag/v1.10.0) and [[email protected]](https://github.com/ava-labs/coreth/releases/tag/v0.12.0), incorporating specific features for Flare and Songbird networks. These features include prioritized contract handling and the invocation of the daemon contract.

## System Requirements
- go version 1.21.8
Expand Down
2 changes: 2 additions & 0 deletions avalanchego/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ tests/e2e/e2e.test
tests/upgrade/upgrade.test

vendor

**/testdata
71 changes: 59 additions & 12 deletions avalanchego/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ run:
# skip auto-generated files.
skip-files:
- ".*\\.pb\\.go$"
- ".*mock.*"

issues:
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
Expand All @@ -15,6 +16,7 @@ linters:
disable-all: true
enable:
- asciicheck
- bodyclose
- depguard
- errcheck
- exportloopref
Expand All @@ -23,35 +25,79 @@ linters:
- gofmt
- gofumpt
- goimports
- revive
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- noctx
- nolintlint
- prealloc
- revive
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- unconvert
- whitespace
- staticcheck
# - bodyclose
# - structcheck
# - lll
# - gomnd
# - goprintffuncname
# - interfacer
# - typecheck
# - errorlint (TODO: re-enable in go1.20 migration)
# - goerr113
# - noctx
# - gomnd
# - lll

linters-settings:
errorlint:
# Check for plain type assertions and type switches.
asserts: false
# Check for plain error comparisons.
comparison: false
revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr
- name: bool-literal-in-expr
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return
- name: early-return
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines
- name: empty-lines
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format
- name: string-format
disabled: false
arguments:
- ["fmt.Errorf[0]", "/.*%.*/", "no format directive, use errors.New instead"]
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag
- name: struct-tag
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-naming
- name: unexported-naming
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error
- name: unhandled-error
disabled: false
arguments:
- "fmt\\.Fprint"
- "fmt\\.Fprintf"
- "fmt\\.Print"
- "fmt\\.Printf"
- "fmt\\.Println"
- "math/rand\\.Read"
- "strings\\.Builder\\.WriteString"
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
- name: unused-parameter
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-receiver
- name: unused-receiver
disabled: false
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break
- name: useless-break
disabled: false
staticcheck:
go: "1.18"
go: "1.19"
# https://staticcheck.io/docs/options#checks
checks:
- "all"
Expand All @@ -65,4 +111,5 @@ linters-settings:
list-type: blacklist
packages-with-error-message:
- io/ioutil: 'io/ioutil is deprecated. Use package io or os instead.'
- github.com/stretchr/testify/assert: 'github.com/stretchr/testify/require should be used instead.'
include-go-root: true
6 changes: 3 additions & 3 deletions avalanchego/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# README.md
# go.mod
# ============= Compilation Stage ================
FROM golang:1.18.5-buster AS builder
RUN apt-get update && apt-get install -y --no-install-recommends bash=5.0-4 git=1:2.20.1-2+deb10u3 make=4.2.1-1.2 gcc=4:8.3.0-1 musl-dev=1.1.21-2 ca-certificates=20200601~deb10u2 linux-headers-amd64
FROM golang:1.19.6-buster AS builder
RUN apt-get update && apt-get install -y --no-install-recommends bash=5.0-4 make=4.2.1-1.2 gcc=4:8.3.0-1 musl-dev=1.1.21-2 ca-certificates=20200601~deb10u2 linux-headers-amd64

WORKDIR /build
# Copy and download avalanche dependencies using go mod
Expand All @@ -17,7 +17,7 @@ RUN go mod download
# Copy the code into the container
COPY . .

# Build avalanchego and plugins
# Build avalanchego
RUN ./scripts/build.sh

# ============= Cleanup Stage ================
Expand Down
2 changes: 1 addition & 1 deletion avalanchego/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2020, Ava Labs, Inc.
Copyright (C) 2019-2023, Ava Labs, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
4 changes: 2 additions & 2 deletions avalanchego/LICENSE.header
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Copyright (C) 2019-2022, Ava Labs, Inc. All rights reserved.
See the file LICENSE for licensing terms.
Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
See the file LICENSE for licensing terms.
65 changes: 39 additions & 26 deletions avalanchego/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@ The minimum recommended hardware specification for nodes connected to Mainnet is
- CPU: Equivalent of 8 AWS vCPU
- RAM: 16 GiB
- Storage: 1 TiB
- OS: Ubuntu 20.04 or macOS >= 12
- OS: Ubuntu 20.04/22.04 or macOS >= 12
- Network: Reliable IPv4 or IPv6 network connection, with an open public port.

If you plan to build AvalancheGo from source, you will also need the following software:

- [Go](https://golang.org/doc/install) version >= 1.18.1
- [Go](https://golang.org/doc/install) version >= 1.19.6
- [gcc](https://gcc.gnu.org/)
- g++

### Native Install
### Building From Source

#### Clone The Repository

Clone the AvalancheGo repository:

Expand All @@ -35,17 +37,17 @@ git clone [email protected]:ava-labs/avalanchego.git
cd avalanchego
```

This will clone and checkout to `master` branch.
This will clone and checkout the `master` branch.

#### Building the Avalanche Executable
#### Building AvalancheGo

Build Avalanche by running the build script:
Build AvalancheGo by running the build script:

```sh
./scripts/build.sh
```

The output of the script will be the Avalanche binary named `avalanchego`. It is located in the build directory:
The `avalanchego` binary is now in the `build` directory. To run:

```sh
./build/avalanchego
Expand All @@ -57,20 +59,20 @@ Install AvalancheGo using an `apt` repository.

#### Adding the APT Repository

If you have already added the APT repository, you do not need to add it again.
If you already have the APT repository added, you do not need to add it again.

To add the repository on Ubuntu 20.04 (Focal), run:
To add the repository on Ubuntu, run:

```sh
sudo su -
wget -O - https://downloads.avax.network/avalanchego.gpg.key | apt-key add -
echo "deb https://downloads.avax.network/apt focal main" > /etc/apt/sources.list.d/avalanche.list
wget -qO - https://downloads.avax.network/avalanchego.gpg.key | tee /etc/apt/trusted.gpg.d/avalanchego.asc
source /etc/os-release && echo "deb https://downloads.avax.network/apt $UBUNTU_CODENAME main" > /etc/apt/sources.list.d/avalanche.list
exit
```

#### Installing the Latest Version

After adding the APT repository, install avalanchego by running:
After adding the APT repository, install `avalanchego` by running:

```sh
sudo apt update
Expand All @@ -85,9 +87,9 @@ The Avalanche binary to be executed is named `avalanchego`.

### Docker Install

Make sure docker is installed on the machine - so commands like `docker run` etc. are available.
Make sure Docker is installed on the machine - so commands like `docker run` etc. are available.

Building the docker image of latest avalanchego branch can be done by running:
Building the Docker image of latest `avalanchego` branch can be done by running:

```sh
./scripts/build_image.sh
Expand All @@ -99,7 +101,7 @@ To check the built image, run:
docker image ls
```

The image should be tagged as `avaplatform/avalanchego:xxxxxxxx`, where `xxxxxxxx` is the shortened commit of the Avalanche source it was built from. To run the avalanche node, run:
The image should be tagged as `avaplatform/avalanchego:xxxxxxxx`, where `xxxxxxxx` is the shortened commit of the Avalanche source it was built from. To run the Avalanche node, run:

```sh
docker run -ti -p 9650:9650 -p 9651:9651 avaplatform/avalanchego:xxxxxxxx /avalanchego/build/avalanchego
Expand Down Expand Up @@ -133,7 +135,7 @@ See [this tutorial.](https://docs.avax.network/build/tutorials/platform/create-a

## Bootstrapping

A node needs to catch up to the latest network state before it can participate in consensus and serve API calls. This process, called bootstrapping, currently takes several days for a new node connected to Mainnet.
A node needs to catch up to the latest network state before it can participate in consensus and serve API calls. This process (called bootstrapping) currently takes several days for a new node connected to Mainnet.

A node will not [report healthy](https://docs.avax.network/build/avalanchego-apis/health) until it is done bootstrapping.

Expand All @@ -143,15 +145,15 @@ The bottleneck during bootstrapping is typically database IO. Using a more power

## Generating Code

Avalanchego uses multiple tools to generate efficient and boilerplate code.
AvalancheGo uses multiple tools to generate efficient and boilerplate code.

### Running protobuf codegen

To regenerate the protobuf go code, run `scripts/protobuf_codegen.sh` from the root of the repo.

This should only be necessary when upgrading protobuf versions or modifying .proto definition files.

To use this script, you must have [buf](https://docs.buf.build/installation) (v1.7.0), protoc-gen-go (v1.28.0) and protoc-gen-go-grpc (v1.2.0) installed.
To use this script, you must have [buf](https://docs.buf.build/installation) (v1.11.0), protoc-gen-go (v1.28.0) and protoc-gen-go-grpc (v1.2.0) installed.

To install the buf dependencies:

Expand Down Expand Up @@ -186,17 +188,28 @@ docker run -t -i -v $(pwd):/opt/avalanche -w/opt/avalanche avalanche:protobuf_co

### Running mock codegen

Going forward, AvalancheGo will use [gomock](https://github.com/golang/mock) for mocking in unit tests.
To regenerate the [gomock](https://github.com/golang/mock) code, run `scripts/mock.gen.sh` from the root of the repo.

Example usage:
This should only be necessary when modifying exported interfaces or after modifying `scripts/mock.mockgen.txt`.

```sh
mockgen -destination vms/platformvm/state/mock_diff.go -package state github.com/ava-labs/avalanchego/vms/platformvm/state Diff
```
## Versioning

### Version Semantics

AvalancheGo is first and foremost a client for the Avalanche network. The versioning of AvalancheGo follows that of the Avalanche network.

- `v0.x.x` indicates a development network version.
- `v1.x.x` indicates a production network version.
- `vx.[Upgrade].x` indicates the number of network upgrades that have occurred.
- `vx.x.[Patch]` indicates the number of client upgrades that have occurred since the last network upgrade.

### Library Compatibility Guarantees

Because AvalancheGo's version denotes the network version, it is expected that interfaces exported by AvalancheGo's packages may change in `Patch` version updates.

This makes a mock implementation of the `Diff` interface from `github.com/ava-labs/avalanchego/vms/platformvm/state`and puts it at `vms/platformvm/state/mock_diff.go`. The struct implementing the mock will be in the `state` package.
### API Compatibility Guarantees

See `gomock` documentation for more information.
APIs exposed when running AvalancheGo will maintain backwards compatibility, unless the functionality is explicitly deprecated and announced when removed.

## Supported Platforms

Expand Down Expand Up @@ -232,4 +245,4 @@ To officially support a new platform, one must satisfy the following requirement

**We and our community welcome responsible disclosures.**

If you've discovered a security vulnerability, please report it via our [bug bounty program](https://hackenproof.com/avalanche/). Valid reports will be eligible for a reward (terms and conditions apply).
Please refer to our [Security Policy](SECURITY.md) and [Security Advisories](https://github.com/ava-labs/avalanchego/security/advisories).
Loading

0 comments on commit 3c23c20

Please sign in to comment.