From c124fcb759bb1917df3dd709e5e358945b48ac7b Mon Sep 17 00:00:00 2001 From: Daniel Wang <99078276+dantaik@users.noreply.github.com> Date: Tue, 14 Nov 2023 09:29:43 +0300 Subject: [PATCH] fix(protocol): fix and improve CrossChainSynced event (#15202) Co-authored-by: Daniel Wang --- .../protocol/contracts/L1/libs/LibVerifying.sol | 14 ++++++++++---- packages/protocol/contracts/L2/TaikoL2.sol | 2 +- .../protocol/contracts/common/ICrossChainSync.sol | 8 ++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/protocol/contracts/L1/libs/LibVerifying.sol b/packages/protocol/contracts/L1/libs/LibVerifying.sol index 16a0e85238..717d1fd736 100644 --- a/packages/protocol/contracts/L1/libs/LibVerifying.sol +++ b/packages/protocol/contracts/L1/libs/LibVerifying.sol @@ -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. @@ -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 }); @@ -244,7 +247,10 @@ library LibVerifying { .sendSignal(signalRoot); emit CrossChainSynced( - lastVerifiedBlockId, blockHash, signalRoot + uint64(block.number), + lastVerifiedBlockId, + blockHash, + signalRoot ); } } diff --git a/packages/protocol/contracts/L2/TaikoL2.sol b/packages/protocol/contracts/L2/TaikoL2.sol index 28c9a0331c..facafa388f 100644 --- a/packages/protocol/contracts/L2/TaikoL2.sol +++ b/packages/protocol/contracts/L2/TaikoL2.sol @@ -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 diff --git a/packages/protocol/contracts/common/ICrossChainSync.sol b/packages/protocol/contracts/common/ICrossChainSync.sol index 05c53e95cc..f491e15cf7 100644 --- a/packages/protocol/contracts/common/ICrossChainSync.sol +++ b/packages/protocol/contracts/common/ICrossChainSync.sol @@ -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 );