Skip to content

Commit 8664cbf

Browse files
committed
chore(ci): check gencodec generated files are up to date
- fix generation of code using type aliases and Go 1.23 - reproducible generation locally (pin gencodec version) - CI keeps generated Go files up to date with other source code - Generate missing files See original PR ava-labs/coreth#856
1 parent c74aa9e commit 8664cbf

File tree

10 files changed

+419
-11
lines changed

10 files changed

+419
-11
lines changed

.github/workflows/tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ jobs:
5757
run: echo "TIMEOUT=1200s" >> "$GITHUB_ENV"
5858
- run: go mod download
5959
shell: bash
60+
- name: fjl/gencodec generated files are up to date
61+
run: |
62+
grep -lr -E '^// Code generated by github\.com\/fjl\/gencodec\. DO NOT EDIT\.$' . | xargs -r rm
63+
go generate -run "github.com/fjl/gencodec" ./...
64+
git add --intent-to-add --all
65+
git diff --exit-code
6066
- name: Mocks are up to date
6167
shell: bash
6268
run: |

cmd/evm/internal/t8ntool/gen_header.go

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/gen_genesis.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/types/account.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"github.com/ava-labs/libevm/common/math"
2929
)
3030

31-
//go:generate go run github.com/fjl/gencodec@a3c3302847cea77ab534228aefa025992dc2c696 -type Account -field-override accountMarshaling -out gen_account.go
31+
//go:generate go run github.com/fjl/gencodec -type Account -field-override accountMarshaling -out gen_account.go
3232

3333
// Account represents an Ethereum account and its attached data.
3434
// This type is used to specify accounts in the genesis block state, and

core/types/header_ext.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func (h *HeaderSerializable) updateToExtras(extras *HeaderExtra) {
148148
extras.BlockGasCost = h.BlockGasCost
149149
}
150150

151-
//go:generate go run github.com/fjl/gencodec@a3c3302847cea77ab534228aefa025992dc2c696 -type HeaderSerializable -field-override headerMarshaling -out gen_header_serializable_json.go
151+
//go:generate go run github.com/fjl/gencodec -type HeaderSerializable -field-override headerMarshaling -out gen_header_serializable_json.go
152152
//go:generate go run github.com/ava-labs/libevm/rlp/rlpgen@739ba847f6f407f63fd6a24175b24e56fea583a1 -type HeaderSerializable -out gen_header_serializable_rlp.go
153153

154154
// HeaderSerializable defines the header of a block in the Ethereum blockchain,

eth/ethconfig/gen_config.go

Lines changed: 273 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)