Skip to content

Commit 808edc0

Browse files
authored
Merge pull request #608 from iotaledger/fix/linters
Fix/linters
2 parents 696a78c + ac62333 commit 808edc0

File tree

83 files changed

+176
-116
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+176
-116
lines changed

packages/chain/cmt_log/cmt_log.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
"github.com/iotaledger/wasp/packages/isc"
3131
"github.com/iotaledger/wasp/packages/metrics"
3232
"github.com/iotaledger/wasp/packages/tcrypto"
33-
"github.com/iotaledger/wasp/packages/util/byz_quorum"
33+
"github.com/iotaledger/wasp/packages/util/byzquorum"
3434
)
3535

3636
// Public interface for this algorithm.
@@ -117,7 +117,7 @@ func New(
117117
// Construct the object.
118118
n := len(nodeIDs)
119119
f := dkShare.DSS().MaxFaulty()
120-
if f > byz_quorum.MaxF(n) {
120+
if f > byzquorum.MaxF(n) {
121121
log.LogPanicf("invalid f=%v for n=%v", f, n)
122122
}
123123
//

packages/dkg/node.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/iotaledger/wasp/packages/registry"
2323
"github.com/iotaledger/wasp/packages/tcrypto"
2424
"github.com/iotaledger/wasp/packages/util"
25-
"github.com/iotaledger/wasp/packages/util/byz_quorum"
25+
"github.com/iotaledger/wasp/packages/util/byzquorum"
2626
)
2727

2828
type NodeProvider func() *Node
@@ -120,7 +120,7 @@ func (n *Node) GenerateDistributedKey(
120120
return nil, invalidParams(fmt.Errorf("wrong DKG parameters: N = %d, T = %d", peerCount, threshold))
121121
}
122122

123-
if threshold < uint16(byz_quorum.MinQuorum(int(peerCount))) {
123+
if threshold < uint16(byzquorum.MinQuorum(int(peerCount))) {
124124
return nil, invalidParams(fmt.Errorf("wrong DKG parameters: for N = %d value T must be at least %d", peerCount, peerCount/2+1))
125125
}
126126
//

packages/gpa/rbc/bracha/bracha.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2020 IOTA Stiftung
22
// SPDX-License-Identifier: Apache-2.0
33

4-
// package bracha implements Bracha's Reliable Broadcast.
4+
// Package bracha implements Bracha's Reliable Broadcast.
55
// The original version of this RBC can be found here (see "FIG. 1. The broadcast primitive"):
66
//
77
// Gabriel Bracha. 1987. Asynchronous byzantine agreement protocols. Inf. Comput.
@@ -70,7 +70,7 @@ type rbc struct {
7070

7171
var _ gpa.GPA = &rbc{}
7272

73-
// Create new instance of the RBC.
73+
// New creates new instance of the RBC.
7474
func New(peers []gpa.NodeID, f int, me, broadcaster gpa.NodeID, maxMsgSize int, predicate func([]byte) bool, log gpa.Logger) gpa.GPA {
7575
r := &rbc{
7676
n: len(peers),

packages/gpa/test_context.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/samber/lo"
1212
)
1313

14-
// Imitates a cluster of nodes and the medium performing the message exchange.
14+
// TestContext imitates a cluster of nodes and the medium performing the message exchange.
1515
// Inputs are processes in-order for each node individually.
1616
type TestContext struct {
1717
nodes map[NodeID]GPA // Nodes to test.
@@ -54,7 +54,7 @@ func (tc *TestContext) MsgCounts() (int, int) {
5454
return tc.msgsSent, tc.msgsRecv
5555
}
5656

57-
// Will add new inputs to the existing set.
57+
// AddInputs adds new inputs to the existing set.
5858
// The inputs will be overridden, if exist for the same nodes.
5959
func (tc *TestContext) AddInputs(inputs map[NodeID]Input) {
6060
for nid := range inputs {
@@ -234,7 +234,7 @@ func (tc *TestContext) RunAll() {
234234
tc.RunUntil(tc.OutOfMessagesPredicate())
235235
}
236236

237-
// Returns a number of non-nil outputs.
237+
// NumberOfOutputs returns a number of non-nil outputs.
238238
func (tc *TestContext) NumberOfOutputs() int {
239239
outNum := 0
240240
for _, node := range tc.nodes {
@@ -245,14 +245,14 @@ func (tc *TestContext) NumberOfOutputs() int {
245245
return outNum
246246
}
247247

248-
// Will run until there will be at least outNum of non-nil outputs generated.
248+
// NumberOfOutputsPredicate runs until there will be at least outNum of non-nil outputs generated.
249249
func (tc *TestContext) NumberOfOutputsPredicate(outNum int) func() bool {
250250
return func() bool {
251251
return tc.NumberOfOutputs() >= outNum
252252
}
253253
}
254254

255-
// Will run until all the messages will be processed.
255+
// OutOfMessagesPredicate runs until all the messages will be processed.
256256
func (tc *TestContext) OutOfMessagesPredicate() func() bool {
257257
return func() bool { return false }
258258
}

packages/gpa/test_message.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package gpa
55

66
const msgTypeTest MessageType = 0xff
77

8-
// Just a message for test cases.
8+
// TestMessage is just a message for test cases.
99
type TestMessage struct {
1010
recipient NodeID
1111
sender NodeID

packages/hashing/hash.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package hashing provides hashing utilities for the IOTA Smart Contract platform.
12
package hashing
23

34
import (

packages/isc/assert/assert.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package assert provides assertion utilities for the IOTA Smart Contract platform.
12
package assert
23

34
import (

packages/isc/assets.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,14 @@ func (o ObjectSet) Sorted() []IotaObject {
223223
}
224224

225225
// Iterate returns a deterministic iterator
226-
func (c ObjectSet) Iterate() iter.Seq[IotaObject] {
226+
func (o ObjectSet) Iterate() iter.Seq[IotaObject] {
227227
return func(yield func(IotaObject) bool) {
228-
for _, k := range slices.SortedFunc(maps.Keys(c.items), func(a, b iotago.ObjectID) int {
228+
for _, k := range slices.SortedFunc(maps.Keys(o.items), func(a, b iotago.ObjectID) int {
229229
return bytes.Compare(a[:], b[:])
230230
}) {
231231
if !yield(IotaObject{
232232
ID: k,
233-
Type: c.items[k],
233+
Type: o.items[k],
234234
}) {
235235
return
236236
}
@@ -464,8 +464,8 @@ func (a *Assets) AsAssetsBagWithBalances(b *iscmove.AssetsBag) *iscmove.AssetsBa
464464
}
465465
}
466466

467-
// JsonTokenScheme is for now a 1:1 copy of the Stardusts version
468-
type JsonTokenScheme struct {
467+
// JSONTokenScheme is for now a 1:1 copy of the Stardusts version
468+
type JSONTokenScheme struct {
469469
Type int `json:"type"`
470470
MintedSupply string `json:"mintedTokens"`
471471
MeltedTokens string `json:"meltedTokens"`

packages/isc/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright 2020 IOTA Stiftung
22
// SPDX-License-Identifier: Apache-2.0
33

4-
// Package 'isc' defines fundamental types that are used in Wasp.
4+
// Package isc defines fundamental types that are used in Wasp.
55
package isc

packages/isc/isctest/random.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Package isctest provides testing utilities and helpers for the ISC (IOTA Smart Contracts) package.
2+
// It includes functionality for creating test fixtures and simulating various ISC conditions.
13
package isctest
24

35
import (
@@ -62,7 +64,7 @@ func RandomStateAnchor(opts ...RandomAnchorOption) isc.StateAnchor {
6264
return isc.NewStateAnchor(&anchorRefWithObject, *iotatest.RandomAddress())
6365
}
6466

65-
// simualte how StateAnchor is updated (state transition)
67+
// UpdateStateAnchor simulates how StateAnchor is updated (state transition)
6668
// assume the AssetsBag keep unchanged
6769
func UpdateStateAnchor(anchor *isc.StateAnchor, stateMetadata ...[]byte) *isc.StateAnchor {
6870
// a := anchor.Clone()

packages/isc/sandbox_interface.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ type StateAnchor struct {
390390
iscPackage iotago.Address
391391
}
392392

393-
// Every time changing the L1 state of the Anchor object, the nodes should create
393+
// NewStateAnchor creates a new state anchor. Every time changing the L1 state of the Anchor object, the nodes should create it.
394394
// a latest StateAnchor, and remember to update the latest ObjectRef of GasCoin
395395
// "changing the L1 state of the Anchor object" includes the following 'txbuilder' operations
396396
// * BuildTransactionEssence (update the anchor commitment)

packages/isc/vmerror.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (e *VMErrorTemplate) Create(params ...VMErrorParam) *VMError {
8686
}
8787
}
8888

89-
// VMErrorTemplate implements error just in case someone panics with
89+
// Error implements the error interface. VMErrorTemplate implements error just in case someone panics with it.
9090
// VMErrorTemplate by mistake, so that we don't crash the VM because of that.
9191
func (e *VMErrorTemplate) Error() string {
9292
// calling Sprintf so that it marks missing parameters as errors
@@ -129,7 +129,7 @@ func (e *UnresolvedVMError) Error() string {
129129
return fmt.Sprintf("UnresolvedVMError(code: %s)", e.ErrorCode)
130130
}
131131

132-
// produce the params as humanly readably json, and the uints as strings
132+
// ToJSONStruct produces the params as humanly readable json, and the uints as strings
133133
func (e *UnresolvedVMError) ToJSONStruct() *UnresolvedVMErrorJSON {
134134
if e == nil {
135135
return &UnresolvedVMErrorJSON{

packages/kv/buffered/buffered.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Package buffered provides buffered implementations of the key-value store
2+
// interfaces. It allows for batch operations and in-memory caching of key-value
3+
// operations before committing them to the underlying storage.
14
package buffered
25

36
import (
@@ -57,7 +60,7 @@ func (b *BufferedKVStore) DangerouslyDumpToDict() dict.Dict {
5760
return ret
5861
}
5962

60-
// iterates over all key-value pairs in KVStore
63+
// DangerouslyDumpToString iterates over all key-value pairs in KVStore
6164
func (b *BufferedKVStore) DangerouslyDumpToString() string {
6265
ret := " BufferedKVStore:\n"
6366
for k, v := range b.DangerouslyDumpToDict() {

packages/kv/codec/dict.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Package codec provides encoding and decoding functionality for the kv package.
2+
// It handles serialization and deserialization of various data types to and from
3+
// the key-value store format.
14
package codec
25

36
import (

packages/kv/collections/array.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func (a *Array) PruneAt(index uint32) {
116116
a.kvw.Del(a.getArrayElemKey(index))
117117
}
118118

119-
// adds to the end of the list
119+
// Push adds to the end of the list
120120
func (a *Array) Push(value []byte) {
121121
index := a.addToSize(1)
122122
key := a.getArrayElemKey(index)

packages/kv/collections/map.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Package collections provides high-level data structures built on top of
2+
// the kv package. It implements common collection types such as maps, arrays,
3+
// and other data structures with a key-value store backend.
14
package collections
25

36
import (

packages/kv/dict/dict.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Package dict provides a dictionary implementation for key-value storage.
2+
// It implements the kv.KVStore interface with an in-memory map as the backend,
3+
// allowing for efficient key-value operations and serialization.
14
package dict
25

36
import (

packages/kv/kvstream.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Package kv provides key-value storage interfaces and implementations
2+
// for IOTA Smart Contracts. It defines the core functionality for storing,
3+
// retrieving, and streaming key-value pairs.
14
package kv
25

36
import (

packages/kv/subrealm/subrealm.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Package subrealm provides functionality for working with isolated subsets
2+
// of the key-value store. It enables creation of distinct realms within a
3+
// single KV store, allowing for better organization and isolation of data.
14
package subrealm
25

36
import (

packages/metrics/peering.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package metrics provides functionality for collecting and exposing metrics about the system.
12
package metrics
23

34
import (

packages/nodeconn/nodeconn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2020 IOTA Stiftung
22
// SPDX-License-Identifier: Apache-2.0
33

4-
// nodeconn package provides an interface to the L1 node (Hornet).
4+
// Package nodeconn provides an interface to the L1 node (Hornet).
55
package nodeconn
66

77
import (

packages/onchangemap/onchangemap.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package onchangemap provides a map implementation that triggers callbacks when items are added, modified, or deleted.
12
package onchangemap
23

34
import (

packages/origin/origin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package origin provides functionality for chain origination and initialization.
12
package origin
23

34
import (

packages/parameters/l1parameters.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package parameters provides configuration parameters for L1 and other components of the system.
12
package parameters
23

34
import (

packages/parameters/parameterstest/parameterstest.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package parameterstest provides testing utilities for the parameters package.
12
package parameterstest
23

34
import (

packages/peering/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"strconv"
1111
)
1212

13-
// Check, if peeringURL is of proper format.
13+
// CheckPeeringURL verifies if peeringURL is of proper format.
1414
func CheckPeeringURL(url string) error {
1515
sHost, sPort, err := net.SplitHostPort(url)
1616
if err != nil {

packages/peering/domain/domain.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright 2020 IOTA Stiftung
22
// SPDX-License-Identifier: Apache-2.0
33

4+
// Package domain provides domain-specific functionality for peer-to-peer communication.
45
package domain
56

67
import (

packages/peering/peer_message.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"github.com/iotaledger/wasp/packages/util/rwutil"
2020
)
2121

22-
// PeerMessage is an envelope for all the messages exchanged via the peering module.
22+
// PeerMessageData is an envelope for all the messages exchanged via the peering module.
2323
type PeerMessageData struct {
2424
PeeringID PeeringID
2525
MsgReceiver byte

packages/peering/peering.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ type TrustedNetworkManager interface {
6868
TrustedPeersListener(callback func([]*TrustedPeer)) context.CancelFunc
6969
}
7070

71-
// Basic checks, to be used in all the implementations.
71+
// ValidateTrustedPeerParams performs basic checks on trusted peer parameters, to be used in all the implementations.
7272
func ValidateTrustedPeerParams(name string, pubKey *cryptolib.PublicKey, peeringURL string) error {
7373
if name != pubKey.String() && strings.HasPrefix(name, "0x") {
7474
return fmt.Errorf("name cannot start with '0x' unless it is equal to pubKey")
@@ -79,7 +79,7 @@ func ValidateTrustedPeerParams(name string, pubKey *cryptolib.PublicKey, peering
7979
return nil
8080
}
8181

82-
// Resolves pubKeysOrNames to TrustedPeers. Fails if any of the names/keys cannot be resolved.
82+
// QueryByPubKeyOrName resolves pubKeysOrNames to TrustedPeers. Fails if any of the names/keys cannot be resolved.
8383
func QueryByPubKeyOrName(trustedPeers []*TrustedPeer, pubKeysOrNames []string) ([]*TrustedPeer, error) {
8484
result := make([]*TrustedPeer, len(pubKeysOrNames))
8585
for i, pubKeyOrName := range pubKeysOrNames {

packages/publisher/events.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type ISCEvent[T any] struct {
2929
Payload T `json:"payload"`
3030
}
3131

32-
// kind is not printed right now, because it is added when calling p.publish
32+
// String returns a string representation of the event. Note that kind is not printed right now, because it is added when calling p.publish.
3333
func (e *ISCEvent[T]) String() string {
3434
issuerStr := "vm"
3535
if e.Issuer != nil {

packages/publisher/publisher.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package publisher provides functionality for publishing chain events to subscribers.
12
package publisher
23

34
import (
@@ -56,25 +57,25 @@ func New(log log.Logger) *Publisher {
5657
return p
5758
}
5859

59-
// Implements the chain.ChainListener interface.
60+
// BlockApplied implements the chain.ChainListener interface.
6061
// NOTE: Do not block the caller!
6162
func (p *Publisher) BlockApplied(chainID isc.ChainID, block state.Block, latestState kv.KVStoreReader) {
6263
p.blockAppliedPipe.In() <- &blockApplied{chainID: chainID, block: block, latestState: latestState}
6364
}
6465

65-
// Implements the chain.ChainListener interface.
66+
// AccessNodesUpdated implements the chain.ChainListener interface.
6667
// NOTE: Do not block the caller!
6768
func (p *Publisher) AccessNodesUpdated(chainID isc.ChainID, accessNodes []*cryptolib.PublicKey) {
6869
// We don't need this event.
6970
}
7071

71-
// Implements the chain.ChainListener interface.
72+
// ServerNodesUpdated implements the chain.ChainListener interface.
7273
// NOTE: Do not block the caller!
7374
func (p *Publisher) ServerNodesUpdated(chainID isc.ChainID, serverNodes []*cryptolib.PublicKey) {
7475
// We don't need this event.
7576
}
7677

77-
// This is called by the component to run this.
78+
// Run is called by the component to run this.
7879
func (p *Publisher) Run(ctx context.Context) {
7980
blockAppliedPipeOutCh := p.blockAppliedPipe.Out()
8081
for {

packages/registry/chain_registry.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// Copyright 2020 IOTA Stiftung
22
// SPDX-License-Identifier: Apache-2.0
3+
4+
// Package registry provides functionality for managing chain records, consensus state,
5+
// and distributed key shares in the system.
36
package registry
47

58
import (

0 commit comments

Comments
 (0)