Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
gpsanant committed Sep 18, 2024
1 parent cc64c85 commit 6f8f89c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/contracts/core/StakeRootCompendium.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ contract StakeRootCompendium is StakeRootCompendiumStorage {

stakeRootSubmissions.push(StakeRootSubmission({
calculationTimestamp: 0,
submissionTimestamp: uint32(block.timestamp),
stakeRoot: bytes32(0),
confirmed: false
}));
Expand Down Expand Up @@ -205,6 +206,7 @@ contract StakeRootCompendium is StakeRootCompendiumStorage {
);
stakeRootSubmissions.push(StakeRootSubmission({
calculationTimestamp: uint32(calculationTimestamp),
submissionTimestamp: uint32(block.timestamp),
stakeRoot: stakeRoot,
confirmed: false
}));
Expand Down Expand Up @@ -500,7 +502,6 @@ contract StakeRootCompendium is StakeRootCompendiumStorage {
/// @inheritdoc IStakeRootCompendium
function getOperatorSetRoot(
OperatorSet calldata operatorSet,
address[] calldata operators,
OperatorLeaf[] calldata operatorLeaves
) external view returns (bytes32) {
require(
Expand All @@ -514,11 +515,11 @@ contract StakeRootCompendium is StakeRootCompendiumStorage {

uint256 totalDelegatedStake;
uint256 totalSlashableStake;
address prevOperator;
bytes32 prevExtraData;
bytes32[] memory operatorLeavesHashes = new bytes32[](operatorLeaves.length);
for (uint256 i = 0; i < operatorLeaves.length; i++) {
require(uint160(prevOperator) < uint160(operators[i]), "AVSSyncTree.getOperatorSetRoot: operators not sorted");
prevOperator = operators[i];
require(uint256(prevExtraData) < uint256(operatorLeaves[i].extraData), "StakeRootCompendium.getOperatorSetRoot: extraData not sorted");
prevExtraData = operatorLeaves[i].extraData;

operatorLeavesHashes[i] = keccak256(
abi.encodePacked(
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/interfaces/IStakeRootCompendium.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ interface IStakeRootCompendium {
struct StakeRootSubmission {
bytes32 stakeRoot;
uint32 calculationTimestamp; // the timestamp of the state the stakeRoot was calculated against
uint32 submissionTimestamp; // the timestamp of the submission
bool confirmed; // whether the rootConfimer has confirmed the root
}

Expand Down Expand Up @@ -96,12 +97,11 @@ interface IStakeRootCompendium {
/**
* @notice Returns the operatorSet root for the given operatorSet with the given witnesses
* @param operatorSet the operatorSet to calculate the operator set root for
* @param operators the operators in the operatorSet
* @param operatorLeaves the operator leaves in the operatorSet
* @dev leaves must be sorted by extraData
*/
function getOperatorSetRoot(
OperatorSet calldata operatorSet,
address[] calldata operators,
OperatorLeaf[] calldata operatorLeaves
) external view returns (bytes32);

Expand Down

0 comments on commit 6f8f89c

Please sign in to comment.