feat[contracts]: Add block/allow and pausing to the L1 Messenger#579
feat[contracts]: Add block/allow and pausing to the L1 Messenger#579
Conversation
🦋 Changeset detectedLatest commit: 78246e1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| ***************/ | ||
|
|
||
| /** | ||
| * Pass a default zero address to the address resolver. This will be updated when initialized. |
There was a problem hiding this comment.
I felt like this comment was slightly misleading, as the constructor is setting nothing in the proxy.
| override | ||
| public | ||
| nonReentrant | ||
| onlyRelayer() |
There was a problem hiding this comment.
I looked elsewhere: using brackets on modifiers with no args was inconsistent with other parts of the code.
| /** | ||
| * Relays a cross domain message to a contract. | ||
| * @inheritdoc iOVM_L1CrossDomainMessenger | ||
| * This function executes a transaction on L1, which was initiated on L2. |
There was a problem hiding this comment.
I brought these doc strings in here from the interface.
There was a problem hiding this comment.
The docs should live in the interface, so let's revert this change.
.../contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol
Show resolved
Hide resolved
.../contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol
Show resolved
Hide resolved
packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_Pausable.sol
Outdated
Show resolved
Hide resolved
packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts
Show resolved
Hide resolved
.../contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol
Show resolved
Hide resolved
.../contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol
Show resolved
Hide resolved
.../contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol
Show resolved
Hide resolved
ben-chain
left a comment
There was a problem hiding this comment.
Looking good, requested a quick additional test.
@K-Ho this code doesn't feel super meaningful to me without removing the onlyRelayer. I feel like we should:
- Make this PR be against the 0.3.0 RC
- Remove the
onlyRelayerandMultiMessageRelayer.
Maybe there's an argument for having 2. in a separate step though?
.../contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol
Show resolved
Hide resolved
.../contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol
Show resolved
Hide resolved
.../contracts/contracts/optimistic-ethereum/OVM/bridge/messaging/OVM_L1CrossDomainMessenger.sol
Outdated
Show resolved
Hide resolved
packages/contracts/contracts/optimistic-ethereum/libraries/utils/Lib_Pausable.sol
Outdated
Show resolved
Hide resolved
packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts
Show resolved
Hide resolved
tynes
left a comment
There was a problem hiding this comment.
So, downgrade to patch?
Yup please downgrade this to patch, we will bump the minor version once for the RLP regenesis
@ben-chain Isn't the |
This is true, although we have had the idea in the past of using the |
I agree that this is a better solution |
|
7192f59 to
88bfc22
Compare
|
I've rebased and squashed the PR, while resolving merge conflicts. Let's try to avoid |
88bfc22 to
36909c9
Compare
ben-chain
left a comment
There was a problem hiding this comment.
This is looking good to me. I have a tiny request to leave a test in, but then I think we'll be good to merge.
packages/contracts/test/contracts/OVM/bridge/base/OVM_L1CrossDomainMessenger.spec.ts
Outdated
Show resolved
Hide resolved
|
Looks like this needs another rebase/squash |
ec46324 to
554e5eb
Compare
There was a problem hiding this comment.
Have you thought about not adding a blockedMessages mapping and instead just writing to successfulMessages? This would save a SLOAD in relayMessage. The name successfulMessages doesn't really make sense anymore if that was the case, it could be something like messages or relayedMessages
There was a problem hiding this comment.
Good question! Yes, it's mentioned in the PR description, and called out inline here.
An important downside IMO is that it changes the trust assumptions significantly, because if we retain the allowMessage() functionality, the owner could delete successfulMessages entries, making messages replayable.
There was a problem hiding this comment.
Agreed that this is not a permission we want to enable.
|
This PR is on |
@tynes Is there any action you would like me to take? :) |
The change requested that I not remove a test. The test was not removed, it was simply relocated to the end of the file: https://github.com/ethereum-optimism/optimism/pull/579/files#diff-b54fbcb912d89d7f34df9c51f5476fa991feafec083c879b83a56b50fc52dd40R446
This is identical to Pausable, except for replacing Context._msgSender() with just msg.sender
This reverts commit 4bbfe60.
fe287a6 to
78246e1
Compare
There was a problem hiding this comment.
Agreed that this is not a permission we want to enable.
* feat(contracts): add pausable.sol This is identical to Pausable, except for replacing Context._msgSender() with just msg.sender * feat: add pause, block and allow to L1 messenger * test(l1-messenger): access control, block, allow * chore: add changeset * chore: yarn lint * test[contracts]: maintain previous test order * fix[contracts]: add upgradable OZ contracts * Revert "test[contracts]: maintain previous test order" This reverts commit 4bbfe60. * test[contracts]: add initializer modifier * fix(contracts): delete unused file Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
* feat(derive): holocene frame queue changes * feat(derive): holocene frame queue * Update crates/derive/src/stages/frame_queue.rs Co-authored-by: clabby <ben@clab.by> * fix(derive): fq nits --------- Co-authored-by: clabby <ben@clab.by>
Description
This PR adds safety functionality to the L1 Messenger:
except with the 'Context._msgSender()` thing removed.Additional context
I think the main design decision worth discussing here is the additional gas cost of needing to SLOAD from the
blockedMessagesmapping on everyrelayMessage()call. The alternative would be to use thesuccessfulMessagesmapping to block messages. The very large downside of that is it gives theownerthe ability to allow a message to be relayed twice (or more).IMO the cost is probably acceptable consider the frequency of use.