Commit graph

15031 commits

Author SHA1 Message Date
Felix Lange
9e4c147bf2
core/vm: implement EIP-7951 - precompile for secp256r1 (#31991)
https://github.com/ethereum/EIPs/pull/9833

Based on #27540, #30043

---------

Co-authored-by: Ulaş Erdoğan <uerdogan2001@hotmail.com>
2025-08-13 16:39:36 -04:00
Jonathan Oppenheimer
ba21474eeb
Delete custom secp256 implementation (#215)
## Why this should be merged
This PR removes the custom secp256 implementation in a single, seperate
commit, as requested in https://github.com/ava-labs/libevm/pull/214
2025-08-12 10:39:07 -04:00
Arran Schlosberg
62dc2ea087
refactor: set EVM.readOnly and depth before running stateful precompile (#210)
## Why this should be merged

Improved clarity.

## How this works

Semantically equivalent refactor. These values aren't accessible /
needed during execution of a stateful precompile, but are important when
making outgoing calls so were originally only set in the
`PrecompileEnvironment.Call()` implementation. This was confusing and
led to a false-positive bug report.

## How this was tested

Existing tests.
2025-08-12 01:35:13 +01:00
Arran Schlosberg
e7035f19ee
feat!: disambiguate EVM-semantic and raw caller/self addresses for precompiles (#211)
## Why this should be merged

Provides precompiles with unambiguous access to contextual addresses,
without the consumer needing to understand how they change under
different call types.

## How this works

The `libevm.AddressContext` type, which used to carry 3 addresses, now
provides different versions of `Caller` and `Self`. The EVM-semantic
versions are as defined by the rules of the EVM (and available before
this change). The raw versions are the unmodified caller and self.

## How this was tested

Extension of existing UTs to include raw addresses in addition to
existing, EVM-semantic ones.
2025-08-07 23:48:32 +01:00
Austin Larson
e35febe777
feat: enable invalidating txs (#208)
## Why this should be merged

In case a tx's execution (specifically a registered precompile) should
be invalidated, this allows the EVM to find this error.

## How this works

Adds a setter and getter that can be called from a precompile.

## How this was tested

UT
2025-08-01 13:43:47 -04:00
Arran Schlosberg
464de82910
feat: state-key transformation w/ override (#205)
## Why this should be merged

`ava-labs/coreth` has a partitioned state-address space, achieved by
setting or clearing a specific bit in the hash used to key the space.
This change allows such behaviour to be achieved with pure `libevm`
instead of the `StateDB` wrapping that `coreth` currently uses.

## How this works

Introduction of `state.StateDBHooks` interface, including a
`TransformStateKey()` method that allows for arbitrary change of state
key. If registered, this hook will be honoured by
`StateDB.{Get,GetCommitted,State}Key()` methods unless they receive a
`stateconf.SkipStateKeyTransformation` option.

## How this was tested

Unit test of `SetState() -> GetState() + GetCommittedState()` round trip
with and without options to skip.
2025-07-22 13:08:53 -04:00
Stephen Buttolph
99f0d0b1de
Add *StateDB.TxHash for usage with Warp (#204)
## Why this should be merged

Coreth and Subnet-EVM require access to the current tx hash in the Warp
precompile (for selecting the correct predicate results).

This can not be exposed as a wrapper through the `OverrideEVMResetArgs`
because `SetTxContext` is called _prior_ to resetting the EVM instance.
Therefore, the `SetTxContext` function on any DB wrapper would never be
called.

## How this works

Exposes the existing `txHash` through a `TxHash()` function.

## How this was tested

Added a trivial unit test.
2025-07-21 22:20:20 -04:00
Martin HS
08e2b6da8a
crypto/kz4844: pass blobs by ref (#29050)
This change makes use of the following underlying changes to the kzg-libraries in order to avoid passing large things on the stack:

- c-kzg: https://github.com/ethereum/c-kzg-4844/pull/393 and
- go-kzg: https://github.com/crate-crypto/go-kzg-4844/pull/63
2025-06-25 11:14:37 +01:00
Marius van der Wijden
8ae463196c
crypto/secp256k1: update libsecp256k1 (#31242)
Updates the libsecp256k1 dependency to commit:
c0d9480fbbf8eccbd4be23ed27f6f2af6f3b211e

PR:
```
BenchmarkSign-24    	   57756	     21214 ns/op	     164 B/op	       3 allocs/op
BenchmarkRecover-24    	   37156	     33044 ns/op	      80 B/op	       1 allocs/op
BenchmarkEcrecoverSignature-24    	   36889	     32935 ns/op	      80 B/op	       1 allocs/op
BenchmarkVerifySignature-24    	   41163	     29207 ns/op	       0 B/op	       0 allocs/op
BenchmarkDecompressPubkey-24    	  318624	      4062 ns/op	     304 B/op	       6 allocs/op
```

Master:
```
BenchmarkSign-24    	   34509	     35330 ns/op	     164 B/op	       3 allocs/op
BenchmarkRecover-24    	   25418	     47725 ns/op	      80 B/op	       1 allocs/op
BenchmarkEcrecoverSignature-24    	   25735	     47591 ns/op	      80 B/op	       1 allocs/op
BenchmarkVerifySignature-24    	   29108	     41097 ns/op	       0 B/op	       0 allocs/op
BenchmarkDecompressPubkey-24    	  294747	      4143 ns/op	     304 B/op	       6 allocs/op
```

Performance seems to be improved significantly:
```
Sign-24      34.86µ ± 3%   21.66µ ± 2%  -37.86% (p=0.000 n=10)
Recover-24   46.14µ ± 3%   33.24µ ± 2%  -27.95% (p=0.000 n=10)
```
2025-06-23 16:52:59 +01:00
Arran Schlosberg
ff3977602d
chore: yamllint ignore all of upstream crypto/secp256k1 2025-06-23 16:52:58 +01:00
Arran Schlosberg
d4c22ca34b
chore: stochastic gradient descent to fix goheader (#196)
## 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.
2025-06-23 15:52:20 +00:00
Arran Schlosberg
f850ca6bfe
chore: placate goheader (#195)
## Why this should be merged

`goheader` linter apparently hasn't been running but now decided to and
is blocking another PR. It's not worth the time to investigatie why
(probably a version update).

## How this works

Update header comments as required.

## How this was tested

N/A
2025-06-23 15:25:18 +00:00
Arran Schlosberg
263186c08f
chore: bump libevm minor version to 0.3.0 (#192)
## Why this should be merged

Addition of recent, functionality constitutes a bump to the minor
version. Doing this on `main` first for consistency and will cut a
release candidate after.

## How this works

Magic

## How this was tested

Super magic
2025-06-20 09:31:36 -04:00
Austin Larson
9b97d60230
feat: triedb.Database.Update options via statedb.Commit (#190)
## Why this should be merged

To allow more thorough handling of duplicate state roots (or any other
info other users would like), additional information can be provided to
a call of `statedb.Commit`. This change allows arbitrary types to be
sent to `triedb` as well as the `SnapshotTree`. However, this is a
breaking change for those using the functionality already, since the
snapshot commit option is wrapped with another call.

## How this works

See the edited libevm test for usage.

## How this was tested

Edited test case to include `TrieDBUpdateOption` and ensures the payload
is sent.
2025-06-18 17:54:37 +00:00
Stephen Buttolph
ab5ad25dc3
crypto/bn256/cloudflare: pull in upstream fix for R27 and R29 usage (#32057)
Pulls in https://github.com/cloudflare/bn256/pull/48 to remove usage of
R27 and R29 [which are reserved](https://go.dev/doc/asm#arm64).
2025-06-18 10:48:15 -04:00
Arran Schlosberg
0bfe4a0380
chore: fix linter issues that CI missed (#188)
## Why this should be merged

#185 was allowed to merge despite CI requiring the `lint` job.

## How this works

Fix linter issues.

## How this was tested

The first commit is an empty commit, expected to fail CI, to confirm
that the job is in fact required.
2025-06-11 21:06:26 +01:00
Arran Schlosberg
bedfd12e2d
feat: RulesHooks.MinimumGasConsumption (#185)
## Why this should be merged

Required for
[ACP-194](https://github.com/avalanche-foundation/ACPs/tree/main/ACPs/194-streaming-asynchronous-execution#gas-charged)
$\lambda$ bound on gas consumption.

## How this works

Hook into `core.StateTransition.TransitionDb()` as this is the bottom of
all execution paths (e.g. `core.ApplyTransaction()` as used in SAE,
`core.StateProcessor.Process(*Block,...)`, etc.). Once consumed gas is
no longer changing (i.e. after all spends and refunds), the transaction
limit is passed to the hook to determine the minimum consumption, which
is applied.

## How this was tested

Unit test via `core.ApplyTransaction()` as this is our entry point in
SAE.

---------

Signed-off-by: Arran Schlosberg <519948+ARR4N@users.noreply.github.com>
Co-authored-by: Stephen Buttolph <stephen@avalabs.org>
2025-06-11 18:22:33 +00:00
Arran Schlosberg
2672fbd7cd
feat: RIP-7212 precompile for P256 ECDSA verification (#184)
## Why this should be merged

Implementation for
[ACP-204](https://github.com/avalanche-foundation/ACPs/pull/204).

## How this works

Implements
[RIP-7212](https://github.com/ethereum/RIPs/blob/master/RIPS/rip-7212.md)
and an additional `Pack(hash,r,s,key)` function with
precompile-compatible output.

## How this was tested

Unit tests including fuzzing, test case from the proposed but unmerged
geth implementation, and vectors from [Project
Wycheproof](https://github.com/C2SP/wycheproof).
2025-06-10 10:28:02 -04:00
Arran Schlosberg
fd03f3ac29
chore: deprecate cherry-picking on release (#186)
## Why this should be merged

Our old strategy of only cherry-picking on release branches made the
`main` branch incompatible with dependent repos.

## How this works

The goal of the old strategy was to avoid cherry-picking on the same
branch to which we would later merge the duplicated, upstream commit.
This can instead be achieved by tracking the cherry-picked commits and
reverting them as part of the geth sync. Since we already do this for
our own changes and a single cherry-pick (see #128), there's no need to
use the two approaches simultaneously.

This PR deletes the cherry-picking mechanism and removes the
release-branch test that enforced its proper usage. It will be followed
up by a series of PRs, one per cherry-pick that would have otherwise
been placed on release branches.

## How this was tested

n/a
2025-06-10 15:18:42 +01:00
Sina M
7b6ff3e0ff
internal/ethapi: fix panic in debug methods (#31157)
Fixes an error when the block is not found in debug methods.
2025-06-10 15:08:41 +01:00
Felix Lange
955616d7c2
crypto: add IsOnCurve check (#31100) 2025-06-10 15:08:40 +01:00
maskpp
7688f988c2
core/state/snapshot: add a missing lock (#30001)
* upgrade lock usage

* revert unnecessary change
2025-06-10 15:08:40 +01:00
Nathan
7c5a8086a7
eth/gasprice: add query limit for FeeHistory to defend DDOS attack (#29644)
* eth/gasprice: add query limit for FeeHistory to defend DDOS attack

* fix return values after cherry-pick

---------

Co-authored-by: Eric <45141191+zlacfzy@users.noreply.github.com>
2025-06-10 15:08:39 +01:00
Nathan
b570d5ee0c
params: print time value instead of pointer in ConfigCompatError (#29514) 2025-06-10 15:08:38 +01:00
Aaron Chen
9f0e1f8da1
core/state: fix bug in statedb.Copy and remove unnecessary preallocation (#29563)
This change removes an unnecessary preallocation and fixes a flaw with no-op copies of some parts of the statedb
2025-06-10 15:08:38 +01:00
Shiming Zhang
8580388508
internal/build, rpc: add missing HTTP response body Close() calls (#29223)
Co-authored-by: Felix Lange <fjl@twurst.com>
2025-06-10 15:08:34 +01:00
Austin Larson
7342b55267
feat(triedb): expose backend for custom use (#183)
## Why this should be merged

To override the standard trie behavior for custom databases in
`core/state/database.go`, custom methods may need to be defined on the
backend database.

## How this works

Exposes `backend` interface for the API

## How this was tested

No tests necessary - isn't used in `libevm`.
2025-05-30 14:29:56 -04:00
Arran Schlosberg
2d94327f8d
feat: partially expose internal/ethapi package (#182)
## Why this should be merged

Exposes API implementations for use by SAE.

## How this works

Type aliases and constructor propagation.

## How this was tested

N/A
2025-05-27 10:29:35 -04:00
Arran Schlosberg
c2e6df1b99
refactor(core/vm): expose clearing of registered hooks in tests (#181)
## Why this should be merged

Importing some `avalanchego` test fixtures automatically imports
`coreth` packages that register extras, which affects testing of other
VMs that depend on `libevm`. All other registered extras can be cleared
with the pattern in this PR.

## How this works

Uses the `register.AtMostOnce` type already used in `params` and
`types`. I forgot to update the `vm` package when implementing the type.

## How this was tested

Existing unit tests.
2025-04-16 14:05:45 +01:00
Stephen Buttolph
86a2fa8836
Verify key length in range proofs (#176)
## Why this should be merged

This enforces an assumption that is currently made by
`VerifyRangeProof`. If a key is a prefix of another key, the current
code can panic.

## How this works

Enforces all keys have the same length.

## How this was tested

Added a unit test.
2025-04-10 14:14:42 -04:00
Quentin McGaw
d7bb4f6050
feat(core/types): export rlpHash() (#174)
#163 was removed by mistake in #162 so this re-adds it

Co-authored-by: Arran Schlosberg <519948+ARR4N@users.noreply.github.com>
2025-03-27 16:32:41 +01:00
Quentin McGaw
979064cfdb
fix(ci): go_tooling CI job git checkout tip of PR (#173)
## 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>
2025-03-26 11:29:45 +01:00
Quentin McGaw
7b930f19b7
fix(libevm/tooling/release): small cherrypick.sh fixes (#171)
- Use grep `-E` flag instead of `-P` flag so it works on all platforms
- Add `-S` flag to `git cherry-pick` since it doesn't always sign all commits after resolving conflicts
2025-03-26 11:26:10 +01:00
Arran Schlosberg
1d75a11657
chore: release-branch test logs HEAD (#172)
## Why this should be merged

Debugging release-branch test failures in CI but not locally.

## How this works

Logs `HEAD` before testing branch properties.

## How this was tested

NA
2025-03-26 09:59:35 +00:00
Quentin McGaw
319a92458d
feat(params): export newTimestampCompatError with alias NewTimestampCompatError (#168)
Signed-off-by: Quentin McGaw <quentin.mcgaw@gmail.com>
Co-authored-by: Arran Schlosberg <519948+ARR4N@users.noreply.github.com>
2025-03-25 20:40:27 +01:00
Quentin McGaw
87a2d57b96
chore!(triedb): remove config argument for DBConstructor (#167) 2025-03-25 11:22:59 +01:00
Arran Schlosberg
7be6bee7ab
chore: enable metrics by default (#165)
## Why this should be merged

The `metrics.Enabled` global is misleadingly named and disables
_constructors_, not individual metrics when they're used. This resulted
in all `ava-labs/coreth` metrics being no-ops because it was only set to
`true` after they were all constructed. As the majority of metrics are
globals, they're created during package initialisation so simply setting
`metrics.Enabled = true` somewhere in `coreth` isn't a guarantee of
ordering. The old `coreth/metrics` package simply set the global to
`true` by default.

## How this works

`metrics.Enabled = true` at the point of declaration.

## How this was tested

Local inspection of metrics on a running binary.
2025-03-20 16:24:22 +01:00
Arran Schlosberg
7b8d20f3d5
fix(ci): only create local main branch if non-existent (#164)
## 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 🤷
2025-03-17 13:00:39 -07:00
Arran Schlosberg
0ed61356ed
refactor(params): make LibEVMVersion a constant (#162)
> [!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.
2025-03-17 19:29:16 +00:00
Arran Schlosberg
08490a9b76
test: branch properties of main and release/* (#145)
## 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
```
2025-03-17 16:55:39 +00:00
Arran Schlosberg
433c6069e2
feat(core/types): export rlpHash() (#163)
## Why this should be merged

Allows `core/types/hashing.go` to be deleted from `coreth`.

## How this works

Exported function acts as a proxy for unexported upstream function.

## How this was tested

NA
2025-03-13 18:44:20 +00:00
Arran Schlosberg
b0332b5168
chore(ci): add merge_group trigger to required workflows (#160)
## Why this should be merged

Allows ruleset-required workflows to be triggered by a merge queue, not
just the PR for the merge. Although `main` isn't a particularly "busy"
branch, a merge queue will ensure that CI passes on the exact version of
code that is about to be merged; i.e. (from the [docs]):

> The merge queue provides the same benefits as the **Require branches
to be up to date before merging** branch protection, but does not
require a pull request author to update their pull request branch and
wait for status checks to finish before trying to merge.

[docs]:
https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue#about-merge-queues

## How this works

Adds `merge_group` workflow trigger with [recommended
type](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#merge_group).

## How this was tested

N/A (worst-case it has to be reverted and another PR is temporarily
blocked).
2025-03-11 13:57:57 +00:00
Arran Schlosberg
4c6e50e7d1
chore: module-renaming workflow inverts between libevm and geth (#152)
## 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)
2025-03-07 13:23:11 +00:00
Quentin McGaw
739ba847f6
feat(rlp/rlpgen): support alias types (#154)
## Why this should be merged

To be able to generate RLP code using type aliases (defined e.g. in
`coreth`).
This can and should be PR-ed upstream as well I think.

## How this works

Call `types.Unalias()` at the start of `buildContext.makeOp()`. The
alternative of adding a `case` to the switch statement adds unnecessary
recursive calls while `types.Unalias()` is a no-op if not an alias.

## How this was tested

New `rlpgen` unit test with aliases of well-known types that have
special handling—these make their proper handling easy to spot when
inspecting generated code. A recursive alias in the same test also
demonstrates full alias resolution.

---------

Co-authored-by: Arran Schlosberg <me@arranschlosberg.com>
2025-02-27 11:13:11 +00:00
Arran Schlosberg
9f410ecc7e
chore: go@1.23 (#156)
## Why this should be merged

We'll be building with Go 1.23 via `avalanchego` so should align
versions. Also unblocks #154.

## How this works

Bump `go.mod` version and run `go mod tidy`.

## How this was tested

CI on existing tests.
2025-02-25 16:46:04 +00:00
Arran Schlosberg
24d7bdeae6
chore!: remove memsize (#155)
## Why this should be merged

`memsize` blocks usage of Go 1.23. We'll be building with 1.23 via
`avalanchego` anyway (which doesn't transitively import `memsize`) so we
want to run tests with the correct version. It will also unblock #154.

## How this works

✂️ 

We already cherry-pick the upstream commit
(e4675771ed) that removes `memsize` when
on release branches so we instead do it ourselves and no longer
cherry-pick. To avoid conflicts at the next `geth` sync, this PR should
be reverted before performing the merge. See #128.

## How this was tested

Existing tests.
2025-02-25 16:12:58 +00:00
Arran Schlosberg
02110d3f34
chore: logging (#151)
## 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.
2025-02-24 16:53:21 +00:00
Arran Schlosberg
d32c7e0090
chore: remove module retractions in lieu of bumping minor (#147)
## Why this should be merged

Both #141 and #81 attempted to fix my lack of planning with release
versioning however Go modules [require a higher-precedence version for
retract statements to be
honoured](https://go.dev/ref/mod#go-mod-file-retract:~:text=The%20new%20version%20must%20be%20higher%20than%20other%20release%20or%20pre%2Drelease%20versions%3B%20that%20is%2C%20the%20%40latest%20version%20query%20should%20resolve%20to%20the%20new%20version%20before%20retractions%20are%20considered.).
The only way we can get that with our [versioning
rules](32e7dafe1c/params/version.libevm.go (L30))
is to bump the minor version. This will negate the need for explicit
retraction so I'm removing it as a cleanup.

## How this works

n/a

## How this was tested

[Effect of bumping
minor](https://semvercompare.azurewebsites.net/?version=1.13.14-0.1.0.rc.3&version=1.13.14-0.1.0.rc-2&version=1.13.14-0.1.0-rc.1&version=1.13.14-0.2.0.rc.1):


![image](https://github.com/user-attachments/assets/d8eb3508-9c62-4864-b0ba-19b8f5f218f1)
2025-02-17 17:49:44 +00:00
Arran Schlosberg
32e7dafe1c
chore: release branches remove memsize (#146)
## Why this should be merged

A separately cherry-picked commit, the fix for `StateDB.Copy()`,
requires Go 1.23 for use of the `maps` package. This, however, breaks
`memsize`, which was later removed later from `geth` for the same
reason.

## How this works

All release branches will now cherry-pick ethereum/go-ethereum#30253.

## How this was tested

Updated list of cherry-picks applied to #142, which [passed
tests](https://github.com/ava-labs/libevm/actions/runs/13371460014/job/37340683594).
2025-02-17 14:02:02 +00:00
Quentin McGaw
1344d20908
chore(ci): disable lint goheader step on non-pull-request events (#143)
- 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
2025-02-17 11:34:52 +00:00