Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronc committed Mar 31, 2024
1 parent 38b631a commit 4aff001
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 42 deletions.
8 changes: 0 additions & 8 deletions x/ecocredit/base/keeper/msg_create_batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package keeper
import (
"encoding/json"
"strconv"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -497,10 +496,3 @@ func (s *createBatchSuite) ExpectEventCreateBatchWithProperties(a gocuke.DocStri
err = testutil.MatchEvent(&event, sdkEvent)
require.NoError(s.t, err)
}

func (s *createBatchSuite) getProjectSequence(projectID string) uint64 {
str := strings.Split(projectID, "-")
seq, err := strconv.ParseUint(str[1], 10, 32)
require.NoError(s.t, err)
return seq
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@ func (s *createUnregisteredProjectSuite) Before(t gocuke.TestingT) {

s.bankKeeper.EXPECT().
SendCoinsFromAccountToModule(gomock.Any(), s.addr, gomock.Any(), gomock.Any()).
DoAndReturn(func(_ sdk.Context, fromAddr sdk.AccAddress, toAddr string, coins sdk.Coins) error {
DoAndReturn(func(_ sdk.Context, fromAddr sdk.AccAddress, _ string, coins sdk.Coins) error {
if fromAddr.Equals(s.addr) {
s.balance = s.balance.Sub(coins...)
return nil
} else {
return fmt.Errorf("unexpected from address: %s", fromAddr)
}
return fmt.Errorf("unexpected from address: %s", fromAddr)
}).
AnyTimes()
}
Expand Down
2 changes: 1 addition & 1 deletion x/ecocredit/base/keeper/query_project_enrollment.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
types "github.com/regen-network/regen-ledger/x/ecocredit/v3/base/types/v1"
)

func (k Keeper) ProjectEnrollment(ctx context.Context, request *types.QueryProjectEnrollmentRequest) (*types.QueryProjectEnrollmentResponse, error) { //TODO implement me
func (k Keeper) ProjectEnrollment(ctx context.Context, request *types.QueryProjectEnrollmentRequest) (*types.QueryProjectEnrollmentResponse, error) {
project, err := k.stateStore.ProjectTable().GetById(ctx, request.ProjectId)
if err != nil {
return nil, regenerrors.ErrNotFound.Wrapf("could not get project with id %s: %s", request.ProjectId, err.Error())
Expand Down
23 changes: 0 additions & 23 deletions x/ecocredit/base/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ func testFormatProjectID(t *rapid.T) {
require.NoError(t, err)
}

func testInvalidProjectID(t *rapid.T) {
projectID := genInvalidProjectID.Draw(t, "projectID")
require.Error(t, ValidateProjectID(projectID))
}

func testFormatBatchDenom(t *rapid.T) {
creditTypeAbbrev := genCreditTypeAbbrev.Draw(t, "creditTypeAbbrev")
classSeq := rapid.Uint64().Draw(t, "classSeq")
Expand All @@ -69,11 +64,6 @@ func testFormatBatchDenom(t *rapid.T) {
require.NoError(t, err)
}

func testInvalidBatchDenom(t *rapid.T) {
batchDenom := genInvalidBatchDenom.Draw(t, "batchDenom")
require.Error(t, ValidateBatchDenom(batchDenom))
}

func testGetClassIDFromBatchDenom(t *rapid.T) {
creditTypeAbbrev := genCreditTypeAbbrev.Draw(t, "creditTypeAbbrev")
classSeq := rapid.Uint64().Draw(t, "classSeq")
Expand Down Expand Up @@ -110,19 +100,6 @@ var genInvalidClassID = rapid.OneOf(
rapid.StringMatching(`[A-Z]{4,}[0-9]*`),
)

// genInvalidProjectID generates strings that don't conform to the project id format
var genInvalidProjectID = rapid.OneOf(
rapid.StringMatching(`[a-zA-Z]*`),
rapid.StringMatching(`[0-9]*`),
rapid.StringMatching(`[A-Z]{4,}[0-9]*`),
)

// genInvalidBatchDenom generates strings that don't conform to the batch denom format
var genInvalidBatchDenom = rapid.OneOf(
genInvalidClassID,
rapid.StringMatching(`[A-Z]{1,3}[0-9]*-[a-zA-Z\-]*`),
)

// genTime generates time values up to the year ~9999 to avoid overflowing the
// denomination format.
var genTime = rapid.Custom(func(t *rapid.T) *time.Time {
Expand Down
4 changes: 2 additions & 2 deletions x/ecocredit/genesis/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ func TestGenesisValidate(t *testing.T) {
Jurisdiction: "AQ",
})
require.NoError(t, err)
ss.ProjectEnrollmentTable().Insert(ctx, &baseapi.ProjectEnrollment{
err = ss.ProjectEnrollmentTable().Insert(ctx, &baseapi.ProjectEnrollment{
ProjectKey: pKey,
ClassKey: cKey,
Status: baseapi.ProjectEnrollmentStatus_PROJECT_ENROLLMENT_STATUS_ACCEPTED,
Expand All @@ -429,7 +429,7 @@ func TestGenesisValidate(t *testing.T) {
Jurisdiction: "AQ",
})
require.NoError(t, err)
ss.ProjectEnrollmentTable().Insert(ctx, &baseapi.ProjectEnrollment{
err = ss.ProjectEnrollmentTable().Insert(ctx, &baseapi.ProjectEnrollment{
ProjectKey: pKeyBIO,
ClassKey: cKeyBIO,
Status: baseapi.ProjectEnrollmentStatus_PROJECT_ENROLLMENT_STATUS_ACCEPTED,
Expand Down
5 changes: 0 additions & 5 deletions x/ecocredit/server/testsuite/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ func (s *GenesisTestSuite) TestInitExportGenesis() {
batchSeqJSON, err := json.Marshal(batchSeq)
require.NoError(err)

projectSeq := []baseapi.ProjectSequence{{ClassKey: 1, NextSequence: 3}}
projectSeqJSON, err := json.Marshal(projectSeq)
require.NoError(err)

classAllowlistSettingJSON, err := json.Marshal(baseapi.ClassCreatorAllowlist{
Enabled: true,
})
Expand Down Expand Up @@ -113,7 +109,6 @@ func (s *GenesisTestSuite) TestInitExportGenesis() {
wrapper[string(proto.MessageName(&baseapi.BatchSupply{}))] = batchSupplyJSON
wrapper[string(proto.MessageName(&baseapi.ClassSequence{}))] = classSeqJSON
wrapper[string(proto.MessageName(&baseapi.BatchSequence{}))] = batchSeqJSON
wrapper[string(proto.MessageName(&baseapi.ProjectSequence{}))] = projectSeqJSON
wrapper[string(proto.MessageName(&baseapi.ClassCreatorAllowlist{}))] = classAllowlistSettingJSON
wrapper[string(proto.MessageName(&baseapi.AllowedClassCreator{}))] = allowedClassCreatorsJSON
wrapper[string(proto.MessageName(&baseapi.ClassFee{}))] = classFeeJSON
Expand Down

0 comments on commit 4aff001

Please sign in to comment.