From 667f138776306d0750a4ec072c9a796a72197ccc Mon Sep 17 00:00:00 2001 From: tnasu Date: Fri, 4 Feb 2022 18:04:32 +0900 Subject: [PATCH] Fix misspell behaviour to behavior --- .golangci.yml | 2 +- {behaviour => behavior}/doc.go | 6 +-- behavior/peer_behavior.go | 49 ++++++++++++++++++++ {behaviour => behavior}/reporter.go | 28 ++++++------ {behaviour => behavior}/reporter_test.go | 58 ++++++++++++------------ behaviour/peer_behaviour.go | 49 -------------------- blockchain/v1/reactor.go | 14 +++--- blockchain/v2/reactor.go | 16 +++---- blockchain/v2/reactor_test.go | 6 +-- config/config.go | 2 +- config/toml.go | 2 +- consensus/state.go | 2 +- consensus/state_test.go | 4 +- p2p/transport.go | 8 ++-- rpc/client/interface.go | 2 +- rpc/jsonrpc/server/ws_handler.go | 2 +- state/state_test.go | 2 +- test/maverick/consensus/state.go | 2 +- version/version.go | 2 +- 19 files changed, 128 insertions(+), 128 deletions(-) rename {behaviour => behavior}/doc.go (92%) create mode 100644 behavior/peer_behavior.go rename {behaviour => behavior}/reporter.go (73%) rename {behaviour => behavior}/reporter_test.go (73%) delete mode 100644 behaviour/peer_behaviour.go diff --git a/.golangci.yml b/.golangci.yml index d2b5880aa..e0f3fe163 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -26,7 +26,7 @@ linters: # - interfacer - lll # - maligned - # - misspell + - misspell - nakedret - nolintlint - prealloc diff --git a/behaviour/doc.go b/behavior/doc.go similarity index 92% rename from behaviour/doc.go rename to behavior/doc.go index 40061e095..defe9f79d 100644 --- a/behaviour/doc.go +++ b/behavior/doc.go @@ -1,7 +1,7 @@ /* -Package Behaviour provides a mechanism for reactors to report behaviour of peers. +Package Behaviour provides a mechanism for reactors to report behavior of peers. -Instead of a reactor calling the switch directly it will call the behaviour module which will +Instead of a reactor calling the switch directly it will call the behavior module which will handle the stoping and marking peer as good on behalf of the reactor. There are four different behaviours a reactor can report. @@ -39,4 +39,4 @@ type blockPart struct { This message will request the peer be marked as good */ -package behaviour +package behavior diff --git a/behavior/peer_behavior.go b/behavior/peer_behavior.go new file mode 100644 index 000000000..329077db9 --- /dev/null +++ b/behavior/peer_behavior.go @@ -0,0 +1,49 @@ +package behavior + +import ( + "github.com/line/ostracon/p2p" +) + +// PeerBehavior is a struct describing a behavior a peer performed. +// `peerID` identifies the peer and reason characterizes the specific +// behavior performed by the peer. +type PeerBehavior struct { + peerID p2p.ID + reason interface{} +} + +type badMessage struct { + explanation string +} + +// BadMessage returns a badMessage PeerBehavior. +func BadMessage(peerID p2p.ID, explanation string) PeerBehavior { + return PeerBehavior{peerID: peerID, reason: badMessage{explanation}} +} + +type messageOutOfOrder struct { + explanation string +} + +// MessageOutOfOrder returns a messagOutOfOrder PeerBehavior. +func MessageOutOfOrder(peerID p2p.ID, explanation string) PeerBehavior { + return PeerBehavior{peerID: peerID, reason: messageOutOfOrder{explanation}} +} + +type consensusVote struct { + explanation string +} + +// ConsensusVote returns a consensusVote PeerBehavior. +func ConsensusVote(peerID p2p.ID, explanation string) PeerBehavior { + return PeerBehavior{peerID: peerID, reason: consensusVote{explanation}} +} + +type blockPart struct { + explanation string +} + +// BlockPart returns blockPart PeerBehavior. +func BlockPart(peerID p2p.ID, explanation string) PeerBehavior { + return PeerBehavior{peerID: peerID, reason: blockPart{explanation}} +} diff --git a/behaviour/reporter.go b/behavior/reporter.go similarity index 73% rename from behaviour/reporter.go rename to behavior/reporter.go index 9defab3b4..3d3d6a638 100644 --- a/behaviour/reporter.go +++ b/behavior/reporter.go @@ -1,4 +1,4 @@ -package behaviour +package behavior import ( "errors" @@ -7,13 +7,13 @@ import ( "github.com/line/ostracon/p2p" ) -// Reporter provides an interface for reactors to report the behaviour +// Reporter provides an interface for reactors to report the behavior // of peers synchronously to other components. type Reporter interface { - Report(behaviour PeerBehaviour) error + Report(behaviour PeerBehavior) error } -// SwitchReporter reports peer behaviour to an internal Switch. +// SwitchReporter reports peer behavior to an internal Switch. type SwitchReporter struct { sw *p2p.Switch } @@ -25,8 +25,8 @@ func NewSwitchReporter(sw *p2p.Switch) *SwitchReporter { } } -// Report reports the behaviour of a peer to the Switch. -func (spbr *SwitchReporter) Report(behaviour PeerBehaviour) error { +// Report reports the behavior of a peer to the Switch. +func (spbr *SwitchReporter) Report(behaviour PeerBehavior) error { peer := spbr.sw.Peers().Get(behaviour.peerID) if peer == nil { return errors.New("peer not found") @@ -48,22 +48,22 @@ func (spbr *SwitchReporter) Report(behaviour PeerBehaviour) error { // MockReporter is a concrete implementation of the Reporter // interface used in reactor tests to ensure reactors report the correct -// behaviour in manufactured scenarios. +// behavior in manufactured scenarios. type MockReporter struct { mtx tmsync.RWMutex - pb map[p2p.ID][]PeerBehaviour + pb map[p2p.ID][]PeerBehavior } // NewMockReporter returns a Reporter which records all reported // behaviours in memory. func NewMockReporter() *MockReporter { return &MockReporter{ - pb: map[p2p.ID][]PeerBehaviour{}, + pb: map[p2p.ID][]PeerBehavior{}, } } -// Report stores the PeerBehaviour produced by the peer identified by peerID. -func (mpbr *MockReporter) Report(behaviour PeerBehaviour) error { +// Report stores the PeerBehavior produced by the peer identified by peerID. +func (mpbr *MockReporter) Report(behaviour PeerBehavior) error { mpbr.mtx.Lock() defer mpbr.mtx.Unlock() mpbr.pb[behaviour.peerID] = append(mpbr.pb[behaviour.peerID], behaviour) @@ -72,15 +72,15 @@ func (mpbr *MockReporter) Report(behaviour PeerBehaviour) error { } // GetBehaviours returns all behaviours reported on the peer identified by peerID. -func (mpbr *MockReporter) GetBehaviours(peerID p2p.ID) []PeerBehaviour { +func (mpbr *MockReporter) GetBehaviours(peerID p2p.ID) []PeerBehavior { mpbr.mtx.RLock() defer mpbr.mtx.RUnlock() if items, ok := mpbr.pb[peerID]; ok { - result := make([]PeerBehaviour, len(items)) + result := make([]PeerBehavior, len(items)) copy(result, items) return result } - return []PeerBehaviour{} + return []PeerBehavior{} } diff --git a/behaviour/reporter_test.go b/behavior/reporter_test.go similarity index 73% rename from behaviour/reporter_test.go rename to behavior/reporter_test.go index 076367d25..a892f0138 100644 --- a/behaviour/reporter_test.go +++ b/behavior/reporter_test.go @@ -1,15 +1,15 @@ -package behaviour_test +package behavior_test import ( "sync" "testing" - bh "github.com/line/ostracon/behaviour" + bh "github.com/line/ostracon/behavior" "github.com/line/ostracon/p2p" ) // TestMockReporter tests the MockReporter's ability to store reported -// peer behaviour in memory indexed by the peerID. +// peer behavior in memory indexed by the peerID. func TestMockReporter(t *testing.T) { var peerID p2p.ID = "MockPeer" pr := bh.NewMockReporter() @@ -25,7 +25,7 @@ func TestMockReporter(t *testing.T) { } behaviours = pr.GetBehaviours(peerID) if len(behaviours) != 1 { - t.Error("Expected the peer have one reported behaviour") + t.Error("Expected the peer have one reported behavior") } if behaviours[0] != badMessage { @@ -35,14 +35,14 @@ func TestMockReporter(t *testing.T) { type scriptItem struct { peerID p2p.ID - behaviour bh.PeerBehaviour + behaviour bh.PeerBehavior } // equalBehaviours returns true if a and b contain the same PeerBehaviours with // the same freequencies and otherwise false. -func equalBehaviours(a []bh.PeerBehaviour, b []bh.PeerBehaviour) bool { - aHistogram := map[bh.PeerBehaviour]int{} - bHistogram := map[bh.PeerBehaviour]int{} +func equalBehaviours(a []bh.PeerBehavior, b []bh.PeerBehavior) bool { + aHistogram := map[bh.PeerBehavior]int{} + bHistogram := map[bh.PeerBehavior]int{} for _, behaviour := range a { aHistogram[behaviour]++ @@ -80,31 +80,31 @@ func TestEqualPeerBehaviours(t *testing.T) { consensusVote = bh.ConsensusVote(peerID, "voted") blockPart = bh.BlockPart(peerID, "blocked") equals = []struct { - left []bh.PeerBehaviour - right []bh.PeerBehaviour + left []bh.PeerBehavior + right []bh.PeerBehavior }{ // Empty sets - {[]bh.PeerBehaviour{}, []bh.PeerBehaviour{}}, + {[]bh.PeerBehavior{}, []bh.PeerBehavior{}}, // Single behaviours - {[]bh.PeerBehaviour{consensusVote}, []bh.PeerBehaviour{consensusVote}}, + {[]bh.PeerBehavior{consensusVote}, []bh.PeerBehavior{consensusVote}}, // Equal Frequencies - {[]bh.PeerBehaviour{consensusVote, consensusVote}, - []bh.PeerBehaviour{consensusVote, consensusVote}}, + {[]bh.PeerBehavior{consensusVote, consensusVote}, + []bh.PeerBehavior{consensusVote, consensusVote}}, // Equal frequencies different orders - {[]bh.PeerBehaviour{consensusVote, blockPart}, - []bh.PeerBehaviour{blockPart, consensusVote}}, + {[]bh.PeerBehavior{consensusVote, blockPart}, + []bh.PeerBehavior{blockPart, consensusVote}}, } unequals = []struct { - left []bh.PeerBehaviour - right []bh.PeerBehaviour + left []bh.PeerBehavior + right []bh.PeerBehavior }{ // Comparing empty sets to non empty sets - {[]bh.PeerBehaviour{}, []bh.PeerBehaviour{consensusVote}}, + {[]bh.PeerBehavior{}, []bh.PeerBehavior{consensusVote}}, // Different behaviours - {[]bh.PeerBehaviour{consensusVote}, []bh.PeerBehaviour{blockPart}}, - // Same behaviour with different frequencies - {[]bh.PeerBehaviour{consensusVote}, - []bh.PeerBehaviour{consensusVote, consensusVote}}, + {[]bh.PeerBehavior{consensusVote}, []bh.PeerBehavior{blockPart}}, + // Same behavior with different frequencies + {[]bh.PeerBehavior{consensusVote}, + []bh.PeerBehavior{consensusVote, consensusVote}}, } ) @@ -129,25 +129,25 @@ func TestMockPeerBehaviourReporterConcurrency(t *testing.T) { var ( behaviourScript = []struct { peerID p2p.ID - behaviours []bh.PeerBehaviour + behaviours []bh.PeerBehavior }{ - {"1", []bh.PeerBehaviour{bh.ConsensusVote("1", "")}}, - {"2", []bh.PeerBehaviour{bh.ConsensusVote("2", ""), bh.ConsensusVote("2", ""), bh.ConsensusVote("2", "")}}, + {"1", []bh.PeerBehavior{bh.ConsensusVote("1", "")}}, + {"2", []bh.PeerBehavior{bh.ConsensusVote("2", ""), bh.ConsensusVote("2", ""), bh.ConsensusVote("2", "")}}, { "3", - []bh.PeerBehaviour{bh.BlockPart("3", ""), + []bh.PeerBehavior{bh.BlockPart("3", ""), bh.ConsensusVote("3", ""), bh.BlockPart("3", ""), bh.ConsensusVote("3", "")}}, { "4", - []bh.PeerBehaviour{bh.ConsensusVote("4", ""), + []bh.PeerBehavior{bh.ConsensusVote("4", ""), bh.ConsensusVote("4", ""), bh.ConsensusVote("4", ""), bh.ConsensusVote("4", "")}}, { "5", - []bh.PeerBehaviour{bh.BlockPart("5", ""), + []bh.PeerBehavior{bh.BlockPart("5", ""), bh.ConsensusVote("5", ""), bh.BlockPart("5", ""), bh.ConsensusVote("5", "")}}, diff --git a/behaviour/peer_behaviour.go b/behaviour/peer_behaviour.go deleted file mode 100644 index 4391c02a0..000000000 --- a/behaviour/peer_behaviour.go +++ /dev/null @@ -1,49 +0,0 @@ -package behaviour - -import ( - "github.com/line/ostracon/p2p" -) - -// PeerBehaviour is a struct describing a behaviour a peer performed. -// `peerID` identifies the peer and reason characterizes the specific -// behaviour performed by the peer. -type PeerBehaviour struct { - peerID p2p.ID - reason interface{} -} - -type badMessage struct { - explanation string -} - -// BadMessage returns a badMessage PeerBehaviour. -func BadMessage(peerID p2p.ID, explanation string) PeerBehaviour { - return PeerBehaviour{peerID: peerID, reason: badMessage{explanation}} -} - -type messageOutOfOrder struct { - explanation string -} - -// MessageOutOfOrder returns a messagOutOfOrder PeerBehaviour. -func MessageOutOfOrder(peerID p2p.ID, explanation string) PeerBehaviour { - return PeerBehaviour{peerID: peerID, reason: messageOutOfOrder{explanation}} -} - -type consensusVote struct { - explanation string -} - -// ConsensusVote returns a consensusVote PeerBehaviour. -func ConsensusVote(peerID p2p.ID, explanation string) PeerBehaviour { - return PeerBehaviour{peerID: peerID, reason: consensusVote{explanation}} -} - -type blockPart struct { - explanation string -} - -// BlockPart returns blockPart PeerBehaviour. -func BlockPart(peerID p2p.ID, explanation string) PeerBehaviour { - return PeerBehaviour{peerID: peerID, reason: blockPart{explanation}} -} diff --git a/blockchain/v1/reactor.go b/blockchain/v1/reactor.go index 0c9a0b495..8256e3141 100644 --- a/blockchain/v1/reactor.go +++ b/blockchain/v1/reactor.go @@ -5,7 +5,7 @@ import ( "reflect" "time" - "github.com/line/ostracon/behaviour" + "github.com/line/ostracon/behavior" bc "github.com/line/ostracon/blockchain" "github.com/line/ostracon/libs/log" "github.com/line/ostracon/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, async, recvBufSize) - // 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) // call BaseReactor's OnStart() err := bcR.BaseReactor.OnStart() @@ -261,13 +261,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 } @@ -458,7 +458,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())) } } diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index 30c860d9a..ff044008f 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "github.com/line/ostracon/behaviour" + "github.com/line/ostracon/behavior" bc "github.com/line/ostracon/blockchain" "github.com/line/ostracon/libs/log" tmsync "github.com/line/ostracon/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 } @@ -58,7 +58,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 { @@ -86,7 +86,7 @@ func NewBlockchainReactor( blockApplier blockApplier, store blockStore, fastSync bool) *BlockchainReactor { - reporter := behaviour.NewMockReporter() + reporter := behavior.NewMockReporter() return newReactor(state, store, reporter, blockApplier, fastSync) } @@ -130,7 +130,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 { @@ -377,7 +377,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: @@ -461,13 +461,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 } diff --git a/blockchain/v2/reactor_test.go b/blockchain/v2/reactor_test.go index bfd549a2b..4927a26ef 100644 --- a/blockchain/v2/reactor_test.go +++ b/blockchain/v2/reactor_test.go @@ -10,7 +10,7 @@ import ( "time" abci "github.com/line/ostracon/abci/types" - "github.com/line/ostracon/behaviour" + "github.com/line/ostracon/behavior" bc "github.com/line/ostracon/blockchain" cfg "github.com/line/ostracon/config" "github.com/line/ostracon/libs/log" @@ -145,7 +145,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 @@ -302,7 +302,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 diff --git a/config/config.go b/config/config.go index 6512faccd..ec51e1487 100644 --- a/config/config.go +++ b/config/config.go @@ -410,7 +410,7 @@ type RPCConfig struct { // // Enabling this parameter will cause the WebSocket connection to be closed // instead if it cannot read fast enough, allowing for greater - // predictability in subscription behaviour. + // predictability in subscription behavior. CloseOnSlowClient bool `mapstructure:"experimental_close_on_slow_client"` // How long to wait for a tx to be committed during /broadcast_tx_commit diff --git a/config/toml.go b/config/toml.go index 0bca78e60..1cdd57bba 100644 --- a/config/toml.go +++ b/config/toml.go @@ -253,7 +253,7 @@ experimental_websocket_write_buffer_size = {{ .RPC.WebSocketWriteBufferSize }} # # Enabling this experimental parameter will cause the WebSocket connection to # be closed instead if it cannot read fast enough, allowing for greater -# predictability in subscription behaviour. +# predictability in subscription behavior. experimental_close_on_slow_client = {{ .RPC.CloseOnSlowClient }} # How long to wait for a tx to be committed during /broadcast_tx_commit. diff --git a/consensus/state.go b/consensus/state.go index 0bcc8bb41..760e66486 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -2133,7 +2133,7 @@ func (cs *State) addVote(vote *types.Vote, peerID p2p.ID) (added bool, err error } // Height mismatch is ignored. - // Not necessarily a bad peer, but not favourable behaviour. + // Not necessarily a bad peer, but not favourable behavior. if vote.Height != cs.Height { cs.Logger.Debug("vote ignored and not added", "vote_height", vote.Height, "cs_height", cs.Height, "peer", peerID) return diff --git a/consensus/state_test.go b/consensus/state_test.go index 611b1e626..7d19bdaa8 100644 --- a/consensus/state_test.go +++ b/consensus/state_test.go @@ -2474,13 +2474,13 @@ func TestStateAllVoterToSelectedVoter(t *testing.T) { } func TestPruneBlocks(t *testing.T) { - // Based behaviour is counter.Application + // Based behavior is counter.Application mockApp := &mocks.Application{} mockApp.On("BeginBlock", mock.Anything).Return(abci.ResponseBeginBlock{}) mockApp.On("EndBlock", mock.Anything).Return(abci.ResponseEndBlock{}) mockApp.On("BeginRecheckTx", mock.Anything).Return(abci.ResponseBeginRecheckTx{Code: abci.CodeTypeOK}) mockApp.On("EndRecheckTx", mock.Anything).Return(abci.ResponseEndRecheckTx{Code: abci.CodeTypeOK}) - // Mocking behaviour to response `RetainHeight` for pruneBlocks + // Mocking behavior to response `RetainHeight` for pruneBlocks mockApp.On("Commit", mock.Anything, mock.Anything).Return(abci.ResponseCommit{RetainHeight: 1}) cs1, vss := randStateWithVoterParamsWithApp( diff --git a/p2p/transport.go b/p2p/transport.go index 7c2c0493d..234079349 100644 --- a/p2p/transport.go +++ b/p2p/transport.go @@ -20,7 +20,7 @@ const ( defaultHandshakeTimeout = 3 * time.Second ) -// IPResolver is a behaviour subset of net.Resolver. +// IPResolver is a behavior subset of net.Resolver. type IPResolver interface { LookupIPAddr(context.Context, string) ([]net.IPAddr, error) } @@ -37,9 +37,9 @@ type accept struct { // peerConfig is used to bundle data we need to fully setup a Peer with an // MConn, provided by the caller of Accept and Dial (currently the Switch). This // a temporary measure until reactor setup is less dynamic and we introduce the -// concept of PeerBehaviour to communicate about significant Peer lifecycle +// concept of PeerBehavior to communicate about significant Peer lifecycle // events. -// TODO(xla): Refactor out with more static Reactor setup and PeerBehaviour. +// TODO(xla): Refactor out with more static Reactor setup and PeerBehavior. type peerConfig struct { chDescs []*conn.ChannelDescriptor onPeerError func(Peer, interface{}) @@ -70,7 +70,7 @@ type Transport interface { } // transportLifecycle bundles the methods for callers to control start and stop -// behaviour. +// behavior. type transportLifecycle interface { Close() error Listen(NetAddress) error diff --git a/rpc/client/interface.go b/rpc/client/interface.go index daa3b6ba7..3a43aaa05 100644 --- a/rpc/client/interface.go +++ b/rpc/client/interface.go @@ -140,7 +140,7 @@ type MempoolClient interface { } // EvidenceClient is used for submitting an evidence of the malicious -// behaviour. +// behavior. type EvidenceClient interface { BroadcastEvidence(context.Context, types.Evidence) (*ctypes.ResultBroadcastEvidence, error) } diff --git a/rpc/jsonrpc/server/ws_handler.go b/rpc/jsonrpc/server/ws_handler.go index c43dbaa79..886000919 100644 --- a/rpc/jsonrpc/server/ws_handler.go +++ b/rpc/jsonrpc/server/ws_handler.go @@ -49,7 +49,7 @@ func NewWebsocketManager( CheckOrigin: func(r *http.Request) bool { // TODO ??? // - // The default behaviour would be relevant to browser-based clients, + // The default behavior would be relevant to browser-based clients, // afaik. I suppose having a pass-through is a workaround for allowing // for more complex security schemes, shifting the burden of // AuthN/AuthZ outside the Ostracon RPC. diff --git a/state/state_test.go b/state/state_test.go index e72ef430d..06e5a6748 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -45,7 +45,7 @@ func setupTestCase(t *testing.T) (func(t *testing.T), dbm.DB, sm.State) { return tearDown, stateDB, state } -// TestStateCopy tests the correct copying behaviour of State. +// TestStateCopy tests the correct copying behavior of State. func TestStateCopy(t *testing.T) { tearDown, _, state := setupTestCase(t) defer tearDown(t) diff --git a/test/maverick/consensus/state.go b/test/maverick/consensus/state.go index 941144ddd..8e1f632a1 100644 --- a/test/maverick/consensus/state.go +++ b/test/maverick/consensus/state.go @@ -387,7 +387,7 @@ func (cs *State) addVote( } // Height mismatch is ignored. - // Not necessarily a bad peer, but not favourable behaviour. + // Not necessarily a bad peer, but not favourable behavior. if vote.Height != cs.Height { cs.Logger.Debug("vote ignored and not added", "voteHeight", vote.Height, "csHeight", cs.Height, "peerID", peerID) return diff --git a/version/version.go b/version/version.go index 68fcf279a..bf075002f 100644 --- a/version/version.go +++ b/version/version.go @@ -14,7 +14,7 @@ const ( ) var ( - // P2PProtocol versions all p2p behaviour and msgs. + // P2PProtocol versions all p2p behavior and msgs. // This includes proposer selection. P2PProtocol uint64 = 8