chore: lint repo (use american english) (#9144)

This commit is contained in:
Callum Waters
2022-08-01 14:24:49 +02:00
committed by GitHub
parent 439d84afa1
commit 49ec3b9780
60 changed files with 407 additions and 404 deletions

View File

@@ -5,7 +5,7 @@ import (
"reflect"
"time"
"github.com/tendermint/tendermint/behaviour"
"github.com/tendermint/tendermint/behavior"
bc "github.com/tendermint/tendermint/blockchain"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/p2p"
@@ -66,7 +66,7 @@ type BlockchainReactor struct {
// the switch.
eventsFromFSMCh chan bcFsmMessage
swReporter *behaviour.SwitchReporter
swReporter *behavior.SwitchReporter
}
// NewBlockchainReactor returns new reactor instance.
@@ -100,7 +100,7 @@ func NewBlockchainReactor(state sm.State, blockExec *sm.BlockExecutor, store *st
fsm := NewFSM(startHeight, bcR)
bcR.fsm = fsm
bcR.BaseReactor = *p2p.NewBaseReactor("BlockchainReactor", bcR)
// bcR.swReporter = behaviour.NewSwitchReporter(bcR.BaseReactor.Switch)
// bcR.swReporter = behavior.NewSwitchReporter(bcR.BaseReactor.Switch)
return bcR
}
@@ -138,7 +138,7 @@ func (bcR *BlockchainReactor) SetLogger(l log.Logger) {
// OnStart implements service.Service.
func (bcR *BlockchainReactor) OnStart() error {
bcR.swReporter = behaviour.NewSwitchReporter(bcR.BaseReactor.Switch)
bcR.swReporter = behavior.NewSwitchReporter(bcR.BaseReactor.Switch)
if bcR.fastSync {
go bcR.poolRoutine()
}
@@ -254,13 +254,13 @@ func (bcR *BlockchainReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte)
msg, err := bc.DecodeMsg(msgBytes)
if err != nil {
bcR.Logger.Error("error decoding message", "src", src, "chId", chID, "err", err)
_ = bcR.swReporter.Report(behaviour.BadMessage(src.ID(), err.Error()))
_ = bcR.swReporter.Report(behavior.BadMessage(src.ID(), err.Error()))
return
}
if err = bc.ValidateMsg(msg); err != nil {
bcR.Logger.Error("peer sent us invalid msg", "peer", src, "msg", msg, "err", err)
_ = bcR.swReporter.Report(behaviour.BadMessage(src.ID(), err.Error()))
_ = bcR.swReporter.Report(behavior.BadMessage(src.ID(), err.Error()))
return
}
@@ -451,7 +451,7 @@ ForLoop:
func (bcR *BlockchainReactor) reportPeerErrorToSwitch(err error, peerID p2p.ID) {
peer := bcR.Switch.Peers().Get(peerID)
if peer != nil {
_ = bcR.swReporter.Report(behaviour.BadMessage(peerID, err.Error()))
_ = bcR.swReporter.Report(behavior.BadMessage(peerID, err.Error()))
}
}

View File

@@ -82,7 +82,7 @@ func executeProcessorTests(t *testing.T, tests []testFields) {
}
}()
// First step must always initialise the currentState as state.
// First step must always initialize the currentState as state.
if step.currentState != nil {
state = makeState(step.currentState)
}

View File

@@ -5,7 +5,7 @@ import (
"fmt"
"time"
"github.com/tendermint/tendermint/behaviour"
"github.com/tendermint/tendermint/behavior"
bc "github.com/tendermint/tendermint/blockchain"
"github.com/tendermint/tendermint/libs/log"
tmsync "github.com/tendermint/tendermint/libs/sync"
@@ -42,7 +42,7 @@ type BlockchainReactor struct {
syncHeight int64
events chan Event // non-nil during a fast sync
reporter behaviour.Reporter
reporter behavior.Reporter
io iIO
store blockStore
}
@@ -57,7 +57,7 @@ type blockApplier interface {
}
// XXX: unify naming in this package around tmState
func newReactor(state state.State, store blockStore, reporter behaviour.Reporter,
func newReactor(state state.State, store blockStore, reporter behavior.Reporter,
blockApplier blockApplier, fastSync bool) *BlockchainReactor {
initHeight := state.LastBlockHeight + 1
if initHeight == 1 {
@@ -85,7 +85,7 @@ func NewBlockchainReactor(
blockApplier blockApplier,
store blockStore,
fastSync bool) *BlockchainReactor {
reporter := behaviour.NewMockReporter()
reporter := behavior.NewMockReporter()
return newReactor(state, store, reporter, blockApplier, fastSync)
}
@@ -129,7 +129,7 @@ func (r *BlockchainReactor) SetLogger(logger log.Logger) {
// Start implements cmn.Service interface
func (r *BlockchainReactor) Start() error {
r.reporter = behaviour.NewSwitchReporter(r.BaseReactor.Switch)
r.reporter = behavior.NewSwitchReporter(r.BaseReactor.Switch)
if r.fastSync {
err := r.startSync(nil)
if err != nil {
@@ -139,7 +139,7 @@ func (r *BlockchainReactor) Start() error {
return nil
}
// startSync begins a fast sync, signalled by r.events being non-nil. If state is non-nil,
// startSync begins a fast sync, signaled by r.events being non-nil. If state is non-nil,
// the scheduler and processor is updated with this state on startup.
func (r *BlockchainReactor) startSync(state *state.State) error {
r.mtx.Lock()
@@ -376,7 +376,7 @@ func (r *BlockchainReactor) demux(events <-chan Event) {
r.processor.send(event)
case scPeerError:
r.processor.send(event)
if err := r.reporter.Report(behaviour.BadMessage(event.peerID, "scPeerError")); err != nil {
if err := r.reporter.Report(behavior.BadMessage(event.peerID, "scPeerError")); err != nil {
r.logger.Error("Error reporting peer", "err", err)
}
case scBlockRequest:
@@ -460,13 +460,13 @@ func (r *BlockchainReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) {
if err != nil {
r.logger.Error("error decoding message",
"src", src.ID(), "chId", chID, "msg", msg, "err", err)
_ = r.reporter.Report(behaviour.BadMessage(src.ID(), err.Error()))
_ = r.reporter.Report(behavior.BadMessage(src.ID(), err.Error()))
return
}
if err = bc.ValidateMsg(msg); err != nil {
r.logger.Error("peer sent us invalid msg", "peer", src, "msg", msg, "err", err)
_ = r.reporter.Report(behaviour.BadMessage(src.ID(), err.Error()))
_ = r.reporter.Report(behavior.BadMessage(src.ID(), err.Error()))
return
}

View File

@@ -14,7 +14,7 @@ import (
dbm "github.com/tendermint/tm-db"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/behaviour"
"github.com/tendermint/tendermint/behavior"
bc "github.com/tendermint/tendermint/blockchain"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/libs/log"
@@ -144,7 +144,7 @@ type testReactorParams struct {
func newTestReactor(p testReactorParams) *BlockchainReactor {
store, state, _ := newReactorStore(p.genDoc, p.privVals, p.startHeight)
reporter := behaviour.NewMockReporter()
reporter := behavior.NewMockReporter()
var appl blockApplier
@@ -301,7 +301,7 @@ func newTestReactor(p testReactorParams) *BlockchainReactor {
// t.Run(tt.name, func(t *testing.T) {
// reactor := newTestReactor(params)
// reactor.Start()
// reactor.reporter = behaviour.NewMockReporter()
// reactor.reporter = behavior.NewMockReporter()
// mockSwitch := &mockSwitchIo{switchedToConsensus: false}
// reactor.io = mockSwitch
// // time for go routines to start

View File

@@ -2225,7 +2225,7 @@ func TestScHandle(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
var sc *scheduler
for i, step := range tt.steps {
// First step must always initialise the currentState as state.
// First step must always initialize the currentState as state.
if step.currentSc != nil {
sc = newTestScheduler(*step.currentSc)
}