Skip to content

Commit b3b32b5

Browse files
authored
chore(protocol): avoid transfer to self in assignment hook (#16696)
1 parent 977b5cb commit b3b32b5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/protocol/contracts/L1/TaikoData.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ library TaikoData {
110110
}
111111

112112
/// @dev Struct containing data required for verifying a block.
113-
/// 10 slots reserved for upgradability, 3 slots used.
113+
/// 3 slots used.
114114
struct Block {
115115
bytes32 metaHash; // slot 1
116116
address assignedProver; // slot 2

packages/protocol/contracts/L1/hooks/AssignmentHook.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ contract AssignmentHook is EssentialContract, IHook {
118118
// The proposer irrevocably pays a fee to the assigned prover, either in
119119
// Ether or ERC20 tokens.
120120
if (assignment.feeToken == address(0)) {
121-
// Paying Ether
121+
// Paying Ether even when proverFee is 0 to trigger a potential receive() function call.
122122
// Note that this payment may fail if it cost more gas
123123
bool success = _blk.assignedProver.sendEther(proverFee, MAX_GAS_PAYING_PROVER, "");
124124
if (!success) emit EtherPaymentFailed(_blk.assignedProver, MAX_GAS_PAYING_PROVER);
125-
} else if (proverFee != 0) {
125+
} else if (proverFee != 0 && _meta.sender != _blk.assignedProver) {
126126
// Paying ERC20 tokens
127127
IERC20(assignment.feeToken).safeTransferFrom(
128128
_meta.sender, _blk.assignedProver, proverFee

0 commit comments

Comments
 (0)