Skip to content
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
96fc992
style: forbidigo t.Fatal (#1279)
alarso16 Sep 29, 2025
1a0ecea
subnet-evm specific linting
JonathanOppenheimer Nov 17, 2025
a32a038
Merge branch 'master' into JonathanOppenheimer/sync-pr-1279-forbidgo
JonathanOppenheimer Nov 17, 2025
fc68ccd
fix merge
JonathanOppenheimer Nov 17, 2025
ce76ccf
use require nil instead
JonathanOppenheimer Nov 17, 2025
4405b43
fix linting
JonathanOppenheimer Nov 17, 2025
7ed4f7b
Add set default log from coreth
JonathanOppenheimer Nov 17, 2025
d725b55
lint
JonathanOppenheimer Nov 17, 2025
104c7cb
fix merge
JonathanOppenheimer Nov 17, 2025
94f3547
get rid of a lot of require.Fail
JonathanOppenheimer Nov 17, 2025
7da2909
some Austin comments
JonathanOppenheimer Nov 17, 2025
54688c7
More Austin comments
JonathanOppenheimer Nov 17, 2025
963d58f
Update core/blockchain_ext_test.go
JonathanOppenheimer Nov 17, 2025
016a09c
lint
JonathanOppenheimer Nov 17, 2025
324071c
more cleanup
JonathanOppenheimer Nov 17, 2025
dccd040
more austin
JonathanOppenheimer Nov 17, 2025
9723436
Update plugin/evm/customtypes/block_ext_test.go
JonathanOppenheimer Nov 17, 2025
cea161c
Update plugin/evm/customtypes/header_ext_test.go
JonathanOppenheimer Nov 17, 2025
aa1b960
More Austin suggestions
JonathanOppenheimer Nov 17, 2025
9602fd5
fix sticky test
JonathanOppenheimer Nov 17, 2025
a863dda
Update core/blockchain_ext_test.go
JonathanOppenheimer Nov 17, 2025
6fd5673
further simplify api extra test
JonathanOppenheimer Nov 17, 2025
67e5a35
More Austin comment
JonathanOppenheimer Nov 17, 2025
efba90f
simplify test
JonathanOppenheimer Nov 17, 2025
2efea13
fix uncles test
JonathanOppenheimer Nov 17, 2025
15eddc3
Update plugin/evm/syncervm_test.go
JonathanOppenheimer Nov 17, 2025
544e028
clean up code syncer test
JonathanOppenheimer Nov 17, 2025
f209131
Update plugin/evm/vm_test.go
JonathanOppenheimer Nov 17, 2025
784946a
Austin comments
JonathanOppenheimer Nov 17, 2025
fca96c1
remove confusing error checking
JonathanOppenheimer Nov 17, 2025
21dca21
austin comments
JonathanOppenheimer Nov 17, 2025
6f634bc
revert
JonathanOppenheimer Nov 17, 2025
b6007a9
remove out of PR scope change
JonathanOppenheimer Nov 17, 2025
d002836
don't fully revert
JonathanOppenheimer Nov 17, 2025
f3a60b6
lint
JonathanOppenheimer Nov 17, 2025
6f63d49
require no error
JonathanOppenheimer Nov 17, 2025
f99591a
add blockchain stop back
JonathanOppenheimer Nov 18, 2025
6743707
use binint.cmp
JonathanOppenheimer Nov 18, 2025
4d25847
Merge branch 'master' into JonathanOppenheimer/sync-pr-1279-forbidgo
JonathanOppenheimer Nov 18, 2025
25db6a9
restore blockcahin test
JonathanOppenheimer Nov 19, 2025
64ca62c
Merge branch 'master' into JonathanOppenheimer/sync-pr-1279-forbidgo
JonathanOppenheimer Nov 19, 2025
d54febd
remove exception
JonathanOppenheimer Nov 20, 2025
9ae0b3d
Merge branch 'master' into JonathanOppenheimer/sync-pr-1279-forbidgo
JonathanOppenheimer Nov 20, 2025
8ce8366
Cey feedback
JonathanOppenheimer Nov 21, 2025
6166387
Update params/extras/precompile_upgrade_test.go
JonathanOppenheimer Nov 21, 2025
1f5bcec
Cey feedback
JonathanOppenheimer Nov 21, 2025
0aef80d
Merge remote-tracking branch 'origin' into JonathanOppenheimer/sync-p…
JonathanOppenheimer Nov 21, 2025
7bf4819
Revert to nil
JonathanOppenheimer Nov 21, 2025
527f3b6
Merge branch 'master' into JonathanOppenheimer/sync-pr-1279-forbidgo
JonathanOppenheimer Nov 21, 2025
5883f1d
chore: lint
JonathanOppenheimer Nov 22, 2025
53490cf
revert version_test suggestion
ceyonur Nov 24, 2025
e080ed1
fix linter
ceyonur Nov 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .avalanche-golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ linters:
# - depguard
# - errcheck
- errorlint
# - forbidigo
- forbidigo
- goconst
- gocritic
- goprintffuncname
Expand Down Expand Up @@ -104,12 +104,12 @@ linters:
forbidigo:
# Forbid the following identifiers (list of regexp).
forbid:
- pattern: require\.Error$(# ErrorIs should be used instead)?
- pattern: require\.ErrorContains$(# ErrorIs should be used instead)?
- pattern: require\.EqualValues$(# Equal should be used instead)?
- pattern: require\.NotEqualValues$(# NotEqual should be used instead)?
# - pattern: require\.Error$(# ErrorIs should be used instead)?
# - pattern: require\.ErrorContains$(# ErrorIs should be used instead)?
# - pattern: require\.EqualValues$(# Equal should be used instead)?
# - pattern: require\.NotEqualValues$(# NotEqual should be used instead)?
- pattern: ^(t|b|tb|f)\.(Fatal|Fatalf|Error|Errorf)$(# the require library should be used instead)?
- pattern: ^sort\.(Slice|Strings)$(# the slices package should be used instead)?
# - pattern: ^sort\.(Slice|Strings)$(# the slices package should be used instead)?
# Exclude godoc examples from forbidigo checks.
exclude-godoc-examples: false
gosec:
Expand Down
47 changes: 17 additions & 30 deletions accounts/abi/bind/precompilebind/precompile_bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,7 @@ func TestPrecompileBind(t *testing.T) {
ws := t.TempDir()

pkg := filepath.Join(ws, "precompilebindtest")
if err := os.MkdirAll(pkg, 0o700); err != nil {
t.Fatalf("failed to create package: %v", err)
}
require.NoError(t, os.MkdirAll(pkg, 0o700), "failed to create package")
// Generate the test suite for all the contracts
for i, tt := range bindTests {
t.Run(tt.name, func(t *testing.T) {
Expand All @@ -642,14 +640,10 @@ func TestPrecompileBind(t *testing.T) {
require.ErrorContains(t, err, tt.errMsg)
return
}
if err != nil {
t.Fatalf("test %d: failed to generate binding: %v", i, err)
}
require.NoError(t, err, "test %d: failed to generate binding: %v", i, err)

precompilePath := filepath.Join(pkg, tt.name)
if err := os.MkdirAll(precompilePath, 0o700); err != nil {
t.Fatalf("failed to create package: %v", err)
}
require.NoError(t, os.MkdirAll(precompilePath, 0o700), "failed to create package")
for _, file := range bindedFiles {
switch file.FileName {
case ContractFileName:
Expand All @@ -663,13 +657,9 @@ func TestPrecompileBind(t *testing.T) {
// change address to a suitable one for testing
file.Content = strings.Replace(file.Content, `common.HexToAddress("{ASUITABLEHEXADDRESS}")`, `common.HexToAddress("0x03000000000000000000000000000000000000ff")`, 1)
}
if err = os.WriteFile(filepath.Join(precompilePath, file.FileName), []byte(file.Content), 0o600); err != nil {
t.Fatalf("test %d: failed to write binding: %v", i, err)
}
}
if err = os.WriteFile(filepath.Join(precompilePath, "contract.abi"), []byte(tt.abi), 0o600); err != nil {
t.Fatalf("test %d: failed to write binding: %v", i, err)
require.NoError(t, os.WriteFile(filepath.Join(precompilePath, file.FileName), []byte(file.Content), 0o600), "test %d: failed to write binding", i)
}
require.NoError(t, os.WriteFile(filepath.Join(precompilePath, "contract.abi"), []byte(tt.abi), 0o600), "test %d: failed to write binding", i)

// Generate the test file with the injected test code
code := fmt.Sprintf(`
Expand All @@ -684,32 +674,29 @@ func TestPrecompileBind(t *testing.T) {
%s
}
`, tt.name, tt.imports, tt.name, tt.tester)
if err := os.WriteFile(filepath.Join(precompilePath, strings.ToLower(tt.name)+"_test.go"), []byte(code), 0o600); err != nil {
t.Fatalf("test %d: failed to write tests: %v", i, err)
}
require.NoError(t, os.WriteFile(filepath.Join(precompilePath, strings.ToLower(tt.name)+"_test.go"), []byte(code), 0o600), "test %d: failed to write tests", i)
})
}

moder := exec.Command(gocmd, "mod", "init", "precompilebindtest")
moder.Dir = pkg
if out, err := moder.CombinedOutput(); err != nil {
t.Fatalf("failed to convert binding test to modules: %v\n%s", err, out)
}
out, err := moder.CombinedOutput()
require.NoError(t, err, "failed to convert binding test to modules: %v\n%s", err, out)

pwd, _ := os.Getwd()
replacer := exec.Command(gocmd, "mod", "edit", "-x", "-require", "github.com/ava-labs/[email protected]", "-replace", "github.com/ava-labs/subnet-evm="+filepath.Join(pwd, "..", "..", "..", "..")) // Repo root
replacer.Dir = pkg
if out, err := replacer.CombinedOutput(); err != nil {
t.Fatalf("failed to replace binding test dependency to current source tree: %v\n%s", err, out)
}
out, err = replacer.CombinedOutput()
require.NoError(t, err, "failed to replace binding test dependency to current source tree: %v\n%s", err, out)

tidier := exec.Command(gocmd, "mod", "tidy", "-compat=1.24")
tidier.Dir = pkg
if out, err := tidier.CombinedOutput(); err != nil {
t.Fatalf("failed to tidy Go module file: %v\n%s", err, out)
}
out, err = tidier.CombinedOutput()
require.NoError(t, err, "failed to tidy Go module file: %v\n%s", err, out)

// Test the entire package and report any failures
cmd := exec.Command(gocmd, "test", "./...", "-v", "-count", "1")
cmd.Dir = pkg
if out, err := cmd.CombinedOutput(); err != nil {
t.Fatalf("failed to run binding test: %v\n%s", err, out)
}
out, err = cmd.CombinedOutput()
require.NoError(t, err, "failed to run binding test: %v\n%s", err, out)
}
Loading
Loading