Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: golangci/golangci-lint-action@v9.2.0
with:
version: latest
args: --timeout 10m
args: --timeout 10m ./...
github-token: ${{ secrets.github_token }}
if: env.GIT_DIFF

Expand Down
59 changes: 58 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,57 @@
version: "2"
run:
modules-download-mode: readonly
timeout: 10m
tests: true
build-tags:
- evm
- e2e
- docker
linters:
enable:
- asciicheck
- bidichk
- bodyclose
- contextcheck
- copyloopvar
- durationcheck
- errname
- errorlint
- govet
- ineffassign
- makezero
- gosec
- misspell
- nilerr
- noctx
- prealloc
- predeclared
- reassign
- revive
- rowserrcheck
- sqlclosecheck
- staticcheck
- unconvert
- unused
- usestdlibvars
- wastedassign
settings:
errcheck:
check-type-assertions: true
check-blank: true
govet:
enable-all: true
disable:
- fieldalignment
- shadow
gocritic:
enabled-tags:
- diagnostic
- style
- performance
disabled-checks:
- hugeParam
- rangeValCopy
gosec:
excludes:
- G115
Expand All @@ -21,7 +60,7 @@ linters:
- name: package-comments
disabled: true
- name: duplicated-imports
severity: warning
severity: error
- name: exported
arguments:
- disableStutteringCheck
Expand All @@ -32,10 +71,28 @@ linters:
- common-false-positives
- legacy
- std-error-handling
rules:
- path: _test\.go
linters:
- prealloc
- noctx
paths:
- third_party$
- builtin$
- examples$
disable:
- containedctx
- errcheck
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As coderabbit pointed out, some linters are in enabled and disabled at the same time. for example errcheck.

- gocritic
- nolintlint
- testifylint
- thelper
- tparallel
- unparam
- wrapcheck
issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gci
Expand Down
4 changes: 2 additions & 2 deletions .just/lint.just
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[group('lint')]
lint: vet
@echo "--> Running golangci-lint"
@golangci-lint run
@golangci-lint run ./...
@echo "--> Running markdownlint"
@markdownlint --config .markdownlint.yaml '**/*.md'
@echo "--> Running hadolint"
Expand All @@ -18,7 +18,7 @@ lint: vet
[group('lint')]
lint-fix:
@echo "--> Formatting go"
@golangci-lint run --fix
@golangci-lint run --fix ./...
@echo "--> Formatting markdownlint"
@markdownlint --config .markdownlint.yaml --ignore './changelog.md' '**/*.md' -f

Expand Down
1 change: 1 addition & 0 deletions block/internal/da/async_block_retriever_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,6 @@ func TestBlockData_SerializationEmpty(t *testing.T) {
}

assert.Equal(t, uint64(100), decoded.Height)
assert.Equal(t, time.Unix(0, 0).UTC(), decoded.Timestamp)
assert.Equal(t, 0, len(decoded.Blobs))
}
9 changes: 4 additions & 5 deletions block/internal/executing/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ func (e *Executor) executionLoop() {
} else {
delay = time.Until(currentState.LastBlockTime.Add(e.config.Node.BlockTime.Duration))
}

if delay > 0 {
e.logger.Info().Dur("delay", delay).Msg("waiting to start block production")
select {
Expand Down Expand Up @@ -591,7 +590,7 @@ func (e *Executor) ProduceBlock(ctx context.Context) error {
LastSubmittedDaHeaderHeight: e.cache.GetLastSubmittedHeaderHeight(),
LastSubmittedDaDataHeight: e.cache.GetLastSubmittedDataHeight(),
}
if err := e.raftNode.Broadcast(e.ctx, raftState); err != nil {
if err := e.raftNode.Broadcast(ctx, raftState); err != nil {
return fmt.Errorf("failed to propose block to raft: %w", err)
}
e.logger.Debug().Uint64("height", newHeight).Msg("proposed block to raft")
Expand All @@ -617,12 +616,12 @@ func (e *Executor) ProduceBlock(ctx context.Context) error {
// IMPORTANT: Header MUST be broadcast before data — the P2P layer validates
// incoming data against the current and previous header, so out-of-order
// delivery would cause validation failures on peers.
if err := e.headerBroadcaster.WriteToStoreAndBroadcast(e.ctx, &types.P2PSignedHeader{
if err := e.headerBroadcaster.WriteToStoreAndBroadcast(ctx, &types.P2PSignedHeader{
SignedHeader: header,
}); err != nil {
e.logger.Error().Err(err).Msg("failed to broadcast header")
}
if err := e.dataBroadcaster.WriteToStoreAndBroadcast(e.ctx, &types.P2PData{
if err := e.dataBroadcaster.WriteToStoreAndBroadcast(ctx, &types.P2PData{
Data: data,
}); err != nil {
e.logger.Error().Err(err).Msg("failed to broadcast data")
Expand All @@ -637,7 +636,7 @@ func (e *Executor) ProduceBlock(ctx context.Context) error {

// For based sequencer, advance safe/finalized since it comes from DA.
if e.config.Node.BasedSequencer {
if err := e.exec.SetFinal(e.ctx, newHeight); err != nil {
if err := e.exec.SetFinal(ctx, newHeight); err != nil {
e.sendCriticalError(fmt.Errorf("failed to set final height in based sequencer mode: %w", err))
return fmt.Errorf("failed to set final height in based sequencer mode: %w", err)
}
Expand Down
14 changes: 7 additions & 7 deletions block/internal/submitting/da_submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ func (rs *retryState) Next(reason retryReason, pol retryPolicy) {
}

// clamp constrains a duration between min and max bounds
func clamp(v, min, max time.Duration) time.Duration {
if min > max {
min, max = max, min
func clamp(v, minTime, maxTime time.Duration) time.Duration {
if minTime > maxTime {
minTime, maxTime = maxTime, minTime
}
if v < min {
return min
if v < minTime {
return minTime
}
if v > max {
return max
if v > maxTime {
return maxTime
}
return v
}
Expand Down
1 change: 0 additions & 1 deletion block/internal/submitting/da_submitter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ func TestDASubmitter_SubmitHeaders_Success(t *testing.T) {

// Create test signer
addr, pub, signer := createTestSigner(t)
gen.ProposerAddress = addr

// Create test headers
header1 := &types.SignedHeader{
Expand Down
Loading
Loading