Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4a571be
build(pre-commit): integrate pre-commit hooks with upstream files fil…
powerslider Aug 14, 2025
c310875
fix: revert scripts/lint.sh due to not being practical to run locally…
powerslider Aug 15, 2025
fba660f
Merge branch 'master' into powerslider/1120-pre-commit-hooks
powerslider Aug 15, 2025
250c431
fix: add normalization steps when reading upstream_files.txt
powerslider Aug 15, 2025
3a41223
Merge branch 'master' into powerslider/1120-pre-commit-hooks
powerslider Aug 18, 2025
d739d3b
fix: add a blank line to please the license_header linter after the A…
powerslider Aug 18, 2025
c0c59e3
fix: revert unimpactful changes in lint.sh script
powerslider Aug 18, 2025
6cfa338
fix: more license fixes
powerslider Aug 18, 2025
fab273b
fix: revert adding a new line after //********** because of the end-o…
powerslider Aug 18, 2025
ea3388d
fix: more license fixes
powerslider Aug 18, 2025
9a632b4
Merge branch 'master' into powerslider/1120-pre-commit-hooks
powerslider Aug 19, 2025
45b9885
Merge branch 'master' into powerslider/1120-pre-commit-hooks
powerslider Aug 19, 2025
bcda734
fix: enable avalanche_golangci_lint hook
powerslider Aug 19, 2025
4819f5c
fix: treats both relative and absolute repo paths the same when filte…
powerslider Aug 19, 2025
f53e9d1
docs: add README docs
powerslider Aug 19, 2025
0565060
fix: add support to the filter script for absolute and ./ paths
powerslider Aug 19, 2025
6394b7e
Merge branch 'master' into powerslider/1120-pre-commit-hooks
powerslider Aug 25, 2025
409def6
fix: revert changes on lint.sh
powerslider Aug 25, 2025
9d9c631
Merge branch 'master' into powerslider/1120-pre-commit-hooks
powerslider Aug 27, 2025
9afc8c4
Merge branch 'master' into powerslider/1120-pre-commit-hooks
powerslider Aug 29, 2025
8879363
Merge branch 'master' into powerslider/1120-pre-commit-hooks
powerslider Sep 2, 2025
b025d27
Merge branch 'master' into powerslider/1120-pre-commit-hooks
powerslider Sep 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@
* @ava-labs/platform-evm
/.github/ @maru-ava @ava-labs/platform-evm
/triedb/firewood/ @alarso16 @ava-labs/platform-evm

66 changes: 36 additions & 30 deletions .github/CONTRIBUTING.md
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(fyi) I'm not reviewing this file, on the assumption that it's only formatting. Please let me know if that's an incorrect assumption.

Original file line number Diff line number Diff line change
@@ -1,53 +1,56 @@
# 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
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
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
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 [here](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"
- 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 [here](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
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:
- To **re-generate all mocks**, use the command below from the root of the project:

```sh
go generate -run "go.uber.org/mock/mockgen" ./...
```
```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

* 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):
- 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.
Expand All @@ -59,10 +62,13 @@ Mocks are auto-generated using [mockgen](https://pkg.go.dev/go.uber.org/mock/moc
```

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:

- 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.
- 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.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
Expand Down
96 changes: 96 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Usage:
# 1) Install the hooks:
# pre-commit install && pre-commit install --hook-type pre-push
# 2) [Optional] Run the hooks on demand before committing:
# pre-commit run --all-files
# 3) [Optional] Run the hooks on demand before pushing changes:
# pre-commit run --hook-stage pre-push --all-files
#
# NOTE: 2) and 3) are only needed to run the hooks manually.
# The hooks are automatically run by git when committing or pushing changes.
#
# If you want to temporarily disable the hooks without uninstalling them, you can use:
# git commit --no-verify
# git push --no-verify
#
# If you want to uninstall the hooks, you can use:
# pre-commit uninstall
#
# If you want to re-install the hooks, you can run 1) again.

minimum_pre_commit_version: "3.6.0"

repos:
# Fast feedback at commit time: baseline golangci-lint (v1)
- repo: https://github.com/golangci/golangci-lint
rev: v1.63.4
hooks:
- id: golangci-lint
name: golangci-lint (baseline)
args: ["--config=.golangci.yml"]
stages: [pre-commit]

# Local utility scripts and full repo checks
- repo: local
hooks:
# Stricter extra lints (golangci-lint v2) on staged changes at pre-commit
- id: extra-golangci-lint
name: golangci-lint (extra via scripts/lint.sh)
entry: bash -lc 'TESTS="avalanche_golangci_lint" scripts/lint.sh'
language: system
stages: [pre-commit]
pass_filenames: false

- id: actionlint
name: actionlint
entry: scripts/actionlint.sh
language: system
files: ^\.github/workflows/.*\.(yml|yaml)$
stages: [pre-commit]
pass_filenames: false

- id: shellcheck
name: shellcheck
entry: scripts/shellcheck.sh
language: system
files: \.sh$
stages: [pre-commit]
pass_filenames: false

# General purpose housekeeping hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
name: trailing-whitespace (filtered)
entry: scripts/filter_precommit_files.sh trailing-whitespace-fixer --
pass_filenames: true
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
name: end-of-file-fixer (filtered)
entry: scripts/filter_precommit_files.sh end-of-file-fixer --
pass_filenames: true
- id: check-merge-conflict
- id: check-yaml
name: check-yaml (filtered)
entry: scripts/filter_precommit_files.sh check-yaml --
pass_filenames: true
- id: check-toml
name: check-toml (filtered)
entry: scripts/filter_precommit_files.sh check-toml --
pass_filenames: true
- id: check-json
name: check-json (filtered)
entry: scripts/filter_precommit_files.sh check-json --
pass_filenames: true
# Exclude intentionally invalid JSON fixtures used by tests
exclude: ^rpc/testdata/invalid-.*\.json$

# Markdown formatter
- repo: https://github.com/hukkin/mdformat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's standard here? I'm not sure if we want to make these changes just for the pre-commit hooks (added arbitrarily) if we're not also going to lint for them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @alarso16 re aligning pre-commit and linter checks. IMO the pre-commit is the fast-fail while the linter is the gatekeeper.

rev: 0.7.22
hooks:
- id: mdformat
additional_dependencies:
- mdformat-gfm==0.4.1
- mdformat-frontmatter==2.0.8
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ test run, require binary dependencies. One way of making these dependencies avai
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`)
- 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`)

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
Expand All @@ -50,7 +50,7 @@ The C-Chain supports the following API namespaces:
- `txpool`
- `debug`

Only the `eth` namespace is enabled by default.
Only the `eth` namespace is enabled by default.
To enable the other namespaces see the instructions for passing the C-Chain config to AvalancheGo [here.](https://docs.avax.network/nodes/configure/chain-config-flags#enabling-evm-apis)
Full documentation for the C-Chain's API can be found [here.](https://docs.avax.network/reference/avalanchego/c-chain/api)

Expand Down Expand Up @@ -82,15 +82,15 @@ To support these changes, there have been a number of changes to the C-Chain blo

### Block Body

* `Version`: provides version of the `ExtData` in the block. Currently, this field is always 0.
* `ExtData`: extra data field within the block body to store atomic transaction bytes.
- `Version`: provides version of the `ExtData` in the block. Currently, this field is always 0.
- `ExtData`: extra data field within the block body to store atomic transaction bytes.

### Block Header

* `ExtDataHash`: the hash of the bytes in the `ExtDataHash` field
* `BaseFee`: Added by EIP-1559 to represent the base fee of the block (present in Ethereum as of EIP-1559)
* `ExtDataGasUsed`: amount of gas consumed by the atomic transactions in the block
* `BlockGasCost`: surcharge for producing a block faster than the target rate
- `ExtDataHash`: the hash of the bytes in the `ExtDataHash` field
- `BaseFee`: Added by EIP-1559 to represent the base fee of the block (present in Ethereum as of EIP-1559)
- `ExtDataGasUsed`: amount of gas consumed by the atomic transactions in the block
- `BlockGasCost`: surcharge for producing a block faster than the target rate

## Releasing

Expand Down
5 changes: 4 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

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


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

- Major refactor to use [`libevm`](https://github.com/ava-labs/libevm) for EVM execution, database access, types & chain configuration. This improves maintainability and enables keeping up with upstream changes more easily.
Expand All @@ -30,11 +29,15 @@
## [v0.15.0](https://github.com/ava-labs/coreth/releases/tag/v0.15.0)

- Bump golang version to v1.23.6

- Bump golangci-lint to v1.63 and add linters

- Implement ACP-176

- Add `GasTarget` to the chain config to allow modifying the chain's `GasTarget` based on the ACP-176 rules

- Added `eth_suggestPriceOptions` API to suggest gas prices (slow, normal, fast) based on the current network conditions

- Added `"price-options-slow-fee-percentage"`, `"price-options-fast-fee-percentage"`, `"price-options-max-base-fee"`, and `"price-options-max-tip"` config flags to configure the new `eth_suggestPriceOptions` API

## [v0.14.1](https://github.com/ava-labs/coreth/releases/tag/v0.14.1)
Expand Down
1 change: 0 additions & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ Please refer to the [Bug Bounty Page](https://hackenproof.com/avalanche) for the
## 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.

2 changes: 1 addition & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ tasks:

update-avalanchego-version:
desc: Update AvalancheGo version in go.mod and sync GitHub Actions workflow custom action version
cmd: bash -x ./scripts/update_avalanchego_version.sh # ci.yml
cmd: bash -x ./scripts/update_avalanchego_version.sh # ci.yml
Loading
Loading