## Why this should be merged
Version increase across all `ava-labs` EVM-related code.
## How this works
Bump to 1.24.8 in both `go.mod` files + requisite version increase for
`golangci-lint`.
## How this was tested
Existing tests.
---------
Co-authored-by: Austin Larson <austin.larson@avalabs.org>
## Why this should be merged
Avoids false positives from `goheader`.
## How this works
Checks out entire history to give the linter a reference point for new
issues only.
## How this was tested
With great frustration by waiting for CI.
## Why this should be merged
The release-branch CI job tests branch properties of the `git` DAG but
GitHub's `actions/checkout` by default creates a speculative merge
commit against which PR CI is run. Running against this hypothetical
situation makes the tests fail.
## How this works
[`actions/checkout` uses PR
tip](https://github.com/actions/checkout?tab=readme-ov-file#checkout-pull-request-head-commit-instead-of-merge-commit)
## How this was tested
Future run against a release branch.
---------
Signed-off-by: Quentin McGaw <quentin.mcgaw@gmail.com>
## Why this should be merged
The CI job in #145 requires a local (to the runner) `main` branch and
since `actions/checkout` doesn't check it out, the workflow creates the
branch off `origin/main`. However, after merge of a PR to `main`, the
workflow is run on `main` itself and that step [fails because the branch
already
exists](https://github.com/ava-labs/libevm/actions/runs/13908218530/job/38916101218).
## How this works
Only call `git branch main origin/main` if `main` doesn't exist.
## How this was tested
We'll see once it's merged 🤷
> [!NOTE]
> This will be merged into `main` once the current target branch has
been merged.
## Why this should be merged
My original implementation was back to front and it's been bugging me.
## How this works
Originally `params.LibEVMVersion` was a `var` (because it needed to be
computed) and the test used a `const`. This change simply inverts the
two and moves some code around without any change in logic.
I bumped the minor version to 2 (a no-op when not on a release branch)
to bring it in line with the latest release candidate and to avoid
forgetting to do so when performing an actual release.
## How this was tested
Unit test of version-string constant.
## Why this should be merged
Safer release process by enforcing invariants of `release/*` branches as
automated in #137 to fulfil #25.
## How this works
New test for `go_tooling` CI job.
If the PR target branch is `main` then only the `params.ReleaseType` is
checked. If the target is neither `main` nor a release branch then the
test is skipped. The checks performed on `release/*` branches are
described in the test.
## How this was tested
Locally against a dummy release branch with deliberate problems created
by (a) including this PR's changes in the final commit and (b) not
updating the libevm version.
```
$ go test -v ./... --target_branch="release/v1.13.14-0.1.0.rc.3"
=== RUN TestCherryPicksFormat
--- PASS: TestCherryPicksFormat (0.39s)
=== RUN TestBranchProperties
=== RUN TestBranchProperties/branch_name
release_test.go:172:
Error Trace: .../ava-labs/libevm/libevm/tooling/release/release_test.go:172
Error: Not equal:
expected: "release/v1.13.14-0.1.0.beta"
actual : "release/v1.13.14-0.1.0.rc.3"
Diff:
--- Expected
+++ Actual
@@ -1 +1 @@
-release/v1.13.14-0.1.0.beta
+release/v1.13.14-0.1.0.rc.3
Test: TestBranchProperties/branch_name
release_test.go:175: On release branch; params.LibEVMReleaseType = "beta", which is unsuitable for release branches
=== RUN TestBranchProperties/commit_history
release_test.go:192: Forked from "main" at commit 4c6e50e7d1 (chore: module-renaming workflow inverts between `libevm` and `geth` (#152))
release_test.go:314: ### History since fork from default branch (8 commits):
release_test.go:316: internal/build, rpc: add missing HTTP response body Close() calls (#29223) by Shiming Zhang <wzshiming@hotmail.com>
release_test.go:316: core/state: fix bug in statedb.Copy and remove unnecessary preallocation (#29563) by Aaron Chen <aaronchen.lisp@gmail.com>
release_test.go:316: params: print time value instead of pointer in ConfigCompatError (#29514) by Nathan <Nathan.l@nodereal.io>
release_test.go:316: eth/gasprice: add query limit for FeeHistory to defend DDOS attack (#29644) by Nathan <Nathan.l@nodereal.io>
release_test.go:316: core/state/snapshot: add a missing lock (#30001) by maskpp <maskpp266@gmail.com>
release_test.go:316: crypto: add IsOnCurve check (#31100) by Felix Lange <fjl@twurst.com>
release_test.go:316: internal/ethapi: fix panic in debug methods (#31157) by Sina M <1591639+s1na@users.noreply.github.com>
release_test.go:316: x by Arran Schlosberg <me@arranschlosberg.com>
=== RUN TestBranchProperties/commit_history/cherry_picked_commits
release_test.go:314: ### Expected cherry-picks (7 commits):
release_test.go:316: internal/build, rpc: add missing HTTP response body Close() calls (#29223) by Shiming Zhang <wzshiming@hotmail.com>
release_test.go:316: core/state: fix bug in statedb.Copy and remove unnecessary preallocation (#29563) by Aaron Chen <aaronchen.lisp@gmail.com>
release_test.go:316: params: print time value instead of pointer in ConfigCompatError (#29514) by Nathan <Nathan.l@nodereal.io>
release_test.go:316: eth/gasprice: add query limit for FeeHistory to defend DDOS attack (#29644) by Nathan <Nathan.l@nodereal.io>
release_test.go:316: core/state/snapshot: add a missing lock (#30001) by maskpp <maskpp266@gmail.com>
release_test.go:316: crypto: add IsOnCurve check (#31100) by Felix Lange <fjl@twurst.com>
release_test.go:316: internal/ethapi: fix panic in debug methods (#31157) by Sina M <1591639+s1na@users.noreply.github.com>
=== RUN TestBranchProperties/commit_history/final_commit
release_test.go:365: Modified disallowed file "go.yml"
release_test.go:365: Modified disallowed file "go.mod"
release_test.go:365: Modified disallowed file "go.sum"
release_test.go:365: Modified disallowed file "release_test.go"
--- FAIL: TestBranchProperties (2.07s)
--- FAIL: TestBranchProperties/branch_name (0.00s)
--- FAIL: TestBranchProperties/commit_history (2.07s)
--- PASS: TestBranchProperties/commit_history/cherry_picked_commits (1.81s)
--- FAIL: TestBranchProperties/commit_history/final_commit (0.01s)
FAIL
FAIL github.com/ava-labs/libevm/libevm/tooling/release 2.712s
FAIL
```
## Why this should be merged
Originally I'd planned on doing an upstream sync by running the rename
workflow on the incoming commit and then merging it to `main` however
this resulted in hundreds of merge commits that were solely due to Go
imports. Renaming the module from `ava-labs/libevm` to
`ethereum/go-ethereum` removed 90% of conflicts (H/T @darioush). The
module will then need to be named `ava-labs/libevm` again, so the commit
history will probably[^1] look like this after an update:
```mermaid
---
config:
gitGraph:
mainBranchName: main
parallelCommits: true
---
gitGraph TB:
branch geth order:2
commit id:"geth@v1.15.2"
checkout main
commit id:"libevm@v1.13.14"
branch sync/v1.15.2
commit id:"[AUTO] rename to ethereum/go-ethereum"
merge geth
commit id:"[AUTO] rename to ava-labs/libevm"
checkout main
merge sync/v1.15.2 id:"libevm@v1.15.2"
```
[^1]: Specifics of and rationale behind the merge strategy are beyond
the scope of this PR.
## How this works
The current module name is determined with `go list -m` and the rename
from/to patterns are no longer hard-coded.
## How this was tested
Inspection of runs and resulting branch. Although these were the
bc8e5015694707ff682c444afff52a3801b35a53 workflow, the only other commit
in this PR is cosmetic (as seen in [this
run](https://github.com/ava-labs/libevm/actions/runs/13433886428) to
create f2cecaff9c01c86053644aafc9b7196229a84cbc).
1. Run on `main` @ d32c7e0090 changes from
`libevm` to `go-ethereum`:
a.
[Run](https://github.com/ava-labs/libevm/actions/runs/13432588947/job/37527588744)
b.
[Commit](6288df93f7)
c. Created branch `arr4n/auto/test-invertible-rename`
2. Re-run on `arr4n/auto/test-invertible-rename` changes back to
`libevm`:
a. [Run](https://github.com/ava-labs/libevm/actions/runs/13432810657)
b.
[Commit](6f4f94edd9)
c. [Auto-generated branch is identical to `main` at the time of
running](d32c7e0090...6f4f94edd9)
## Why this should be merged
Adds logging of `libevm` modification of default behaviour.
## How this works
1. Introduces `log.Lazy` functions to allow expensive logging operations
to be computed i.f.f. required by the logging level.
2. Adds `Info` logging for registration of types and `Debug` logging for
all else.
3. Only paths that change behaviour in a potentially unpredictable
manner are logged; of note, RLP / JSON encoding is _not_ considered
unpredictable given that registered extras are logged.
4. The minimal viable package, `set`, was necessary because we don't
want to depend on `avalanchego` and the `hashicorp/go-set` latest
version requires a later version of Go. #153 tracks a swap to the latter
when possible.
The `eth/tracers/internal/tracetest` test flaked at least twice
(unrelated to these changes) so I've marked it as such since it's not
worth a separate PR.
## How this was tested
New unit test on `log.Lazy` + `set` methods. Existing CI for the rest as
it's a refactor.
- Pin golangci-lint action to v6 now that goheader doesn't run on the default branch pushes
- This addresses the goheader step misbehaving and linting all files on pushes
## Why this should be merged
Branch-protection rules only require the Go linter (erroneously called
`lint`) by mistake. All linters are now dependencies of a single `lint`
job that remains as a PR gate. New linters will now be enforced by
default.
Closes#138
## How this works
GitHub Actions `need` configuration. The path limitation of running
`yamllint` is removed because it's such a cheap job so is ok to always
run.
## How this was tested
Inspection of CI run and PR's required jobs:


The action pinned as v6 uses v6.3.1 which is currently misbehaving on the main branch linting all files instead of just the files from the current commit.
`goheader` only needs to be run on files changed in the current PR as it will otherwise suggest updating copyright years on untouched files. The other linters, however, should be run in the same manner as a local invocation
- New workflow triggering only on yaml file changes using the built-in `yamllint`
- `.yamllint.yml` configuration added at the root of the project
- Fix existing yml files to satisfy ymllint
- Ignore go-ethereum original yml files
## Why this should be merged
This is a precursor to being able to override `types.Header` RLP
{en,de}coding. As there is already a `Header.EncodeRLP()` method we
either have to modify the generated code or rename the generated
method—this PR does the latter.
## How this works
The `rlpgen -internal_methods` flag changes the generated methods from
`EncodeRLP()` and `DecodeRLP()` to `encodeRLP()` and `decodeRLP()`,
respectively. A new CI job checks that generated code is up to date. We
can then implement our own `Header.EncodeRLP()` that either overrides or
falls back on the original.
It appears that `core/gen_genesis.go` was out of date but only because
of formatting.
## How this was tested
I deliberately excluded the change to `core/types/gen_header_rlp.go` to
confirm that the new workflow
[detects](https://github.com/ava-labs/libevm/actions/runs/12259667481/job/34202386378?pr=86#step:5:92)
the change and fails. The actual change can be inspected via the code
diff.
## Why this should be merged
Cleans up loose ends after renaming the Go module. Also adds an
introduction to the README to explain the purpose of libevm.
## How this works
The changed hash in the workflow is just a fix (although a no-op). The
spaces after the copyright headers are to stop them from [showing up in
documentation](https://pkg.go.dev/github.com/ava-labs/libevm@v1.13.14-0.1.0-rc.1/params).
## How this was tested
n/a
## Why this should be merged
These workflows are required by branch protection for release branches,
but aren't run automatically so release PRs can't currently be merged.
## How this works
Extends the `branches` filters of necessary workflows.
## How this was tested
n/a
Linter:
- Block imports of `ethereum/go-ethereum` upstream module
- Disable `goimports` checks on upstream code
Go:
- Update flaky-test regex
- Run flaky and non-flaky tests in different steps as this makes it easier to spot incorrect regex
Upstream delta:
- Use env var in workflow instead of `libevm-base` tag -> base changes atomically with the update commit
## Why this should be merged
Signs commits for auto-renaming the Go module, originally introduced in
#51 with unsigned commits that can't be merged to `main`.
## How this works
Changes the commit action to use
[`ghcommit`](https://github.com/planetscale/ghcommit), which was made
specifically to allow for keyless signing (GitHub signs the commit). The
workflow no longer opens a PR to the `renamed-go-module` branch as it's
redundant and the generated branch can be used directly.
The commit message includes the `workflow_dispatch` trigger branch as
well as a hash of the workflow file for a complete audit trail.
I removed the commented-out PR trigger as it's unnecessary. In
development we can now just trigger the workflow on the dev branch.
## How this was tested
Inspecting [the
commit](572b8ab74e)
generated by a [workflow
run](https://github.com/ava-labs/libevm/actions/runs/11357025696/job/31589219847).
It is identical in modifications to the one reviewed in #59.
## Why this should be merged
#51 had a bug when checking whether or not to open a PR. I was
originally blocking everything if _not_ on main instead of doing
something if on it. The [manually dispatched run therefore didn't open a
PR as
expected](https://github.com/ava-labs/libevm/actions/runs/11299366394/job/31430160561).
## How this works
Change `!=` to `==`
## How this was tested
n/a
Signed-off-by: Arran Schlosberg <519948+ARR4N@users.noreply.github.com>
## Why this should be merged
Automate renaming of the Go module from
`github.com/ethereum/go-ethereum` to `github.com/ava-labs/libevm`.
## How this works
Before starting this PR, I branched the `renamed-go-module` branch off
`master` (the upstream geth branch; our default is called `main`). It
has been protected to require PRs, which are automatically generated by
the workflow introduced in this PR.
The new workflow is designed to be manually dispatched with an input
string of the commit hash to use as a source for renaming. On dispatch,
it:
1. Checks out the source commit;
2. Renames the module;
3. Makes all necessary internal changes (e.g. import renaming);
4. Runs [smoke
tests](https://en.wikipedia.org/wiki/Smoke_testing_(software));
5. Commits the changes to a new branch; and
6. Opens a PR to merge the new branch into `renamed-go-module`.
### Intended usage
When performing an upstream sync to pull in new geth code, this workflow
will first be run against the geth commit we intend to merge. After the
generated PR is merged, the `renamed-go-module` branch will be the one
incorporated into `main`.
Note that the `renamed-go-module` branch requires _two_ reviewers to
approve. The user who dispatches the workflow SHOULD be one, with any
other valid reviewer as the other. This is because a single-reviewer
workflow would allow any user to update the `renamed-go-module` branch
because the PR author is `github-actions`.
## How this was tested
Inspection of the generated PR #57 as well as the [workflow run that
generated
it](https://github.com/ava-labs/libevm/actions/runs/11298471240/job/31427495426).
* fix: `vm.WithUNSAFECallerAddressProxying` under `DELEGATECALL`
* test: `vm.WithUNSAFECallerAddressProxying()` effect on outgoing caller addr
* chore: mark `eth/tracers/js` test flaky
* feat: `vm.PrecompileEnvironment.IncomingCallType()`
* chore: minor documentation edit
* doc: `PrecompileEnvironment` example for determining actual caller
* chore: placate the linter
All commits except the last two constitute PRs #43 and #44. The last two reverted files such that only changes to the `pseudo` and `ethtest` packages remain; once this is merged into the `libevm` branch then `libevm` will be merged into the branch for #44 too. Cherry-picking commits was not possible as some touched both halves of the changes; the squash-merges will, however, make this convoluted history irrelevant.
* feat: `types.StateAccount` pseudo-generic payload
* feat: registration of `StateAccount` payload type
* chore: mark `eth/tracers/logger` flaky
* chore: copyright header + `gci`
* test: lock default `types.SlimAccount` RLP encoding
* feat: `vm.SlimAccount.Extra` from `StateAccount` equiv
* chore: placate the linter
* test: `pseudo.Type.EncodeRLP()`
* test: `pseudo.Type.DecodeRLP()`
* fix: `pseudo.Type.DecodeRLP()` with non-pointer type
* feat: `pseudo.Type.IsZero()` and `Type.Equal(*Type)`
* feat: `types.StateAccountExtra.DecodeRLP()`
* chore: revert non-pseudo-package modifications
* chore: delete non-pseudo-package additions
* chore: workflow to print diffs vs `libevm-base` tag
* fix: job name
* fix: use `${{ github.ref_name }}` instead of `HEAD`
* fix: use `github.sha` instead of `github.ref_name`
* fix: `fetch-tags: true`
* chore: fml
* fix: `fetch-depth: 0` for more than just 1 commit
* fix: check out branch before performing diff
* chore: `set -x` to aid debugging
* fix: add `--` suffix to `git checkout`
* fix: use `github.ref_name` instead of `github.sha`
* refactor: move all actions inside workflow
* fix: use `github.ref` for full name
* fix: only use explicit diff for `libevm`
* chore: `git diff --color=always`
* feat: color-blindness a11y
* chore: `golangci-lint` CI workflow
* fix: make `golangci-lint` happy
* chore: bump `actions/{checkout,setup-go}` versions
* chore: overhaul `.golanci.yml` config
* fix: all linter issues
* chore: exclude non-libevm linters + change deprecated option
* fix: add overflow check in example
* fix: try again; different local version?
* chore: this is trying my patience
* chore: enable `gci` and fix ordering
* chore: mark `ethclient/gethclient` test as flaky
* chore: mark `eth/catalyst` test as flaky
* fix: run flaky upstream tests sequentially
* chore: run flaky tests first to fail early
There are fewer of them so they'll fail quickly and allow the CI run to just be restarted.