optimism icon indicating copy to clipboard operation
optimism copied to clipboard

`reentrantAware` modifier is not used.

Open pegahcarter opened this issue 1 year ago • 1 comments

reentrantAware modifier is present here but does not actually do anything.

I suggest changing to a regular transient reentrant protection.

https://github.com/ethereum-optimism/optimism/blob/69d2d47b0f4ea0a41905b0ef52f3fa343ea7633e/packages/contracts-bedrock/src/L2/CrossL2Inbox.sol#L115

pegahcarter avatar Jul 10 '24 16:07 pegahcarter

What do you mean it does nothing? It does do something. The implementation is here

https://github.com/ethereum-optimism/optimism/blob/d091bb33ceba0931205584d88b8c2bd84404e466/packages/contracts-bedrock/src/libraries/TransientContext.sol#L65-L69

It allows for reentrancy without clobbering transient storage

tynes avatar Jul 14 '24 14:07 tynes

Right, I understand that the storage is incremented. However, this storage is not checked or managed elsewhere so I do not understand the purpose of tracking the number of entrances.

pegahcarter avatar Jul 15 '24 14:07 pegahcarter

It is used here:

https://github.com/ethereum-optimism/optimism/blob/69d2d47b0f4ea0a41905b0ef52f3fa343ea7633e/packages/contracts-bedrock/src/L2/CrossL2Inbox.sol#L136

tynes avatar Jul 15 '24 20:07 tynes