Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
436c48fd
Unverified
Commit
436c48fd
authored
Sep 13, 2021
by
Davis Shaver
Committed by
Kelvin Fichter
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore(contracts): defaults lib w/ xdomain msg sender
parent
8148d2fb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
24 deletions
+28
-24
four-news-drive.md
.changeset/four-news-drive.md
+5
-0
OVM_L1CrossDomainMessenger.sol
...cts/contracts/L1/messaging/OVM_L1CrossDomainMessenger.sol
+5
-12
OVM_L2CrossDomainMessenger.sol
...cts/contracts/L2/messaging/OVM_L2CrossDomainMessenger.sol
+4
-12
Lib_DefaultValues.sol
...racts/contracts/libraries/constants/Lib_DefaultValues.sol
+14
-0
No files found.
.changeset/four-news-drive.md
0 → 100644
View file @
436c48fd
---
'
@eth-optimism/contracts'
:
patch
---
Added default values library for contracts
packages/contracts/contracts/L1/messaging/OVM_L1CrossDomainMessenger.sol
View file @
436c48fd
...
...
@@ -7,6 +7,7 @@ import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolve
import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol";
import { Lib_AddressManager } from "../../libraries/resolver/Lib_AddressManager.sol";
import { Lib_SecureMerkleTrie } from "../../libraries/trie/Lib_SecureMerkleTrie.sol";
import { Lib_DefaultValues } from "../../libraries/constants/Lib_DefaultValues.sol";
import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployAddresses.sol";
import { Lib_CrossDomainUtils } from "../../libraries/bridge/Lib_CrossDomainUtils.sol";
...
...
@@ -51,14 +52,6 @@ contract OVM_L1CrossDomainMessenger is
bytes32 indexed _xDomainCalldataHash
);
/*************
* Constants *
*************/
// The default x-domain message sender being set to a non-zero value makes
// deployment a bit more expensive, but in exchange the refund on every call to
// `relayMessage` by the L1 and L2 messengers will be higher.
address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;
/**********************
* Contract Variables *
...
...
@@ -68,7 +61,7 @@ contract OVM_L1CrossDomainMessenger is
mapping (bytes32 => bool) public relayedMessages;
mapping (bytes32 => bool) public successfulMessages;
address internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;
address internal xDomainMsgSender =
Lib_DefaultValues.
DEFAULT_XDOMAIN_SENDER;
/***************
* Constructor *
...
...
@@ -121,7 +114,7 @@ contract OVM_L1CrossDomainMessenger is
"L1CrossDomainMessenger already intialized."
);
libAddressManager = Lib_AddressManager(_libAddressManager);
xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;
xDomainMsgSender =
Lib_DefaultValues.
DEFAULT_XDOMAIN_SENDER;
// Initialize upgradable OZ contracts
__Context_init_unchained(); // Context is a dependency for both Ownable and Pausable
...
...
@@ -176,7 +169,7 @@ contract OVM_L1CrossDomainMessenger is
address
)
{
require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, "xDomainMessageSender is not set");
require(xDomainMsgSender !=
Lib_DefaultValues.
DEFAULT_XDOMAIN_SENDER, "xDomainMessageSender is not set");
return xDomainMsgSender;
}
...
...
@@ -266,7 +259,7 @@ contract OVM_L1CrossDomainMessenger is
xDomainMsgSender = _sender;
(bool success, ) = _target.call(_message);
xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;
xDomainMsgSender =
Lib_DefaultValues.
DEFAULT_XDOMAIN_SENDER;
// Mark the message as received if the call was successful. Ensures that a message can be
// relayed multiple times in the case that the call reverted.
...
...
packages/contracts/contracts/L2/messaging/OVM_L2CrossDomainMessenger.sol
View file @
436c48fd
...
...
@@ -4,6 +4,7 @@ pragma experimental ABIEncoderV2;
/* Library Imports */
import { Lib_CrossDomainUtils } from "../../libraries/bridge/Lib_CrossDomainUtils.sol";
import { Lib_DefaultValues } from "../../libraries/constants/Lib_DefaultValues.sol";
import { Lib_PredeployAddresses } from "../../libraries/constants/Lib_PredeployAddresses.sol";
/* Interface Imports */
...
...
@@ -29,15 +30,6 @@ contract OVM_L2CrossDomainMessenger is
ReentrancyGuard
{
/*************
* Constants *
*************/
// The default x-domain message sender being set to a non-zero value makes
// deployment a bit more expensive, but in exchange the refund on every call to
// `relayMessage` by the L1 and L2 messengers will be higher.
address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;
/*************
* Variables *
*************/
...
...
@@ -46,7 +38,7 @@ contract OVM_L2CrossDomainMessenger is
mapping (bytes32 => bool) public successfulMessages;
mapping (bytes32 => bool) public sentMessages;
uint256 public messageNonce;
address internal xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;
address internal xDomainMsgSender =
Lib_DefaultValues.
DEFAULT_XDOMAIN_SENDER;
address public l1CrossDomainMessenger;
/***************
...
...
@@ -73,7 +65,7 @@ contract OVM_L2CrossDomainMessenger is
address
)
{
require(xDomainMsgSender != DEFAULT_XDOMAIN_SENDER, "xDomainMessageSender is not set");
require(xDomainMsgSender !=
Lib_DefaultValues.
DEFAULT_XDOMAIN_SENDER, "xDomainMessageSender is not set");
return xDomainMsgSender;
}
...
...
@@ -150,7 +142,7 @@ contract OVM_L2CrossDomainMessenger is
xDomainMsgSender = _sender;
(bool success, ) = _target.call(_message);
xDomainMsgSender = DEFAULT_XDOMAIN_SENDER;
xDomainMsgSender =
Lib_DefaultValues.
DEFAULT_XDOMAIN_SENDER;
// Mark the message as received if the call was successful. Ensures that a message can be
// relayed multiple times in the case that the call reverted.
...
...
packages/contracts/contracts/libraries/constants/Lib_DefaultValues.sol
0 → 100644
View file @
436c48fd
// SPDX-License-Identifier: MIT
pragma solidity >0.5.0 <0.8.0;
/**
* @title Lib_DefaultValues
*/
library Lib_DefaultValues {
// The default x-domain message sender being set to a non-zero value makes
// deployment a bit more expensive, but in exchange the refund on every call to
// `relayMessage` by the L1 and L2 messengers will be higher.
address internal constant DEFAULT_XDOMAIN_SENDER = 0x000000000000000000000000000000000000dEaD;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment