Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
NebojsaHorvat committed Jan 20, 2025
2 parents a26c0ec + d00d1db commit fd06692
Show file tree
Hide file tree
Showing 406 changed files with 12,975 additions and 12,456 deletions.
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@

# review whenever someone opens a pull request.

* @darioush @ceyonur
* @ceyonur @darioush @ava-labs/platform-evm

33 changes: 33 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,36 @@ Please make sure your contributions adhere to our coding guidelines:
Before you submit a feature request, please check and make sure that it isn't
possible through some other means.

## Mocks

Mocks are auto-generated using [mockgen](https://pkg.go.dev/go.uber.org/mock/mockgen) and `//go:generate` commands in the code.

* To **re-generate all mocks**, use the command below from the root of the project:

```sh
go generate -run "go.uber.org/mock/mockgen" ./...
```

* To **add** an interface that needs a corresponding mock generated:
* if the file `mocks_generate_test.go` exists in the package where the interface is located, either:
* modify its `//go:generate go run go.uber.org/mock/mockgen` to generate a mock for your interface (preferred); or
* add another `//go:generate go run go.uber.org/mock/mockgen` to generate a mock for your interface according to specific mock generation settings
* if the file `mocks_generate_test.go` does not exist in the package where the interface is located, create it with content (adapt as needed):

```go
// Copyright (C) 2025-2025, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package mypackage
//go:generate go run go.uber.org/mock/mockgen -package=${GOPACKAGE} -destination=mocks_test.go . YourInterface
```

Notes:
1. Ideally generate all mocks to `mocks_test.go` for the package you need to use the mocks for and do not export mocks to other packages. This reduces package dependencies, reduces production code pollution and forces to have locally defined narrow interfaces.
1. Prefer using reflect mode to generate mocks than source mode, unless you need a mock for an unexported interface, which should be rare.
* To **remove** an interface from having a corresponding mock generated:
1. Edit the `mocks_generate_test.go` file in the directory where the interface is defined
1. If the `//go:generate` mockgen command line:
* generates a mock file for multiple interfaces, remove your interface from the line
* generates a mock file only for the interface, remove the entire line. If the file is empty, remove `mocks_generate_test.go` as well.
4 changes: 4 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
## How this works

## How this was tested

## Need to be documented?

## Need to update RELEASES.md?
137 changes: 74 additions & 63 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ on:
workflow_dispatch:
inputs:
avalanchegoRepo:
description: 'avalanchego github repository'
description: "avalanchego github repository"
required: true
default: 'ava-labs/avalanchego'
default: "ava-labs/avalanchego"
avalanchegoBranch:
description: 'avalanchego branch'
description: "avalanchego branch"
required: true
default: 'master'
default: "master"

jobs:
lint:
Expand All @@ -31,8 +31,7 @@ jobs:
token: ${{ secrets.AVALANCHE_PAT }}
- uses: actions/setup-go@v5
with:
go-version: '~1.21.9'
check-latest: true
go-version: "~1.22.8"
- name: change avalanchego dep
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
Expand All @@ -51,72 +50,84 @@ jobs:
- name: Run shellcheck
shell: bash
run: scripts/shellcheck.sh
- name: Run actionlint
shell: bash
run: scripts/actionlint.sh
test:
name: Golang Unit Tests v${{ matrix.go }} (${{ matrix.os }})
name: Golang Unit Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-20.04, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: check out ${{ github.event.inputs.avalanchegoRepo }} ${{ github.event.inputs.avalanchegoBranch }}
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.avalanchegoRepo }}
ref: ${{ github.event.inputs.avalanchegoBranch }}
path: avalanchego
token: ${{ secrets.AVALANCHE_PAT }}
- uses: actions/setup-go@v5
with:
go-version: '~1.21.9'
check-latest: true
- name: change avalanchego dep
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
go mod edit -replace github.com/ava-labs/avalanchego=./avalanchego
go mod tidy
- name: Set timeout on Windows # Windows UT run slower and need a longer timeout
shell: bash
if: matrix.os == 'windows-latest'
run: echo "TIMEOUT=1200s" >> $GITHUB_ENV
- run: go mod download
shell: bash
- run: ./scripts/build.sh evm
shell: bash
- run: ./scripts/build_test.sh
shell: bash
env:
TIMEOUT: ${{ env.TIMEOUT }}
- run: ./scripts/coverage.sh
shell: bash
- uses: actions/checkout@v4
- name: check out ${{ github.event.inputs.avalanchegoRepo }} ${{ github.event.inputs.avalanchegoBranch }}
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.avalanchegoRepo }}
ref: ${{ github.event.inputs.avalanchegoBranch }}
path: avalanchego
token: ${{ secrets.AVALANCHE_PAT }}
- uses: actions/setup-go@v5
with:
go-version: "~1.22.8"
- name: change avalanchego dep
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
go mod edit -replace github.com/ava-labs/avalanchego=./avalanchego
go mod tidy
- name: Set timeout on Windows # Windows UT run slower and need a longer timeout
shell: bash
if: matrix.os == 'windows-latest'
run: echo "TIMEOUT=1200s" >> "$GITHUB_ENV"
- run: go mod download
shell: bash
- name: go mod tidy
run: |
go mod tidy
git diff --exit-code
- name: Mocks are up to date
shell: bash
run: |
grep -lr -E '^// Code generated by MockGen\. DO NOT EDIT\.$' . | xargs -r rm
go generate -run "go.uber.org/mock/mockgen" ./...
git add --intent-to-add --all
git diff --exit-code
- run: ./scripts/build.sh evm
shell: bash
- run: ./scripts/build_test.sh
shell: bash
env:
TIMEOUT: ${{ env.TIMEOUT }}
- run: ./scripts/coverage.sh
shell: bash
avalanchego_e2e:
name: AvalancheGo E2E Tests v${{ matrix.go }} (${{ matrix.os }})
name: AvalancheGo E2E Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04 ]
os: [ubuntu-20.04]
steps:
- uses: actions/checkout@v4
- name: check out ${{ github.event.inputs.avalanchegoRepo }} ${{ github.event.inputs.avalanchegoBranch }}
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.avalanchegoRepo }}
ref: ${{ github.event.inputs.avalanchegoBranch }}
path: avalanchego
token: ${{ secrets.AVALANCHE_PAT }}
- uses: actions/setup-go@v5
with:
go-version: '~1.21.9'
check-latest: true
- name: Run e2e tests
run: E2E_SERIAL=1 ./scripts/tests.e2e.sh
shell: bash
- name: Upload tmpnet network dir
uses: actions/upload-artifact@v4
if: always()
with:
name: tmpnet-data
path: ~/.tmpnet/networks/1000
- uses: actions/checkout@v4
- name: check out ${{ github.event.inputs.avalanchegoRepo }} ${{ github.event.inputs.avalanchegoBranch }}
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/checkout@v4
with:
repository: ${{ github.event.inputs.avalanchegoRepo }}
ref: ${{ github.event.inputs.avalanchegoBranch }}
path: avalanchego
token: ${{ secrets.AVALANCHE_PAT }}
- uses: actions/setup-go@v5
with:
go-version: "~1.22.8"
- name: Run e2e tests
run: E2E_SERIAL=1 ./scripts/tests.e2e.sh
shell: bash
- name: Upload tmpnet network dir
uses: actions/upload-artifact@v4
if: always()
with:
name: tmpnet-data
path: ~/.tmpnet/networks/1000
9 changes: 4 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -53,7 +53,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -67,5 +67,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

uses: github/codeql-action/analyze@v3
19 changes: 19 additions & 0 deletions .github/workflows/sync-subnet-evm-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Sync Subnet EVM Branch"
on:
workflow_dispatch:
inputs:
remoteBranch:
description: "Subnet EVM Branch"
required: true
default: "master"

jobs:
sync_branch:
name: Sync Subnet EVM Branch
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: "~1.22.8"
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ run:
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
# Include non-test files tagged as test-only.
# Context: https://github.com/ava-labs/avalanchego/pull/3173

linters:
disable-all: true
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ============= Compilation Stage ================
FROM golang:1.21.9-bullseye AS builder
FROM golang:1.22.8-bullseye AS builder

ARG AVALANCHE_VERSION

Expand All @@ -17,7 +17,7 @@ WORKDIR $GOPATH/src/github.com/ava-labs/avalanchego
RUN go mod download
# Replace the coreth dependency
RUN go mod edit -replace github.com/ava-labs/coreth=../coreth
RUN go mod download && go mod tidy -compat=1.21
RUN go mod download && go mod tidy -compat=1.22

# Build the AvalancheGo binary with local version of coreth.
RUN ./scripts/build_avalanche.sh
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Coreth and the C-Chain

[Avalanche](https://docs.avax.network/intro) is a network composed of multiple blockchains.
[Avalanche](https://www.avax.network/) is a network composed of multiple blockchains.
Each blockchain is an instance of a Virtual Machine (VM), much like an object in an object-oriented language is an instance of a class.
That is, the VM defines the behavior of the blockchain.
Coreth (from core Ethereum) is the [Virtual Machine (VM)](https://docs.avax.network/learn/avalanche/virtual-machines) that defines the Contract Chain (C-Chain).
Coreth (from core Ethereum) is the [Virtual Machine (VM)](https://docs.avax.network/learn/virtual-machines) that defines the Contract Chain (C-Chain).
This chain implements the Ethereum Virtual Machine and supports Solidity smart contracts as well as most other Ethereum client functionality.

## Building
Expand Down Expand Up @@ -39,7 +39,7 @@ Full documentation for the C-Chain's API can be found [here.](https://docs.avax.

## Compatibility

The C-Chain is compatible with almost all Ethereum tooling, including [Core,](https://docs.avax.network/build/dapp/launch-dapp#through-core) [Metamask,](https://docs.avax.network/build/dapp/launch-dapp#through-metamask) [Remix](https://docs.avax.network/build/tutorials/smart-contracts/deploy-a-smart-contract-on-avalanche-using-remix-and-metamask) and [Truffle.](https://docs.avax.network/build/tutorials/smart-contracts/using-truffle-with-the-avalanche-c-chain)
The C-Chain is compatible with almost all Ethereum tooling, including [Core,](https://docs.avax.network/build/dapp/launch-dapp#through-core) [Metamask,](https://docs.avax.network/build/dapp/launch-dapp#through-metamask) [Remix](https://docs.avax.network/dapps/smart-contract-dev/deploy-with-remix-ide) and [Truffle.](https://docs.avax.network/build/tutorials/smart-contracts/using-truffle-with-the-avalanche-c-chain)

## Differences Between Avalanche C-Chain and Ethereum

Expand Down
48 changes: 48 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
# Release Notes

## Pending Release

## [v0.14.1](https://github.com/ava-labs/coreth/releases/tag/v0.14.1)

- Removed deprecated `ExportKey`, `ExportAVAX`, `Export`, `ImportKey`, `ImportAVAX`, `Import` APIs
- IMPORTANT: `eth_getProof` calls for historical state will be rejected by default.
- On archive nodes (`"pruning-enabled": false`): queries for historical proofs for state older than approximately 24 hours preceding the last accepted block will be rejected by default. This can be adjusted with the new option `historical-proof-query-window` which defines the number of blocks before the last accepted block which should be accepted for state proof queries, or set to `0` to accept any block number state query (previous behavior).
- On `pruning` nodes: queries for proofs past the tip buffer (32 blocks) will be rejected. This is in support of moving to a path based storage scheme, which does not support historical state proofs.
- Remove API eth_getAssetBalance that was used to query ANT balances (deprecated since v0.10.0)
- Remove legacy gossip handler and metrics (deprecated since v0.10.0)
- Refactored trie_prefetcher.go to be structurally similar to [upstream](https://github.com/ethereum/go-ethereum/tree/v1.13.14).

## [v0.14.0](https://github.com/ava-labs/coreth/releases/tag/v0.14.0)
- Minor version update to correspond to avalanchego v1.12.0 / Etna.
- Remove unused historical opcodes CALLEX, BALANCEMC
- Remove unused pre-AP2 handling of genesis contract
- Fix to track tx size in block building
- Test fixes
- Update go version to 1.22

## [v0.13.8](https://github.com/ava-labs/coreth/releases/tag/v0.13.8)
- Update geth dependency to v1.13.14
- eupgrade: lowering the base fee to 1 nAVAX
- eupgrade/cancun: verify no blobs in header
- Supports ACP-118 message types
- Gets network upgrade timestamps from avalanchego
- Remove cross-chain handlers

## [v0.13.7](https://github.com/ava-labs/coreth/releases/tag/v0.13.7)
- Add EUpgrade base definitions
- Remove Block Status
- Fix and improve "GetBlockIDAtHeight"
- Bump golang version requirement to 1.21.12
- Bump AvalancheGo to v1.11.10-prerelease

## [v0.13.6](https://github.com/ava-labs/coreth/releases/tag/v0.13.6)
- rpc: truncate call error data logs
- logging: remove path prefix (up to coreth@version/) from logged file names.
- cleanup: removes pre-Durango scripts

## [v0.13.5](https://github.com/ava-labs/coreth/releases/tag/v0.13.5)
- Bump AvalancheGo to v1.11.7
- Bump golang version requirement to 1.21.12
- Switches timestamp log back to "timestamp" (as was before v0.13.4)
- Add missing fields to "toCallArg"
- Fix state sync ETA overflow
- Fix state sync crash bug

## [v0.13.4](https://github.com/ava-labs/coreth/releases/tag/v0.13.4)
- Fixes snapshot use when state sync was explicitly enabled
- Fixes v0.13.3 locking regression in async snapshot generation
Expand Down
2 changes: 1 addition & 1 deletion accounts/abi/abi.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
)

// The ABI holds information about a contract's context and available
// invokable methods. It will allow you to type check function calls and
// invocable methods. It will allow you to type check function calls and
// packs data accordingly.
type ABI struct {
Constructor Method
Expand Down
Loading

0 comments on commit fd06692

Please sign in to comment.