Skip to content

Commit 31342bc

Browse files
committed
Merge branch 'master' into powerslider/4368-migrate-stats-coreth
2 parents 568f878 + edff599 commit 31342bc

File tree

169 files changed

+5516
-2555
lines changed

Some content is hidden

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

169 files changed

+5516
-2555
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
/tests/*.md @joshua-kim @maru-ava @meaghanfitzgerald
3131
/tests/reexecute/ @aaronbuchwald
3232
/tools/* @joshua-kim @maru-ava
33+
/vms/evm/ @ARR4N @joshua-kim @StephenButtolph
3334
/x/blockdb @DracoLi
3435
/x/merkledb @joshua-kim @rrazvan1
3536
/x/sync @joshua-kim @rrazvan1

.github/actions/c-chain-reexecution-benchmark/action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ runs:
9595
LABELS=${{ env.LABELS }} \
9696
BENCHMARK_OUTPUT_FILE=${{ env.BENCHMARK_OUTPUT_FILE }} \
9797
RUNNER_NAME=${{ inputs.runner_name }} \
98-
METRICS_ENABLED=true
98+
METRICS_SERVER_ENABLED=true \
99+
METRICS_COLLECTOR_ENABLED=true
99100
prometheus_url: ${{ inputs.prometheus-url }}
100101
prometheus_push_url: ${{ inputs.prometheus-push-url }}
101102
prometheus_username: ${{ inputs.prometheus-username }}

.golangci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ linters:
6060
- tagalign
6161
- testifylint
6262
- unconvert
63+
- usetesting
6364
- unparam
6465
- unused
6566
- usestdlibvars
@@ -199,6 +200,14 @@ linters:
199200
disable:
200201
- go-require
201202
- float-compare
203+
usetesting:
204+
os-create-temp: true # Disallow `os.CreateTemp("", ...)`
205+
os-mkdir-temp: true # Disallow `os.MkdirTemp()`
206+
os-setenv: true # Disallow `os.Setenv()`
207+
os-temp-dir: true # Disallow `os.TempDir()`
208+
os-chdir: true # Disallow `os.Chdir()`
209+
context-background: true # Disallow `context.Background()`
210+
context-todo: true # Disallow `context.TODO()`
202211
unused:
203212
# Mark all struct fields that have been written to as used.
204213
# Default: true
@@ -216,6 +225,15 @@ linters:
216225
- common-false-positives
217226
- legacy
218227
- std-error-handling
228+
rules:
229+
# Exclude some linters from running on test files.
230+
# 1. Exclude the top level tests/ directory.
231+
# 2. Exclude any file prefixed with test_ in any directory.
232+
# 3. Exclude any directory suffixed with test.
233+
# 4. Exclude any file suffixed with _test.go.
234+
- path: "(^tests/)|(^(.*/)*test_[^/]*\\.go$)|(.*test/.*)|(.*_test\\.go$)"
235+
linters:
236+
- prealloc
219237
formatters:
220238
enable:
221239
- gci

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
To start developing on AvalancheGo, you'll need a few things installed.
66

7-
- Golang version >= 1.24.8
7+
- Golang version >= 1.24.9
88
- gcc
99
- g++
1010

@@ -110,7 +110,7 @@ Mocks are auto-generated using [mockgen](https://pkg.go.dev/go.uber.org/mock/moc
110110
- Run the linter
111111

112112
```sh
113-
./scipts/run_task.sh lint
113+
./scripts/run_task.sh lint
114114
```
115115

116116
### Continuous Integration (CI)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The minimum recommended hardware specification for nodes connected to Mainnet is
2323

2424
If you plan to build AvalancheGo from source, you will also need the following software:
2525

26-
- [Go](https://golang.org/doc/install) version >= 1.24.8
26+
- [Go](https://golang.org/doc/install) version >= 1.24.9
2727
- [gcc](https://gcc.gnu.org/)
2828
- g++
2929

RELEASES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release Notes
22

3+
## Pending
4+
5+
### Configs
6+
7+
- Changed default block delay for L1s (other than Primary Network) to 0.
8+
39
## [v1.13.5](https://github.com/ava-labs/avalanchego/releases/tag/v1.13.5)
410

511
This version is backwards compatible to [v1.13.0](https://github.com/ava-labs/avalanchego/releases/tag/v1.13.0). It is optional, but encouraged.

Taskfile.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ tasks:
170170
desc: Runs static analysis tests of golang code
171171
cmd: ./scripts/lint.sh
172172

173+
lint-fix:
174+
desc: Runs automated fixing for failing static analysis of golang code
175+
cmd: ./scripts/run_tool.sh golangci-lint run --config .golangci.yml --fix
176+
173177
lint-action:
174178
desc: Runs actionlint to check sanity of github action configuration
175179
cmd: ./scripts/actionlint.sh
@@ -203,7 +207,8 @@ tasks:
203207
END_BLOCK: '{{.END_BLOCK}}'
204208
LABELS: '{{.LABELS | default ""}}'
205209
BENCHMARK_OUTPUT_FILE: '{{.BENCHMARK_OUTPUT_FILE | default ""}}'
206-
METRICS_ENABLED: '{{.METRICS_ENABLED | default "false"}}'
210+
METRICS_SERVER_ENABLED: '{{.METRICS_SERVER_ENABLED | default "false"}}'
211+
METRICS_COLLECTOR_ENABLED: '{{.METRICS_COLLECTOR_ENABLED | default "false"}}'
207212
cmd: |
208213
CURRENT_STATE_DIR={{.CURRENT_STATE_DIR}} \
209214
BLOCK_DIR={{.BLOCK_DIR}} \
@@ -213,7 +218,8 @@ tasks:
213218
END_BLOCK={{.END_BLOCK}} \
214219
LABELS={{.LABELS}} \
215220
BENCHMARK_OUTPUT_FILE={{.BENCHMARK_OUTPUT_FILE}} \
216-
METRICS_ENABLED={{.METRICS_ENABLED}} \
221+
METRICS_SERVER_ENABLED={{.METRICS_SERVER_ENABLED}} \
222+
METRICS_COLLECTOR_ENABLED={{.METRICS_COLLECTOR_ENABLED}} \
217223
bash -x ./scripts/benchmark_cchain_range.sh
218224
219225
reexecute-cchain-range-with-copied-data:
@@ -228,7 +234,8 @@ tasks:
228234
END_BLOCK: '{{.END_BLOCK | default "250000"}}'
229235
LABELS: '{{.LABELS | default ""}}'
230236
BENCHMARK_OUTPUT_FILE: '{{.BENCHMARK_OUTPUT_FILE | default ""}}'
231-
METRICS_ENABLED: '{{.METRICS_ENABLED | default "false"}}'
237+
METRICS_SERVER_ENABLED: '{{.METRICS_SERVER_ENABLED | default "false"}}'
238+
METRICS_COLLECTOR_ENABLED: '{{.METRICS_COLLECTOR_ENABLED | default "false"}}'
232239
cmds:
233240
- task: import-cchain-reexecute-range
234241
vars:
@@ -245,7 +252,8 @@ tasks:
245252
END_BLOCK: '{{.END_BLOCK}}'
246253
LABELS: '{{.LABELS}}'
247254
BENCHMARK_OUTPUT_FILE: '{{.BENCHMARK_OUTPUT_FILE}}'
248-
METRICS_ENABLED: '{{.METRICS_ENABLED}}'
255+
METRICS_SERVER_ENABLED: '{{.METRICS_SERVER_ENABLED}}'
256+
METRICS_COLLECTOR_ENABLED: '{{.METRICS_COLLECTOR_ENABLED}}'
249257

250258
test-bootstrap-monitor-e2e:
251259
desc: Runs bootstrap monitor e2e tests

api/admin/client_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func TestStartCPUProfiler(t *testing.T) {
7878
for _, test := range SuccessResponseTests {
7979
t.Run(test.name, func(t *testing.T) {
8080
mockClient := Client{Requester: NewMockClient(&api.EmptyReply{}, test.expectedErr)}
81-
err := mockClient.StartCPUProfiler(context.Background())
81+
err := mockClient.StartCPUProfiler(t.Context())
8282
require.ErrorIs(t, err, test.expectedErr)
8383
})
8484
}
@@ -88,7 +88,7 @@ func TestStopCPUProfiler(t *testing.T) {
8888
for _, test := range SuccessResponseTests {
8989
t.Run(test.name, func(t *testing.T) {
9090
mockClient := Client{Requester: NewMockClient(&api.EmptyReply{}, test.expectedErr)}
91-
err := mockClient.StopCPUProfiler(context.Background())
91+
err := mockClient.StopCPUProfiler(t.Context())
9292
require.ErrorIs(t, err, test.expectedErr)
9393
})
9494
}
@@ -98,7 +98,7 @@ func TestMemoryProfile(t *testing.T) {
9898
for _, test := range SuccessResponseTests {
9999
t.Run(test.name, func(t *testing.T) {
100100
mockClient := Client{Requester: NewMockClient(&api.EmptyReply{}, test.expectedErr)}
101-
err := mockClient.MemoryProfile(context.Background())
101+
err := mockClient.MemoryProfile(t.Context())
102102
require.ErrorIs(t, err, test.expectedErr)
103103
})
104104
}
@@ -108,7 +108,7 @@ func TestLockProfile(t *testing.T) {
108108
for _, test := range SuccessResponseTests {
109109
t.Run(test.name, func(t *testing.T) {
110110
mockClient := Client{Requester: NewMockClient(&api.EmptyReply{}, test.expectedErr)}
111-
err := mockClient.LockProfile(context.Background())
111+
err := mockClient.LockProfile(t.Context())
112112
require.ErrorIs(t, err, test.expectedErr)
113113
})
114114
}
@@ -118,7 +118,7 @@ func TestAlias(t *testing.T) {
118118
for _, test := range SuccessResponseTests {
119119
t.Run(test.name, func(t *testing.T) {
120120
mockClient := Client{Requester: NewMockClient(&api.EmptyReply{}, test.expectedErr)}
121-
err := mockClient.Alias(context.Background(), "alias", "alias2")
121+
err := mockClient.Alias(t.Context(), "alias", "alias2")
122122
require.ErrorIs(t, err, test.expectedErr)
123123
})
124124
}
@@ -128,7 +128,7 @@ func TestAliasChain(t *testing.T) {
128128
for _, test := range SuccessResponseTests {
129129
t.Run(test.name, func(t *testing.T) {
130130
mockClient := Client{Requester: NewMockClient(&api.EmptyReply{}, test.expectedErr)}
131-
err := mockClient.AliasChain(context.Background(), "chain", "chain-alias")
131+
err := mockClient.AliasChain(t.Context(), "chain", "chain-alias")
132132
require.ErrorIs(t, err, test.expectedErr)
133133
})
134134
}
@@ -143,14 +143,14 @@ func TestGetChainAliases(t *testing.T) {
143143
Aliases: expectedReply,
144144
}, nil)}
145145

146-
reply, err := mockClient.GetChainAliases(context.Background(), "chain")
146+
reply, err := mockClient.GetChainAliases(t.Context(), "chain")
147147
require.NoError(err)
148148
require.Equal(expectedReply, reply)
149149
})
150150

151151
t.Run("failure", func(t *testing.T) {
152152
mockClient := Client{Requester: NewMockClient(&GetChainAliasesReply{}, errTest)}
153-
_, err := mockClient.GetChainAliases(context.Background(), "chain")
153+
_, err := mockClient.GetChainAliases(t.Context(), "chain")
154154
require.ErrorIs(t, err, errTest)
155155
})
156156
}
@@ -159,7 +159,7 @@ func TestStacktrace(t *testing.T) {
159159
for _, test := range SuccessResponseTests {
160160
t.Run(test.name, func(t *testing.T) {
161161
mockClient := Client{Requester: NewMockClient(&api.EmptyReply{}, test.expectedErr)}
162-
err := mockClient.Stacktrace(context.Background())
162+
err := mockClient.Stacktrace(t.Context())
163163
require.ErrorIs(t, err, test.expectedErr)
164164
})
165165
}
@@ -182,15 +182,15 @@ func TestReloadInstalledVMs(t *testing.T) {
182182
FailedVMs: expectedFailedVMs,
183183
}, nil)}
184184

185-
loadedVMs, failedVMs, err := mockClient.LoadVMs(context.Background())
185+
loadedVMs, failedVMs, err := mockClient.LoadVMs(t.Context())
186186
require.NoError(err)
187187
require.Equal(expectedNewVMs, loadedVMs)
188188
require.Equal(expectedFailedVMs, failedVMs)
189189
})
190190

191191
t.Run("failure", func(t *testing.T) {
192192
mockClient := Client{Requester: NewMockClient(&LoadVMsReply{}, errTest)}
193-
_, _, err := mockClient.LoadVMs(context.Background())
193+
_, _, err := mockClient.LoadVMs(t.Context())
194194
require.ErrorIs(t, err, errTest)
195195
})
196196
}
@@ -253,7 +253,7 @@ func TestSetLoggerLevel(t *testing.T) {
253253
),
254254
}
255255
res, err := c.SetLoggerLevel(
256-
context.Background(),
256+
t.Context(),
257257
"",
258258
tt.logLevel,
259259
tt.displayLevel,
@@ -306,7 +306,7 @@ func TestGetLoggerLevel(t *testing.T) {
306306
),
307307
}
308308
res, err := c.GetLoggerLevel(
309-
context.Background(),
309+
t.Context(),
310310
tt.loggerName,
311311
)
312312
require.ErrorIs(err, tt.clientErr)
@@ -347,7 +347,7 @@ func TestGetConfig(t *testing.T) {
347347
c := Client{
348348
Requester: NewMockClient(tt.expectedResponse, tt.serviceErr),
349349
}
350-
res, err := c.GetConfig(context.Background())
350+
res, err := c.GetConfig(t.Context())
351351
require.ErrorIs(err, tt.clientErr)
352352
if tt.clientErr != nil {
353353
return

api/health/client_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,33 +48,33 @@ func TestClient(t *testing.T) {
4848
}
4949

5050
{
51-
readiness, err := c.Readiness(context.Background(), nil)
51+
readiness, err := c.Readiness(t.Context(), nil)
5252
require.NoError(err)
5353
require.True(readiness.Healthy)
5454
}
5555

5656
{
57-
health, err := c.Health(context.Background(), nil)
57+
health, err := c.Health(t.Context(), nil)
5858
require.NoError(err)
5959
require.True(health.Healthy)
6060
}
6161

6262
{
63-
liveness, err := c.Liveness(context.Background(), nil)
63+
liveness, err := c.Liveness(t.Context(), nil)
6464
require.NoError(err)
6565
require.True(liveness.Healthy)
6666
}
6767

6868
{
69-
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
69+
ctx, cancel := context.WithTimeout(t.Context(), 3*time.Second)
7070
healthy, err := AwaitHealthy(ctx, c, time.Second, nil)
7171
cancel()
7272
require.NoError(err)
7373
require.True(healthy)
7474
}
7575

7676
{
77-
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
77+
ctx, cancel := context.WithTimeout(t.Context(), 3*time.Second)
7878
healthy, err := AwaitReady(ctx, c, time.Second, nil)
7979
cancel()
8080
require.NoError(err)
@@ -84,15 +84,15 @@ func TestClient(t *testing.T) {
8484
mc.reply.Healthy = false
8585

8686
{
87-
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Microsecond)
87+
ctx, cancel := context.WithTimeout(t.Context(), 20*time.Microsecond)
8888
healthy, err := AwaitHealthy(ctx, c, time.Microsecond, nil)
8989
cancel()
9090
require.ErrorIs(err, context.DeadlineExceeded)
9191
require.False(healthy)
9292
}
9393

9494
{
95-
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Microsecond)
95+
ctx, cancel := context.WithTimeout(t.Context(), 20*time.Microsecond)
9696
healthy, err := AwaitReady(ctx, c, time.Microsecond, nil)
9797
cancel()
9898
require.ErrorIs(err, context.DeadlineExceeded)
@@ -104,14 +104,14 @@ func TestClient(t *testing.T) {
104104
}
105105

106106
{
107-
healthy, err := AwaitHealthy(context.Background(), c, time.Microsecond, nil)
107+
healthy, err := AwaitHealthy(t.Context(), c, time.Microsecond, nil)
108108
require.NoError(err)
109109
require.True(healthy)
110110
}
111111

112112
mc.reply.Healthy = false
113113
{
114-
healthy, err := AwaitReady(context.Background(), c, time.Microsecond, nil)
114+
healthy, err := AwaitReady(t.Context(), c, time.Microsecond, nil)
115115
require.NoError(err)
116116
require.True(healthy)
117117
}

api/health/health_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func TestPassingChecks(t *testing.T) {
125125
require.NoError(h.RegisterHealthCheck("check", check))
126126
require.NoError(h.RegisterLivenessCheck("check", check))
127127

128-
h.Start(context.Background(), checkFreq)
128+
h.Start(t.Context(), checkFreq)
129129
defer h.Stop()
130130

131131
{
@@ -189,7 +189,7 @@ func TestPassingThenFailingChecks(t *testing.T) {
189189
require.NoError(h.RegisterHealthCheck("check", check))
190190
require.NoError(h.RegisterLivenessCheck("check", check))
191191

192-
h.Start(context.Background(), checkFreq)
192+
h.Start(t.Context(), checkFreq)
193193
defer h.Stop()
194194

195195
awaitReadiness(t, h, true)
@@ -240,7 +240,7 @@ func TestDeadlockRegression(t *testing.T) {
240240
return "", nil
241241
})
242242

243-
h.Start(context.Background(), time.Nanosecond)
243+
h.Start(t.Context(), time.Nanosecond)
244244
defer h.Stop()
245245

246246
for i := 0; i < 100; i++ {
@@ -307,7 +307,7 @@ func TestTags(t *testing.T) {
307307
require.False(health)
308308
}
309309

310-
h.Start(context.Background(), checkFreq)
310+
h.Start(t.Context(), checkFreq)
311311

312312
awaitHealthy(t, h, true)
313313

0 commit comments

Comments
 (0)