From 8bd01e4012f85568e43d29172b960b21642888d9 Mon Sep 17 00:00:00 2001 From: Luca Moser <moser.luca@gmail.com> Date: Fri, 26 Jun 2020 12:07:32 +0200 Subject: [PATCH] Fixes typos throughout the codebase (#561) * fixes typos * lets make the dog shut up --- .../packages/tangle/payloadmetadata.go | 8 ++++---- .../packages/tangle/payloadmetadata_test.go | 8 ++++---- .../valuetransfers/packages/tangle/tangle_test.go | 2 +- .../packages/tangle/transactionmetadata.go | 8 ++++---- .../binary/datastructure/orderedmap/orderedmap.go | 2 +- .../datastructure/orderedmap/orderedmap_test.go | 2 +- .../messagerequester/messagerequester.go | 2 +- .../binary/messagelayer/tangle/messagemetadata.go | 5 +++-- packages/metrics/events.go | 2 +- plugins/analysis/dashboard/fpc_conflict.go | 2 +- plugins/dashboard/explorer_routes.go | 4 ++-- plugins/metrics/global_metrics.go | 14 +++++++------- plugins/prometheus/autopeering.go | 2 +- plugins/prometheus/process.go | 4 ++-- plugins/webapi/info/plugin.go | 2 +- plugins/webapi/message/plugin.go | 2 +- plugins/webapi/value/attachments/handler.go | 4 ++-- plugins/webapi/value/gettransactionbyid/handler.go | 2 +- plugins/webapi/value/unspentoutputs/handler.go | 2 +- .../tester/tests/common/common_test.go | 8 ++++---- tools/relay-checker/main.go | 4 ++-- 21 files changed, 45 insertions(+), 44 deletions(-) diff --git a/dapps/valuetransfers/packages/tangle/payloadmetadata.go b/dapps/valuetransfers/packages/tangle/payloadmetadata.go index 414561c6..be575207 100644 --- a/dapps/valuetransfers/packages/tangle/payloadmetadata.go +++ b/dapps/valuetransfers/packages/tangle/payloadmetadata.go @@ -137,8 +137,8 @@ func (payloadMetadata *PayloadMetadata) setSolid(solid bool) (modified bool) { return } -// SoldificationTime returns the time when the payload was marked to be solid. -func (payloadMetadata *PayloadMetadata) SoldificationTime() time.Time { +// SolidificationTime returns the time when the payload was marked to be solid. +func (payloadMetadata *PayloadMetadata) SolidificationTime() time.Time { payloadMetadata.solidificationTimeMutex.RLock() defer payloadMetadata.solidificationTimeMutex.RUnlock() @@ -286,7 +286,7 @@ func (payloadMetadata *PayloadMetadata) String() string { return stringify.Struct("PayloadMetadata", stringify.StructField("payloadId", payloadMetadata.PayloadID()), stringify.StructField("solid", payloadMetadata.IsSolid()), - stringify.StructField("solidificationTime", payloadMetadata.SoldificationTime()), + stringify.StructField("solidificationTime", payloadMetadata.SolidificationTime()), ) } @@ -305,7 +305,7 @@ func (payloadMetadata *PayloadMetadata) Update(other objectstorage.StorableObjec // ObjectStorageValue is required to match the encoding.BinaryMarshaler interface. func (payloadMetadata *PayloadMetadata) ObjectStorageValue() []byte { return marshalutil.New(marshalutil.TIME_SIZE + 4*marshalutil.BOOL_SIZE). - WriteTime(payloadMetadata.SoldificationTime()). + WriteTime(payloadMetadata.SolidificationTime()). WriteBool(payloadMetadata.IsSolid()). WriteBool(payloadMetadata.Liked()). WriteBool(payloadMetadata.Confirmed()). diff --git a/dapps/valuetransfers/packages/tangle/payloadmetadata_test.go b/dapps/valuetransfers/packages/tangle/payloadmetadata_test.go index 501bcf79..ff194d0b 100644 --- a/dapps/valuetransfers/packages/tangle/payloadmetadata_test.go +++ b/dapps/valuetransfers/packages/tangle/payloadmetadata_test.go @@ -18,7 +18,7 @@ func TestMarshalUnmarshal(t *testing.T) { assert.Equal(t, originalMetadata.PayloadID(), clonedMetadata.PayloadID()) assert.Equal(t, originalMetadata.IsSolid(), clonedMetadata.IsSolid()) - assert.Equal(t, originalMetadata.SoldificationTime().Round(time.Second), clonedMetadata.SoldificationTime().Round(time.Second)) + assert.Equal(t, originalMetadata.SolidificationTime().Round(time.Second), clonedMetadata.SolidificationTime().Round(time.Second)) originalMetadata.setSolid(true) @@ -29,17 +29,17 @@ func TestMarshalUnmarshal(t *testing.T) { assert.Equal(t, originalMetadata.PayloadID(), clonedMetadata.PayloadID()) assert.Equal(t, originalMetadata.IsSolid(), clonedMetadata.IsSolid()) - assert.Equal(t, originalMetadata.SoldificationTime().Round(time.Second), clonedMetadata.SoldificationTime().Round(time.Second)) + assert.Equal(t, originalMetadata.SolidificationTime().Round(time.Second), clonedMetadata.SolidificationTime().Round(time.Second)) } func TestPayloadMetadata_SetSolid(t *testing.T) { originalMetadata := NewPayloadMetadata(payload.GenesisID) assert.Equal(t, false, originalMetadata.IsSolid()) - assert.Equal(t, time.Time{}, originalMetadata.SoldificationTime()) + assert.Equal(t, time.Time{}, originalMetadata.SolidificationTime()) originalMetadata.setSolid(true) assert.Equal(t, true, originalMetadata.IsSolid()) - assert.Equal(t, time.Now().Round(time.Second), originalMetadata.SoldificationTime().Round(time.Second)) + assert.Equal(t, time.Now().Round(time.Second), originalMetadata.SolidificationTime().Round(time.Second)) } diff --git a/dapps/valuetransfers/packages/tangle/tangle_test.go b/dapps/valuetransfers/packages/tangle/tangle_test.go index aab20994..b0d1273e 100644 --- a/dapps/valuetransfers/packages/tangle/tangle_test.go +++ b/dapps/valuetransfers/packages/tangle/tangle_test.go @@ -247,7 +247,7 @@ func TestMoveTransactionToBranch(t *testing.T) { cachedTransaction, cachedTransactionMetadata, _, _ := tangle.storeTransactionModels(valueObject) txMetadata := cachedTransactionMetadata.Unwrap() - // create conflicting branche + // create conflicting branch cachedBranch2, _ := tangle.BranchManager().Fork(branchmanager.BranchID{2}, []branchmanager.BranchID{branchmanager.MasterBranchID}, []branchmanager.ConflictID{{0}}) defer cachedBranch2.Release() diff --git a/dapps/valuetransfers/packages/tangle/transactionmetadata.go b/dapps/valuetransfers/packages/tangle/transactionmetadata.go index 22b832fe..753e7059 100644 --- a/dapps/valuetransfers/packages/tangle/transactionmetadata.go +++ b/dapps/valuetransfers/packages/tangle/transactionmetadata.go @@ -354,8 +354,8 @@ func (transactionMetadata *TransactionMetadata) FinalizationTime() time.Time { return transactionMetadata.finalizationTime } -// SoldificationTime returns the time when the Transaction was marked to be solid. -func (transactionMetadata *TransactionMetadata) SoldificationTime() time.Time { +// SolidificationTime returns the time when the Transaction was marked to be solid. +func (transactionMetadata *TransactionMetadata) SolidificationTime() time.Time { transactionMetadata.solidificationTimeMutex.RLock() defer transactionMetadata.solidificationTimeMutex.RUnlock() @@ -366,7 +366,7 @@ func (transactionMetadata *TransactionMetadata) SoldificationTime() time.Time { func (transactionMetadata *TransactionMetadata) Bytes() []byte { return marshalutil.New(branchmanager.BranchIDLength + 2*marshalutil.TIME_SIZE + 6*marshalutil.BOOL_SIZE). WriteBytes(transactionMetadata.BranchID().Bytes()). - WriteTime(transactionMetadata.SoldificationTime()). + WriteTime(transactionMetadata.SolidificationTime()). WriteTime(transactionMetadata.FinalizationTime()). WriteBool(transactionMetadata.Solid()). WriteBool(transactionMetadata.Preferred()). @@ -383,7 +383,7 @@ func (transactionMetadata *TransactionMetadata) String() string { stringify.StructField("id", transactionMetadata.ID()), stringify.StructField("branchId", transactionMetadata.BranchID()), stringify.StructField("solid", transactionMetadata.Solid()), - stringify.StructField("solidificationTime", transactionMetadata.SoldificationTime()), + stringify.StructField("solidificationTime", transactionMetadata.SolidificationTime()), ) } diff --git a/packages/binary/datastructure/orderedmap/orderedmap.go b/packages/binary/datastructure/orderedmap/orderedmap.go index 22b62588..dc6f19be 100644 --- a/packages/binary/datastructure/orderedmap/orderedmap.go +++ b/packages/binary/datastructure/orderedmap/orderedmap.go @@ -91,7 +91,7 @@ func (orderedMap *OrderedMap) ForEach(consumer func(key, value interface{}) bool return true } -// Delete deletes the given key (and related value) from the orederedMap. +// Delete deletes the given key (and related value) from the orderedMap. // It returns false if the key is not found. func (orderedMap *OrderedMap) Delete(key interface{}) bool { if _, valueExists := orderedMap.Get(key); !valueExists { diff --git a/packages/binary/datastructure/orderedmap/orderedmap_test.go b/packages/binary/datastructure/orderedmap/orderedmap_test.go index 72e3e71c..0b202a08 100644 --- a/packages/binary/datastructure/orderedmap/orderedmap_test.go +++ b/packages/binary/datastructure/orderedmap/orderedmap_test.go @@ -73,7 +73,7 @@ func TestSetGetDelete(t *testing.T) { assert.False(t, ok) // when deleting an existing element, we must get true, - // the elemente must be removed, and size decremented. + // the element must be removed, and size decremented. deleted := orderedMap.Delete("key") assert.True(t, deleted) value, ok = orderedMap.Get("key") diff --git a/packages/binary/messagelayer/messagerequester/messagerequester.go b/packages/binary/messagelayer/messagerequester/messagerequester.go index ce350f4b..50185208 100644 --- a/packages/binary/messagelayer/messagerequester/messagerequester.go +++ b/packages/binary/messagelayer/messagerequester/messagerequester.go @@ -11,7 +11,7 @@ import ( ) var ( - // DefaultRequestWorkerCount defines the Default Request Worker Count of the message reqeuster. + // DefaultRequestWorkerCount defines the Default Request Worker Count of the message requester. DefaultRequestWorkerCount = runtime.GOMAXPROCS(0) ) diff --git a/packages/binary/messagelayer/tangle/messagemetadata.go b/packages/binary/messagelayer/tangle/messagemetadata.go index 21345fc6..e1abe276 100644 --- a/packages/binary/messagelayer/tangle/messagemetadata.go +++ b/packages/binary/messagelayer/tangle/messagemetadata.go @@ -105,7 +105,8 @@ func (messageMetadata *MessageMetadata) SetSolid(solid bool) (modified bool) { return } -func (messageMetadata *MessageMetadata) SoldificationTime() time.Time { +// SolidificationTime returns the time when the message was marked to be solid. +func (messageMetadata *MessageMetadata) SolidificationTime() time.Time { messageMetadata.solidificationTimeMutex.RLock() defer messageMetadata.solidificationTimeMutex.RUnlock() @@ -119,7 +120,7 @@ func (messageMetadata *MessageMetadata) ObjectStorageKey() []byte { func (messageMetadata *MessageMetadata) ObjectStorageValue() []byte { return marshalutil.New(). WriteTime(messageMetadata.receivedTime). - WriteTime(messageMetadata.SoldificationTime()). + WriteTime(messageMetadata.SolidificationTime()). WriteBool(messageMetadata.IsSolid()). Bytes() } diff --git a/packages/metrics/events.go b/packages/metrics/events.go index b2d7bbd2..91d94c6b 100644 --- a/packages/metrics/events.go +++ b/packages/metrics/events.go @@ -39,7 +39,7 @@ type QueryReceivedEvent struct { // QueryReplyErrorEvent is used to pass information through a QueryReplyError event. type QueryReplyErrorEvent struct { - // ID defines the ID on the queryied node. + // ID defines the ID on the queried node. ID string // OpinionCount defines the local FPC number of opinions requested within a failed query. OpinionCount int diff --git a/plugins/analysis/dashboard/fpc_conflict.go b/plugins/analysis/dashboard/fpc_conflict.go index 2dfd3c37..a7880b96 100644 --- a/plugins/analysis/dashboard/fpc_conflict.go +++ b/plugins/analysis/dashboard/fpc_conflict.go @@ -38,7 +38,7 @@ func (c conflict) isFinalized() bool { return (count == len(c.NodesView)) } -// finalizedRatio returns the ratio of nodes that have finlized a given conflict. +// finalizedRatio returns the ratio of nodes that have finalized a given conflict. func (c conflict) finalizedRatio() float64 { if len(c.NodesView) == 0 { return 0 diff --git a/plugins/dashboard/explorer_routes.go b/plugins/dashboard/explorer_routes.go index a5a0d8a2..e00e1e2e 100644 --- a/plugins/dashboard/explorer_routes.go +++ b/plugins/dashboard/explorer_routes.go @@ -43,7 +43,7 @@ func createExplorerMessage(msg *message.Message) (*ExplorerMessage, error) { messageMetadata := cachedMessageMetadata.Unwrap() t := &ExplorerMessage{ ID: messageID.String(), - SolidificationTimestamp: messageMetadata.SoldificationTime().Unix(), + SolidificationTimestamp: messageMetadata.SolidificationTime().Unix(), IssuanceTimestamp: msg.IssuingTime().Unix(), IssuerPublicKey: msg.IssuerPublicKey().String(), Signature: msg.Signature().String(), @@ -60,7 +60,7 @@ func createExplorerMessage(msg *message.Message) (*ExplorerMessage, error) { // ExplorerAddress defines the struct of the ExplorerAddress. type ExplorerAddress struct { - // Messagess hold the list of *ExplorerMessage. + // Messages hold the list of *ExplorerMessage. Messages []*ExplorerMessage `json:"message"` } diff --git a/plugins/metrics/global_metrics.go b/plugins/metrics/global_metrics.go index 4eee1bf1..0a0ef139 100644 --- a/plugins/metrics/global_metrics.go +++ b/plugins/metrics/global_metrics.go @@ -24,14 +24,14 @@ type NodeInfo struct { } var ( - nodesMetrics = make(map[string]NodeInfo) - nodessMetricsMutex sync.RWMutex - networkDiameter atomic.Int32 + nodesMetrics = make(map[string]NodeInfo) + nodesMetricsMutex sync.RWMutex + networkDiameter atomic.Int32 ) var onMetricHeartbeatReceived = events.NewClosure(func(hb *packet.MetricHeartbeat) { - nodessMetricsMutex.Lock() - defer nodessMetricsMutex.Unlock() + nodesMetricsMutex.Lock() + defer nodesMetricsMutex.Unlock() nodesMetrics[shortNodeIDString(hb.OwnID)] = NodeInfo{ OS: hb.OS, Arch: hb.Arch, @@ -43,8 +43,8 @@ var onMetricHeartbeatReceived = events.NewClosure(func(hb *packet.MetricHeartbea // NodesMetrics returns info about the OS, arch, number of cpu cores, cpu load and memory usage. func NodesMetrics() map[string]NodeInfo { - nodessMetricsMutex.RLock() - defer nodessMetricsMutex.RUnlock() + nodesMetricsMutex.RLock() + defer nodesMetricsMutex.RUnlock() // create copy of the map var copy = make(map[string]NodeInfo) // manually copy content diff --git a/plugins/prometheus/autopeering.go b/plugins/prometheus/autopeering.go index bd4b7435..5d38aa84 100644 --- a/plugins/prometheus/autopeering.go +++ b/plugins/prometheus/autopeering.go @@ -22,7 +22,7 @@ func registerAutopeeringMetrics() { avgNeighborConnectionLifeTime = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "autopeering_avg_neighbor_connection_lifetime", - Help: "Autopeering avgerage neighbor connection lifetime.", + Help: "Autopeering average neighbor connection lifetime.", }) connectionsCount = prometheus.NewGauge(prometheus.GaugeOpts{ diff --git a/plugins/prometheus/process.go b/plugins/prometheus/process.go index eda4dfc2..05ea6542 100644 --- a/plugins/prometheus/process.go +++ b/plugins/prometheus/process.go @@ -23,10 +23,10 @@ func registerProcessMetrics() { registry.MustRegister(cpuUsage) registry.MustRegister(memUsageBytes) - addCollect(collectProcesskMetrics) + addCollect(collectProcessMetrics) } -func collectProcesskMetrics() { +func collectProcessMetrics() { cpuUsage.Set(float64(metrics.CPUUsage())) memUsageBytes.Set(float64(metrics.MemUsage())) } diff --git a/plugins/webapi/info/plugin.go b/plugins/webapi/info/plugin.go index 255343b6..8c2053d0 100644 --- a/plugins/webapi/info/plugin.go +++ b/plugins/webapi/info/plugin.go @@ -63,7 +63,7 @@ func configure(_ *node.Plugin) { // "Graceful Shutdown", // "Logger" // ], -// "disabledlugins":[ +// "disabledplugins":[ // "RemoteLog", // "Spammer", // "WebAPI Auth" diff --git a/plugins/webapi/message/plugin.go b/plugins/webapi/message/plugin.go index 015a69e3..c65b6c3e 100644 --- a/plugins/webapi/message/plugin.go +++ b/plugins/webapi/message/plugin.go @@ -72,7 +72,7 @@ func findMessageByID(c echo.Context) error { msgResp := Message{ Metadata: Metadata{ Solid: msgMetadata.IsSolid(), - SolidificationTime: msgMetadata.SoldificationTime().Unix(), + SolidificationTime: msgMetadata.SolidificationTime().Unix(), }, ID: msg.Id().String(), TrunkID: msg.TrunkId().String(), diff --git a/plugins/webapi/value/attachments/handler.go b/plugins/webapi/value/attachments/handler.go index a54d517e..973ec5e8 100644 --- a/plugins/webapi/value/attachments/handler.go +++ b/plugins/webapi/value/attachments/handler.go @@ -28,7 +28,7 @@ func Handler(c echo.Context) error { } txn := utils.ParseTransaction(txnObj.Unwrap()) - // get attachements by txn id + // get attachments by txn id for _, attachmentObj := range valuetransfers.Tangle().Attachments(txnID) { defer attachmentObj.Release() if !attachmentObj.Exists() { @@ -56,7 +56,7 @@ func Handler(c echo.Context) error { return c.JSON(http.StatusOK, Response{Attachments: valueObjs}) } -// Response is the HTTP response from retreiving value objects. +// Response is the HTTP response from retrieving value objects. type Response struct { Attachments []ValueObject `json:"attachments,omitempty"` Error string `json:"error,omitempty"` diff --git a/plugins/webapi/value/gettransactionbyid/handler.go b/plugins/webapi/value/gettransactionbyid/handler.go index 0f8ebaaa..769c9dda 100644 --- a/plugins/webapi/value/gettransactionbyid/handler.go +++ b/plugins/webapi/value/gettransactionbyid/handler.go @@ -45,7 +45,7 @@ func Handler(c echo.Context) error { }) } -// Response is the HTTP response from retreiving transaction. +// Response is the HTTP response from retrieving transaction. type Response struct { Transaction utils.Transaction `json:"transaction,omitempty"` InclusionState utils.InclusionState `json:"inclusion_state,omitempty"` diff --git a/plugins/webapi/value/unspentoutputs/handler.go b/plugins/webapi/value/unspentoutputs/handler.go index 22dc4f0e..1e0f08bb 100644 --- a/plugins/webapi/value/unspentoutputs/handler.go +++ b/plugins/webapi/value/unspentoutputs/handler.go @@ -79,7 +79,7 @@ type Request struct { Error string `json:"error,omitempty"` } -// Response is the HTTP response from retreiving value objects. +// Response is the HTTP response from retrieving value objects. type Response struct { UnspentOutputs []UnspentOutput `json:"unspent_outputs,omitempty"` Error string `json:"error,omitempty"` diff --git a/tools/integration-tests/tester/tests/common/common_test.go b/tools/integration-tests/tester/tests/common/common_test.go index 32f4fea3..2d28acc1 100644 --- a/tools/integration-tests/tester/tests/common/common_test.go +++ b/tools/integration-tests/tester/tests/common/common_test.go @@ -14,8 +14,8 @@ import ( // a node that joins later solidifies, whether it is desyned after a restart // and becomes synced again. func TestSynchronization(t *testing.T) { - initalPeers := 4 - n, err := f.CreateNetwork("common_TestSynchronization", initalPeers, 2) + initialPeers := 4 + n, err := f.CreateNetwork("common_TestSynchronization", initialPeers, 2) require.NoError(t, err) defer tests.ShutdownNetwork(t, n) @@ -37,7 +37,7 @@ func TestSynchronization(t *testing.T) { require.NoError(t, err) // 3. issue some messages on old peers so that new peer can solidify - ids = tests.SendDataMessagesOnRandomPeer(t, n.Peers()[:initalPeers], 10, ids) + ids = tests.SendDataMessagesOnRandomPeer(t, n.Peers()[:initialPeers], 10, ids) // wait for peer to solidify time.Sleep(15 * time.Second) @@ -66,7 +66,7 @@ func TestSynchronization(t *testing.T) { //assert.Falsef(t, resp.Synced, "Peer %s should be desynced but is synced!", newPeer.String()) // 8. issue some messages on old peers so that new peer can sync again - ids = tests.SendDataMessagesOnRandomPeer(t, n.Peers()[:initalPeers], 10, ids) + ids = tests.SendDataMessagesOnRandomPeer(t, n.Peers()[:initialPeers], 10, ids) // wait for peer to sync time.Sleep(10 * time.Second) diff --git a/tools/relay-checker/main.go b/tools/relay-checker/main.go index 92e1bb43..998fda5f 100644 --- a/tools/relay-checker/main.go +++ b/tools/relay-checker/main.go @@ -17,7 +17,7 @@ func testBroadcastData(api *client.GoShimmerAPI) (string, error) { return msgID, nil } -func testTargetGetMessagess(api *client.GoShimmerAPI, msgID string) error { +func testTargetGetMessages(api *client.GoShimmerAPI, msgID string) error { // query target node for broadcasted data if _, err := api.FindMessageByID([]string{msgID}); err != nil { return fmt.Errorf("querying the target node failed: %w", err) @@ -56,7 +56,7 @@ func main() { time.Sleep(time.Duration(cooldownTime) * time.Second) // query target node - err = testTargetGetMessagess(api, msgID) + err = testTargetGetMessages(api, msgID) if err != nil { fmt.Printf("%s\n", err) break -- GitLab