-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: added OWR pectra v0.1 #145
base: main
Are you sure you want to change the base?
Conversation
|
||
(bool ret,) = pectraConsolidationAddress.call{value: msg.value}(abi.encodePacked(source, target)); | ||
if (!ret) revert InvalidConsolidation_Failed(); | ||
emit ConsolidationRequested(msg.sender); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add source and destination pubkeys too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean ? Isn't the source and destination the pubKeys already?
/// Requests principal withdrawal | ||
function requestPrincipalWithdrawal(bytes memory pubkey, uint8 amount) external payable onlyOwnerOrRoles(PRINCIPAL_WITHDRAWAL_ROLE) { | ||
_requestWithdrawal(pubkey, amount, false); | ||
emit PrincipalWithdrawalRequested(msg.sender); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets include amount here
} | ||
|
||
/// Requests principal withdrawal | ||
function requestPrincipalWithdrawal(bytes memory pubkey, uint8 amount) external payable onlyOwnerOrRoles(PRINCIPAL_WITHDRAWAL_ROLE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be an array given that multiple validators will use a OWR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add a batchRequest method as well. For both, principal and rewards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Want to have a think about the contract name, and the name of the two system contracts. Concern about a uint8 knocking around. Think we potentially may need to get smart around the value handling aspect, to ensure we have enough msg.value
to pay the basefee, but also don't overpay or get the eth stuck.
Let me know if the feedback is unclear :)
address public immutable pectraWithdrawalAddress; | ||
address public immutable pectraConsolidationAddress; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
address public immutable pectraWithdrawalAddress; | |
address public immutable pectraConsolidationAddress; | |
address public immutable executionLayerWithdrawalSystemContract; | |
address public immutable consolidationSystemContract; |
People won't remember these by the hardfork they come in with. TBH we might come up with a better name for the contract too.
// solhint-disable-next-line no-empty-blocks | ||
/// clone implementation doesn't use constructor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// solhint-disable-next-line no-empty-blocks | |
/// clone implementation doesn't use constructor | |
/// Sets the system contract addresses for execution layer withdrawals and consolidations. |
|
||
/// emit event when receiving ETH | ||
/// @dev implemented w/i clone bytecode | ||
/* receive() external payable { */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* receive() external payable { */ | |
/* receive() external payable { */ |
Do we not want this address to be payable? I see its commented in OWR too. Certainly no need to emit an event. But wonder would people try and transfer eth to this contract, maybe not having a payable receive or fallback prevents that, idk.
// ;; +--------+--------+ | ||
// ;; 48 48 | ||
|
||
(bool ret,) = pectraConsolidationAddress.call{value: msg.value}(abi.encodePacked(source, target)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(bool ret,) = pectraConsolidationAddress.call{value: msg.value}(abi.encodePacked(source, target)); | |
(bool ret,) = pectraConsolidationAddress.call{value: msg.value}(abi.encodePacked(source, target)); |
Its interesting that the fee will have to be passed as a value to the call, not as like gas costs. This might make it difficult to predict. Does the method return value if we overpay? it doesn't look like it to me. https://github.com/lightclient/sys-asm/blob/main/src/consolidations/main.eas#L51
So maybe we should do a read request of the fee (i think that's possible looking at the assembly), then send only that as msg.value? and then return the remainder to the caller?
|
||
import "forge-std/console.sol"; | ||
|
||
contract PectraWithdrawalMock { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to other places, maybe this should be called an ExecutionLayerWithdrawalSystemContractMock
// +--------+--------+ | ||
// | pubkey | amount | | ||
// +--------+--------+ | ||
// 48 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a stupid question but, are these measured in bits or bytes?
Because uint8, is 8 bits, representing a max number of 255. but is bytes memory pubkey
also measured in bits? or is it measured in bytes? A validator pubkey is 96 hex chars, or 48 byte chars, or 384 bits.
Should amount
be a uint64? which is 8*8bytes. That seems to make more sense for an amount to withdraw than a number from 0-> 255
if ( | ||
(!_rewards && amount < BALANCE_CLASSIFICATION_THRESHOLD) | ||
|| (_rewards && amount >= BALANCE_CLASSIFICATION_THRESHOLD) | ||
) { | ||
if (_rewards) revert InvalidPectraWithdrawal_Rewards(); | ||
else revert InvalidPectraWithdrawal_Principal(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are we trying to achieve here? I feel like this could be simplified, I have a hard time parsing it with an if(and or and)(if/else).
/// @author Obol | ||
/// @notice A factory contract for cheaply deploying | ||
/// OptimisticWithdrawalRecipientPectra. | ||
/// @dev This contract uses token = address(0) to refer to ETH. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// @dev This contract uses token = address(0) to refer to ETH. |
This is a stale comment from when the OWRs supported erc20s, and native eth was indicated by using address(0)
for the token address, right?
owr = OptimisticWithdrawalRecipientPectra(address(owrImpl).clone(data)); | ||
owr.initialize(owner); | ||
|
||
emit CreateOWRecipient(address(owr), recoveryAddress, principalRecipient, rewardRecipient, amountOfPrincipalStake); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we log the owner? (how many things can we include in a log? i thought it was 4, 3 if named, but this has 5 and I'm suggesting a 6th
/// based on threshold to it's recipients | ||
/// @dev Only ETH can be distributed for a given deployment. There is a | ||
/// recovery method for tokens sent by accident. | ||
contract OptimisticWithdrawalRecipientPectra is Clone, OwnableRoles { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contract OptimisticWithdrawalRecipientPectra is Clone, OwnableRoles { | |
contract ControllableWithdrawalRecipient is Clone, OwnableRoles { |
contract OptimisticWithdrawalRecipientPectra is Clone, OwnableRoles { | |
contract EditableWithdrawalRecipient is Clone, OwnableRoles { |
contract OptimisticWithdrawalRecipientPectra is Clone, OwnableRoles { | |
contract ControllableOptimisticWithdrawalRecipient is Clone, OwnableRoles { |
Trying to decide on what name might make the most sense, not convinced people will remember these features by the hardfork they are introduced in. Want to keep the withdrawal recipient suffix. Probably should keep the optimistic piece, to indicate that it optimistically assumes rewards are rewards not worst case slashing. Hoping to incorporate the 'exitable' and 'editable' aspects potentially.
Have a think and maybe run by me what option we go with before you make the changes.
No description provided.