Skip to content

Commit

Permalink
merge hyperchain and statediff hash
Browse files Browse the repository at this point in the history
  • Loading branch information
vladenysiuk committed May 29, 2024
1 parent 68f6074 commit a28a65d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
5 changes: 4 additions & 1 deletion system-contracts/contracts/Compressor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ contract Compressor is ICompressor, ISystemContract {
uint256 _numberOfStateDiffs,
uint256 _enumerationIndexSize,
bytes calldata _stateDiffs,
bytes calldata _compressedStateDiffs
bytes calldata _compressedStateDiffs,
bytes memory _hyperchainData
) external onlyCallFrom(address(L1_MESSENGER_CONTRACT)) returns (bytes32 stateDiffHash) {
// We do not enforce the operator to use the optimal, i.e. the minimally possible _enumerationIndexSize.
// We do enforce however, that the _enumerationIndexSize is not larger than 8 bytes long, which is the
Expand Down Expand Up @@ -187,6 +188,8 @@ contract Compressor is ICompressor, ISystemContract {
require(stateDiffPtr == _compressedStateDiffs.length, "Extra data in _compressedStateDiffs");

stateDiffHash = EfficientCall.keccak(_stateDiffs);
bytes32 hyperchainHash = keccak256(_hyperchainData);
stateDiffHash = keccak256(abi.encode(stateDiffHash,hyperchainHash));
}

/// @notice Decode the raw compressed data into the dictionary and the encoded data.
Expand Down
10 changes: 3 additions & 7 deletions system-contracts/contracts/L1Messenger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,7 @@ contract L1Messenger is IL1Messenger, ISystemContract {
function publishPubdataAndClearState(
bytes calldata _totalL2ToL1PubdataAndStateDiffs
) external onlyCallFromBootloader {
// Send hyperchain batches
SystemContractHelper.toL1(
true,
bytes32(uint256(SystemLogKey.HYPERCHAIN_PUBDATA_KEY)),
keccak256(BATCH_AGGREGATOR.returnBatchesAndClearState())
);


uint256 calldataPtr = 0;

Expand Down Expand Up @@ -313,7 +308,8 @@ contract L1Messenger is IL1Messenger, ISystemContract {
numberOfStateDiffs,
enumerationIndexSize,
stateDiffs,
compressedStateDiffs
compressedStateDiffs,
BATCH_AGGREGATOR.returnBatchesAndClearState()
);
//

Expand Down
3 changes: 2 additions & 1 deletion system-contracts/contracts/interfaces/ICompressor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface ICompressor {
uint256 _numberOfStateDiffs,
uint256 _enumerationIndexSize,
bytes calldata _stateDiffs,
bytes calldata _compressedStateDiffs
bytes calldata _compressedStateDiffs,
bytes memory _hyperchainData
) external returns (bytes32 stateDiffHash);
}

0 comments on commit a28a65d

Please sign in to comment.