-
Notifications
You must be signed in to change notification settings - Fork 98
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
Use transient storage in Outbox and Bridge #260
base: bold-merge
Are you sure you want to change the base?
Conversation
@@ -67,6 +70,13 @@ abstract contract AbsBridge is Initializable, DelegateCallAware, IBridge { | |||
_; | |||
} | |||
|
|||
/// @inheritdoc IBridge | |||
function postUpgradeInit() external onlyDelegated onlyProxyOwner { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can remove the postUpgradeInit
from both AbsBridge
and AbsOutbox
, and just require no active outbox from the upgrade action
i guess this is a bit of a nit / preference thing though
@@ -55,7 +57,8 @@ abstract contract AbsBridge is Initializable, DelegateCallAware, IBridge { | |||
|
|||
uint256 public override sequencerReportedSubMessageCount; | |||
|
|||
address internal constant EMPTY_ACTIVEOUTBOX = address(type(uint160).max); | |||
// transient storage vars | |||
address internal transient currentActiveOutbox; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, we could change this and get rid of function activeOutbox()
address internal transient currentActiveOutbox; | |
/// @dev The address of current active Outbox, or zero if no outbox is active | |
address public transient activeOutbox; |
@@ -42,7 +43,8 @@ abstract contract AbsBridge is Initializable, DelegateCallAware, IBridge { | |||
address[] public allowedDelayedInboxList; | |||
address[] public allowedOutboxList; | |||
|
|||
address internal _activeOutbox; | |||
// @dev Deprecated in place of transient storage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// @dev Deprecated in place of transient storage | |
/// @dev Deprecated in place of transient storage |
// we don't return the default context value to avoid a breaking change in the API | ||
if (sender == SENDER_DEFAULT_CONTEXT) return address(0); | ||
return sender; | ||
return contextSender; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar to the comment about removing AbsBridge::activeOutbox()
and renaming the transient var, we could do the same with all these context values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess this would change the return type though. meh maybe not worth
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could actually change the variable types to keep the interface the same. The linked code will cost 600 gas regardless of the variable sizes because there's no warm / cold distinction for tstore.
so we could also change their types, eg uint256 public transient l2ToL1Block
vs uint128 internal transient contextL2Block
Integrate transient storage for:
Some plugins are temporary disabled as they're not working with the Solidity 0.8.28 due to 'transient' keyword