From 1216bbd5d9de95f6527bb464efec58a0e54757c0 Mon Sep 17 00:00:00 2001 From: Paul Weidner Date: Sun, 21 Jul 2024 09:07:11 -0700 Subject: [PATCH 1/6] Remove classId from TestTxCreateProjectCmd --- x/ecocredit/client/testsuite/tx.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/x/ecocredit/client/testsuite/tx.go b/x/ecocredit/client/testsuite/tx.go index fac7db8e13..21f7c7d141 100644 --- a/x/ecocredit/client/testsuite/tx.go +++ b/x/ecocredit/client/testsuite/tx.go @@ -127,20 +127,19 @@ func (s *IntegrationTestSuite) TestTxCreateProjectCmd() { }{ { name: "missing args", - args: []string{"foo", "bar"}, + args: []string{"foo"}, expErr: true, - expErrMsg: "Error: accepts 3 arg(s), received 2", + expErrMsg: "Error: accepts 2 arg(s), received 1", }, { name: "too many args", - args: []string{"foo", "bar", "baz", "foo"}, + args: []string{"foo", "bar", "baz"}, expErr: true, - expErrMsg: "Error: accepts 3 arg(s), received 4", + expErrMsg: "Error: accepts 2 arg(s), received 3", }, { name: "missing from flag", args: []string{ - s.classID, "US-WA", "metadata", }, @@ -150,7 +149,6 @@ func (s *IntegrationTestSuite) TestTxCreateProjectCmd() { { name: "valid", args: []string{ - s.classID, "US-WA", "metadata", fmt.Sprintf("--%s=%s", flags.FlagFrom, admin), @@ -159,7 +157,6 @@ func (s *IntegrationTestSuite) TestTxCreateProjectCmd() { { name: "valid from key-name", args: []string{ - s.classID, "US-WA", "metadata", fmt.Sprintf("--%s=%s", flags.FlagFrom, s.val.Moniker), @@ -168,7 +165,6 @@ func (s *IntegrationTestSuite) TestTxCreateProjectCmd() { { name: "valid with amino-json", args: []string{ - s.classID, "US-WA", "metadata", fmt.Sprintf("--%s=%s", flags.FlagFrom, admin), From 26b1f220b3e9de6b2ce6977b4dc16d1129bc479d Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Sun, 21 Jul 2024 21:53:58 +0200 Subject: [PATCH 2/6] Update x/ecocredit/base/keeper/msg_create_project.go Co-authored-by: Paul Weidner --- x/ecocredit/base/keeper/msg_create_project.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x/ecocredit/base/keeper/msg_create_project.go b/x/ecocredit/base/keeper/msg_create_project.go index c7f8daec74..9a9ee0c9ce 100644 --- a/x/ecocredit/base/keeper/msg_create_project.go +++ b/x/ecocredit/base/keeper/msg_create_project.go @@ -79,8 +79,7 @@ func (k Keeper) CreateProject(ctx context.Context, req *types.MsgCreateProject) }, nil } -// createNewProject generates a projectID when no projectID was given for CreateProject. -// The ID is generated by concatenating the classID and a sequence number. +// createNewProject creates a new project when no class was given for CreateProject. func (k Keeper) createNewProject(ctx context.Context) (*api.Project, string, error) { newProject := &api.Project{} id, err := k.stateStore.ProjectTable().InsertReturningID(ctx, newProject) From f1968c5d88139a5fa8910fc04561f39211c1baa3 Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 20 Aug 2024 10:46:28 -0400 Subject: [PATCH 3/6] Update proto/regen/ecocredit/v1/query.proto Co-authored-by: Cory --- proto/regen/ecocredit/v1/query.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/regen/ecocredit/v1/query.proto b/proto/regen/ecocredit/v1/query.proto index 2c5f15c28b..ae220d45bb 100644 --- a/proto/regen/ecocredit/v1/query.proto +++ b/proto/regen/ecocredit/v1/query.proto @@ -895,7 +895,7 @@ message QueryProjectEnrollmentsResponse { // EnrollmentInfo is the human-readable project enrollment information. message EnrollmentInfo { - // project_id is the unique identifier of the project to query. + // project_id is the unique identifier of the project. string project_id = 1; // class_id is the unique identifier of the credit class to query. From dc4f2351a3ba1a6bf536b23afbdf1dc9f7c03cda Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 20 Aug 2024 10:46:40 -0400 Subject: [PATCH 4/6] Update proto/regen/ecocredit/v1/query.proto Co-authored-by: Cory --- proto/regen/ecocredit/v1/query.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/regen/ecocredit/v1/query.proto b/proto/regen/ecocredit/v1/query.proto index ae220d45bb..406840a8cc 100644 --- a/proto/regen/ecocredit/v1/query.proto +++ b/proto/regen/ecocredit/v1/query.proto @@ -898,7 +898,7 @@ message EnrollmentInfo { // project_id is the unique identifier of the project. string project_id = 1; - // class_id is the unique identifier of the credit class to query. + // class_id is the unique identifier of the credit class. string class_id = 2; // status is the status of the enrollment. From 75a7dfed4f43c15d838b4be5edc5e4b33d565bbf Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Tue, 20 Aug 2024 10:46:54 -0400 Subject: [PATCH 5/6] Update x/ecocredit/base/client/tx.go Co-authored-by: Cory --- x/ecocredit/base/client/tx.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/ecocredit/base/client/tx.go b/x/ecocredit/base/client/tx.go index a421bb0108..65c7e2d933 100644 --- a/x/ecocredit/base/client/tx.go +++ b/x/ecocredit/base/client/tx.go @@ -153,7 +153,7 @@ regen tx ecocredit create-project "US-WA 98225" regen:13toVgf5UjYBz6J29x28pLQyjK var err error fee, err = sdk.ParseCoinNormalized(projectFee) if err != nil { - return fmt.Errorf("failed to parse class-fee: %w", err) + return fmt.Errorf("failed to parse project-fee: %w", err) } } From 8fd6b938bea054cb37aca035411da780d83d77ac Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Wed, 9 Oct 2024 18:26:11 -0400 Subject: [PATCH 6/6] Update x/ecocredit/migrations/v5/state_test.go Co-authored-by: Cory Levinson --- x/ecocredit/migrations/v5/state_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/ecocredit/migrations/v5/state_test.go b/x/ecocredit/migrations/v5/state_test.go index 71fd542d5b..b01d9eff1c 100644 --- a/x/ecocredit/migrations/v5/state_test.go +++ b/x/ecocredit/migrations/v5/state_test.go @@ -119,6 +119,7 @@ func TestMigrate(t *testing.T) { enrollment3, err := state.ProjectEnrollmentTable().Get(ctx, projKey3, clsKey2) require.NoError(t, err) require.Equal(t, projKey3, enrollment3.ProjectKey) + require.Equal(t, clsKey2, enrollment3.ClassKey) }