-
Notifications
You must be signed in to change notification settings - Fork 107
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
Reputation improvements #1140
base: develop
Are you sure you want to change the base?
Reputation improvements #1140
Conversation
24507bf
to
79c4c1b
Compare
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.
High level comments:
- Colony-specific decay rates I'm broadly happy with
- Ditto changes to payout scalar
- I think that the introduction of a linked list and capping the number of tokens earning reputation simply to support the feature of "give rep on finalization" represents an injudicious complexity/feature tradeoff
- I think that the introduction of domain scaling before the introduction of nested domains is over-engineering, and that feature should wait until we have actual colonies using nested domains
Elaborating on my point at the end of the call, the current implementation of The initial decision to give reputation when a payment is finalized (as opposed to when it is claimed) was (I believe) made in response to the argument that no one would "claim" a reputation penalty. While this is probably true, our claim functions have been made public, meaning that anyone can claim a payment on another's behalf. This means that if a payment would result in a negative penalty, and the recipient has no incentive to claim that penalty, that someone else is able to "claim" the penalty on their behalf. One could argue that this second "claim" function would result in more transactions, and more headache for users. However, given that we have now added support for multicall, it would be straightforward to include any reputation penalty "claims" as part of a single transaction, meaning that these implementation decisions would be ultimately invisible to the user. I am proposing that we drop the more-complex implementation of this functionality, given that we can achieve the desired product goal in an alternative way, which would result in less overall complexity across the contracts and dapp. The addition of a multicall as part of finalization would require the dapp to make a few more queries on finalization, but I believe this would still be a net simplification over the current implementation. |
To make it clear, this is what we lose from the simplified version:
This is what we gain:
If this cover the differences, then I would opt for the simplified version as you have described. |
abf0f20
to
5b6a948
Compare
Need to be able to set scale factor for reputation mining. EDIT: This is now done. |
5b6a948
to
7671757
Compare
c7a43ba
to
8d2fbd4
Compare
19f6889
to
1272c2f
Compare
b00abe5
to
61a2cae
Compare
bbaaddb
to
1e79f5d
Compare
cc2f77e
to
22031ec
Compare
038f1f6
to
a96f3e3
Compare
Closes #1124
Per-token reputation rate
In order to maintain some of the behaviour around payments (i.e. reputation being emitted on finalization, not claim), after a discussion with Arren, we came to the conclusion that we would limit the number of tokens that, if paid out from a colony, would result in reputation being awarded to the recipient. We landed on ten, which seems like plenty. In principle, this could be increased in the future, but only with the spectre of gas limits hanging over our heads.
The relevant tokens are stored in a linked list, and tokens must be inserted in order of ascending address in order to ensure there are not duplicate entries - indeed, when any editing of the list is taking place, the previous token must be provided.
The root permission is required to do this, for fairly obvious reasons.
An event is emitted when a token rate is set.
Per-domain reputation rate
Sadly, the same spectre of gas limits hangs over us with respect to per-domain reputation rate, given how it is intended to work (after a discussion with Arren, as this was not clear in the original issue). With multiple domains in a hierarchy, (e.g. A -> B -> C -> D), then the per-domain rate for D is equal to a factor set for D, times the factor (if any) set for C, and so on up the tree. It seems as if that the creation limit (because we note children / parents on skill creation) dwarfs this factor, but something to keep in mind.
Note that strictly, I've implemented this as a per skill reputation scaling, but only provide a mechanism for the skills of domains to be set. This gives us some latitude for the future to add per-skill scaling, but ultimately was driven by the requirement to walk up the skill tree, where it isn't possible to walk up (on-chain) the domain tree.
Again, the root permission is required to set the per-domain reputation rate. This is because of a scenario where the scale factor in a domain is set to 0, any non-root permission being allowed to set it to non-zero allows unexpected earning of reputation in root.
For both per-domain scaling, and per-token scaling, the scale factor is applied before being emitted to the reputation update log. No changes will be required once #1132 is merged as a result, and the reputation miners also need do nothing to accommodate these changes.
An event is emitted when a domain reputation rate is set.
Updates to payout scalar
Encompassing two bullet points in the requirements, permissions around
payoutScalar
have been changed - ultimately, those who were able to adjust it before can now adjust it between -1 and 0 (previously -1 and 1). This removes the ability to give bonus reputation using thepayoutScalar
. Root permission is now required to set the scalar above 0 (and can be set to an arbitrarily high value), which can be used in extraordinary circumstances to edit the reputation earned by a payment.Per-colony decay rate
Fairly self-explanatory. I've limited the precision to the same amount of precision we have currently for the default value. Colonies can return to following our default decay rate even if they've set their own previously.
This feature will require a little additional work to sit alongside #1132, in that the function call that sets the decay rate will need to be bridged, but otherwise decay-rate calculations will occur as previously. Updates to the decay rate require one reputation cycle to complete, which is tracked by storing the address of the currently active cycle and not accessing the storage with a simple getter, but via
getColonyReputationDecayRate
.The changes to the reputation miner code is such that it should be able to be deployed before the contract changes to allow a seamless transition.
An event is emitted when a colony's decay rate is set.
Other changes
I've made a few other changes on my way through this work:
require(false, "...")
replaced withrevert(...)
bn2bytes32
function to work as I expected, at least, with negative values.Notes
I'm not 100% that I've covered all overflow guards for the scaling, so a special eye there would be appreciated.