Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add unused linter #1294

Merged
merged 6 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions tm2/pkg/amino/genproto/bindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func generateMethodsForType(imports *ast.GenDecl, scope *ast.Scope, pkg *amino.P
}
dpbote_ := pbote_[1:]

// ////////////////
// // -----------
thehowl marked this conversation as resolved.
Show resolved Hide resolved
// ToPBMessage()
{
scope2 := ast.NewScope(scope)
Expand All @@ -127,7 +127,7 @@ func generateMethodsForType(imports *ast.GenDecl, scope *ast.Scope, pkg *amino.P
))
}

// ////////////////
// // -----------
// EmptyPBMessage()
// Use to create the pbm to proto.Unmarshal to before FromPBMessage.
{
Expand All @@ -148,7 +148,7 @@ func generateMethodsForType(imports *ast.GenDecl, scope *ast.Scope, pkg *amino.P
))
}

// ////////////////
// // -----------
// FromPBMessage()
{
scope2 := ast.NewScope(scope)
Expand All @@ -169,7 +169,7 @@ func generateMethodsForType(imports *ast.GenDecl, scope *ast.Scope, pkg *amino.P
))
}

// ////////////////
// // -----------
// TypeUrl()
{
methods = append(methods, _func("GetTypeURL",
Expand All @@ -182,7 +182,7 @@ func generateMethodsForType(imports *ast.GenDecl, scope *ast.Scope, pkg *amino.P
))
}

// ////////////////
// // -----------
// Is*ReprEmpty()
{
rinfo := info.ReprType
Expand Down
14 changes: 7 additions & 7 deletions tm2/pkg/bft/consensus/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ x * TestHalt1 - if we see +2/3 precommits after timing out into new round, we sh

*/

//----------------------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------------
// ProposeSuite

func TestStateProposerSelection0(t *testing.T) {
Expand Down Expand Up @@ -255,7 +255,7 @@ func TestStateBadProposal(t *testing.T) {
signAddVotes(cs1, types.PrecommitType, propBlock.Hash(), propBlock.MakePartSet(partSize).Header(), vs2)
}

//----------------------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------------
// FullRoundSuite

// propose, prevote, and precommit a block
Expand Down Expand Up @@ -354,7 +354,7 @@ func TestStateFullRound2(t *testing.T) {
ensureNewBlock(newBlockCh, height)
}

//------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
// LockSuite

// two validators, 4 rounds.
Expand Down Expand Up @@ -409,7 +409,7 @@ func TestStateLockNoPOL(t *testing.T) {
// but with invalid args. then we enterPrecommitWait, and the timeout to new round
ensureNewTimeout(timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds())

///
// -----------

round++ // moving to the next round
ensureNewRound(newRoundCh, height, round)
Expand Down Expand Up @@ -1496,7 +1496,7 @@ func TestFlappyResetTimeoutPrecommitUponNewHeight(t *testing.T) {
assert.False(t, rs.TriggeredTimeoutPrecommit, "triggeredTimeoutPrecommit should be false at the beginning of each height")
}

//------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
// SlashingSuite
// TODO: Slashing

Expand Down Expand Up @@ -1573,10 +1573,10 @@ func TestStateSlashingPrecommits(t *testing.T) {
}
*/

//------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
// CatchupSuite

//------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
// HaltSuite

// 4 vals.
Expand Down
4 changes: 2 additions & 2 deletions tm2/pkg/bft/consensus/wal_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func WALGenerateNBlocks(t *testing.T, wr io.Writer, numBlocks int) (err error) {
logger := log.TestingLogger().With("wal_generator", "wal_generator")
logger.Info("generating WAL (last height msg excluded)", "numBlocks", numBlocks)

/////////////////////////////////////////////////////////////////////////////
// -----------
// COPY PASTE FROM node.go WITH A FEW MODIFICATIONS
// NOTE: we can't import node package because of circular dependency.
// NOTE: we don't do handshake so need to set state.Version.Consensus.App directly.
Expand Down Expand Up @@ -83,7 +83,7 @@ func WALGenerateNBlocks(t *testing.T, wr io.Writer, numBlocks int) (err error) {
consensusState.SetPrivValidator(privValidator)
}
// END OF COPY PASTE
/////////////////////////////////////////////////////////////////////////////
// -----------

// set consensus wal to buffered WAL, which will write all incoming msgs to buffer
numBlocksWritten := make(chan struct{})
Expand Down
2 changes: 1 addition & 1 deletion tm2/pkg/bft/privval/signer_listener_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func TestRetryConnToRemoteSigner(t *testing.T) {
}
}

// /////////////////////////////////
// // -----------

func newSignerListenerEndpoint(logger log.Logger, ln net.Listener, timeoutReadWrite time.Duration) *SignerListenerEndpoint {
var listener net.Listener
Expand Down
2 changes: 1 addition & 1 deletion tm2/pkg/bft/rpc/lib/client/ws_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func (c *WSClient) CallWithArrayParams(ctx context.Context, method string, param
return c.Send(ctx, request)
}

///////////////////////////////////////////////////////////////////////////////
// -----------
// Private methods

func (c *WSClient) dial() error {
Expand Down
6 changes: 3 additions & 3 deletions tm2/pkg/bft/rpc/lib/server/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import (
"github.com/gnolang/gno/tm2/pkg/log"
)

//////////////////////////////////////////////////////////////////////////////
// -----------
// HTTP REST API
// TODO

//////////////////////////////////////////////////////////////////////////////
// -----------
// JSON-RPC over HTTP

func testMux() *http.ServeMux {
Expand Down Expand Up @@ -229,7 +229,7 @@ func TestUnknownRPCPath(t *testing.T) {
require.Equal(t, http.StatusNotFound, res.StatusCode, "should always return 404")
}

//////////////////////////////////////////////////////////////////////////////
// -----------
// JSON-RPC over WEBSOCKETS

func TestWebsocketManagerHandler(t *testing.T) {
Expand Down
10 changes: 5 additions & 5 deletions tm2/pkg/bft/types/validator_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ func (vals *ValidatorSet) VerifyFutureCommit(newSet *ValidatorSet, chainID strin
return nil
}

//-----------------
// -----------------
// ErrTooMuchChange

func IsErrTooMuchChange(err error) bool {
Expand All @@ -775,7 +775,7 @@ func (e tooMuchChangeError) Error() string {
return fmt.Sprintf("Invalid commit -- insufficient old voting power: got %v, needed %v", e.got, e.needed)
}

//----------------
// ----------------

func (vals *ValidatorSet) String() string {
return vals.StringIndented("")
Expand All @@ -802,7 +802,7 @@ func (vals *ValidatorSet) StringIndented(indent string) string {
indent)
}

//-------------------------------------
// -------------------------------------
// Implements sort for sorting validators by address.

// Sort validators by address.
Expand All @@ -822,7 +822,7 @@ func (valz ValidatorsByAddress) Swap(i, j int) {
valz[j] = it
}

//----------------------------------------
// ----------------------------------------
// for testing

// RandValidatorSet returns a randomized validator set, useful for testing.
Expand All @@ -841,7 +841,7 @@ func RandValidatorSet(numValidators int, votingPower int64) (*ValidatorSet, []Pr
return vals, privValidators
}

///////////////////////////////////////////////////////////////////////////////
// -----------
// safe addition/subtraction

func safeAdd(a, b int64) (int64, bool) {
Expand Down
4 changes: 2 additions & 2 deletions tm2/pkg/bft/wal/wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ OUTER_LOOP:
return nil, false, nil
}

// /////////////////////////////////////////////////////////////////////////////
// // -----------

// A WALWriter writes custom-encoded WAL messages to an output stream.
// Each binary WAL entry is length encoded, then crc encoded,
Expand Down Expand Up @@ -512,7 +512,7 @@ func (enc *WALWriter) WriteMeta(meta MetaMessage) error {
return err
}

// /////////////////////////////////////////////////////////////////////////////
// // -----------

// IsDataCorruptionError returns true if data has been corrupted inside WAL.
func IsDataCorruptionError(err error) bool {
Expand Down
2 changes: 1 addition & 1 deletion tm2/pkg/iavl/nodedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ func (ndb *nodeDB) saveRoot(hash []byte, version int64) error {
return nil
}

////////////////// Utility and test functions /////////////////////////////////
// ----------- Utility and test functions // -----------

func (ndb *nodeDB) leafNodes() []*Node {
leaves := []*Node{}
Expand Down
4 changes: 2 additions & 2 deletions tm2/pkg/iavl/proof_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func (proof *RangeProof) _computeRootHash() (rootHash []byte, treeEnd bool, err
return rootHash, treeEnd, nil
}

///////////////////////////////////////////////////////////////////////////////
// -----------

// keyStart is inclusive and keyEnd is exclusive.
// If keyStart or keyEnd don't exist, the leaf before keyStart
Expand Down Expand Up @@ -442,7 +442,7 @@ func (t *ImmutableTree) getRangeProof(keyStart, keyEnd []byte, limit int) (proof
}, keys, values, nil
}

//----------------------------------------
// ----------------------------------------

// GetWithProof gets the value under the key if it exists, or returns nil.
// A proof of existence or absence is returned alongside the value.
Expand Down
2 changes: 1 addition & 1 deletion tm2/pkg/iavl/tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ func TestLoadVersionForOverwriting(t *testing.T) {
require.NoError(err, "SaveVersion should not fail.")
}

//////////////////////////// BENCHMARKS ///////////////////////////////////////
// ----------- BENCHMARKS // -----------

func BenchmarkTreeLoadAndDelete(b *testing.B) {
if testing.Short() {
Expand Down
Loading