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(x/ecocredit): independent project API #2150

Merged
merged 29 commits into from
Feb 16, 2024
Merged

Conversation

aaronc
Copy link
Member

@aaronc aaronc commented Jan 30, 2024

Description

Closes: #1323 and replaces #1422.

Based on the current way in which project pages are evaluating in app.regen.network, there is a need for an on-chain representation of projects before they have been admitted into credit classes. This PR introduces an application system for a project to enter into a credit class.

The key assumptions this design makes are:

  • a project can apply to one credit class at a time via a single issuer of the credit class
  • a project must explicitly specify which issuer (registry agent?) they are submitting the application to
  • an application can only have three evaluation statues: approved, changes requested and rejected
  • a credit class in an existing credit class can apply to another one
  • project ID's are created independently from credit classes

This is intended to be done in a non API breaking way.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@aaronc aaronc requested a review from clevinson January 30, 2024 16:42
@aaronc aaronc marked this pull request as ready for review January 30, 2024 19:03
@S4mmyb
Copy link
Member

S4mmyb commented Feb 1, 2024

Great work @aaronc ! Overall I think this looks good and it's exciting to see an independent projects PR. The key assumptions you made in the design are:

  • a project can apply to one credit class at a time via a single issuer of the credit class
  • a project must explicitly specify which issuer (registry agent?) they are submitting the application to
  • an application can only have three evaluation statues: approved, changes requested and rejected
  • a credit class in an existing credit class can apply to another one
  • project ID’s are created independently from credit classes

For the most part I agree with this framework, but I am curious about your reasoning for why they must specify the issuer. The counter argument I see for this is that if certain issuers for a credit class are known to be more lenient in their reviews than others. Obviously we wouldn't want this to be the case as there should be very clear processes in place where decisions to approve have minimal subjectivity. But there given the complexity of these projects and the nature of project applications (which have a lot of written justification) there is always the possibility some are more lenient than others or have differences of opinions. With that framing in mind, it would probably make more sense to design it such that the application goes to all issuers, and one issuer claims it. This design could also solve business if certain issuers have higher workloads than other or are unavailable to take on applications (if that's a problem). If we do take that framing, one approach would be to add in an additional status in the ApplicationStatus field which is APPLICATION_STATUS_RECIEVED, which indicates an issuer has received the application and is reviewing it.

My other question around this is, what happens if an application is rejected. I think we want to allow for multiple applications on the same project, as a rejection doesn't always indicate that the project doens't meet the criteria. Rather it might be incomplete from a reporting standpoint or too premature. If the issuer needs additional info and the ApplicationStatus changes to APPLICATION_STATUS_CHANGES_REQUESTED, does that application close or is it still open (i.e. do they need to reapply)? If it's rejected, do we want to track previous applications against that project_id which issuers can reference against to see why it was previously rejected?

Again, great job.

@aaronc
Copy link
Member Author

aaronc commented Feb 1, 2024

Thanks for the review @S4mmyb. Would it make sense to allow any issuer to request changes? Should there be some application period whereby any issuer can block an approval if they do so before say a 2 week time period?

Also should we consider allowing multiple credit classes per project?

@aaronc
Copy link
Member Author

aaronc commented Feb 5, 2024

The more I think about it, the more I think we should simply allow a project to be enrolled in multiple credit classes simultaneously. This would subsume the need for a separate API for pre-financing as in #2152 since these could all be modeled as credit classes themselves. It would also allow reuse of the credit class infrastructure including the anti-spam fee and basketing. Also, we've heard of potential cases of credit stacking. The main argument for not allowing multiple credit class enrollment seems to be more of an argument against stacking which although maybe correct is likely not something we should encode ideologically at the protocol call especially since pre-financing is a valid use case.

@S4mmyb
Copy link
Member

S4mmyb commented Feb 5, 2024

Thanks for the review @S4mmyb. Would it make sense to allow any issuer to request changes? Should there be some application period whereby any issuer can block an approval if they do so before say a 2 week time period?

Also should we consider allowing multiple credit classes per project?

I think we should have an APPLICATION_STATUS_CHANGES_REQUESTED tag if they are requesting changes that simply changes state when an issuer requests changes. But I don't think we should encode any time limits on-chain, at least for now. I think both in a project applying to an issuer or an issuer requesting changes there should be time limits or expectations, but I think those should be handled contractually via legal agreements.

@aaronc
Copy link
Member Author

aaronc commented Feb 6, 2024

So what if in the credit class project relationship, an issuer can at any time change the status between approved, changes requested and rejected? Also a project could unilaterally withdrawal from a credit class relationship.

Copy link
Member

@clevinson clevinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good. Excited to see how simple this is (at least at the proto level).

I (similarly to sam) think projects should apply just to the credit class (not a specific issuer), though how we handle the application review process & permissioning may make that a bit difficult (e.g. multiple issuers coordinating on a review... see my in-line comment below).

I'm also in favor of a project enrolling in multiple credit classes simultaneously. If we wanted any on-chain enforcement to restrict projects being enrolled in multiple credit classes, we probably only do that for credit classes of the same type. In other words, a project should not be able to be enrolled in two credit classes of the same type during the same time period.

Comment on lines 410 to 412
// issuer is the issuer of the credit class which the application has been
// submitted to.
string issuer = 4;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @S4mmyb's feedback that we maybe don't need to specify the issuer as part of an application submission. I think in our existing use cases, we mostly have 1 issuer / registry agent org per credit class. If cases arise where we may have multiple issuers for a credit class, then I think it's safe to assume that they are sufficiently coordinated (seeing that all issuers have equal rights to issue credit batches on any project).

I'd prefer projects just apply to a credit class, and any issuer can pick it up.

One thing that we still need to talk through is whether a application review process (once initiated by an issuer), has to be fully completed by that same issuer, or if any issuer can change application status of any project application at any point in time.

Chatting w/ @S4mmyb briefly about this, I get the sense he prefers the former approach. So an "application review cycle" once opened by a single issuer, is owned by that issuer until the cycle completes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the simpler model is to assume that credit class issuers are sufficiently coordinated. What if an issuer were removed? Then this means that the project is stuck in an unreconcilable state.


// Application represents the evaluation status that a credit class issuer
// assigns to a credit class application.
enum ApplicationStatus {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So possibly we should add an APPLICATION_STATUS_ASSIGNED if we are treating applications as a first come first serve by the issuers?

Though in seeing this, I'm wondering if it overcomplicates the process and if we would be better off just choosing either:

  • projects apply to a specific issuer
  • project applies to the credit class, and any issuer can change the status at any point in time (e.g. issuer A can set it as 'change requested' and issuer B can later accept the project)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently I'm leaning towards the latter for simplicity

proto/regen/ecocredit/v1/tx.proto Outdated Show resolved Hide resolved
}

// MsgSubmitClassApplication is the Msg/SubmitClassApplication request type.
message MsgSubmitClassApplication {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a field representing the project term? In the context of a credit class, I believe a project will always have a defined project term (start date & end date), and it is then expected that the registry agent will issue credit batches for each vintage year during that project term.

Currently I don't think projects encode this data on-chain, but it might be useful to do if we want to restrict projects from enrolling from two credit classes of the same credit type during the same time period.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is well enough specified to include on chain yet. @S4mmyb ?

@aaronc
Copy link
Member Author

aaronc commented Feb 6, 2024

Makes sense and I agree with uniqueness around credit type. I'll update this PR to reflect that.

@aaronc aaronc mentioned this pull request Feb 6, 2024
19 tasks
@aaronc
Copy link
Member Author

aaronc commented Feb 6, 2024

I've updated this design based on the comments above and tried to go for as simple as possible. Would appreciate another review @clevinson @S4mmyb or maybe we chat live to resolve any remaining design issues.

Copy link
Member

@clevinson clevinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks great. Only concrete suggestions are:

  • changing ProjectClass name to ProjectEnrollment or ProjectClassEnrollment
  • similarly, where it says "project class relationship" I think it should instead say "project class enrollment" or "project's enrolled in credit class"

proto/regen/ecocredit/v1/tx.proto Outdated Show resolved Hide resolved
proto/regen/ecocredit/v1/tx.proto Outdated Show resolved Hide resolved
proto/regen/ecocredit/v1/tx.proto Outdated Show resolved Hide resolved
proto/regen/ecocredit/v1/state.proto Outdated Show resolved Hide resolved
proto/regen/ecocredit/v1/events.proto Show resolved Hide resolved
proto/regen/ecocredit/v1/query.proto Outdated Show resolved Hide resolved
@clevinson
Copy link
Member

Few more general reflections after my call with @aaronc earlier today.

There are 2 API design choices that IMO are OK for us to move forward with in their current form, but probably warrant a bit more conversation w/ @S4mmyb to make sure we are making the best choice that satisfies most of our design concerns while keeping implementation simple.

Project Enrollment Statuses (& Right to Withdraw)

Key questions:

  1. Who has the right to early terminate a project on-chain? Both project_admin & issuer ? or just issuer? Currently, this is only able to be done by the project_admin and can be done at any time. But maybe it's better to have this action be performed by a credit class issuer (assuming a project has already been accepted). In this scenario, a project could only withdraw an enrollment if it hasn't been "accepted", but once accepted, ending a project would be called "terminate project" and is an action that only an issuer can perform
  2. Should we encode any on-chain of the progression between project statuses? I guess this question is separate from this PR (which is focused on API design), but it is an open question whether an issuer should be able to move a project from an "Accepted" state back to "Change Requested" or "Unspecified". IMO once in "Accepted" state, a project should only be able to be "Terminated" from that point on, and that action must be taken by an Issuer.

Project Terms

@S4mmyb Do you think we have a clear enough idea of the requirements of "Project Terms" that we should incorporate that into this PR? From my understanding, projects always have a defined term (project start date & end date), so it might make sense to add those to this PR as part of a "project enrollment". This way, when each project applies to a credit class it has a specified project term in advance.

We could use this project term in a few ways:

  • projects could automatically be "unenrolled" in a credit class when the project term ends
  • allows for pontential on-chain enforcement of double counting (ensuring no project enrolls in 2 credit classes of the same credit type w/ overlapping project terms). If we implement project terms now, then this would allow for projects to enroll in multiple credit classes (of the same credit type) as long as the project terms are non overlapping (e.g. carbonplus grasslands for 2020-2025, and in 2023 they could begin enrollment process in another carbon credit class for 2026-2030).

Fees

Probably for a future design, but we shouldn't forget that at some point we'd like to incorporate fixed fees into the project registration flow. I know Gregory has expressed interest in future implementations that support bonding / locking REGEN when enrolling a project in a credit class, and that REGEN being burned / slashed if a project prematurely terminates.

@aaronc mentioned on our call that its probably best to wait until we have an MVP implemented and some actual usage before we put in more UX hurdles such on-chain / bonded REGEN fees.

Copy link

codecov bot commented Feb 7, 2024

Codecov Report

Attention: 40 lines in your changes are missing coverage. Please review.

Comparison is base (45044a3) 73.11% compared to head (5c83b1e) 72.90%.

❗ Current head 5c83b1e differs from pull request most recent head be8f2f4. Consider uploading reports for the commit be8f2f4 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2150      +/-   ##
==========================================
- Coverage   73.11%   72.90%   -0.22%     
==========================================
  Files         236      240       +4     
  Lines       13820    13860      +40     
==========================================
  Hits        10105    10105              
- Misses       2976     3016      +40     
  Partials      739      739              
Files Coverage Δ
x/ecocredit/base/keeper/keeper.go 100.00% <ø> (ø)
.../base/types/v1/msg_create_or_update_application.go 0.00% <0.00%> (ø)
...t/base/types/v1/msg_create_unregistered_project.go 0.00% <0.00%> (ø)
...dit/base/types/v1/msg_update_project_enrollment.go 0.00% <0.00%> (ø)
.../ecocredit/base/types/v1/msg_update_project_fee.go 0.00% <0.00%> (ø)

@aaronc
Copy link
Member Author

aaronc commented Feb 8, 2024

@clevinson based on my discussion with @S4mmyb we decided that a project developer can only create, update or withdraw an application but cannot unilaterally withdraw from a credit class on chain. They need to coordinate this off-chain with the credit class issuer and then the credit class issuer can terminate. So I've added a TERMINATED status and made withdrawal only relevant to an application. I've also simplified and renamed the API so that there are now only two methods for enrollments:

  • CreateOrUpdateApplication - for a project admin to create, update or withdraw an application
  • UpdateProjectEnrollment - for a credit class issuer to approve, request changes to or reject an application, or to terminate a project

These two methods have two corresponding events.

We also agreed to not worry about checking enrollment dates or even double enrollment in two classes of the same credit type at all. We're creating transparency here, rather than trying to orchestrate some rule system that isn't fully defined yet.

Generally, this current design feels pretty simple and flexible. From my conversation with @S4mmyb yesterday, it sounds like this general direction is good enough so I might begin some implementation work on the side.

When you get a chance @clevinson and @S4mmyb, would appreciate another round of reviews so we can iron out any details and approve if this is ready.

@aaronc
Copy link
Member Author

aaronc commented Feb 13, 2024

Although I said that I think more complex fees could be added later (if needed), I did add a governance-controlled project creation fee which seems important for spam prevention.

Copy link
Contributor

@paul121 paul121 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks good. I don't have many opinions about the project applications and enrollments as I'm not as familiar with how these processes work today. But the concepts here make sense, and agree with making applications to a credit class generally and not specific issuers.

One thing that I don't see mentioned above - would it be desirable for credit classes to have a status of whether they are accepting applications for new projects? Perhaps credit classes should not be able to deny creation of applications to their credit class (promote open participation). But there may be scenarios when a credit class is no longer "active" or has been replaced by a new credit class that should be used instead.

Otherwise I'm more concerned with the technical changes and how this might affect existing credit classes and projects.

  • What is happening to project IDs? And consistency/inconsistency of project IDs in batch IDs?
  • This introduces the concept of "project termination" from a credit class via the project enrollment. But projects that are created directly to a credit class will not have an enrollment created, thus credit class issuers would not be able to "terminate" these projects, until an application/enrollment is created by the project admin. This would also affect existing projects on-chain today, but could potentially be updated in a migration.

Comment on lines +365 to +366
// MsgCreateOrUpdateApplication is the Msg/CreateOrUpdateApplication request type.
message MsgCreateOrUpdateApplication {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only one message for create and update? What fields can be updated after creation? This is different than Projects that have separate messages for creation and updating individual fields. These message make it very clear what can and cannot be updated. Their corresponding events also make it simple to subscribe to changes.

For applications it seems like only two fields should be updated: metadata and withdraw. It seems like you would make a new application instead of updating the project ID or credit class on an existing application. And for withdrawing, it isn't clear if that value can be updated multiple times. If you withdraw an application, would it make sense to "lock" the application state from any future updates and instead require creating a new application?

In this case, messages could be simplified to:

  • MsgCreateApplication
  • MsgUpdateApplicationMetadata
  • MsgWithdrawApplication

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main rationale is that there's a fair amount of ceremony for every new method - separate messages, validation, tests, etc. So I can split it up if the single method is overly complex. It's just a little more annoying for implementation.

Withdrawing would delete the application and you'd need to re-apply.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, makes sense re: implementation. Lately I have been working on a couple projects that interact with ecocredit projects + credit class, and must say the I like the separate messages. It's somewhat self-documenting and seems consistent within the ecocredit module.

I think it works well because most of the time we are only updating project/credit class metadata. If we were frequently updating multiple fields then it would make sense to include in a single message. But in this case, too, it seems like metadata would be the most frequent update. A dedicated message for withdrawing wouldn't be bad imo.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I can make separate messages. Not that much harder

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is one message okay for update enrollment?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yeah one message for update enrollment makes more sense. It would be common to update both the metadata and status at the same time. Although this would be the only ecocredit entity without its own dedicated update metadata msg 🤷

Copy link
Member Author

@aaronc aaronc Feb 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In looking into separating create and update, it honestly feels like too much code duplication to have a separate messages here since it will be the exact same fields in each message, the exact same validation and even the exact same keeper logic. The only different logic would be for withdraw, although I think that would also share all the same validation and most of the logic. So I'm inclined to either keep it as or just separate withdraw into its own message. I understand other operations in x/ecocredit are separated, but in those cases the arguments really are different enough that each message would have different validaton and substantially different logic. But that isn't the case here - it's very simple and almost identical. Maybe when you do your review @clevinson, you can opine on the direction.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think of the two options, separating out withdraw into it's own message makes the most sense. Like @paul121 said, the only two things we would really update are the metadata and withdraw. Having a separate withdraw message makes sense to me. Having a separate update metadata message I'm not sure about, mainly because I I don't know how often we would actually update application metadata or what that process would look like. If an issuer requested changes made to the application, would the project admin do we think it's important to have the issuer update the metadata to reflect the revised / new evidence?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a separate update metadata message I'm not sure about, mainly because I I don't know how often we would actually update application metadata or what that process would look like. If an issuer requested changes made to the application, would the project admin do we think it's important to have the issuer update the metadata to reflect the revised / new evidence?

My understanding: When an issuer requests changes to an application I would expect the issuer to update the Enrollement status & metadata. I would then expect the project admin to update the Application metadata to address the requested changes. How revisions are represented is outside of the scope here, but could be included within the metadata content.

Comment on lines +359 to +363
// MsgCreateUnregisteredProjectResponse is the Msg/CreateUnregisteredProject response type.
message MsgCreateUnregisteredProjectResponse {
// project_id is the unique identifier of the project.
string project_id = 1;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will project IDs be generated? Will they be auto-incrementing IDs unique across all credit classes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-increment across all projects independent of credit class.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once a project registers under a credit class, does the project-id change to adopt the credit class project_id? What happens to the projct_id when the project de-registers from a credit class, or if it is enrolled in multiple credit classes?

Copy link
Member Author

@aaronc aaronc Feb 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, all project IDs would be stable, unique and uncorrelated with credit classes

@aaronc
Copy link
Member Author

aaronc commented Feb 13, 2024

Perhaps credit classes should not be able to deny creation of applications to their credit class (promote open participation). But there may be scenarios when a credit class is no longer "active" or has been replaced by a new credit class that should be used instead.

@S4mmyb @clevinson any thoughts here?

  • What is happening to project IDs? And consistency/inconsistency of project IDs in batch IDs?

If it's a new project ID, ex. P007, then its batches would start C003-P007- for the class C003.

For existing project IDs, say C003-001, we could either reassign them a name based on their integer index. Or we could keep the same ID, but make choices when batches are created:

  • if creating a batch within C003 then we still name it C003-001- etc.
  • if creating a batch in say C004, then we could use its unique integer index (say 4) and the batch would be C004-P004 in which case P004 is basically its alternate project ID based on the new ID scheme
  • This introduces the concept of "project termination" from a credit class via the project enrollment. But projects that are created directly to a credit class will not have an enrollment created, thus credit class issuers would not be able to "terminate" these projects, until an application/enrollment is created by the project admin. This would also affect existing projects on-chain today, but could potentially be updated in a migration.

Actually, we'd have a migration for existing credit classes to create the enrollment record.

@aaronc
Copy link
Member Author

aaronc commented Feb 14, 2024

I've clarified that whenever an application is withdrawn or status is set to rejected or terminated, that the data is deleted from state allowing the project to apply again to the same credit class in the future. Let me know if this is undesirable for any reason. I know we had discussed keeping the on-chain state for terminated projects @S4mmyb, but in this case, we would need to allow issuers to set the state backed to accepted in order for the project to re-enroll. It seems simpler to just delete and then allow reapplication in the case where projects are terminated which would make the re-enrollment behavior uniform across withdrawn, rejected and terminated states.

Copy link
Member

@S4mmyb S4mmyb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I think this looks good to me. I agree with @paul121 's comments about how updating project-ids will happen as projects enter/exit credit classes, or are enrolled in multiple credit classes. For instance, if I have an independent project with id P002 then enroll in Credit Class C08 as the 1st project of that credit class, would the id change to C08-001? What happens if I unenroll at a later point in time? Does it go back to being P002 or is it reassigned a new id based on autoincrementing? Also do we reserve the C08-001 id and just say that that project has been terminated? I have similar questions around id assignment for multiple enrollment.

Another question I had was who sets the governance-gated project-creation fee. To me this makes sense that it happens at the credit class level as the application process / overhead might differ depending on the nature of the credit class. Is that the intent? Would that be the same thing, or different from a burn fee?

One thing that I don't see mentioned above - would it be desirable for credit classes to have a status of whether they are accepting applications for new projects? Perhaps credit classes should not be able to deny creation of applications to their credit class (promote open participation). But there may be scenarios when a credit class is no longer "active" or has been replaced by a new credit class that should be used instead.

Great question @paul121. In general I think it makes sense to allow credit classes to have open vs closed enrollment, but I feel like at this point in time the real-world exploration of what it means to govern a credit class is too premature to really know how we should implment that. Would the admin set it? Could the registry set it? What happens if someone wants to take a deactivated credit class out of retirement? That said, it would be pretty simple to just add an open/closed field set by the credit class admin that would allow applications, and if it is maybe we just go for it.


// enrollment_metadata is any arbitrary metadata set by the credit class
// admin evaluating the project's application to the credit class.
string enrollment_metadata = 6;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this would be more aptly named evaluation_metadata?

Comment on lines +359 to +363
// MsgCreateUnregisteredProjectResponse is the Msg/CreateUnregisteredProject response type.
message MsgCreateUnregisteredProjectResponse {
// project_id is the unique identifier of the project.
string project_id = 1;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once a project registers under a credit class, does the project-id change to adopt the credit class project_id? What happens to the projct_id when the project de-registers from a credit class, or if it is enrolled in multiple credit classes?

Comment on lines +365 to +366
// MsgCreateOrUpdateApplication is the Msg/CreateOrUpdateApplication request type.
message MsgCreateOrUpdateApplication {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think of the two options, separating out withdraw into it's own message makes the most sense. Like @paul121 said, the only two things we would really update are the metadata and withdraw. Having a separate withdraw message makes sense to me. Having a separate update metadata message I'm not sure about, mainly because I I don't know how often we would actually update application metadata or what that process would look like. If an issuer requested changes made to the application, would the project admin do we think it's important to have the issuer update the metadata to reflect the revised / new evidence?

@aaronc
Copy link
Member Author

aaronc commented Feb 15, 2024

Overall I think this looks good to me. I agree with @paul121 's comments about how updating project-ids will happen as projects enter/exit credit classes, or are enrolled in multiple credit classes. For instance, if I have an independent project with id P002 then enroll in Credit Class C08 as the 1st project of that credit class, would the id change to C08-001? What happens if I unenroll at a later point in time? Does it go back to being P002 or is it reassigned a new id based on autoincrementing? Also do we reserve the C08-001 id and just say that that project has been terminated? I have similar questions around id assignment for multiple enrollment.

No, it would always be P002 and your batches would be C008-P002. We wouldn't change IDs.

Another question I had was who sets the governance-gated project-creation fee. To me this makes sense that it happens at the credit class level as the application process / overhead might differ depending on the nature of the credit class. Is that the intent? Would that be the same thing, or different from a burn fee?

I think there's some misunderstanding here. Project creation in this model happens independently from applying to credit classes. If we want an application fee for credit classes, that's a different consideration and I'm not sure we need to put that on chain right now. I'm just suggesting some small anti-spam fee (maybe ~$10USD) so people don't create tons of garbage projects. This fee would be set by chain governance just like the credit class creation fee.

One thing that I don't see mentioned above - would it be desirable for credit classes to have a status of whether they are accepting applications for new projects? Perhaps credit classes should not be able to deny creation of applications to their credit class (promote open participation). But there may be scenarios when a credit class is no longer "active" or has been replaced by a new credit class that should be used instead.

Great question @paul121. In general I think it makes sense to allow credit classes to have open vs closed enrollment, but I feel like at this point in time the real-world exploration of what it means to govern a credit class is too premature to really know how we should implment that. Would the admin set it? Could the registry set it? What happens if someone wants to take a deactivated credit class out of retirement? That said, it would be pretty simple to just add an open/closed field set by the credit class admin that would allow applications, and if it is maybe we just go for it.

We could have a boolean active field on credit classes that can be turned on/off to block applications, but honestly not sure that's needed at this point.

Copy link
Member

@clevinson clevinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! Approving with a few minor suggestions, but hoping @aaronc can just make the final call with this and others' input in mind.

The one thing I'll add about the separating out of MsgCreateOrUpdateApplication is that it's not totally clear from documentation how the user should set the metadata field when they are using this msg to withdraw an application. I guess they should leave metadata blank?

With this confusion, I do have a preference for us to have a separate explicit msg for withdraw. As for the other actions (create & update), I think both strategies are fine, and don't have a strong preference as to whether they are consolidated or have separate Msg's.

proto/regen/ecocredit/v1/query.proto Outdated Show resolved Hide resolved
@aaronc
Copy link
Member Author

aaronc commented Feb 16, 2024

I was assuming that withdrawal would allow metadata and that this would get passed onto the event. In that case do separate withdrawal and create/update messages still make sense? Like I said the arguments and validation would otherwise be 100% the same including metadata although we could remove the awkward withdraw bool.

@aaronc
Copy link
Member Author

aaronc commented Feb 16, 2024

I'd like to merge this as is without adding a separate withdraw method. Each new method results in > 200 LOC when we include tests and all and with limited resources, maintainability and correctness are big concerns. Reducing implementation complexity can help with that even though I acknowledge it makes the resulting API a bit more complex.

@aaronc aaronc enabled auto-merge (squash) February 16, 2024 19:56
@aaronc aaronc merged commit 3b21ecd into main Feb 16, 2024
27 checks passed
@aaronc aaronc deleted the aaronc/independent-projects branch February 16, 2024 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add specification for independent projects
4 participants