-
Notifications
You must be signed in to change notification settings - Fork 112
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
Introduce Korporatio extension #1122
base: develop
Are you sure you want to change the base?
Conversation
0cc0363
to
dc2df16
Compare
f5e9317
to
5ace2e1
Compare
dd5fc04
to
60a8ee6
Compare
@arrenv @area take a look and let me know what you think. I tried to provide functionality to support both the centralized and decentralized use cases. @arrenv could I have more clarification on what you intend for paying for the application. Would that be a motion that transfers funds to... the metacolony? |
883d889
to
e9c2194
Compare
Sorry for missing this until now. Question, is the claim delay configurable? Can the claim not just be returned with the cancellation? Also, this would likely require additional UI, right? Payment for the application will be done using a Motion, I feel the best implementation of this is for the payment to go to the MetaColony. However, the original intention was to have it go to a hard-coded address directly to the incorporation service provider. Do you have any opinions on this from a contract perspective? |
@arrenv the claim delay is configurable. The idea is that if a user cancels the application, there is still time to slash the stake in the case that a user is malicious. If they could immediately cancel and reclaim their stake, then there would be no way to slash them. My suggestion would be for a function on the extension to take the funds (as part of the submit function) and transfer them to the metacolony. That way the motion is a single function call to the extension. The extension could allow the application fee to be configured by the colony, or it can be hard-coded. Up to you. Normally I would be against hard-coding but I could see the value in this case. Also, I'm assuming the application fee should be paid in CLNY? Or xDAI? |
@kronosapiens What would be the downside of them cancelling it themselves straight away? What impact would have have on the Colony as a bad actor? Not saying we shouldn't have it, but I am curious as to the importance of it. It is also something we will need to account for in the UI. I do prefer the payment to be made into the Metacolony being the flow. The downside of it though is that it then becomes an issue of tracking/reconciling that payment and then manually processing it to be sent to the incorporation service provider. The application fee is currently denominated in USDC. |
@arrenv see here: #1118 (comment) |
Thank you, I recall it now. I will make a note of it for the UI updates. |
99e9fc3
to
95aa18a
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.
Given that the spec is that this works with voting, we should have some tests along those lines in here - and in particular, ones that make sure that even if the voting extension has permissions in root (as it usually does), then motions in subdomains cannot interfere unexpectedly.
Noting that @area is asking for a test showing that stakes can be returned to a user if the extension is deleted |
10f7e81
to
c4e79ec
Compare
e1d2819
to
0844a1c
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.
One of the requirements is
Be able to cancel a staked application with a motion.
Which is marked as done in the original issue, but I don't believe this is possible, as cancelling is limited to onlyApplicant
?
Similarly:
Anyone else can make change requests to the application, but changes will require a motion.
The requirements go on to say
If it proves unsuitable we may be able to consider limiting changing the application details to the owner only.
Emphasis my own. What's the state of discussions on this?
@area the Regarding the editing of the motion, I made the argument that such backs-and-forth can occur off-chain, and the applicant can update the IPFS hash as needed. I suppose we could allow @arrenv thoughts on these? |
It would still be necessary to cancel an application and have the option not to slash a stake. An example scenario of this is that it has been decided to delay the application to a date in the future, and the application was not created in malice. Shown in the design with the force toggle, and the option to show mercy:
It would allow more flexibility to allow people other then the applicant to make changes via a motion, otherwise full control of the application itself remains with a single person. Editing via a motion is how it was spec'd and designed for this reason. |
@arrenv currently you can "show mercy" by not penalizing their reputation. Are you saying that "showing mercy" would be not slashing tokens OR penalizing reputation? Should those be two different options, or should they always come together, i.e. either you slash both tokens and rep or neither? |
Yes, I think it would be better to just keep them as one as you said. I.e. 'Smite' would slash both both tokens and rep, 'Show mercy' would not slash both tokens and rep. |
I've updated the PR to allow for applications to be updated either by the creator or via a motion, as well as the other changes we've discussed. |
fabe0fe
to
24a488e
Compare
require(applications[_applicationId].cancelledAt == UINT256_MAX, "korporatio-stake-cancelled"); | ||
require( | ||
msgSender() == applications[_applicationId].applicant || | ||
colony.hasUserRole(msgSender(), 1, ColonyDataTypes.ColonyRole.Root), |
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 still does not meet the specification:
> Anyone else can make change requests to the application, but changes will require a motion.
I get the intention (we give the Voting Extension root permission) but it allows anyone with root permission to update an application.
EDIT: After talking with Arren, it being controlled by the Root permission is acceptable. I've still left my original comment just to (admittedly) let me get on my traditional soapbox and say it is important to either a) Stick to the specification or b) get the specification changed by the owner of it if you disagree with it.
} | ||
|
||
function deleteApplication(uint256 _applicationId, bool _punish) public { | ||
require(applications[_applicationId].stakeAmount > 0, "korporatio-cannot-slash"); |
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 function should presumably work when an application has been made without staking?
uint256 colonyReputation = checkReputation(rootHash, rootSkillId, address(0x0), _colonyKey, _colonyValue, _colonyBranchMask, _colonySiblings); | ||
uint256 userReputation = checkReputation(rootHash, rootSkillId, msgSender(), _userKey, _userValue, _userBranchMask, _userSiblings); | ||
|
||
uint256 requiredStake = wmul(colonyReputation, repFraction); |
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.
Given things key off of stakeAmount
, should it be required to be nonzero here to ensure the lifecycle doesn't go off the rails? (After talking to Arren, it should be)
Or possibly nothing should be gated behind stakeAmount
as there is the option to create without a stake.
|
||
stakeFraction = _stakeFraction; | ||
repFraction = _repFraction; | ||
claimDelay = _claimDelay; |
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.
All three of these are missing validation on the supplied values.
|
||
// Public | ||
|
||
function initialise(uint256 _stakeFraction, uint256 _repFraction, uint256 _claimDelay) public { |
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.
Many of the public functions are missing natspec comments. In particular, be sure to include when something is a wad.
Closes #1118
Current flow:
submitApplication
submitFreeApplication
cancelApplication
reclaimStake
slashStake
, optionally slashing reputationupdateApplication
submitApplication
stakeFraction
andclaimDelay
values using the respective setter functionsThe intention is that the claim delay allows for the colony to punish an applicant for malicious behavior, and that the final submission of the application take place via a motion. Updating the IPFS hash emits an event, which can be used by the Dapp to render the UI.