Skip to content
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

ETH-786: fix Delegated event #901

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

jtakalai
Copy link
Contributor

No description provided.

TODO: check tests
Copy link

linear bot commented Sep 16, 2024

@jtakalai jtakalai marked this pull request as draft September 16, 2024 11:21
@jtakalai jtakalai changed the title ETH-768: fix Delegated event ETH-786: fix Delegated event Sep 16, 2024
Copy link

ETH-768: fix Delegated event

Generated at commit: 6c04f6492917ead63fe3b1d5f202973e69fd89d5

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
3
1
0
14
40
58
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

@jtakalai jtakalai requested a review from teogeb October 2, 2024 12:11
@@ -331,7 +334,6 @@ contract Operator is Initializable, ERC2771ContextUpgradeable, IERC677Receiver,
}

latestDelegationTimestamp[delegator] = block.timestamp; // solhint-disable-line not-rely-on-time
emit Delegated(delegator, amountDataWei);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could rename the _delegate function as our definition of delegation is now stricter.

The linear ticket defines:
"Delegated should mean DATA was moved into Operator contract via delegate or transferAndCall, not the other self-delegation hacks (fisherman, operator's cut)"
If I understood correctly, this also defines what delegation means as a concept, not just when we emit the event? As we should of course emit the Delegated event always when a delegation happens, and never when it doesn't happen.

@@ -127,7 +127,7 @@ contract StakeModule is IStakeModule, Operator {
uint protocolFee = earningsDataWei * streamrConfig.protocolFeeFraction() / 1 ether;
token.transfer(streamrConfig.protocolFeeBeneficiary(), protocolFee);

// "self-delegate" the operator's share === mint new operator tokens
// Self-delegate the operator's cut === mint new operator tokens
Copy link
Contributor

Choose a reason for hiding this comment

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

Could avoid the "self-delegate" term, or at least keep that in quotes.

As we have now defined that self-delegation is not a delegation at all, it is very misleading term. If we want to have a totally separate term, that could be e.g. "invest", or "fund"? But "self-delegation" in quotes is maybe ok for now, too.

Suggested change
// Self-delegate the operator's cut === mint new operator tokens
Mint new operator tokens

@@ -372,10 +372,10 @@ type OperatorDailyBucket @entity {
"Delegators that joined today. Updated when Delegation entity is created"
delegatorCountChange: Int!

"Sum of DATA tokens delegated to this operator today, by all delegators. Updated when Delegated event is fired"
"DATA value of received operator tokens, by all delegators. Updated when BalanceUpdate event is fired"
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this include only real delegations, or some of the "hack-delegations? If it includes only the real delegations, should it be updated only by the Delegated/Undelegated events?

(And if it need to include also hack-delegations, should we deprecate this field and have a separate field for the real delegations?)

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.

2 participants