-
Notifications
You must be signed in to change notification settings - Fork 103
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 support for credit cancelling (#385) #391
Conversation
Codecov Report
@@ Coverage Diff @@
## master #391 +/- ##
==========================================
- Coverage 59.87% 56.36% -3.51%
==========================================
Files 56 59 +3
Lines 3404 3717 +313
==========================================
+ Hits 2038 2095 +57
- Misses 1102 1351 +249
- Partials 264 271 +7
Flags with carried forward coverage won't be shown. Click here to find out more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM other than YAML in the CLI and my small thought about naming. What alternatives do we have to YAML? Could we do something like coins does (ex 100atom,1000regen
)?
@aaronc @blushi I found this as well:
It states in the comment of |
@aaronc I've implemented with the form |
That sounds good. Separately we should find a way for credit batch names to always start with a letter so a colon isn't needed. I propose |
Yeah, I think that seems reasonable and makes it interoperable with |
Yes 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks neat, just a small nit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just small comments
@@ -172,6 +173,34 @@ Parameters: | |||
} | |||
} | |||
|
|||
func txCancel() *cobra.Command { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't have to be part of this PR but it would be good to add some integration tests for the ecocredit CLI for next release
I believe #150 should be added to v1.1 - Baikal Upgrade milestone, wdyt @clevinson @aaronc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sounds good - how do we test the CLI currently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see for instance in x/group/client/testsuite
Not sure, will ask Ron. |
I think we should update the docs to mention cancellation. |
@aaronc And do we need to change the logic so that when we cancel credits, the |
I asked Ron about that he responded:
We do already keep track of active and retired credits as part of the tradable and retired balances / supplies. Canceled credits can be indexed based on cancel events. So I believe it would make sense to keep the |
Okay, sounds good! I'll adjust some docs that suggest cancel is as if they're never issued, because that's not the case here. Thanks for checking that! |
71393f9
to
15bcd85
Compare
I think language which distinguishes issued from active/valid at the batch level makes sense. I think leaving total amount as is could be confusing |
@aaronc hmm, okay, so perhaps renaming to |
Sure, but then I would also add a |
@aaronc Hmm, yeah, I had similar concerns. Ron's requirement above only needs us to track 3 of those 4 values, so we can decide which one to leave for reconstruction, or just accept the redundancy and store them all? What about adjusting |
@aaronc Could you have a look at Ru's proposal above to get this PR move forward? |
I think that makes sense and is likely least error prone. |
@aaronc could you give this another review with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Description
This PR adds support for cancelling ecocredits. An account holder can cancel credits that they own from any credit batch. Cancelled credits are removed from the holders tradeable balance and from the tradeable supply. Cancelling credits has no effect on the retirement balances and supplies. After cancellation it is as if the credit was never issued, except that it is still accounted for in the
total_amount
in theBatchInfo
for the batch.Closes: #385
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...
!
to the type prefix if API or client breaking changeCHANGELOG.md
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...
!
in the type prefix if API or client breaking change