Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ctb): Per-message reentrancy guard for relayMessage #4919

Merged
merged 12 commits into from
Feb 21, 2023
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.

4 changes: 2 additions & 2 deletions op-bindings/bindings/l1crossdomainmessenger_more.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.

4 changes: 2 additions & 2 deletions op-bindings/bindings/l2crossdomainmessenger_more.go

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions op-chain-ops/genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,8 @@ func NewL2StorageConfig(config *DeployConfig, block *types.Block) (state.Storage
"msgNonce": 0,
}
storage["L2CrossDomainMessenger"] = state.StorageValues{
"_initialized": 1,
"_owner": config.ProxyAdminOwner,
// re-entrency lock
"_status": 1,
"_initialized": 1,
"_owner": config.ProxyAdminOwner,
"_initializing": false,
"_paused": false,
"xDomainMsgSender": "0x000000000000000000000000000000000000dEaD",
Expand Down
78 changes: 40 additions & 38 deletions packages/contracts-bedrock/.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ CrossDomainOwnableThroughPortal_Test:test_depositTransaction_crossDomainOwner_su
CrossDomainOwnable_Test:test_onlyOwner_notOwner_reverts() (gas: 10530)
CrossDomainOwnable_Test:test_onlyOwner_succeeds() (gas: 34861)
CrossDomainOwnable2_Test:test_onlyOwner_notMessenger_reverts() (gas: 8416)
CrossDomainOwnable2_Test:test_onlyOwner_notOwner2_reverts() (gas: 61738)
CrossDomainOwnable2_Test:test_onlyOwner_notOwner2_reverts() (gas: 63695)
CrossDomainOwnable2_Test:test_onlyOwner_notOwner_reverts() (gas: 16588)
CrossDomainOwnable2_Test:test_onlyOwner_succeeds() (gas: 77766)
CrossDomainOwnable3_Test:test_constructor_succeeds() (gas: 10510)
CrossDomainOwnable3_Test:test_crossDomainOnlyOwner_notMessenger_reverts() (gas: 28311)
CrossDomainOwnable3_Test:test_crossDomainOnlyOwner_notOwner2_reverts() (gas: 78170)
CrossDomainOwnable3_Test:test_crossDomainOnlyOwner_notOwner_reverts() (gas: 32000)
CrossDomainOwnable3_Test:test_crossDomainTransferOwnership_succeeds() (gas: 95748)
CrossDomainOwnable3_Test:test_localOnlyOwner_notOwner_reverts() (gas: 13237)
CrossDomainOwnable3_Test:test_localOnlyOwner_succeeds() (gas: 35197)
CrossDomainOwnable3_Test:test_localTransferOwnership_succeeds() (gas: 52084)
CrossDomainOwnable3_Test:test_transferOwnershipNoLocal_succeeds() (gas: 48565)
CrossDomainOwnable3_Test:test_transferOwnership_noLocal_zeroAddress_reverts() (gas: 12039)
CrossDomainOwnable2_Test:test_onlyOwner_succeeds() (gas: 78212)
CrossDomainOwnable3_Test:test_constructor_succeeds() (gas: 10576)
CrossDomainOwnable3_Test:test_crossDomainOnlyOwner_notMessenger_reverts() (gas: 28289)
CrossDomainOwnable3_Test:test_crossDomainOnlyOwner_notOwner2_reverts() (gas: 78594)
CrossDomainOwnable3_Test:test_crossDomainOnlyOwner_notOwner_reverts() (gas: 31978)
CrossDomainOwnable3_Test:test_crossDomainTransferOwnership_succeeds() (gas: 96172)
CrossDomainOwnable3_Test:test_localOnlyOwner_notOwner_reverts() (gas: 13215)
CrossDomainOwnable3_Test:test_localOnlyOwner_succeeds() (gas: 35220)
CrossDomainOwnable3_Test:test_localTransferOwnership_succeeds() (gas: 52128)
CrossDomainOwnable3_Test:test_transferOwnershipNoLocal_succeeds() (gas: 48632)
CrossDomainOwnable3_Test:test_transferOwnership_noLocalZeroAddress_reverts() (gas: 12037)
CrossDomainOwnable3_Test:test_transferOwnership_notOwner_reverts() (gas: 13414)
CrossDomainOwnable3_Test:test_transferOwnership_zeroAddress_reverts() (gas: 12058)
CrossDomainOwnable3_Test:test_transferOwnership_zeroAddress_reverts() (gas: 12036)
DeployerWhitelist_Test:test_owner_succeeds() (gas: 7538)
DeployerWhitelist_Test:test_storageSlots_succeeds() (gas: 33395)
FeeVault_Test:test_constructor_succeeds() (gas: 10647)
Expand Down Expand Up @@ -70,24 +70,25 @@ 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: 51545)
L1CrossDomainMessenger_Test:test_relayMessage_legacyRetryAfterFailureThenSuccess_reverts() (gas: 230701)
L1CrossDomainMessenger_Test:test_relayMessage_legacyRetryAfterFailure_succeeds() (gas: 204067)
L1CrossDomainMessenger_Test:test_relayMessage_legacyRetryAfterSuccess_reverts() (gas: 144199)
L1CrossDomainMessenger_Test:test_relayMessage_legacy_succeeds() (gas: 77026)
L1CrossDomainMessenger_Test:test_relayMessage_paused_reverts() (gas: 55447)
L1CrossDomainMessenger_Test:test_relayMessage_reentrancyDiffMessage_succeeds() (gas: 723099)
L1CrossDomainMessenger_Test:test_relayMessage_reentrancySameMessage_reverts() (gas: 660069)
L1CrossDomainMessenger_Test:test_relayMessage_retryAfterFailure_succeeds() (gas: 197996)
L1CrossDomainMessenger_Test:test_relayMessage_succeeds() (gas: 73984)
L1CrossDomainMessenger_Test:test_relayMessage_toSystemContract_reverts() (gas: 100511)
L1CrossDomainMessenger_Test:test_relayMessage_v2_reverts() (gas: 14471)
L1CrossDomainMessenger_Test:test_replayMessage_withValue_reverts() (gas: 55573)
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: 84020)
L1CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 84446)
L1CrossDomainMessenger_Test:test_xDomainSender_notSet_reverts() (gas: 24274)
L1ERC721Bridge_Test:test_bridgeERC721To_localTokenZeroAddress_reverts() (gas: 52730)
L1ERC721Bridge_Test:test_bridgeERC721To_remoteTokenZeroAddress_reverts() (gas: 27332)
Expand Down Expand Up @@ -123,18 +124,19 @@ 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: 41551)
L2CrossDomainMessenger_Test:test_relayMessage_reentrancy_reverts() (gas: 167727)
L2CrossDomainMessenger_Test:test_relayMessage_retry_succeeds() (gas: 168327)
L2CrossDomainMessenger_Test:test_relayMessage_succeeds() (gas: 53190)
L2CrossDomainMessenger_Test:test_relayMessage_toSystemContract_reverts() (gas: 36201)
L2CrossDomainMessenger_Test:test_relayMessage_v2_reverts() (gas: 18868)
L2CrossDomainMessenger_Test:test_relayMessage_paused_reverts() (gas: 36500)
L2CrossDomainMessenger_Test:test_relayMessage_reentrancyDiffMessage_succeeds() (gas: 683845)
L2CrossDomainMessenger_Test:test_relayMessage_reentrancySameMessage_reverts() (gas: 629342)
L2CrossDomainMessenger_Test:test_relayMessage_retry_succeeds() (gas: 169219)
L2CrossDomainMessenger_Test:test_relayMessage_succeeds() (gas: 56856)
L2CrossDomainMessenger_Test:test_relayMessage_toSystemContract_reverts() (gas: 53532)
L2CrossDomainMessenger_Test:test_relayMessage_v2_reverts() (gas: 13839)
L2CrossDomainMessenger_Test:test_sendMessage_succeeds() (gas: 122621)
L2CrossDomainMessenger_Test:test_sendMessage_twice_succeeds() (gas: 134715)
L2CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 52578)
L2CrossDomainMessenger_Test:test_sendMessage_twice_succeeds() (gas: 134738)
L2CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 56367)
L2CrossDomainMessenger_Test:test_xDomainSender_senderNotSet_reverts() (gas: 10524)
L2ERC721Bridge_Test:test_bridgeERC721To_localTokenZeroAddress_reverts() (gas: 26454)
L2ERC721Bridge_Test:test_bridgeERC721To_remoteTokenZeroAddress_reverts() (gas: 21770)
Expand Down
Loading