Skip to content

Commit

Permalink
fix(protocol): fix and improve CrossChainSynced event (#15202)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Wang <dong77@gmail.com>
  • Loading branch information
dantaik and dong77 authored Nov 14, 2023
1 parent 716644f commit c124fcb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
14 changes: 10 additions & 4 deletions packages/protocol/contracts/L1/libs/LibVerifying.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ library LibVerifying {
);

event CrossChainSynced(
uint64 indexed srcHeight, bytes32 blockHash, bytes32 signalRoot
uint64 indexed syncedInBlock,
uint64 indexed blockId,
bytes32 blockHash,
bytes32 signalRoot
);

// Warning: Any errors defined here must also be defined in TaikoErrors.sol.
Expand Down Expand Up @@ -222,8 +225,8 @@ library LibVerifying {
blockId: blockId,
assignedProver: blk.assignedProver,
prover: ts.prover,
blockHash: ts.blockHash,
signalRoot: ts.signalRoot,
blockHash: blockHash,
signalRoot: signalRoot,
tier: ts.tier,
contestations: ts.contestations
});
Expand All @@ -244,7 +247,10 @@ library LibVerifying {
.sendSignal(signalRoot);

emit CrossChainSynced(
lastVerifiedBlockId, blockHash, signalRoot
uint64(block.number),
lastVerifiedBlockId,
blockHash,
signalRoot
);
}
}
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 @@ -134,7 +134,7 @@ contract TaikoL2 is Ownable2StepUpgradeable, TaikoL2Signer, ICrossChainSync {
// allow for multi-hop bridging.
ISignalService(signalService).sendSignal(l1SignalRoot);
emit CrossChainSynced(
l1Height, uint64(block.number), l1BlockHash, l1SignalRoot
uint64(block.number), l1Height, l1BlockHash, l1SignalRoot
);

// Update state variables
Expand Down
8 changes: 4 additions & 4 deletions packages/protocol/contracts/common/ICrossChainSync.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ interface ICrossChainSync {
}

/// @dev Emitted when a block has been synced across chains.
/// @param remoteBlockId The ID of the remote block whose block hash and
/// signal root are synced.
/// @param syncedInBlock The ID of this chain's block where the sync
/// happened.
/// @param blockId The ID of the remote block whose block hash and
/// signal root are synced.
/// @param blockHash The hash of the synced block.
/// @param signalRoot The root hash representing cross-chain signals.
event CrossChainSynced(
uint64 indexed remoteBlockId,
uint64 syncedInBlock,
uint64 indexed syncedInBlock,
uint64 indexed blockId,
bytes32 blockHash,
bytes32 signalRoot
);
Expand Down

0 comments on commit c124fcb

Please sign in to comment.