Disallow relayMessage to L2 to L1 Message Passer#360
Conversation
fbb2240 to
c6fc5bc
Compare
| public | ||
| { | ||
| require(transactionContext.ovmNUMBER == 0, "Only be callable at the start of a transaction"); | ||
| require(transactionContext.ovmNUMBER == 0, "Only callable at the start of a transaction"); |
There was a problem hiding this comment.
Sneaking in a fix to this error message that has been bothering me for a while.
| * via this contract's replay function. | ||
| * @dev The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages from L2 onto L1. | ||
| * In the event that a message sent from L1 to L2 is rejected for exceeding the L2 epoch gas limit, it can be resubmitted | ||
| * via this contract's replay function. |
There was a problem hiding this comment.
Lots of whitespace fixes in this PR from the recently added editorConfig file.
| // a call from any L2 account. | ||
| if(_target == resolve("OVM_L2ToL1MessagePasser")){ | ||
| // Write to the successfulMessages mapping and return immediately. | ||
| successfulMessages[xDomainCalldataHash] = true; |
There was a problem hiding this comment.
One could argue against calling this a 'successful message', but I think preventing future attempts to relay it is the right move.
c6fc5bc to
c2d8b0d
Compare
This change prevents call spoofing on L2. Adds a test based on logs and successfulMessages mapping.
c2d8b0d to
ca563f4
Compare
| const logs = ( | ||
| await Mock__OVM_L2ToL1MessagePasser.provider.getTransactionReceipt( | ||
| (await resProm).hash | ||
| ) | ||
| ).logs | ||
| expect(logs).to.deep.equal([]) |
There was a problem hiding this comment.
This check is an indirect way of verifying that "no call was made to the Message Passer", I would have preferred to use Mock__OVM_L2ToL1MessagePasser.smocked.passMessageToL1.calls.length === 0, but smock doesn't actually handle the case where no calls are made to a function. I spend some time on a fix, but other tests broke, so I went with this.
872c98f to
54d138e
Compare
| // a call from any L2 account. | ||
| if(_target == resolve("OVM_L2ToL1MessagePasser")){ | ||
| // Write to the successfulMessages mapping and return immediately. | ||
| successfulMessages[xDomainCalldataHash] = true; |
This change prevents call spoofing on L2.
Adds a test based on logs and successfulMessages mapping.