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

Add function to recover staked funds in misaligned motions #1082

Conversation

area
Copy link
Member

@area area commented Aug 22, 2022

Based on #1081, so no merging. Broadly speaking:

  • Have this function declared in a separate file, with the (wrong) storage layout from v4 so that we can use normal-looking solidity to access the misaligned funds.
  • Had to introduce IVotingReputation as we're spreading the functions across multiple files
  • Slight alteration to implementation in the recovery functions, but hopefully not results. Basically, a motion must be finalized in order for people to be rewarded/punished based on which side they staked on, but because these motions no longer can advance state, I needed to switch to keying off of finalized boolean.

Copy link
Member

@kronosapiens kronosapiens left a comment

Choose a reason for hiding this comment

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

I would rename the directory votingReputation to be consistent with other parts of the codebase.

/// @return The staker reward and the reputation penalty (if any)
function getStakerReward(uint256 _motionId, address _staker, uint256 _vote) external view returns (uint256, uint256);

function createClaimDelayAction(bytes memory action, uint256 value)
Copy link
Member

Choose a reason for hiding this comment

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

Is this external? I thought this was an internal function. I may have made it public for testing at one point.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is, and has been for a while. Not intending to do a pass of that type of thing here, but we can pick it up down the line.

contracts/extensions/VotingReputation/VotingReputation.sol Outdated Show resolved Hide resolved
@area area force-pushed the maint/recover-misalignment-locked-funds branch 7 times, most recently from f92edc5 to 889d682 Compare August 25, 2022 10:33
@area area force-pushed the maint/recover-misalignment-locked-funds branch from 889d682 to c236334 Compare August 25, 2022 14:38
@area area force-pushed the maint/recover-misalignment-locked-funds branch from fc94864 to 189ed1c Compare August 26, 2022 12:20
@area
Copy link
Member Author

area commented Aug 30, 2022

This was included in #1084, but if you want more changes will need rebasing and more work from me before being merged in to develop.

@kronosapiens kronosapiens deleted the maint/recover-misalignment-locked-funds branch November 7, 2023 16:08
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