Skip to content

Commit

Permalink
fix: only ethereum call forwardMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
zkbenny committed Sep 12, 2024
1 parent d8e4c1c commit e893b97
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
26 changes: 9 additions & 17 deletions contracts/Arbitrator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -185,23 +185,15 @@ contract Arbitrator is IArbitrator, OwnableUpgradeable, UUPSUpgradeable, Reentra
bytes calldata _adapterParams
) external payable nonReentrant onlyRelayer {
bytes32 _finalizeMessageHash = keccak256(abi.encode(_value, _callData));
if (_gateway == primaryChainGateway) {
require(_finalizeMessageHash == primaryChainMessageHashQueue.popFront(), "Invalid finalize message hash");
// Unpack destination chain and final callData
(IL1Gateway secondaryChainGateway, bytes memory finalCallData) = abi.decode(_callData, (IL1Gateway, bytes));
require(secondaryChainGateways[secondaryChainGateway], "Invalid secondary chain gateway");
// Forward fee to send message
secondaryChainGateway.sendMessage{value: msg.value + _value}(_value, finalCallData, _adapterParams);
} else {
require(secondaryChainGateways[_gateway], "Not secondary chain gateway");
require(
_finalizeMessageHash == secondaryChainMessageHashQueues[_gateway].popFront(),
"Invalid finalize message hash"
);
// Forward fee to send message
primaryChainGateway.sendMessage{value: msg.value + _value}(_value, _callData, _adapterParams);
}
emit MessageForwarded(_gateway, _value, _callData);
require(secondaryChainGateways[_gateway], "Not secondary chain gateway");
require(
_finalizeMessageHash == secondaryChainMessageHashQueues[_gateway].popFront(),
"Invalid finalize message hash"
);
// Forward fee to send message
IL1Gateway targetGateway = primaryChainGateway;
targetGateway.sendMessage{value: msg.value + _value}(_value, _callData, _adapterParams);
emit MessageForwarded(targetGateway, _value, _callData);
}

function claimMessage(
Expand Down
2 changes: 1 addition & 1 deletion examples/zklinkNova/scripts/sendRawTx.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ task('sendRawTx', 'Send raw tx to nova')
to,
data,
value,
gasPrice
gasPrice,
});
console.log(`The tx hash: ${tx.hash}`);
const txReceipt = await tx.wait(1);
Expand Down

0 comments on commit e893b97

Please sign in to comment.