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

Integrate PufferVault #158

Merged
merged 32 commits into from
Feb 20, 2024
Merged

Integrate PufferVault #158

merged 32 commits into from
Feb 20, 2024

Conversation

bxmmm1
Copy link
Contributor

@bxmmm1 bxmmm1 commented Jan 24, 2024

  • Add PufferVault
  • Remove PufferPool
  • Remove WithdrawalPool
  • Daily limit for withdrawals
  • Validator Tickets

@bxmmm1 bxmmm1 self-assigned this Jan 24, 2024
Copy link

openzeppelin-code bot commented Jan 24, 2024

Integrate PufferVault

Generated at commit: 2f6e62a4cb63e2c417d3356261816758c0543f9c

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
2
2
0
7
31
42
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
1
7
8

For more details view the full report in OpenZeppelin Code Inspector

CheyenneAtapour and others added 9 commits January 25, 2024 14:45
* erc20 permit vt

* add vt functionality and forge fmt

* make mint function pausable

* cleanup comments

---------

Co-authored-by: shcyster <[email protected]>
}

function _setMintPrice(uint56 newPrice) internal {
uint256 oldPrice = _validatorTicketPrice;
Copy link
Contributor

Choose a reason for hiding this comment

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

remove the extra variable, you can emit the event first and then update the global variable

@@ -16,14 +17,14 @@ import { WithdrawalPool } from "puffer/WithdrawalPool.sol";
*/
Copy link
Contributor

@CheyenneAtapour CheyenneAtapour Feb 8, 2024

Choose a reason for hiding this comment

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

Remove the mention of PufferPool within the comment on line 14:

@notice Calls the depositETH function on PufferPool

* Slot 1
*/
uint256 public lockedETH;
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

newline whitespace please :)


// We've received bond in pufETH, so the second param is 0
_transferFunds($, 0);
function withdrawValidatorTicket(uint256 amount, address recipient) external {
Copy link
Contributor

Choose a reason for hiding this comment

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

We do not need withdrawValidatorTicket function. They will receive their validator tickets

  1. When they are skipped via skipProvisioning()
  2. When they call retrieveBond()

Permit calldata pufETHPermit,
Permit calldata vtPermit
) external payable restricted {
//@todo what is the min amount?
Copy link
Contributor

Choose a reason for hiding this comment

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

The min is 28 days, as you have it. But please make it a variable that can be controlled by the DAO

@@ -359,14 +275,13 @@ contract PufferProtocol is IPufferProtocol, AccessManagedUpgradeable, UUPSUpgrad
}

// slither-disable-next-line unchecked-transfer
POOL.transfer(validator.node, validator.bond);
PUFFER_VAULT.transfer(validator.node, validator.bond);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we please change the name of this function to cancelRegistration?

stopRegistration sounds a bit like they are exiting their validator, and it can be a bit confusing

@@ -796,50 +618,13 @@ contract PufferProtocol is IPufferProtocol, AccessManagedUpgradeable, UUPSUpgrad
emit ValidatorLimitPerModuleChanged(oldLimit, limit);
Copy link
Contributor

@CheyenneAtapour CheyenneAtapour Feb 8, 2024

Choose a reason for hiding this comment

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

You can emit the event first so you don't need to declare a separate variable to hold the oldLimit

function _setValidatorLimitPerModule(bytes32 moduleName, uint128 limit) internal {
    ProtocolStorage storage $ = _getPufferProtocolStorage();
    emit ValidatorLimitPerModuleChanged($.moduleLimits[moduleName].allowedLimit, limit);
    $.moduleLimits[moduleName].allowedLimit = limit;
}

Comment on lines 622 to 625
ProtocolStorage storage $ = _getPufferProtocolStorage();
bytes32[] memory oldModuleWeights = $.moduleWeights;
$.moduleWeights = newModuleWeights;
emit ModuleWeightsChanged(oldModuleWeights, newModuleWeights);
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly here, you can emit the event first so you don't have to declare an extra variable

// DAO selectors
bytes4[] memory daoSelectors = new bytes4[](1);
daoSelectors[0] = PufferOracle.setMintPrice.selector;

Copy link
Contributor

Choose a reason for hiding this comment

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

We need to set the access for calling setGuardiansFeeRate()

uint256 numberOfActivePufferValidators,
uint256 totalNumberOfValidators,
bytes[] calldata guardianSignatures
) external {
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 we need valid Guardian signatures for this function, which should be hard to forge, but should we also make this function restricted? We really don't need anybody else calling it, do we?

eigenPodManager = vm.envOr("EIGENPOD_MANAGER", address(new EigenPodManagerMock()));
delayedWithdrawalRouter = vm.envOr("DELAYED_WITHDRAWAL_ROUTER", address(0));
delegationManager = vm.envOr("DELEGATION_MANAGER", address(new DelegationManagerMock()));
}

validatorTicketProxy = new ERC1967Proxy(address(new NoImplementation()), "");
Copy link
Contributor

Choose a reason for hiding this comment

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

In theory, people could "steal" this proxy by backrunning our tx to create this contract to do their own authorizeUpgrade() call. We could consider changing this function within NoImplementation contract to require the address that calls that function to be the same as the deployer (since our deployment scripts basically just have the deployer deploy then upgrade).

}

emit FullWithdrawalsRootPosted(blockNumber, root);
}

/**
* @inheritdoc IPufferProtocol
* @dev Restricted to the DAO
Copy link
Contributor

Choose a reason for hiding this comment

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

Make sure there is a comment like this, specifying who the function is restricted to, for all such functions with restricted modifier. I see there are some which do not have it e.g. createPufferModule and setModuleWeights

* vt accounting

* update retrieveBond

* add todo comments

* VT Alternative (#167)

* alternative code

* penalize cancel and skip provisioning

* Descriptions, todos

* add stop validator virtual VTs

* add virtual VT balance

* rename variables, cleanup

* rename variable, add assertion

* PR changes

* more comments

* Guardian Sig to Include VT Burn Offset (#169)

* add double deposit test

* test double deposit alice for bob

* update guardian signature to include vt burn offset

* update function param comments

---------

Co-authored-by: Cheyenne Atapour <[email protected]>
@bxmmm1 bxmmm1 marked this pull request as ready for review February 16, 2024 15:13
CheyenneAtapour and others added 7 commits February 16, 2024 17:21
* fix proof of rewards interface

* fix signatures

* update selectors

---------

Co-authored-by: Benjamin <[email protected]>
* fix slither error

* update setup access

* refactor to use struct

* update redemption logic

* add comments, refactor burning

* ci update

* ci fix
Copy link
Contributor

@CheyenneAtapour CheyenneAtapour left a comment

Choose a reason for hiding this comment

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

Just very minor comments remain

@JasonVranek JasonVranek merged commit fceda44 into master Feb 20, 2024
4 checks passed
@bxmmm1 bxmmm1 deleted the pufETH branch May 2, 2024 13:05
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