diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6dc6f43bdff4..689caceb9dba 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,6 +10,11 @@ updates: schedule: interval: "daily" open-pull-requests-limit: 0 # Disable non-security version updates + - package-ecosystem: "gomod" # See documentation for possible values + directory: "/graft/coreth" # Location of package manifests + schedule: + interval: "daily" + open-pull-requests-limit: 0 # Disable non-security version updates - package-ecosystem: github-actions directory: "/" schedule: diff --git a/go.mod b/go.mod index 1ae9b6401d26..249798ff01f4 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ module github.com/ava-labs/avalanchego // - go.mod (here) // - nix/go/default.nix (update version and sha256 for supported arches) // - tools/go.mod +// - graft/**/go.mod (e.g. coreth) // // - If updating between minor versions (e.g. 1.24.x -> 1.25.x): // - Consider updating the version of golangci-lint (see tools/go.mod) diff --git a/graft/coreth/.dockerignore b/graft/coreth/.dockerignore deleted file mode 100644 index 6c85e6f6aa24..000000000000 --- a/graft/coreth/.dockerignore +++ /dev/null @@ -1,9 +0,0 @@ -.ci -.github -.gitignore -.golangci.yml -.idea -.vscode - -LICENSE -*.md diff --git a/graft/coreth/.github/CODEOWNERS b/graft/coreth/.github/CODEOWNERS deleted file mode 100644 index fa1f6ca249ba..000000000000 --- a/graft/coreth/.github/CODEOWNERS +++ /dev/null @@ -1,12 +0,0 @@ -# Each line is a file pattern followed by one or more owners. - -# These owners will be the default code owners for everything in the repo. - -# Unless a later match takes precedence, these owners will be requested for - -# review whenever someone opens a pull request. - -* @ava-labs/platform-evm -/.github/ @maru-ava @ava-labs/platform-evm -/triedb/firewood/ @alarso16 @ava-labs/platform-evm - diff --git a/graft/coreth/.github/CONTRIBUTING.md b/graft/coreth/.github/CONTRIBUTING.md deleted file mode 100644 index 6e8db8aea7d3..000000000000 --- a/graft/coreth/.github/CONTRIBUTING.md +++ /dev/null @@ -1,85 +0,0 @@ -# Contributing - -Thank you for considering to help out with the source code! We welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes! - -If you'd like to contribute to coreth, please fork, fix, commit and send a pull request for the maintainers to review and merge into the main code base. If you wish to submit more complex changes though, please check up with the core devs first on [Discord](https://chat.avalabs.org) to ensure those changes are in line with the general philosophy of the project and/or get some early feedback which can make both your efforts much lighter as well as our review and merge procedures quick and simple. - -## Coding guidelines - -Please make sure your contributions adhere to our coding guidelines: - -- Code must adhere to the official Go - [formatting](https://go.dev/doc/effective_go#formatting) guidelines - (i.e. uses [gofmt](https://pkg.go.dev/cmd/gofmt)). -- Code must be documented adhering to the official Go - [commentary](https://go.dev/doc/effective_go#commentary) guidelines. -- Pull requests need to be based on and opened against the `master` branch. -- Pull reuqests should include a detailed description -- Commits are required to be signed. See the [commit signature verification documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) - for information on signing commits. -- Commit messages should be prefixed with the package(s) they modify. - - E.g. "eth, rpc: make trace configs optional" - -## Can I have feature X - -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 task below from the root of the project: - - ```sh - task generate-mocks - ``` - -- 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 tool -modfile=tools/go.mod mockgen` to generate a mock for your interface (preferred); or - - add another `//go:generate go tool -modfile=tools/go.mod 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 tool -modfile=tools/go.mod 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. - -## Tool Dependencies - -This project uses `go tool` to manage development tool dependencies in `tools/go.mod`. This isolates tool dependencies from the main application dependencies and provides consistent, version-locked tools across the team. - -### Managing Tools - -- To **add a new tool**: - - ```sh - go get -tool -modfile=tools/go.mod example.com/tool/cmd/toolname@version - ``` - -- To **upgrade a tool**: - - ```sh - go get -tool -modfile=tools/go.mod example.com/tool/cmd/toolname@newversion - ``` - -- To **run a tool manually**: - - ```sh - go tool -modfile=tools/go.mod toolname [args...] - ``` - -Note: `ginkgo` remains in the main `go.mod` as it is used directly in e2e test code. diff --git a/graft/coreth/.github/ISSUE_TEMPLATE/bug_report.md b/graft/coreth/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 4c524e036c26..000000000000 --- a/graft/coreth/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -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 and/or the log directory of your node. By default, this can be found at `~/.avalanchego/logs/`. - -**Metrics** -If applicable, please include any metrics gathered from your node to assist us in diagnosing the problem. - -**Operating System** -Which OS you used to reveal the bug. - -**Additional context** -Add any other context about the problem here. - -You can submit a bug on the [Avalanche Bug Bounty program page](https://hackenproof.com/avalanche/avalanche-protocol). diff --git a/graft/coreth/.github/ISSUE_TEMPLATE/feature_request.md b/graft/coreth/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7d6155..000000000000 --- a/graft/coreth/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/graft/coreth/.github/dependabot.yml b/graft/coreth/.github/dependabot.yml deleted file mode 100644 index 2c329ee77abd..000000000000 --- a/graft/coreth/.github/dependabot.yml +++ /dev/null @@ -1,17 +0,0 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 -updates: - - package-ecosystem: "gomod" # See documentation for possible values - directory: "/" # Location of package manifests - schedule: - interval: "daily" - open-pull-requests-limit: 0 # Disable non-security version updates - - package-ecosystem: github-actions - directory: "/" - schedule: - interval: "weekly" - open-pull-requests-limit: 0 # Disable non-security version updates \ No newline at end of file diff --git a/graft/coreth/.github/pull_request_template.md b/graft/coreth/.github/pull_request_template.md deleted file mode 100644 index d1b4cd3a7bf3..000000000000 --- a/graft/coreth/.github/pull_request_template.md +++ /dev/null @@ -1,10 +0,0 @@ - -## Why this should be merged - -## How this works - -## How this was tested - -## Need to be documented? - -## Need to update RELEASES.md? diff --git a/graft/coreth/.github/workflows/codeql-analysis.yml b/graft/coreth/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 0cb4cc0d6fc4..000000000000 --- a/graft/coreth/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,72 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ master ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] - merge_group: - types: [checks_requested] - schedule: - - cron: '44 11 * * 4' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'go' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://git.io/codeql-language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@45775bd8235c68ba998cffa5171334d58593da47 #v3.28.15 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # 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@45775bd8235c68ba998cffa5171334d58593da47 #v3.28.15 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@45775bd8235c68ba998cffa5171334d58593da47 #v3.28.15 diff --git a/graft/coreth/.gitignore b/graft/coreth/.gitignore deleted file mode 100644 index c99388413bc8..000000000000 --- a/graft/coreth/.gitignore +++ /dev/null @@ -1,55 +0,0 @@ -./main - -*.log -*~ -.DS_Store - -awscpu - -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib -*.profile - -# Test binary, build with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# ignore GoLand metafiles directory -.idea/ - -*logs/ -!*customlogs/ - -.vscode* - -*.pb* - -*cpu[0-9]* -*mem[0-9]* -*lock[0-9]* -*.profile -*.swp -*.aux -*.fdb* -*.fls -*.gz -*.pdf - -.coverage - -bin/ -build/ - -# Used for e2e testing -avalanchego - -.direnv - -cmd/simulator/.simulator/* -cmd/simulator/simulator diff --git a/graft/coreth/README.md b/graft/coreth/README.md index c287327f3439..13c1b62e6539 100644 --- a/graft/coreth/README.md +++ b/graft/coreth/README.md @@ -1,45 +1,17 @@ # Coreth and the C-Chain [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/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. +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/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 -Coreth is a dependency of AvalancheGo which is used to implement the EVM based Virtual Machine for the Avalanche C-Chain. In order to run with a local version of Coreth, users must update their Coreth dependency within AvalancheGo to point to their local Coreth directory. If Coreth and AvalancheGo are at the standard location within your GOPATH, this will look like the following: - -```bash -cd $GOPATH/src/github.com/ava-labs/avalanchego -go mod edit -replace github.com/ava-labs/coreth=../coreth -``` - -Now that AvalancheGo depends on the local version of Coreth, we can build with the normal build script: - -```bash -./scripts/build.sh -./build/avalanchego -``` - -Note: the C-Chain originally ran in a separate process from the main AvalancheGo process and communicated with it over a local gRPC connection. When this was the case, AvalancheGo's build script would download Coreth, compile it, and place the binary into the `avalanchego/build/plugins` directory. +Coreth is a dependency of AvalancheGo which is used to implement the EVM based Virtual Machine for the Avalanche C-Chain. In order to run with a local version of Coreth, users can simply build AvalancheGo from source. ### Optional Dev Shell -Some activities, such as collecting metrics and logs from the nodes targeted by an e2e -test run, require binary dependencies. One way of making these dependencies available is -to use a nix shell which will give access to the dependencies expected by the test -tooling: - -- Install [nix](https://nixos.org/). The [determinate systems - installer](https://github.com/DeterminateSystems/nix-installer?tab=readme-ov-file#install-nix) - is recommended. -- Use `./scripts/dev_shell.sh` to start a nix shell -- Execute the dependency-requiring command (e.g. `./scripts/tests.e2e.sh --start-collectors`) +Some activities, such as collecting metrics and logs from the nodes targeted by an e2e test run, require binary dependencies. One way of making these dependencies available is to use a nix shell which will give access to the dependencies expected by the test tooling. See [flake.nix](../../flake.nix) for how to start. -This repo also defines a `.envrc` file to configure [devenv](https://direnv.net/). With -`devenv` and `nix` installed, a shell at the root of the repo will automatically start a nix -dev shell. +This repo also defines a `.envrc` file to configure [devenv](https://direnv.net/). With `devenv` and `nix` installed, a shell at the root of the repo will automatically start a nix dev shell. ## API diff --git a/graft/coreth/SECURITY.md b/graft/coreth/SECURITY.md index 3c2ebb4c440c..a3678fd20e4c 100644 --- a/graft/coreth/SECURITY.md +++ b/graft/coreth/SECURITY.md @@ -16,4 +16,4 @@ Please refer to the [Bug Bounty Page](https://immunefi.com/bug-bounty/avalabs/in ## Supported Versions -Please use the [most recently released version](https://github.com/ava-labs/coreth/releases/latest) to perform testing and to validate security issues. +Please use the [most recently released version](https://github.com/ava-labs/avalanchego/releases/latest) to perform testing and to validate security issues. diff --git a/graft/coreth/Taskfile.yml b/graft/coreth/Taskfile.yml index eefaab894078..b7fc0266aac6 100644 --- a/graft/coreth/Taskfile.yml +++ b/graft/coreth/Taskfile.yml @@ -10,10 +10,6 @@ env: tasks: default: ./scripts/run_task.sh --list - build: - desc: Compile Coreth binary with git commit and static linking flags - cmd: ./scripts/build.sh # ci.yml - build-test: desc: Run all Go tests with retry logic for flaky tests, race detection, and coverage reporting cmd: ./scripts/build_test.sh # ci.yml @@ -100,7 +96,7 @@ tasks: shellcheck: desc: Run shellcheck static analysis on all shell scripts with version management - cmd: ./scripts/shellcheck.sh # ci.yml + cmd: ./scripts/shellcheck.sh test-e2e-warp: desc: Run end-to-end warp tests using Ginkgo test framework diff --git a/graft/coreth/cmd/simulator/README.md b/graft/coreth/cmd/simulator/README.md index b2cf67cc93a2..63f2c6ccb0b4 100644 --- a/graft/coreth/cmd/simulator/README.md +++ b/graft/coreth/cmd/simulator/README.md @@ -7,7 +7,7 @@ When building developing your own blockchain using `coreth`, you may want to ana To build the load simulator, navigate to the base of the simulator directory: ```bash -cd $GOPATH/src/github.com/ava-labs/coreth/cmd/simulator +cd $GOPATH/src/github.com/ava-labs/avalanchego/graft/coreth/cmd/simulator ``` Build the simulator: diff --git a/graft/coreth/docs/releasing/README.md b/graft/coreth/docs/releasing/README.md deleted file mode 100644 index afe97cee647c..000000000000 --- a/graft/coreth/docs/releasing/README.md +++ /dev/null @@ -1,166 +0,0 @@ -# Releasing - -## Procedure - -### Release candidate - -â„šī¸ you should always create a release candidate first, and only if everything is fine, you can create a release. - -In this section, we create a release candidate `v0.15.0-rc.0`. We therefore assign these environment variables to simplify copying instructions: - -```bash -export VERSION_RC=v0.15.0-rc.0 -export VERSION=v0.15.0 -``` - -1. Create your branch, usually from the tip of the `master` branch: - - ```bash - git fetch origin master:master - git checkout master - git checkout -b "releases/$VERSION_RC" - ``` - -1. Update the [RELEASES.md](../../RELEASES.md) file by renaming the "Pending" section to the new release version `$VERSION` and creating a new "Pending" section at the top. -1. Modify the [plugin/evm/version.go](../../plugin/evm/version.go) `Version` global string variable and set it to the desired `$VERSION`. -1. Because AvalancheGo and coreth depend on each other, and that we create releases of AvalancheGo before coreth, you can use a recent commit hash or recent release candidate of AvalancheGo in your `go.mod` file. Coreth releases should be tightly coordinated with AvalancheGo releases. -1. Commit your changes and push the branch - - ```bash - git add . - git commit -S -m "chore: release $VERSION_RC" - git push -u origin "releases/$VERSION_RC" - ``` - -1. Create a pull request (PR) from your branch targeting master, for example using [`gh`](https://cli.github.com/): - - ```bash - gh pr create --repo github.com/ava-labs/coreth --base master --title "chore: release $VERSION_RC" - ``` - -1. Wait for the PR checks to pass with - - ```bash - gh pr checks --watch - ``` - -1. Squash and merge your release branch into `master`, for example: - - ```bash - gh pr merge "releases/$VERSION" --squash --delete-branch --subject "chore: release $VERSION" --body "\n- Update AvalancheGo from v1.12.3 to v1.13.0" - ``` - -1. Create and push a tag from the `master` branch: - - ```bash - git fetch origin master:master - git checkout master - # Double check the tip of the master branch is the expected commit - # of the squashed release branch - git log -1 - git tag -s "$VERSION_RC" - git push origin "$VERSION_RC" - ``` - -1. Once the release candidate tag is created, create a pull request on the AvalancheGo repository, bumping the coreth dependency to use this release candidate. Once proven stable, an AvalancheGo release should be created, after which you can create a coreth release. - -### Release - -If a successful release candidate was created and integrated in a release of AvalancheGo, you can now create a release. - -Following the previous example in the [Release candidate section](#release-candidate) we will create a release `v0.15.0` indicated by the `$VERSION` variable. - -1. Create and push a tag from the `master` branch: - - ```bash - git checkout master - git pull origin - # Double check the tip of the master branch is the expected commit - # of the squashed release branch - git log -1 - git tag -s "$VERSION" - git push origin "$VERSION" - ``` - -1. Create a new release on Github, either using: - - the [Github web interface](https://github.com/ava-labs/coreth/releases/new) - 1. In the "Choose a tag" box, select the tag previously created `$VERSION` (`v0.15.0`) - 1. Pick the previous tag, for example as `v0.14.0`. - 1. Set the "Release title" to `$VERSION` (`v0.15.0`) - 1. Set the description using this format: - - ```markdown - This is the Coreth version used in AvalancheGo@v1.13.1 - - # Breaking changes - - # Features - - # Fixes - - # Documentation - - ``` - - 1. Only tick the box "Set as the latest release" - 1. Click on the "Create release" button - - the Github CLI `gh`: - - ```bash - PREVIOUS_VERSION=v0.14.0 - NOTES="This is the Coreth version used in AvalancheGo@v1.13.1 - - # Breaking changes - - # Features - - # Fixes - - # Documentation - - " - gh release create "$VERSION" --notes-start-tag "$PREVIOUS_VERSION" --notes-from-tag "$VERSION" --title "$VERSION" --notes "$NOTES" --verify-tag - ``` - -Note this release will likely never be used in AvalancheGo, which should always be using release candidates to accelerate the development process. However it is still useful to have a release to indicate the last stable version of coreth. - -### Post-release - -After you have successfully released a new coreth version, you need to bump all of the versions again in preperation for the next release. Note that the release here is not final, and will be reassessed, and possibly changer prior to release. Some releases require a major version update, but this will usually be `$VERSION` + `0.0.1`. For example: - -```bash -export P_VERSION=v1.15.1 -``` - -1. Create a branch, from the tip of the `master` branch after the release PR has been merged - - ```bash - git fetch origin master:master - git checkout master - git checkout -b "prep-$P_VERSION-release" - ``` - -1. Bump the version number to the next pending release version, `$P_VERSION` - -- Update the [RELEASES.md](../../RELEASES.md) file with `$P_VERSION`, creating a space for maintainers to place their changes as they make them. -- Modify the [plugin/evm/version.go](../../plugin/evm/version.go) `Version` global string variable and set it to `$P_VERSION`. - -1. Create a pull request (PR) from your branch targeting master, for example using [`gh`](https://cli.github.com/): - - ```bash - gh pr create --repo github.com/ava-labs/coreth --base master --title "chore: prep next release $P_VERSION" - ``` - -1. Wait for the PR checks to pass with - - ```bash - gh pr checks --watch - ``` - -1. Squash and merge your branch into `master`, for example: - - ```bash - gh pr merge "prep-$P_VERSION-release" --squash --subject "chore: prep next release $P_VERSION" - ``` - -1. Pat yourself on the back for a job well done. diff --git a/graft/coreth/go.mod b/graft/coreth/go.mod index 8ed6774b6dc6..d95ce3236093 100644 --- a/graft/coreth/go.mod +++ b/graft/coreth/go.mod @@ -4,13 +4,7 @@ module github.com/ava-labs/avalanchego/graft/coreth // tools/go.mod to avoid polluting the main module's dependencies. See // CONTRIBUTING.md for more details. -// - Changes to the minimum golang version must also be replicated in: -// - go.mod (here) -// - tools/go.mod -// - RELEASES.md -// -// - If updating between minor versions (e.g. 1.24.x -> 1.25.x): -// - Consider updating the version of golangci-lint (see tools/go.mod) +// See ../../go.mod for guidelines on updating the Go version. go 1.24.9 require ( diff --git a/graft/coreth/scripts/build.sh b/graft/coreth/scripts/build.sh deleted file mode 100755 index 319a008693ec..000000000000 --- a/graft/coreth/scripts/build.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o nounset -set -o pipefail - -# Root directory -CORETH_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd ) - -# Load the versions -source "$CORETH_PATH"/scripts/versions.sh - -# Load the constants -source "$CORETH_PATH"/scripts/constants.sh - -if [[ $# -eq 1 ]]; then - BINARY_PATH=$1 -elif [[ $# -eq 0 ]]; then - BINARY_PATH="$DEFAULT_PLUGIN_DIR/$DEFAULT_VM_ID" -else - echo "Invalid arguments to build coreth. Requires zero (default binary path) or one argument to specify the binary path." - exit 1 -fi - -# Check if CORETH_COMMIT is set, if not retrieve the last commit from the repo. -# This is used in the Dockerfile to allow a commit hash to be passed in without -# including the .git/ directory within the Docker image. -CORETH_COMMIT=${CORETH_COMMIT:-$(git rev-list -1 HEAD)} - -# Build Coreth, which runs as a subprocess -echo "Building Coreth @ GitCommit: $CORETH_COMMIT at $BINARY_PATH" -go build -ldflags "-X github.com/ava-labs/coreth/plugin/evm.GitCommit=$CORETH_COMMIT" -o "$BINARY_PATH" "plugin/"*.go diff --git a/graft/coreth/scripts/build_test.sh b/graft/coreth/scripts/build_test.sh index 476fda48853b..eac887012273 100755 --- a/graft/coreth/scripts/build_test.sh +++ b/graft/coreth/scripts/build_test.sh @@ -2,8 +2,8 @@ set -euo pipefail - REPO_ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd ../../../ && pwd ) +# shellcheck disable=SC1091 source "$REPO_ROOT"/scripts/constants.sh # We pass in the arguments to this script directly to enable easily passing parameters such as enabling race detection, diff --git a/graft/coreth/scripts/constants.sh b/graft/coreth/scripts/constants.sh deleted file mode 100644 index 42b4f1682986..000000000000 --- a/graft/coreth/scripts/constants.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -# Ignore warnings about variables appearing unused since this file is not the consumer of the variables it defines. -# shellcheck disable=SC2034 - -set -euo pipefail - -# Set the PATHS -GOPATH="$(go env GOPATH)" -DEFAULT_PLUGIN_DIR="${HOME}/.avalanchego/plugins" -DEFAULT_VM_ID="srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy" - -# Set binary location -binary_path=${CORETH_BINARY_PATH:-"$GOPATH/src/github.com/ava-labs/avalanchego/build/plugins/evm"} - -# Avalabs docker hub -DOCKERHUB_REPO="avaplatform/coreth" - -# Current branch -CURRENT_BRANCH=${CURRENT_BRANCH:-$(git describe --tags --exact-match 2>/dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD)} -echo "Using branch: ${CURRENT_BRANCH}" - -# Image build id -# Use an abbreviated version of the full commit to tag the image. - -# WARNING: this will use the most recent commit even if there are un-committed changes present -CORETH_COMMIT="$(git --git-dir="$CORETH_PATH/.git" rev-parse HEAD)" - -# Set the CGO flags to use the portable version of BLST -# -# We use "export" here instead of just setting a bash variable because we need -# to pass this flag to all child processes spawned by the shell. -export CGO_CFLAGS="-O -D__BLST_PORTABLE__" diff --git a/graft/coreth/scripts/dev_shell.sh b/graft/coreth/scripts/dev_shell.sh deleted file mode 100755 index e0ac26a7bce1..000000000000 --- a/graft/coreth/scripts/dev_shell.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -# Copyright (C) 2025, Ava Labs, Inc. All rights reserved. - -set -euo pipefail - -# Requires nix to be installed. The determinate systems installer is recommended: -# -# https://github.com/DeterminateSystems/nix-installer?tab=readme-ov-file#install-nix -# - -# Load AVALANCHE_VERSION -SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) -# shellcheck source=/scripts/constants.sh -source "$SCRIPT_DIR"/versions.sh - -# Start a dev shell with the avalanchego flake -FLAKE="github:ava-labs/avalanchego?ref=${AVALANCHE_VERSION}" -echo "Starting nix shell for ${FLAKE}" -nix develop "${FLAKE}" "${@}" diff --git a/graft/coreth/scripts/lint.sh b/graft/coreth/scripts/lint.sh index c8cf49bee952..352cfecfb911 100755 --- a/graft/coreth/scripts/lint.sh +++ b/graft/coreth/scripts/lint.sh @@ -3,7 +3,7 @@ set -euo pipefail if ! [[ "$0" =~ scripts/lint.sh ]]; then - echo "must be run from repository root" + echo "must be run from coreth root" exit 255 fi diff --git a/graft/coreth/scripts/lint_fix.sh b/graft/coreth/scripts/lint_fix.sh index ced327878814..00e178068b9c 100755 --- a/graft/coreth/scripts/lint_fix.sh +++ b/graft/coreth/scripts/lint_fix.sh @@ -3,7 +3,7 @@ set -euo pipefail if ! [[ "$0" =~ scripts/lint_fix.sh ]]; then - echo "must be run from repository root" + echo "must be run from coreth root" exit 255 fi diff --git a/graft/coreth/scripts/run_ginkgo_warp.sh b/graft/coreth/scripts/run_ginkgo_warp.sh index 032b1243ef08..7da29f506861 100755 --- a/graft/coreth/scripts/run_ginkgo_warp.sh +++ b/graft/coreth/scripts/run_ginkgo_warp.sh @@ -7,7 +7,8 @@ CORETH_PATH=$( cd .. && pwd ) -source "$CORETH_PATH"/scripts/constants.sh +# shellcheck disable=SC1091 +source "$CORETH_PATH"/../../scripts/constants.sh EXTRA_ARGS=() AVALANCHEGO_BUILD_PATH="${AVALANCHEGO_BUILD_PATH:-}" diff --git a/graft/coreth/scripts/shellcheck.sh b/graft/coreth/scripts/shellcheck.sh index f57b853362f0..140efd2ac989 100755 --- a/graft/coreth/scripts/shellcheck.sh +++ b/graft/coreth/scripts/shellcheck.sh @@ -4,14 +4,6 @@ set -euo pipefail VERSION="v0.9.0" -# Scripts that are sourced from upstream and not maintained in this repo will not be shellchecked. -# Also ignore the local avalanchego clone. -IGNORED_FILES=" - cmd/evm/transition-test.sh - metrics/validate.sh - avalanchego/* -" - function get_version { local target_path=$1 if command -v "${target_path}" > /dev/null; then @@ -44,12 +36,4 @@ else fi fi -IGNORED_CONDITIONS=() -for file in ${IGNORED_FILES}; do - if [[ -n "${IGNORED_CONDITIONS-}" ]]; then - IGNORED_CONDITIONS+=(-o) - fi - IGNORED_CONDITIONS+=(-path "${REPO_ROOT}/${file}" -prune) -done - -find "${REPO_ROOT}" \( "${IGNORED_CONDITIONS[@]}" \) -o -type f -name "*.sh" -print0 | xargs -0 "${SHELLCHECK}" "${@}" +find "${REPO_ROOT}" -type f -name "*.sh" -print0 | xargs -0 "${SHELLCHECK}" "${@}" diff --git a/graft/coreth/scripts/versions.sh b/graft/coreth/scripts/versions.sh deleted file mode 100755 index 941f442a2b6c..000000000000 --- a/graft/coreth/scripts/versions.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# Ignore warnings about variables appearing unused since this file is not the consumer of the variables it defines. -# shellcheck disable=SC2034 - -set -euo pipefail - -if [[ -z ${AVALANCHE_VERSION:-} ]]; then - # Get module details from go.mod - MODULE_DETAILS="$(go list -m "github.com/ava-labs/avalanchego" 2>/dev/null)" - - # Extract the version part - AVALANCHE_VERSION="$(echo "${MODULE_DETAILS}" | awk '{print $2}')" - - # Check if the version matches the pattern where the last part is the module hash - # v*YYYYMMDDHHMMSS-abcdef123456 - # - # If not, the value is assumed to represent a tag - if [[ "${AVALANCHE_VERSION}" =~ ^v.*[0-9]{14}-[0-9a-f]{12}$ ]]; then - # Extract module hash from version - MODULE_HASH="$(echo "${AVALANCHE_VERSION}" | grep -Eo '[0-9a-f]{12}$')" - - # The first 8 chars of the hash is used as the tag of avalanchego images - AVALANCHE_VERSION="${MODULE_HASH::8}" - fi -fi diff --git a/vms/example/xsvm/README.md b/vms/example/xsvm/README.md index 77df0ce5f320..61444614658b 100644 --- a/vms/example/xsvm/README.md +++ b/vms/example/xsvm/README.md @@ -285,7 +285,7 @@ You can do this by following the [subnet tutorial] or by using the [subnet-cli]. [interchain messaging]: https://github.com/ava-labs/avalanchego/tree/master/vms/platformvm/warp/README.md [subnet tutorial]: https://build.avax.network/docs/tooling/create-avalanche-l1 -[Coreth]: https://github.com/ava-labs/coreth +[Coreth]: https://github.com/ava-labs/avalanchego/tree/master/graft/coreth [C-Chain]: https://build.avax.network/docs/quick-start/primary-network#c-chain [Subnet]: https://build.avax.network/docs/avalanche-l1s