Skip to content

Commit

Permalink
fix: store latest block number
Browse files Browse the repository at this point in the history
  • Loading branch information
0xOneTony committed Nov 21, 2023
1 parent 3c8e46f commit b9ebca1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions solidity/contracts/StorageMirrorRootRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ contract StorageMirrorRootRegistry is IStorageMirrorRootRegistry {
*/
bytes32 public latestVerifiedStorageMirrorStorageRoot;

/**
* @notice The latest verified block number of the Home chain
*/
uint256 public latestVerifiedBlockNumber;

constructor(address _storageMirror, IVerifierModule _verifierModule, IBlockHeaderOracle _blockHeaderOracle) {
STORAGE_MIRROR = _storageMirror;
VERIFIER_MODULE = _verifierModule;
Expand All @@ -49,6 +54,7 @@ contract StorageMirrorRootRegistry is IStorageMirrorRootRegistry {
VERIFIER_MODULE.extractStorageMirrorStorageRoot(_blockHeader, _accountProof);

latestVerifiedStorageMirrorStorageRoot = _latestVerifiedStorageMirrorStorageRoot;
latestVerifiedBlockNumber = _blockNumber;

emit VerifiedStorageMirrorStorageRoot(_blockNumber, latestVerifiedStorageMirrorStorageRoot);
}
Expand Down
6 changes: 6 additions & 0 deletions solidity/interfaces/IStorageMirrorRootRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ interface IStorageMirrorRootRegistry {
*/
function BLOCK_HEADER_ORACLE() external view returns (IBlockHeaderOracle _blockHeaderOracle);

/**
* @notice The latest verified block number of the Home chain
* @return _latestVerifiedBlockNumber The latest verified block number of the Home chain
*/
function latestVerifiedBlockNumber() external view returns (uint256 _latestVerifiedBlockNumber);

/**
* @notice The latest verified storage root of the StorageMirror contract in Home chain
* @return _latestVerifiedStorageMirrorStorageRoot The latest verified storage root of the StorageMirror contract in Home chain
Expand Down

0 comments on commit b9ebca1

Please sign in to comment.