-
Notifications
You must be signed in to change notification settings - Fork 193
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
Solid IStakingModule
interface
#574
Solid IStakingModule
interface
#574
Conversation
activeValidatorsKeysCount = depositedSigningKeysCount - exitedValidatorsCount; | ||
readyToDepositValidatorsKeysCount = vettedSigningKeysCount - depositedSigningKeysCount; | ||
bytes memory validatorsReportEncoded = abi.encode( | ||
uint256(totalSigningKeysStats.exitedSigningKeysCount), |
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.
the cast is prob not needed here as ABI encoder pads anything to 32 bytes anyway
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.
Changed the encoding a bit. Now it just returns the struct from the memory instead of slicing it from the abi.encode()
result.
// uint256 totalStuck; | ||
// uint256 totalRefunded; | ||
// uint256 targetLimit; | ||
// uint256 excessCount; |
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 is excessCount
? can it be calc from the other values?
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.
It's a new field introduced by #557 PR. According to the description: "excess validators count for operator that will be forced to exit"
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 thought it's done via targetLimit
, prob I'm misunderstanding smth
// struct ValidatorsReport { | ||
// uint256 totalExited; | ||
// uint256 totalDeposited; | ||
// uint256 totalVetted; |
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 see an inconsistency in naming totalVetted
vs targetLimit
. maybe currentLimit
and targetLimit
?
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.
Such naming was introduced in the #557 PR and was preserved for consistency.
0 // targetLimit | ||
); | ||
assembly { | ||
return(add(validatorsReportEncoded, 32), mul(32, 7)) |
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.
a comment explaining the magic is needed here
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.
Added comment with an explanation of what data is returned
0 // targetLimit | ||
); | ||
assembly { | ||
return(add(validatorsReportEncoded, 32), mul(32, 7)) |
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.
a comment explaining the magic is needed here
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.
Added comment with an explanation of what data is returned
/// 4. a node operator was activated/deactivated | ||
function getValidatorsKeysNonce() external view returns (uint256) { | ||
/// 5. a node operator's validator(s) is used for the deposit | ||
function getDepositsDataNonce() external view returns (uint256) { |
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.
the commonly used term is "deposit data", in the singular form
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'd rename to getDepositNonce()
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.
Renamed to getDepositNonce()
/// 1. a node operator's key(s) is added | ||
/// 2. a node operator's key(s) is removed | ||
/// 3. a node operator's ready to deposit keys count is changed | ||
/// 1. a node operator's validator(s) is added |
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.
validator => deposit data
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.
Fixed
…-staking-module-interface
/// 5. a node operator's key(s) is used for the deposit | ||
function getValidatorsKeysNonce() external view returns (uint256); | ||
/// 5. a node operator's deposit data is used for the deposit | ||
function getDepositNonce() external view returns (uint256); |
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.
getNonce()
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.
Nonce MUST change in any changes in validator deposit data set
uint256 totalExited; | ||
uint256 totalDeposited; | ||
uint256 totalVetted; | ||
uint256 totalStuck; |
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.
stuck
uint256 totalDeposited; | ||
uint256 totalVetted; | ||
uint256 totalStuck; | ||
uint256 totalRefunded; |
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.
refunded
uint256 totalStuck; | ||
uint256 totalRefunded; | ||
uint256 targetLimit; | ||
uint256 excessCount; |
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.
overlimit?
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 thought it's over-limit but from what I've been told it cannot be calculated as deposited - targetLimit
(which the overLimit
name would imply). and if I'm wrong and it can I'd remove the field altogether
/// @return number of exited validators across all node operators | ||
function updateExitedValidatorsKeysCount( | ||
function updateExitedValidatorsCount( |
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.
also add updateRefundedValidators
/// @notice Called by StakingRouter after oracle finishes updating exited keys counts for all operators. | ||
function finishUpdatingExitedValidatorsKeysCount() external; | ||
/// @notice Called by StakingRouter after oracle finishes updating exited validators counts for all operators. | ||
function finishUpdatingExitedValidatorsCount() external; |
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.
finishUpdatingNodeOperatorsData()
onNodeOperatorsDataFinalized()
/// @notice Invalidates all unused validators keys for all node operators | ||
function invalidateReadyToDepositKeys() external; | ||
/// @notice Invalidates all unused validators for all node operators | ||
function invalidateDepositData() external; |
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.
rename somehow
bytes memory signatures | ||
); | ||
|
||
event DepositNonceChanged(uint256 depositNonce); |
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.
event StakingModuleNonceChanged(uint256 depositNonce);
struct ValidatorsReport { | ||
uint256 totalExited; | ||
uint256 totalDeposited; | ||
uint256 totalVetted; |
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.
depositable
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.
that's not correct, though. a key that's already deposited is counted towards totalVetted
but is not depositable
…-staking-module-interface
…-staking-module-interface
/// @param _refundedValidatorsCount New number of refunded validators of the node operator | ||
function updateRefundedValidatorsCount(uint256 _nodeOperatorId, uint256 _refundedValidatorsCount) external { | ||
_onlyExistedNodeOperator(_nodeOperatorId); | ||
_auth(STAKING_ROUTER_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.
need a lever from StakingRouter
@@ -507,7 +505,8 @@ contract NodeOperatorsRegistry is AragonApp, Versioned { | |||
emit RefundedValidatorsCountChanged(_nodeOperatorId, _refundedValidatorsCount); | |||
} | |||
|
|||
function invalidateReadyToDepositKeys() external { | |||
/// @notice Invalidates all unused validators for all node operators | |||
function onWithdrawalCredentialsChanged() external { | |||
uint256 operatorsCount = getNodeOperatorsCount(); | |||
if (operatorsCount > 0) { | |||
invalidateReadyToDepositKeysRange(0, operatorsCount - 1); |
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.
DepositData?
contracts/0.8.9/StakingRouter.sol
Outdated
|
||
// FIXME: get current value from the staking module | ||
uint256 nodeOpStuckKeysCount; | ||
(,,uint256 stuckValidatorsCount,,,uint256 totalExitedValidatorsCount,,) = |
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 add /* varName */
placeholders
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.
hooray 👍
Main changes in the
IStakingModule
interface:Solidity's structs are used for return values. In the contracts with the(Back to tuples)0.4.24
Solidity version returned struct is encoded using assembly.__Keys__
suffix in the method and variable names was removed.