diff --git a/packages/protocol/contracts/L1/TaikoEvents.sol b/packages/protocol/contracts/L1/TaikoEvents.sol index a0d6cb864a..8b62a08ab0 100644 --- a/packages/protocol/contracts/L1/TaikoEvents.sol +++ b/packages/protocol/contracts/L1/TaikoEvents.sol @@ -10,7 +10,7 @@ import {TaikoData} from "./TaikoData.sol"; abstract contract TaikoEvents { // The following events must match the definitions in corresponding L1 libraries. - event BlockProposed(uint256 indexed id, TaikoData.BlockMetadata meta); + event BlockProposed(uint256 indexed id, TaikoData.BlockMetadata meta, uint64 blockFee); event BlockProven( uint256 indexed id, @@ -21,7 +21,7 @@ abstract contract TaikoEvents { uint32 parentGasUsed ); - event BlockVerified(uint256 indexed id, bytes32 blockHash); + event BlockVerified(uint256 indexed id, bytes32 blockHash, uint64 reward); event EthDeposited(TaikoData.EthDeposit deposit); diff --git a/packages/protocol/contracts/L1/libs/LibProposing.sol b/packages/protocol/contracts/L1/libs/LibProposing.sol index 056e3996f7..794d34692d 100644 --- a/packages/protocol/contracts/L1/libs/LibProposing.sol +++ b/packages/protocol/contracts/L1/libs/LibProposing.sol @@ -20,7 +20,7 @@ library LibProposing { using LibAddress for address payable; using LibUtils for TaikoData.State; - event BlockProposed(uint256 indexed id, TaikoData.BlockMetadata meta); + event BlockProposed(uint256 indexed id, TaikoData.BlockMetadata meta, uint64 blockFee); error L1_BLOCK_ID(); error L1_INSUFFICIENT_TOKEN(); @@ -78,17 +78,18 @@ library LibProposing { blk.metaHash = LibUtils.hashMetadata(meta); blk.proposer = msg.sender; - if (state.taikoTokenBalances[msg.sender] < state.blockFee) { + uint64 blockFee = state.blockFee; + if (state.taikoTokenBalances[msg.sender] < blockFee) { revert L1_INSUFFICIENT_TOKEN(); } unchecked { - state.taikoTokenBalances[msg.sender] -= state.blockFee; - state.accBlockFees += state.blockFee; + state.taikoTokenBalances[msg.sender] -= blockFee; + state.accBlockFees += blockFee; state.accProposedAt += meta.timestamp; } - emit BlockProposed(state.numBlocks, meta); + emit BlockProposed(state.numBlocks, meta, blockFee); unchecked { ++state.numBlocks; } diff --git a/packages/protocol/contracts/L1/libs/LibVerifying.sol b/packages/protocol/contracts/L1/libs/LibVerifying.sol index 57042b16a5..aa9f93a471 100644 --- a/packages/protocol/contracts/L1/libs/LibVerifying.sol +++ b/packages/protocol/contracts/L1/libs/LibVerifying.sol @@ -18,7 +18,7 @@ library LibVerifying { using SafeCastUpgradeable for uint256; using LibUtils for TaikoData.State; - event BlockVerified(uint256 indexed id, bytes32 blockHash); + event BlockVerified(uint256 indexed id, bytes32 blockHash, uint64 reward); event CrossChainSynced(uint256 indexed srcHeight, bytes32 blockHash, bytes32 signalRoot); @@ -65,7 +65,7 @@ library LibVerifying { fc.blockHash = genesisBlockHash; fc.provenAt = timeNow; - emit BlockVerified(0, genesisBlockHash); + emit BlockVerified(0, genesisBlockHash, 0); } function verifyBlocks( @@ -183,6 +183,6 @@ library LibVerifying { blk.nextForkChoiceId = 1; blk.verifiedForkChoiceId = fcId; - emit BlockVerified(blk.blockId, fc.blockHash); + emit BlockVerified(blk.blockId, fc.blockHash, reward); } } diff --git a/packages/website/pages/docs/reference/contract-documentation/L1/TaikoEvents.md b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoEvents.md index c5b4964c07..1f0ea94cc1 100644 --- a/packages/website/pages/docs/reference/contract-documentation/L1/TaikoEvents.md +++ b/packages/website/pages/docs/reference/contract-documentation/L1/TaikoEvents.md @@ -7,7 +7,7 @@ title: TaikoEvents ### BlockProposed ```solidity -event BlockProposed(uint256 id, struct TaikoData.BlockMetadata meta) +event BlockProposed(uint256 id, struct TaikoData.BlockMetadata meta, uint64 blockFee) ``` ### BlockProven @@ -19,7 +19,7 @@ event BlockProven(uint256 id, bytes32 parentHash, bytes32 blockHash, bytes32 sig ### BlockVerified ```solidity -event BlockVerified(uint256 id, bytes32 blockHash) +event BlockVerified(uint256 id, bytes32 blockHash, uint64 reward) ``` ### EthDeposited