Skip to content

Commit

Permalink
Merge pull request #131 from nspcc-dev/org-linter
Browse files Browse the repository at this point in the history
Org-wide linter
  • Loading branch information
AnnaShaleva authored Sep 11, 2024
2 parents 212d176 + aab1cf6 commit 6191d39
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 68 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,7 @@ on:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
uses: nspcc-dev/.github/.github/workflows/go-linter.yml@master

test:
name: Test
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/vendor
.golangci.yml

# TLC Model Checker files
formal-models/*/*.toolbox/
54 changes: 0 additions & 54 deletions .golangci.yml

This file was deleted.

4 changes: 2 additions & 2 deletions dbft.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,9 +698,9 @@ func (d *DBFT[H]) changeTimer(delay time.Duration) {
d.Timer.Reset(d.BlockIndex, d.ViewNumber, delay)
}

func (d *DBFT[H]) extendTimer(count time.Duration) {
func (d *DBFT[H]) extendTimer(count int) {
if !d.CommitSent() && (!d.isAntiMEVExtensionEnabled() || !d.PreCommitSent()) && !d.ViewChanging() {
d.Timer.Extend(count * d.SecondsPerBlock / time.Duration(d.M()))
d.Timer.Extend(time.Duration(count) * d.SecondsPerBlock / time.Duration(d.M()))
}
}

Expand Down
3 changes: 3 additions & 0 deletions helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,8 @@ func (c *cache[H]) addMessage(m ConsensusPayload[H]) {
msgs.preCommit[m.ValidatorIndex()] = m
case CommitType:
msgs.commit[m.ValidatorIndex()] = m
default:
// Others are recoveries and we don't currently use them.
// Theoretically messages could be extracted.
}
}
2 changes: 1 addition & 1 deletion internal/consensus/amev_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewAMEVBlock(pre dbft.PreBlock[crypto.Uint256], cnData [][]byte, m int) dbf
tx := Tx64(math.MaxInt64 - int64(sum))
res.transactions = append(preB.initialTransactions, &tx)

// Rebuild Merkle root for the new set of transations.
// Rebuild Merkle root for the new set of transactions.
txHashes := make([]crypto.Uint256, len(res.transactions))
for i := range txHashes {
txHashes[i] = res.transactions[i].Hash()
Expand Down
2 changes: 2 additions & 0 deletions internal/consensus/recovery_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ func (m *recoveryMessage) AddPayload(p dbft.ConsensusPayload[crypto.Uint256]) {
}
copy(cc.Signature[:], p.GetCommit().Signature())
m.commitPayloads = append(m.commitPayloads, cc)
default:
// Other types (recoveries) can't be packed into recovery.
}
}

Expand Down

0 comments on commit 6191d39

Please sign in to comment.