Skip to content

Commit

Permalink
Resolve conflicts; Semver bump; Changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
clabby committed Feb 17, 2023
1 parent f5af70d commit 9907214
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-mangos-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/contracts-bedrock': minor
---

Change the `relayMessage` reentrancy guard in the XDMs to be per-message.
2 changes: 1 addition & 1 deletion op-bindings/bindings/l1crossdomainmessenger.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion op-bindings/bindings/l2crossdomainmessenger.go

Large diffs are not rendered by default.

33 changes: 17 additions & 16 deletions packages/contracts-bedrock/.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,23 @@ L1BlockNumberTest:test_getL1BlockNumber_succeeds() (gas: 10603)
L1BlockNumberTest:test_receive_succeeds() (gas: 25340)
L1CrossDomainMessenger_Test:test_messageVersion_succeeds() (gas: 24781)
L1CrossDomainMessenger_Test:test_pause_callerIsNotOwner_reverts() (gas: 24517)
L1CrossDomainMessenger_Test:test_pause_succeeds() (gas: 52942)
L1CrossDomainMessenger_Test:test_relayMessage_legacyOldReplay_reverts() (gas: 56574)
L1CrossDomainMessenger_Test:test_relayMessage_legacyRetryAfterFailureThenSuccess_reverts() (gas: 212474)
L1CrossDomainMessenger_Test:test_relayMessage_legacyRetryAfterFailure_succeeds() (gas: 203204)
L1CrossDomainMessenger_Test:test_relayMessage_legacyRetryAfterSuccess_reverts() (gas: 126420)
L1CrossDomainMessenger_Test:test_relayMessage_legacy_succeeds() (gas: 76600)
L1CrossDomainMessenger_Test:test_relayMessage_paused_reverts() (gas: 60476)
L1CrossDomainMessenger_Test:test_relayMessage_reentrancy_reverts() (gas: 190799)
L1CrossDomainMessenger_Test:test_relayMessage_retryAfterFailure_succeeds() (gas: 197144)
L1CrossDomainMessenger_Test:test_relayMessage_succeeds() (gas: 73558)
L1CrossDomainMessenger_Test:test_relayMessage_toSystemContract_reverts() (gas: 65827)
L1CrossDomainMessenger_Test:test_relayMessage_v2_reverts() (gas: 19500)
L1CrossDomainMessenger_Test:test_replayMessage_withValue_reverts() (gas: 38220)
L1CrossDomainMessenger_Test:test_pause_succeeds() (gas: 52964)
L1CrossDomainMessenger_Test:test_relayMessage_legacyOldReplay_reverts() (gas: 74749)
L1CrossDomainMessenger_Test:test_relayMessage_legacyRetryAfterFailureThenSuccess_reverts() (gas: 232829)
L1CrossDomainMessenger_Test:test_relayMessage_legacyRetryAfterFailure_succeeds() (gas: 205373)
L1CrossDomainMessenger_Test:test_relayMessage_legacyRetryAfterSuccess_reverts() (gas: 145674)
L1CrossDomainMessenger_Test:test_relayMessage_legacy_succeeds() (gas: 77679)
L1CrossDomainMessenger_Test:test_relayMessage_paused_reverts() (gas: 78550)
L1CrossDomainMessenger_Test:test_relayMessage_reentrancyDiffMessage_succeeds() (gas: 725841)
L1CrossDomainMessenger_Test:test_relayMessage_reentrancySameMessage_reverts() (gas: 661391)
L1CrossDomainMessenger_Test:test_relayMessage_retryAfterFailure_succeeds() (gas: 199464)
L1CrossDomainMessenger_Test:test_relayMessage_succeeds() (gas: 74718)
L1CrossDomainMessenger_Test:test_relayMessage_toSystemContract_reverts() (gas: 102318)
L1CrossDomainMessenger_Test:test_relayMessage_v2_reverts() (gas: 12562)
L1CrossDomainMessenger_Test:test_replayMessage_withValue_reverts() (gas: 56477)
L1CrossDomainMessenger_Test:test_sendMessage_succeeds() (gas: 299710)
L1CrossDomainMessenger_Test:test_sendMessage_twice_succeeds() (gas: 1490566)
L1CrossDomainMessenger_Test:test_unpause_callerIsNotOwner_reverts() (gas: 24516)
L1CrossDomainMessenger_Test:test_unpause_callerIsNotOwner_reverts() (gas: 24538)
L1CrossDomainMessenger_Test:test_unpause_succeeds() (gas: 45185)
L1CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 85083)
L1CrossDomainMessenger_Test:test_xDomainSender_notSet_reverts() (gas: 24274)
Expand Down Expand Up @@ -111,8 +112,8 @@ L1StandardBridge_FinalizeETHWithdrawal_Test:test_finalizeETHWithdrawal_succeeds(
L1StandardBridge_Getter_Test:test_getters_succeeds() (gas: 32151)
L1StandardBridge_Initialize_Test:test_initialize_succeeds() (gas: 22005)
L1StandardBridge_Receive_Test:test_receive_succeeds() (gas: 520198)
L2CrossDomainMessenger_Test:test_messageVersion_succeeds() (gas: 8389)
L2CrossDomainMessenger_Test:test_pause_notOwner_reverts() (gas: 10837)
L2CrossDomainMessenger_Test:test_messageVersion_succeeds() (gas: 8412)
L2CrossDomainMessenger_Test:test_pause_notOwner_reverts() (gas: 10860)
L2CrossDomainMessenger_Test:test_pause_succeeds() (gas: 31846)
L2CrossDomainMessenger_Test:test_relayMessage_paused_reverts() (gas: 59603)
L2CrossDomainMessenger_Test:test_relayMessage_reentrancyDiffMessage_succeeds() (gas: 686507)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ contract L1CrossDomainMessenger is CrossDomainMessenger, Semver {
OptimismPortal public immutable PORTAL;

/**
* @custom:semver 1.0.0
* @custom:semver 1.1.0
*
* @param _portal Address of the OptimismPortal contract on this network.
*/
constructor(OptimismPortal _portal)
Semver(1, 0, 0)
Semver(1, 1, 0)
CrossDomainMessenger(Predeploys.L2_CROSS_DOMAIN_MESSENGER)
{
PORTAL = _portal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import { L2ToL1MessagePasser } from "./L2ToL1MessagePasser.sol";
*/
contract L2CrossDomainMessenger is CrossDomainMessenger, Semver {
/**
* @custom:semver 1.0.0
* @custom:semver 1.1.0
*
* @param _l1CrossDomainMessenger Address of the L1CrossDomainMessenger contract.
*/
constructor(address _l1CrossDomainMessenger)
Semver(1, 0, 0)
Semver(1, 1, 0)
CrossDomainMessenger(_l1CrossDomainMessenger)
{
initialize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ contract L1CrossDomainMessenger_Test is Messenger_Initializer {
vm.prank(address(op));
vm.expectCall(target, callMessage);
L1Messenger.relayMessage(
Encoding.encodeVersionedNonce(0, 1),
Encoding.encodeVersionedNonce({ _nonce: 0, _version: 1 }),
sender,
target,
0,
Expand All @@ -380,7 +380,7 @@ contract L1CrossDomainMessenger_Test is Messenger_Initializer {
caller.setPayload(
abi.encodeWithSelector(
L1Messenger.relayMessage.selector,
Encoding.encodeVersionedNonce(0, 1),
Encoding.encodeVersionedNonce({ _nonce: 0, _version: 1 }),
sender,
target,
0,
Expand Down Expand Up @@ -421,15 +421,15 @@ contract L1CrossDomainMessenger_Test is Messenger_Initializer {
bytes memory messageB = hex"";

bytes32 hashA = Hashing.hashCrossDomainMessage(
Encoding.encodeVersionedNonce(0, 1),
Encoding.encodeVersionedNonce({ _nonce: 0, _version: 1 }),
sender,
target,
0,
0,
messageA
);
bytes32 hashB = Hashing.hashCrossDomainMessage(
Encoding.encodeVersionedNonce(0, 1),
Encoding.encodeVersionedNonce({ _nonce: 0, _version: 1 }),
sender,
target,
0,
Expand All @@ -445,7 +445,7 @@ contract L1CrossDomainMessenger_Test is Messenger_Initializer {

vm.expectCall(target, messageA);
L1Messenger.relayMessage(
Encoding.encodeVersionedNonce(0, 1),
Encoding.encodeVersionedNonce({ _nonce: 0, _version: 1 }),
sender,
target,
0,
Expand All @@ -454,7 +454,7 @@ contract L1CrossDomainMessenger_Test is Messenger_Initializer {
);
vm.expectCall(target, messageB);
L1Messenger.relayMessage(
Encoding.encodeVersionedNonce(0, 1),
Encoding.encodeVersionedNonce({ _nonce: 0, _version: 1 }),
sender,
target,
0,
Expand All @@ -477,7 +477,7 @@ contract L1CrossDomainMessenger_Test is Messenger_Initializer {
caller.setPayload(
abi.encodeWithSelector(
L1Messenger.relayMessage.selector,
Encoding.encodeVersionedNonce(0, 1),
Encoding.encodeVersionedNonce({ _nonce: 0, _version: 1 }),
sender,
target,
0,
Expand All @@ -492,7 +492,7 @@ contract L1CrossDomainMessenger_Test is Messenger_Initializer {
vm.expectEmit(true, true, true, true, target);
emit WhatHappened(true, hex"");
L1Messenger.relayMessage(
Encoding.encodeVersionedNonce(0, 1),
Encoding.encodeVersionedNonce({ _nonce: 0, _version: 1 }),
sender,
target,
0,
Expand Down

0 comments on commit 9907214

Please sign in to comment.