Skip to content

Commit aa62718

Browse files
committed
Merge branch 'master' into patch-1
2 parents a8edc64 + 355228b commit aa62718

File tree

107 files changed

+7566
-811
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+7566
-811
lines changed

.gitea/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
- "master"
55
tags:
66
- "v*"
7+
workflow_dispatch:
78

89
jobs:
910
linux-intel:
@@ -121,6 +122,37 @@ jobs:
121122
LINUX_SIGNING_KEY: ${{ secrets.LINUX_SIGNING_KEY }}
122123
AZURE_BLOBSTORE_TOKEN: ${{ secrets.AZURE_BLOBSTORE_TOKEN }}
123124

125+
windows:
126+
name: Windows Build
127+
runs-on: "win-11"
128+
steps:
129+
- uses: actions/checkout@v4
130+
131+
- name: Set up Go
132+
uses: actions/setup-go@v5
133+
with:
134+
go-version: 1.24
135+
cache: false
136+
137+
# Note: gcc.exe only works properly if the corresponding bin/ directory is
138+
# contained in PATH.
139+
140+
- name: "Build (amd64)"
141+
shell: cmd
142+
run: |
143+
set PATH=%GETH_MINGW%\bin;%PATH%
144+
go run build/ci.go install -dlgo -arch amd64 -cc %GETH_MINGW%\bin\gcc.exe
145+
env:
146+
GETH_MINGW: 'C:\msys64\mingw64'
147+
148+
- name: "Build (386)"
149+
shell: cmd
150+
run: |
151+
set PATH=%GETH_MINGW%\bin;%PATH%
152+
go run build/ci.go install -dlgo -arch 386 -cc %GETH_MINGW%\bin\gcc.exe
153+
env:
154+
GETH_MINGW: 'C:\msys64\mingw32'
155+
124156
docker:
125157
name: Docker Image
126158
runs-on: ubuntu-latest

.github/workflows/go.yml

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
name: i386 linux tests
2-
31
on:
42
push:
5-
branches: [ master ]
3+
branches:
4+
- master
65
pull_request:
7-
branches: [ master ]
6+
branches:
7+
- master
88
workflow_dispatch:
99

1010
jobs:
1111
lint:
1212
name: Lint
13-
runs-on: self-hosted
13+
runs-on: self-hosted-ghr
1414
steps:
1515
- uses: actions/checkout@v4
16+
with:
17+
submodules: false
1618

1719
# Cache build tools to avoid downloading them each time
1820
- uses: actions/cache@v4
@@ -23,7 +25,7 @@ jobs:
2325
- name: Set up Go
2426
uses: actions/setup-go@v5
2527
with:
26-
go-version: 1.23.0
28+
go-version: 1.24
2729
cache: false
2830

2931
- name: Run linters
@@ -32,17 +34,25 @@ jobs:
3234
go run build/ci.go check_generate
3335
go run build/ci.go check_baddeps
3436
35-
build:
36-
runs-on: self-hosted
37+
test:
38+
name: Test
39+
needs: lint
40+
runs-on: self-hosted-ghr
41+
strategy:
42+
matrix:
43+
go:
44+
- '1.24'
45+
- '1.23'
3746
steps:
3847
- uses: actions/checkout@v4
48+
with:
49+
submodules: true
50+
3951
- name: Set up Go
4052
uses: actions/setup-go@v5
4153
with:
42-
go-version: 1.24.0
54+
go-version: ${{ matrix.go }}
4355
cache: false
56+
4457
- name: Run tests
45-
run: go test -short ./...
46-
env:
47-
GOOS: linux
48-
GOARCH: 386
58+
run: go test ./...

accounts/abi/abigen/bindv2_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ func TestBindingV2ConvertedV1Tests(t *testing.T) {
281281
}
282282
// Set this environment variable to regenerate the test outputs.
283283
if os.Getenv("WRITE_TEST_FILES") != "" {
284-
if err := os.WriteFile((fname), []byte(have), 0666); err != nil {
284+
if err := os.WriteFile(fname, []byte(have), 0666); err != nil {
285285
t.Fatalf("err writing expected output to file: %v\n", err)
286286
}
287287
}

accounts/abi/abigen/source2.go.tpl

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ var (
9090

9191
{{range .Calls}}
9292
// Pack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling
93-
// the contract method with ID 0x{{printf "%x" .Original.ID}}.
93+
// the contract method with ID 0x{{printf "%x" .Original.ID}}. This method will panic if any
94+
// invalid/nil inputs are passed.
9495
//
9596
// Solidity: {{.Original.String}}
9697
func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) Pack{{.Normalized.Name}}({{range .Normalized.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) []byte {
@@ -101,6 +102,15 @@ var (
101102
return enc
102103
}
103104

105+
// TryPack{{.Normalized.Name}} is the Go binding used to pack the parameters required for calling
106+
// the contract method with ID 0x{{printf "%x" .Original.ID}}. This method will return an error
107+
// if any inputs are invalid/nil.
108+
//
109+
// Solidity: {{.Original.String}}
110+
func ({{ decapitalise $contract.Type}} *{{$contract.Type}}) TryPack{{.Normalized.Name}}({{range .Normalized.Inputs}} {{.Name}} {{bindtype .Type $structs}}, {{end}}) ([]byte, error) {
111+
return {{ decapitalise $contract.Type}}.abi.Pack("{{.Original.Name}}" {{range .Normalized.Inputs}}, {{.Name}}{{end}})
112+
}
113+
104114
{{/* Unpack method is needed only when there are return args */}}
105115
{{if .Normalized.Outputs }}
106116
{{ if .Structured }}
@@ -133,8 +143,7 @@ var (
133143
outstruct.{{capitalise .Name}} = *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}})
134144
{{- end }}
135145
{{- end }}
136-
return *outstruct, err
137-
{{else}}
146+
return *outstruct, nil{{else}}
138147
if err != nil {
139148
return {{range $i, $_ := .Normalized.Outputs}}{{if ispointertype .Type}}new({{underlyingbindtype .Type }}), {{else}}*new({{bindtype .Type $structs}}), {{end}}{{end}} err
140149
}
@@ -145,8 +154,8 @@ var (
145154
out{{$i}} := *abi.ConvertType(out[{{$i}}], new({{bindtype .Type $structs}})).(*{{bindtype .Type $structs}})
146155
{{- end }}
147156
{{- end}}
148-
return {{range $i, $t := .Normalized.Outputs}}out{{$i}}, {{end}} err
149-
{{- end}}
157+
return {{range $i, $t := .Normalized.Outputs}}out{{$i}}, {{end}} nil
158+
{{- end}}
150159
}
151160
{{end}}
152161
{{end}}

accounts/abi/abigen/testdata/v2/callbackparam.go.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ func (c *CallbackParam) Instance(backend bind.ContractBackend, addr common.Addre
5252
}
5353

5454
// PackTest is the Go binding used to pack the parameters required for calling
55-
// the contract method with ID 0xd7a5aba2.
55+
// the contract method with ID 0xd7a5aba2. This method will panic if any
56+
// invalid/nil inputs are passed.
5657
//
5758
// Solidity: function test(function callback) returns()
5859
func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte {
@@ -62,3 +63,12 @@ func (callbackParam *CallbackParam) PackTest(callback [24]byte) []byte {
6263
}
6364
return enc
6465
}
66+
67+
// TryPackTest is the Go binding used to pack the parameters required for calling
68+
// the contract method with ID 0xd7a5aba2. This method will return an error
69+
// if any inputs are invalid/nil.
70+
//
71+
// Solidity: function test(function callback) returns()
72+
func (callbackParam *CallbackParam) TryPackTest(callback [24]byte) ([]byte, error) {
73+
return callbackParam.abi.Pack("test", callback)
74+
}

0 commit comments

Comments
 (0)