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

Halting inflation #2822

Merged
merged 6 commits into from Dec 7, 2021
Merged

Conversation

vzotova
Copy link
Member

@vzotova vzotova commented Nov 18, 2021

Type of PR:

  • Feature

Required reviews:

  • 3

What this does:
StakingEscrow update only. Removes most of the code from StakingEscrow: halting inflation, removing all methods to control stake (including withdraw), exclude PolicyManager and Adjudicator from lifecycle (for now)

Why it's needed:
First step in merging networks

Notes for reviewers:
Only tests for contracts have been adjusted. Some code for PolicyManger and Adjudicator was not removed to use it together with PREApplication contract later

@vzotova vzotova self-assigned this Nov 18, 2021
@vzotova vzotova changed the base branch from main to threshold-network November 22, 2021 09:22
@vzotova vzotova changed the title [WIP] Halting inflation Halting inflation Nov 22, 2021
@vzotova vzotova marked this pull request as ready for review November 22, 2021 09:27
@@ -109,9 +67,9 @@ contract StakingEscrowStub is Upgradeable {
* @title StakingEscrow
* @notice Contract holds and locks stakers tokens.
* Each staker that locks their tokens will receive some compensation
* @dev |v5.7.1|
* @dev |v6.1.1|
Copy link
Member

Choose a reason for hiding this comment

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

Might be a silly question, but what's the reason this isn't just 6.0.0?

Copy link
Member Author

Choose a reason for hiding this comment

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

I see that we are using min version as 1 (for previous contracts). But honestly can't remember 😅

* @param period Previous period tokens minted for
* @param value Amount minted (in NuNits)
*/
event Minted(address indexed staker, uint16 indexed period, 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 it possible we may need these event definitions for historical purposes? In such case, we could move them to IStakingEscrow.

Copy link
Member Author

Choose a reason for hiding this comment

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

not sure about that, in case we need it we can just use some old abi from registry

}

/**
* @notice Get work that completed by the staker
*/
function getCompletedWork(address _staker) external view returns (uint256) {
return stakerInfo[_staker].completedWork;
return token.totalSupply();
Copy link
Member

Choose a reason for hiding this comment

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

Just to double-check: this implies that we consider all pending work in WorkLock to be done, so people that still have ETH locked can claim it back. Correct? In such case, I think this should be included in the newsfragment.

Copy link
Member Author

Choose a reason for hiding this comment

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

✔️

}
}
addSnapshot(info, int256(_value));
emit Deposited(_staker, _value);
Copy link
Member

Choose a reason for hiding this comment

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

So, we are removing the possibility of depositing NU to StakingEscrow, but we're still allowing WorkLock deposits. Can this have implications on the Threshold side? Maybe a possibility is to somehow end WL completely (i.e. refund & no more deposits)?

Copy link
Member Author

Choose a reason for hiding this comment

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

there is no any way to stop WorkLock, so I can't see how to avoid deposit. Re Threshold: all these "new" tokens are in WorkLock contract and they should be part of currentPeriodSupply. For me it looks like we already consider them as deposited in StakingEscrow

Copy link
Member

Choose a reason for hiding this comment

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

all these "new" tokens are in WorkLock contract and they should be part of currentPeriodSupply. For me it looks like we already consider them as deposited in StakingEscrow

OK, this is a good reasoning.

Copy link
Member

Choose a reason for hiding this comment

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

No bids after Sep 28th 2020 (https://dune.xyz/queries/271579) and only one deposit on Aug 30th 2020 (https://dune.xyz/queries/271593). Would the only implication be that someone loses money for (inexplicably) sending in ETH and there's no longer away to call worktoETH?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand the question. Both events is only for initial worklock phase which was more than year ago

Copy link
Member

Choose a reason for hiding this comment

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

Yep, that's what I was getting at with my question – what exactly is the undesirable corner case where someone makes a deposit post initial worklock phase? Has that occurred in the last 13 months?

Copy link
Member Author

Choose a reason for hiding this comment

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

This deposit for WorkLock, not for StakingEscrow

vzotova added a commit to vzotova/nucypher that referenced this pull request Nov 30, 2021
Co-authored-by: David Núñez <david@nucypher.com>
Copy link
Member

@cygnusv cygnusv left a comment

Choose a reason for hiding this comment

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

A PR for the history books. Thanks @vzotova!

Copy link
Member

@derekpierre derekpierre left a comment

Choose a reason for hiding this comment

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

@vzotova - I assume the failing tests will be dealt with separately as part of the overall EPIC...?

@@ -0,0 +1 @@
Halting NU inflation, now refund in WorkLock is possible without work (claim stil needed)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Halting NU inflation, now refund in WorkLock is possible without work (claim stil needed)
Halting NU inflation; now refund in WorkLock is possible without work (claim still needed)

Copy link
Member Author

Choose a reason for hiding this comment

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

✔️

Co-authored-by: David Núñez <david@nucypher.com>
Co-authored-by: derekpierre <derek.pierre@gmail.com>
@vzotova
Copy link
Member Author

vzotova commented Nov 30, 2021

@vzotova - I assume the failing tests will be dealt with separately as part of the overall EPIC...?

Yeah, it's hard to fix those tests before PREApp contract will be ready (at least)

Copy link
Member

@derekpierre derekpierre left a comment

Choose a reason for hiding this comment

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

🎸

Copy link
Member

@arjunhassard arjunhassard left a comment

Choose a reason for hiding this comment

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

End of an era 🥲

{
}

function depositAsStaker(uint256 _value, uint16 _periods) public onlyDelegateCall {
Copy link
Member

Choose a reason for hiding this comment

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

Are these tests for deposit/withdraw methods that will be used post-merge in some way? How is this related to the staking adaptor contract set?

Copy link
Member Author

Choose a reason for hiding this comment

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

These lines to minimize changes in tests right now

@vzotova vzotova merged commit bbbaf62 into nucypher:threshold-network Dec 7, 2021
@vzotova vzotova deleted the inflation-stop branch December 10, 2021 12:50
vzotova added a commit that referenced this pull request Jan 15, 2022
Co-authored-by: David Núñez <david@nucypher.com>
Co-authored-by: derekpierre <derek.pierre@gmail.com>
KPrasch pushed a commit to KPrasch/nucypher that referenced this pull request Feb 8, 2022
Co-authored-by: David Núñez <david@nucypher.com>
Co-authored-by: derekpierre <derek.pierre@gmail.com>
vepkenez pushed a commit to vepkenez/nucypher that referenced this pull request Mar 17, 2022
Co-authored-by: David Núñez <david@nucypher.com>
Co-authored-by: derekpierre <derek.pierre@gmail.com>
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.

None yet

4 participants