-
Notifications
You must be signed in to change notification settings - Fork 191
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
More efficient accounting oracle #589
More efficient accounting oracle #589
Conversation
if (itemType == EXTRA_DATA_TYPE_EXITED_VALIDATORS || | ||
itemType == EXTRA_DATA_TYPE_STUCK_VALIDATORS | ||
) { | ||
_processExtraDataItem(data, iter); | ||
} else { | ||
revert UnsupportedExtraDataType(index, itemType); | ||
} |
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.
_processExtraDataItem
handles specific two item types, this may not be flexible enough. Not sure if solidity allows it, but something like this might be more flexible and improve the semantics:
if (itemType == EXTRA_DATA_TYPE_EXITED_VALIDATORS) {
(uint256 moduleId, bytes calldata nodeOpIds, bytes calldata valsCounts) = _extractKeysCounts(data, iter);
IStakingRouter(iter.stakingRouter)
.reportStakingModuleExitedKeysCountByNodeOperator(moduleId, nodeOpIds, valsCounts);
} else if (itemType == EXTRA_DATA_TYPE_STUCK_VALIDATORS) {
(uint256 moduleId, bytes calldata nodeOpIds, bytes calldata valsCounts) = _extractKeysCounts(data, iter);
IStakingRouter(iter.stakingRouter)
.reportStakingModuleStuckKeysCountByNodeOperator(moduleId, nodeOpIds, valsCounts);
} else {
revert UnsupportedExtraDataType(index, itemType);
}
- rename
_processExtraDataItem
into something more specific that performs the key extraction, like_extractKeysCounts
- move Staking Router methods calls from
_extractKeysCounts
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.
yeah, this structuring would be better, and Solidity allows this. I'll try finding time to improve as you suggested
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.
Thank you 🚀
Gonna be the most efficient way of passing data 💯
Avoids non-trivial processing of exited/stuck validators report data in the accounting oracle by using
bytes
packing in the Staking Router's methods that receive the data from the oracle.Gets rid of the hardly-explainable and non-semantical
extraDataMaxNodeOpsCountByModule
report field.ResizableArray
is not needed anymore.Should be significantly more gas-efficient than the current impl.