Skip to content

Commit

Permalink
Deactivate to send eth in messageBridge function (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
josojo authored Nov 3, 2023
1 parent 5d70866 commit 4c90c6a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion contracts/inheritedMainContracts/PolygonZkEVMBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ contract PolygonZkEVMBridge is
bool forceUpdateGlobalExitRoot,
bytes calldata metadata
) public virtual payable ifNotEmergencyState {
if (msg.value != 0 && !isDeployedOnL2) {
if (msg.value != 0) {
revert MsgValueNotZero();
}
if (
Expand Down
14 changes: 12 additions & 2 deletions test/contracts/bridge.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ describe('PolygonZkEVMBridge Contract - for L2', () => {
const depositCount = await polygonZkEVMBridgeContract.depositCount();
const originNetwork = networkIDMainnet;
const originAddress = deployer.address;
const amount = ethers.utils.parseEther('10');
const amount = ethers.utils.parseEther('0');
const destinationNetwork = networkIDRollup;
const destinationAddress = deployer.address;

Expand Down Expand Up @@ -246,7 +246,7 @@ describe('PolygonZkEVMBridge Contract - for L2', () => {
const depositCount = await polygonZkEVMBridgeContract.depositCount();
const originNetwork = networkIDMainnet;
const tokenAddress = tokenContract.address;
const amount = ethers.utils.parseEther('10');
const amount = ethers.utils.parseEther('0');
const destinationNetwork = networkIDRollup;
const destinationAddress = deployer.address;

Expand Down Expand Up @@ -1193,6 +1193,16 @@ describe('PolygonZkEVMBridge Contract - for L2', () => {
metadata,
)).to.be.revertedWith('AlreadyClaimed');
});
it('should not allow to send message with ether', async () => {
const amount = ethers.utils.parseEther('10');
await expect(polygonZkEVMBridgeContract.bridgeMessage(
networkIDRollup,
ethers.constants.AddressZero,
true,
'0x',
{ value: amount },
)).to.be.revertedWith('MsgValueNotZero()');
});
});

describe('PolygonZkEVMBridge Contract - for L1', () => {
Expand Down

0 comments on commit 4c90c6a

Please sign in to comment.