Skip to content

Commit

Permalink
refactor(protocol): remove unnecessary field from events (#13190)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored Feb 21, 2023
1 parent ecb846f commit a40a1b6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 28 deletions.
6 changes: 1 addition & 5 deletions packages/protocol/contracts/L1/TaikoEvents.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ abstract contract TaikoEvents {
// The following events must match the definitions in other V1 libraries.
event BlockVerified(uint256 indexed id, bytes32 blockHash);

event BlockCommitted(
uint64 commitSlot,
uint64 commitHeight,
bytes32 commitHash
);
event BlockCommitted(uint64 commitSlot, bytes32 commitHash);

event BlockProposed(uint256 indexed id, TaikoData.BlockMetadata meta);

Expand Down
12 changes: 2 additions & 10 deletions packages/protocol/contracts/L1/libs/LibProposing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ library LibProposing {
using LibUtils for TaikoData.BlockMetadata;
using LibUtils for TaikoData.State;

event BlockCommitted(
uint64 commitSlot,
uint64 commitHeight,
bytes32 commitHash
);
event BlockCommitted(uint64 commitSlot, bytes32 commitHash);
event BlockProposed(uint256 indexed id, TaikoData.BlockMetadata meta);

error L1_METADATA_FIELD();
Expand Down Expand Up @@ -54,11 +50,7 @@ library LibProposing {

state.commits[msg.sender][commitSlot] = hash;

emit BlockCommitted({
commitSlot: commitSlot,
commitHeight: uint64(block.number),
commitHash: commitHash
});
emit BlockCommitted({commitSlot: commitSlot, commitHash: commitHash});
}

function proposeBlock(
Expand Down
10 changes: 3 additions & 7 deletions packages/protocol/contracts/L1/libs/LibVerifying.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ library LibVerifying {

event BlockVerified(uint256 indexed id, bytes32 blockHash);

event HeaderSynced(
uint256 indexed height,
uint256 indexed srcHeight,
bytes32 srcHash
);
event HeaderSynced(uint256 indexed srcHeight, bytes32 srcHash);

error L1_HALTED();
error L1_0_FEE_BASE();
Expand All @@ -44,7 +40,7 @@ library LibVerifying {
state.l2Hashes[0] = genesisBlockHash;

emit BlockVerified(0, genesisBlockHash);
emit HeaderSynced(block.number, 0, genesisBlockHash);
emit HeaderSynced(0, genesisBlockHash);
}

function verifyBlocks(
Expand Down Expand Up @@ -120,7 +116,7 @@ library LibVerifying {
state.l2Hashes[
latestL2Height % config.blockHashHistory
] = latestL2Hash;
emit HeaderSynced(block.number, latestL2Height, latestL2Hash);
emit HeaderSynced(latestL2Height, latestL2Hash);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/contracts/L2/TaikoL2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ contract TaikoL2 is AddressResolver, ReentrancyGuard, IHeaderSync {

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

/**
Expand Down
6 changes: 1 addition & 5 deletions packages/protocol/contracts/common/IHeaderSync.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ pragma solidity ^0.8.18;
* @author dantaik <[email protected]>
*/
interface IHeaderSync {
event HeaderSynced(
uint256 indexed height,
uint256 indexed srcHeight,
bytes32 srcHash
);
event HeaderSynced(uint256 indexed srcHeight, bytes32 srcHash);

function getSyncedHeader(uint256 number) external view returns (bytes32);

Expand Down

0 comments on commit a40a1b6

Please sign in to comment.