-
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
Eco-credit Module Proof of Concept Init #125
Conversation
Codecov Report
@@ Coverage Diff @@
## master #125 +/- ##
=======================================
Coverage 37.34% 37.34%
=======================================
Files 11 11
Lines 905 905
=======================================
Hits 338 338
Misses 561 561
Partials 6 6 |
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
Other than those comments @blushi does this look okay to move forward with? You honestly have the most context from the registry side. |
…' into aaronc/78-credit-module-poc-init
…aronc/78-credit-module-poc-init
string class_id = 1; | ||
|
||
// batch_denom is the unique ID of credit batch. | ||
string batch_denom = 2; |
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.
could you be more precise here: is the batch_denom
unique inside the given class, or globally?
Also, why we are calling it batch_denom
? Why not batch_id
? I know that we use denom
for an asset name, but here it's meaning (without a comment) is not very clear.
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.
Yep I can add some clarifying language on denominations
string batch_denom = 2; | ||
|
||
// issuer is the issuer of the credit batch. | ||
string issuer = 3; |
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.
This will be an address, right? Maybe let's put that in a comment:
// credit batch issuer account address
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.
yep
// sender is the sender of the credits in the case that this event is the result of a transfer. | ||
// It will not be set if credits were issued. | ||
string sender = 2; | ||
} |
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.
There is only one issuer
, so we don't need to code it here. In Ethereum, the standard is to put sender=0
(zero value) for minting / issuance transfers. Maybe we can use the same thing here (sender = ""
)?
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.
Other idea, instead of oneof
would be to add a boolean flag here.
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.
I don't have to use oneof true, but they are mutually exclusive. I can just make sender = ""
if that's preferred
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.
The whole thing is to eliminate theoneof
and normalize the data in the RDBMS sense (so to not use the issuer
field at all here). Adding a boolean flag is only cosmetic if we want to be explicit.
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.
well i'm trying to distinguish between issuer and sender as roles...
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.
I know. My point is that issuer
is known and it must be the same as the batch issuer. By adding it here we denormalize the data.
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.
Right, so I'm removing and just leaving sender = ""
string recipient = 3; | ||
|
||
// batch_denom is the unique ID of credit batch. | ||
string batch_denom = 4; |
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.
ok, so I think this answers my comment above: batch_denom
is unique globally.
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.
yep
|
||
// retired_units are the units of credits in this issuance that are effectively retired by the issuer on receipt. | ||
// Decimal values are acceptable within the precision returned by Query/Precision. | ||
string retired_units = 3; |
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.
As above, retired units are not tradeable - so doesn't it make sense to send it over?
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.
Not sure, but likely yes. A broker may specifically sell credits that can't be traded as part of the contract. Again a business discussion to have with Ron
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.
Indeed, there are cases where sold credits should be "auto-retired".
// credits are the credits being retired. | ||
repeated RetireUnits credits = 2; | ||
|
||
// RetireUnits are the units of the batch being retired. |
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.
this description should use the same language as the comment in line 134. Also, related to the comment above about changing a vocabulary for units (in proto/regen/ecocredit/v1alpha1/events.proto)
string total_units = 4; | ||
|
||
// metadata is any arbitrary metadata to attached to the credit batch. | ||
bytes metadata = 5; |
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.
related to the comment above - let's consider adding a certificate
field.
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.
again let's discuss metadata elsewhere. we don't have context on the engineering team to make these sorts of decisions
|
||
// units is the decimal number of credits that have been retired. | ||
string units = 3; | ||
} |
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.
We should also add a Claim Subject or Claim Reference - which is used to link the credits retire events with real world event.
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.
ditto, this should be part of RFC process
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.
Few comments on the retiring functionality, and whether users can transfer retired credits with this implementation, or what the purpose is of having retired_units
as part of the SendUnits
msg.
Happy for these to be resolved in a followup and use this as a starting point though.
message EventCreateBatch { | ||
|
||
// class_id is the unique ID of credit class. | ||
string class_id = 1; |
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.
What is the reason that these identifiers (class_id) are string and not integer?
I guess for batch_denom
its useful to have as a string, as that's the same type as denoms in the broader cosmos sdk, but for class_id
how do you see these ID's being generated? In my head, this would have been an integer identifier, indexed (as in a relational database) and auto-incrementing
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.
An integer converted to a string and so that it's obviously part of denom. We can reassess later
|
||
// retired_units are the units of credits in this issuance that are effectively retired by the issuer on receipt. | ||
// Decimal values are acceptable within the precision returned by Query/Precision. | ||
string retired_units = 3; |
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.
Seems strange to allow sending of pre-retired credits. IMO retiring should be a separate action done intentionally by the holder of credits.
We already cover the "retire on issuance" use case in the BatchIssuance
message, so why is this needed here as well?
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.
Not necessarily. I believe a broker may specifically only sell credits that are retired on sale. We need to discuss with Ron It may or may not be a use case but better to be on the safe side
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.
agreed cf. #125 (comment)
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
Co-authored-by: Cory <cjlevinson@gmail.com>
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 good to move forward. I will collect the questions / suggestion in an issue for review by a science and business team.
thanks @robert-zaremba |
Co-authored-by: Robert Zaremba <robert@zaremba.ch>
ref #78
Credit Module Proto Files
This includes protobuf files for the design outlined in #117, but it does so without leveraging the existing bank module. Instead the implementation (#119) does its own balance and supply tracking (IMHO more correctly than
x/bank
). As I've said before, we can definitely consider alternate designs (like #115 or whatever we find is needed by users). This is just the design I've had for over a year now (and originally PoC'ed in SF in Oct, 2019). It was pretty simple to implement and I'd just like to get it out there so we can iterate from there.Decimal Balance Experiment
This design also includes an implementation of cosmos/cosmos-sdk#7113 done with https://github.com/cockroachdb/apd. This feels relevant especially concerning the problems we're having with
sdk.Dec
(cosmos/cosmos-sdk#7773. In particular, I wanted to try outapd
, to see if it may be a suitable replacement forsdk.Dec
.Feel free to submit a Draft Pull Request as soon as you start working on something. Before you mark your PR as Ready For Review, make sure you've checked off the following boxes or indicated N/A (not applicable):
CHANGELOG.md
following https://keepachangelog.comThanks!