Skip to content

Commit

Permalink
chore(protocol): avoid transfer to self in assignment hook (#16696)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored Apr 9, 2024
1 parent 977b5cb commit b3b32b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/protocol/contracts/L1/TaikoData.sol
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ library TaikoData {
}

/// @dev Struct containing data required for verifying a block.
/// 10 slots reserved for upgradability, 3 slots used.
/// 3 slots used.
struct Block {
bytes32 metaHash; // slot 1
address assignedProver; // slot 2
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/contracts/L1/hooks/AssignmentHook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ contract AssignmentHook is EssentialContract, IHook {
// The proposer irrevocably pays a fee to the assigned prover, either in
// Ether or ERC20 tokens.
if (assignment.feeToken == address(0)) {
// Paying Ether
// Paying Ether even when proverFee is 0 to trigger a potential receive() function call.
// Note that this payment may fail if it cost more gas
bool success = _blk.assignedProver.sendEther(proverFee, MAX_GAS_PAYING_PROVER, "");
if (!success) emit EtherPaymentFailed(_blk.assignedProver, MAX_GAS_PAYING_PROVER);
} else if (proverFee != 0) {
} else if (proverFee != 0 && _meta.sender != _blk.assignedProver) {
// Paying ERC20 tokens
IERC20(assignment.feeToken).safeTransferFrom(
_meta.sender, _blk.assignedProver, proverFee
Expand Down

0 comments on commit b3b32b5

Please sign in to comment.