Skip to content

Commit

Permalink
feat(protocol): improve sync header storage on L2 (#13041)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed Jan 25, 2023
1 parent 6f6cff0 commit 86c9fe4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/protocol/contracts/L2/TaikoL2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ contract TaikoL2 is AddressResolver, ReentrancyGuard, IHeaderSync {
mapping(uint256 => bytes32) private l2Hashes;
mapping(uint256 => bytes32) private l1Hashes;
bytes32 public publicInputHash;
bytes32 public latestSyncedHeader;
uint256 public latestSyncedL1Height;

uint256[46] private __gap;

Expand Down Expand Up @@ -79,8 +79,8 @@ contract TaikoL2 is AddressResolver, ReentrancyGuard, IHeaderSync {
_checkPublicInputs();
}

latestSyncedL1Height = l1Height;
l1Hashes[l1Height] = l1Hash;
latestSyncedHeader = l1Hash;
emit HeaderSynced(block.number, l1Height, l1Hash);
}

Expand Down Expand Up @@ -140,7 +140,7 @@ contract TaikoL2 is AddressResolver, ReentrancyGuard, IHeaderSync {
}

function getLatestSyncedHeader() public view override returns (bytes32) {
return latestSyncedHeader;
return l1Hashes[latestSyncedL1Height];
}

function getBlockHash(uint256 number) public view returns (bytes32) {
Expand Down

0 comments on commit 86c9fe4

Please sign in to comment.