Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/aaronc/independent-projects-impl…
Browse files Browse the repository at this point in the history
…' into aaronc/independent-projects-impl
  • Loading branch information
aaronc committed Oct 9, 2024
2 parents 27bca17 + 8fd6b93 commit 389ace5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions proto/regen/ecocredit/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -898,10 +898,10 @@ 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.
// class_id is the unique identifier of the credit class.
string class_id = 2;

// status is the status of the enrollment.
Expand Down
2 changes: 1 addition & 1 deletion x/ecocredit/base/client/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
3 changes: 1 addition & 2 deletions x/ecocredit/base/keeper/msg_create_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 4 additions & 8 deletions x/ecocredit/client/testsuite/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand All @@ -150,7 +149,6 @@ func (s *IntegrationTestSuite) TestTxCreateProjectCmd() {
{
name: "valid",
args: []string{
s.classID,
"US-WA",
"metadata",
fmt.Sprintf("--%s=%s", flags.FlagFrom, admin),
Expand All @@ -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),
Expand All @@ -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),
Expand Down
1 change: 1 addition & 0 deletions x/ecocredit/migrations/v5/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

}

Expand Down

0 comments on commit 389ace5

Please sign in to comment.