Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TymKh committed Apr 22, 2024
1 parent c5e0f3b commit effc26b
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
uses: actions/checkout@v2

- name: Install gofumpt
run: go install mvdan.cc/gofumpt@v0.4.0
run: go install mvdan.cc/gofumpt@v0.5.0

- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@2023.1.7
Expand Down
2 changes: 2 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ linters:
- exhaustruct
- nolintlint
- depguard
- testifylint
- perfsprint

#
# Disabled because of generics:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test-race:

lint:
gofmt -d -s .
gofumpt -d -extra .
#gofumpt -d -extra .
go vet ./...
staticcheck ./...
golangci-lint run
Expand Down
2 changes: 1 addition & 1 deletion mevshare/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (m *API) SendBundle(ctx context.Context, bundle SendMevBundleArgs) (_ SendM
}
bundle.Validity.Refund = []RefundConstraint{{0, refundPercent}}
MergePrivacyBuilders(&bundle)
err = MergeInclusionIntervals(&bundle.Inclusion, &unmatchedBundle.Inclusion)
err = MergeInclusionIntervals(&bundle.Inclusion, unmatchedBundle.Inclusion)
if err != nil {
return SendMevBundleResponse{}, ErrBackrunInclusion
}
Expand Down
4 changes: 2 additions & 2 deletions mevshare/bundle_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func cleanBody(bundle *SendMevBundleArgs) {

// MergeInclusionIntervals writes to the topLevel inclusion value of overlap between inner and topLevel
// or return error if there is no overlap
func MergeInclusionIntervals(topLevel, inner *MevBundleInclusion) error {
func MergeInclusionIntervals(topLevel *MevBundleInclusion, inner MevBundleInclusion) error {
if topLevel.MaxBlock < inner.BlockNumber || inner.MaxBlock < topLevel.BlockNumber {
return ErrInvalidInclusion
}
Expand Down Expand Up @@ -117,7 +117,7 @@ func validateBundleInner(level int, bundle *SendMevBundleArgs, currentBlock uint
bodyHashes = append(bodyHashes, tx.Hash())
txs++
} else if el.Bundle != nil {
err = MergeInclusionIntervals(&bundle.Inclusion, &el.Bundle.Inclusion)
err = MergeInclusionIntervals(&bundle.Inclusion, el.Bundle.Inclusion)
if err != nil {
return hash, txs, unmatched, err
}
Expand Down
5 changes: 3 additions & 2 deletions mevshare/bundle_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,14 @@ func TestMergeInclusionIntervals(t *testing.T) {
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
bottomCopy := c.bottom
err := MergeInclusionIntervals(&c.top, &bottomCopy)
topCopy := c.top
err := MergeInclusionIntervals(&topCopy, bottomCopy)
if c.err != nil {
require.ErrorIs(t, err, c.err)
} else {
require.NoError(t, err)
}
require.Equal(t, c.expectedTop, c.top)
require.Equal(t, c.expectedTop, topCopy)
require.Equal(t, c.bottom, bottomCopy)
})
}
Expand Down

0 comments on commit effc26b

Please sign in to comment.