Skip to content

Conversation

orenyodfat
Copy link
Contributor

@orenyodfat orenyodfat commented May 15, 2019

  • it rewards the msg.sender with P % of the proposal's upstakes upon a successful call to this function.
    P = t/10 and t = number of blocks passed between the proposal's timeout and a successful call to this function. max P is 10 %.
  • fix a bug at redeem function
    the bug manifest itself when a dao/scheme will try to redeem its downstakes winning from a failed proposals and only if there is already a reward payout for executeboosted call. in some cases it might cause the redeem call to revert so the dao/scheme could not redeem its winning.

Copy link
Contributor

@ben-kaufman ben-kaufman left a comment

Choose a reason for hiding this comment

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

Looks good, just a small comment.

* @param _proposalId the ID of the proposal
* @return uint256 executeCallBounty
*/
function calcExecuteCallBounty(bytes32 _proposalId) private view returns(uint256) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If there's no special reason not to, please make this public.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok. maybe it will be useful to someone.

Copy link
Contributor

@jellegerbrandy jellegerbrandy left a comment

Choose a reason for hiding this comment

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

Just some comments about comments and variables :-)

* @dev executeBoosted try to execute a boosted or QuietEndingPeriod proposal if it is expired
* it rewards the msg.sender with P % of the proposal's upstakes upon a successful call to this function.
* P = t/10 and t = number of blocks passed between the proposal's timeout and a successful call to this function.
* the function assume an avergae block time of 15 seconds.
Copy link
Contributor

Choose a reason for hiding this comment

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

That seems to me just an unnecesaary complex representation of what you are doing.
Just say "P = t/150, where t is the number of seconds passed since the the proposal's timeout", no need to make assumptions on block times (which you are not making, anyway, this code will run the same whatever the block times are)

Copy link
Contributor Author

@orenyodfat orenyodfat May 16, 2019

Choose a reason for hiding this comment

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

the rewards steps increments on each 15 seconds(which is an average block time).
it is not continuous (step on each second). if we decided to do that we could ,but currently it is not.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it increments on each 15 seconds, which is the average block time, so it will miscalculate the amount of blocks mined exactly half of the time.

To me it looks like adding complexity without any good reason at all. Time in the infra is measured everywhere in seconds and not in (approximations of) blocks, so why make an exception here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

made it a linear function.
see 382daa5

"proposal state in not Boosted nor QuietEndingPeriod");
require(_execute(_proposalId), "proposal need to expire");
uint256 expirationCallBountyPercentage =
uint256 blocksSinceTimeOut =
Copy link
Contributor

Choose a reason for hiding this comment

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

just use seconds, not blocks, as unit of measure (see above)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is blocks ,not very accurate calculation but good enough.
with the assumption that an average block time is 15 seconds.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does not seem so good to me. If the first block is mined after 14 seconds, then "blocksSinceTimeout = ((14).div(15) = 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, the first step is 0.

proposal.expirationCallBountyPercentage = expirationCallBountyPercentage;
expirationCallBounty = expirationCallBountyPercentage.mul(proposal.stakes[YES]).div(100);

proposal.expirationCallBountyPercentage = blocksSinceTimeOut;
Copy link
Contributor

Choose a reason for hiding this comment

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

you write in the docs that the maximum is 10%, but this goes up to 100, it seems to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see that calcExecuteCallBounty divides by 1000, but please please please do not have a variable called PerCentage that stores ProMille.

Copy link
Contributor Author

@orenyodfat orenyodfat May 16, 2019

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I know, my objection is against the variable name, not the calculation :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

just call it expirationCallBountyProMille and everything is fine :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see
0720cf1

Copy link
Contributor

@leviadam leviadam left a comment

Choose a reason for hiding this comment

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

LGTM.

@orenyodfat orenyodfat merged commit 92f66f4 into master May 19, 2019
@orenyodfat orenyodfat deleted the execute_boosted branch May 19, 2019 12:20
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.

4 participants