Commit graph

31 commits

Author SHA1 Message Date
Arran Schlosberg
bc42e5f29c
chore(ci): consolidate linters (#139)
## 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:


![image](https://github.com/user-attachments/assets/9454ca35-8a7f-4393-bdd8-5029cfaaf7e6)


![image](https://github.com/user-attachments/assets/e92b964d-5a64-415d-b8a3-1e9c84af3060)
2025-02-14 11:48:55 -05:00
Arran Schlosberg
00c10cf539
feat: release-branch automation (#137)
## Why this should be merged

Closes #25 

## How this works

See https://github.com/ava-labs/libevm/discussions/126.

The code is in a new module to (a) avoid polluting the root `go.mod`
file and (b) because `go-git` requires a newer version of Go.
Unfortunately `go-git` doesn't support cherry-picking yet so a Bash
script had to be used for that bit `#!/sad`.

## How this was tested

Inspection of output when running `cherrypick.sh` (with `set -x` added)
from the current branch.

```
...
...
+ CHERRY_PICKS='2bd6bd01d2e8561dd7fc21b631f4a34ac16627a1
99bbbc0277
1e9bf2a09e
69f815f6f5
e4b8058d5a
34b46a2f75
159fb1a1db
da71839a270a353bac92e3108e4b74fb0eefec29'
...
Skipping 2bd6bd01d2 already in history
...
Cherry-picking 99bbbc0277
...
Cherry-picking 1e9bf2a09e
...
Cherry-picking 69f815f6f5
...
Cherry-picking e4b8058d5a
...
Cherry-picking 34b46a2f75
...
Cherry-picking 159fb1a1db
...
Cherry-picking da71839a27
...
+ git cherry-pick 99bbbc0277 1e9bf2a09e 69f815f6f5 e4b8058d5a 34b46a2f75 159fb1a1db da71839a27
```
2025-02-14 16:09:41 +00:00
Quentin McGaw
2580bd1d05
chore(ci): add go_tidy job to go workflow (#127) 2025-02-11 15:28:33 +01:00
Quentin McGaw
9125583d8e
chore(ci): pin goheader golangci-lint action to v6.2.0 (#124)
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.
2025-02-10 14:05:16 +00:00
Arran Schlosberg
761c4b40de
fix(ci): module-renaming workflow includes .go.tpl and .proto (#122)
## Why this should be merged

Introduction of breaking upstream changes (inclusion of `.go.tpl` files)
since the workflow was written. Resulted in [failed smoke
tests](https://github.com/ava-labs/libevm/actions/runs/13198798601) due
to ABI-binding templates not being updated.

## How this works

Only (1) is necessary for the fix but the others were added for
convenience as relevant to this PR:

1. Replace module name in `*.go.tpl` files;
2. As above for `*.proto` files (`go_package` option);
3. Remove concurrency limitations as they're unnecessary with a manually
triggered workflow; and
4. Display all tags that point to the source commit as they're useful
for inspection of version.

## How this was tested

[Successful workflow
run](https://github.com/ava-labs/libevm/actions/runs/13199663099/job/36848609786)
at upstream v1.15.0.

For the modifications, respectively:

1. Smoke tests pass and no `.go.tpl` files in [Remnant
references](https://github.com/ava-labs/libevm/actions/runs/13199663099/job/36848609786#step:9:1);
2. As above re remnant references;
3. N/A; and
4. Inspection of [step
output](https://github.com/ava-labs/libevm/actions/runs/13199663099/job/36848609786#step:6:5).
2025-02-07 15:28:53 +00:00
Quentin McGaw
a8df623269
chore(ci): restrict each job concurrency except for main branch (#117)
- save some compute minutes 🌱
- Limit concurrency by workflow + ref (except for main branch)
2025-02-06 11:03:26 +00:00
Quentin McGaw
80bdfe7243
chore(ci): use the Go version found in go.mod (#118) 2025-02-06 10:52:45 +00:00
Quentin McGaw
be6e93eedb
chore(ci): linting job changes regarding goheader (#116)
`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
2025-02-05 09:10:57 +01:00
Quentin McGaw
e2b0abbe53
chore(ci): automate detection of last auto-rename commit(#99) 2025-01-13 18:12:33 +01:00
Quentin McGaw
c996175b46
chore(ci): yaml linter workflow and fix yaml files (#98)
- 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
2025-01-12 13:56:08 +00:00
Quentin McGaw
ce2cde5662
docs(linter): comment why goheader is only enabled in the CI (#101) 2025-01-09 14:17:06 +01:00
Quentin McGaw
efa14ab5d0
chore(ci): goheader linting only runs in CI on changed or new files (#100) 2025-01-08 08:38:50 +00:00
Quentin McGaw
bee85d6171
chore(ci): define Github labels as code with a workflow (#93) 2024-12-23 15:02:52 +01:00
Arran Schlosberg
aa183c52be
refactor: generate internal Header.encodeRLP() for override (#86)
## 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.
2024-12-11 10:20:58 +00:00
Arran Schlosberg
7d1b45b841
chore: mark upstream triedb/pathdb test flaky (#78)
## Why this should be merged

Reduce false-positive CI failures.

## How this works

Runs upstream `triedb/pathdb` test sequentially.

## How this was tested

[Inspection of
CI](https://github.com/ava-labs/libevm/actions/runs/12049469376/job/33596276893?pr=78#step:4:17)
2024-11-27 08:17:26 -08:00
Arran Schlosberg
41a2592b8c
chore: post-rename cleanup + libevm intro (#68)
## 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
2024-10-30 09:51:41 -04:00
Arran Schlosberg
dc8fc0308d
chore: run workflows on PRs+push to release branches (#67)
## 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
2024-10-29 07:29:27 +00:00
Arran Schlosberg
5c6635282d
chore: CI updates for renamed module
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
2024-10-17 13:09:06 +11:00
Arran Schlosberg
c6c85589af
feat: signed commit when renaming upstream module (#61)
## 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.
2024-10-17 12:47:06 +11:00
Arran Schlosberg
21122c043a
fix: run renaming workflow if branch == main (#58)
## 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>
2024-10-11 17:35:31 -04:00
Arran Schlosberg
a8cc7bd033
feat: GitHub action to rename module (#51)
## 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).
2024-10-11 13:30:55 -07:00
Arran Schlosberg
88c00c6801
chore: cleanup after repo and default-branch renames (#55)
* chore: update GitHub workflow refs to `main` branch

* chore: update README reference to old repo path

* chore: exclude `README.md` from `libevm-delta` workflow
2024-10-11 10:29:32 -07:00
Arran Schlosberg
51cd795878
fix: vm.WithUNSAFECallerAddressProxying under DELEGATECALL (#50)
* 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
2024-10-07 12:46:14 +01:00
Arran Schlosberg
336a289f42
feat: pseudo.Type RLP round-tripping (#43)
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
2024-10-01 08:23:51 -07:00
Arran Schlosberg
210f8ab8e1
feat: vm.PrecompiledStatefulContract can make CALLs (#40)
* feat: `vm.PrecompiledStatefulContract` can make `CALL`s

* fix: caller propagation

* feat: precompile can override default caller in `Call()`

* refactor: `WithUNSAFEForceDelegate()` replaces `WithCaller()`

* refactor: `WithUNSAFECallerAddressProxying()` instead of `ForceDelegate`

This matches the pattern used by `ava-labs/coreth` `NativeAssetCall`.

* refactor: `type callType` replaces `rwInheritance` + `delegation` types

* refactor: abstract return-data-proxy contract bytecode

* doc: fix comments from `46346f51`

* fix: `PrecompileEnvironment.Addresses()` for all call types

* chore: readability, linting & mark upstream test flaky

* test: `PrecompileEnvironment.Call()`

* refactor: improved {read,maintain}ability

* doc: fix `evmCallArgs` example

* test: `PrecompileEnvironment.Call()` input data

* fix: write protection for non-zero call value
2024-09-30 17:26:50 +01:00
Arran Schlosberg
df322564d0
chore: workflow to print diffs vs libevm-base tag (#18)
* 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
2024-09-14 09:33:20 +01:00
Arran Schlosberg
04543ea837
chore: golangci-lint CI workflow (#16)
* 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
2024-09-12 20:31:04 +01:00
Arran Schlosberg
2d3894fb97
fix: run flaky upstream tests sequentially (#15)
* 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.
2024-09-12 19:53:38 +01:00
Arran Schlosberg
b6f3eb9093
chore: basic CI (#9)
* chore: Go CI runs on `libevm` branch

* fix: stop using `reflect.TypeFor[T]()`

* chore: rename job, remove flaky tests, and clear `GOOS`+`GOARCH`

* fix: PR branch was `libem`

* chore: rename workflow

* chore: disable flaky `accounts/keystore` test
2024-09-10 20:52:25 +01:00
Sina Mahmoodi
a608c0ac84
cmd/devp2p/internal/ethtest: skip large tx test on github build (#28794)
This test was failling consistently on the github 32-bit build probably due to slow IO. Skipping it for that green check.
2024-01-12 15:14:03 +01:00
Guillaume Ballet
69576df254
.github: use github actions to run 32-bit linux tests (#28549)
use github actions to run 32-bit linux tests
2023-12-05 14:45:40 +01:00