Skip to content
Snippets Groups Projects
Unverified Commit 8bd01e40 authored by Luca Moser's avatar Luca Moser Committed by GitHub
Browse files

Fixes typos throughout the codebase (#561)

* fixes typos

* lets make the dog shut up
parent 7f45a79c
Branches
Tags
No related merge requests found
Showing
with 43 additions and 42 deletions
......@@ -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()).
......
......@@ -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))
}
......@@ -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()
......
......@@ -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()),
)
}
......
......@@ -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 {
......
......@@ -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")
......
......@@ -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)
)
......
......@@ -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()
}
......
......@@ -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
......
......@@ -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
......
......@@ -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"`
}
......
......@@ -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
......
......@@ -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{
......
......@@ -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()))
}
......@@ -63,7 +63,7 @@ func configure(_ *node.Plugin) {
// "Graceful Shutdown",
// "Logger"
// ],
// "disabledlugins":[
// "disabledplugins":[
// "RemoteLog",
// "Spammer",
// "WebAPI Auth"
......
......@@ -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(),
......
......@@ -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"`
......
......@@ -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"`
......
......@@ -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"`
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment