This repository has been archived by the owner on Dec 5, 2021. It is now read-only.
forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Merge omgx_contracts into /optimism monorepo; integrate message-relayer-fast; and connect up message-relayer-fast with the Dockers/ops * further cleanup * get address from addressManager; add tests for the message-relayer-fast * testing contract deployments to the new stack * Deployment working.... * Add fast and slow message contracts (#38) * wip - simplify system - remove message-relayer-fast * Update L1LiquidityPool.sol * message relay working * almost there * major wallet functions confirmed working - ready * fix integration tests * minor tweaks to get everything to run on rebased develop branch * Integrate #37, confirm compilation and function * update .env.example for stable rinkeby endpoint * adds the message-relayer-fast - goal is to end up with self contained folder for this service and associated tests * Added whitelist (#44) * beginning of a fast relayer with unit tests * basics are working * feat: modify tests to add custom messenger * feat: make messenger address pluggable * feat: depl local * feat: register custom messenger * feat: automate * feat: automate * feat: add options for using own custom messegner with service * feat: add options for using own custom messegner with service * merge master * rem: dep files * chore: change build command * style: rename all vars to _fast Co-authored-by: CAPtheorem <79423264+CAPtheorem@users.noreply.github.com> Co-authored-by: cby3149 <46272347+cby3149@users.noreply.github.com>
- Loading branch information
1 parent
d3ae019
commit 9a2f10b
Showing
20 changed files
with
945 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,12 @@ | ||
# Rinkeby | ||
NODE_ENV=local | ||
L1_NODE_WEB3_URL=https://rinkeby.infura.io/v3/YOUR_INFURA_KEY_HERE | ||
L2_NODE_WEB3_URL=http://3.85.224.26:8545 | ||
DEPLOYER_HTTP= | ||
ADDRESS_MANAGER_ADDRESS= | ||
L1_WALLET_KEY= | ||
L1_TARGET=0x0 | ||
L1_BLOCK_OFFSET=0 | ||
RETRIES=100 | ||
|
||
# Local | ||
#local | ||
NODE_ENV=local | ||
L1_NODE_WEB3_URL=http://localhost:9545 | ||
L2_NODE_WEB3_URL=http://localhost:8545 | ||
DEPLOYER_HTTP=http://deployer:8080 | ||
ADDRESS_MANAGER_ADDRESS=0x3e4CFaa8730092552d9425575E49bB542e329981 | ||
L1_WALLET_KEY=0x5b1c2653250e5c580dcb4e51c2944455e144c57ebd6a0645bd359d2e69ca0f0c | ||
L1_TARGET=0x0 | ||
L1_BLOCK_OFFSET=0 | ||
RETRIES=100 | ||
ADDRESS_MANAGER_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3 | ||
TEST_PRIVATE_KEY_1=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 | ||
TEST_PRIVATE_KEY_2=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d | ||
TEST_PRIVATE_KEY_3=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a | ||
TARGET_GAS_LIMIT=9000000000 | ||
CHAIN_ID=28 | ||
L1_WALLET_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 | ||
L1_TARGET=0x0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
...acts/libraries/OVM_CrossDomainEnabled.sol → .../libraries/OVM_CrossDomainEnabledFast.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
packages/omgx/message-relayer-fast/contracts/message/L1Message.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >0.5.0; | ||
|
||
/* Library Imports */ | ||
import "../libraries/OVM_CrossDomainEnabledFast.sol"; | ||
import { L2Message } from "./L2Message.sol"; | ||
|
||
contract L1Message is OVM_CrossDomainEnabledFast { | ||
|
||
address L2MessageAddress; | ||
string crossDomainMessage; | ||
|
||
event ReceiveL2Message ( | ||
string _message | ||
); | ||
|
||
/******************** | ||
* Constructor * | ||
********************/ | ||
constructor ( | ||
address _l1CrossDomainMessenger, | ||
address _l1CrossDomainMessengerFast | ||
) | ||
OVM_CrossDomainEnabledFast(_l1CrossDomainMessenger, _l1CrossDomainMessengerFast) | ||
{} | ||
|
||
function init ( | ||
address _L2MessageAddress | ||
) | ||
public | ||
{ | ||
L2MessageAddress = _L2MessageAddress; | ||
} | ||
|
||
function sendMessageL1ToL2 () public { | ||
bytes memory data = abi.encodeWithSelector( | ||
L2Message.receiveL1Message.selector, | ||
"messageFromL1" | ||
); | ||
|
||
// Send calldata into L1 | ||
sendCrossDomainMessage( | ||
address(L2MessageAddress), | ||
data, | ||
1200000 | ||
); | ||
} | ||
|
||
/************************* | ||
* Cross-chain Functions * | ||
*************************/ | ||
|
||
/** | ||
* Receive message from L2 | ||
* @param _message message | ||
*/ | ||
function receiveL2Message( | ||
string memory _message | ||
) | ||
external | ||
onlyFromCrossDomainAccount(address(L2MessageAddress)) | ||
{ | ||
crossDomainMessage = _message; | ||
emit ReceiveL2Message(_message); | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
packages/omgx/message-relayer-fast/contracts/message/L2Message.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >0.5.0; | ||
|
||
/* Library Imports */ | ||
import "@eth-optimism/contracts/contracts/optimistic-ethereum/libraries/bridge/OVM_CrossDomainEnabled.sol"; | ||
import { L1Message } from "./L1Message.sol"; | ||
|
||
contract L2Message is OVM_CrossDomainEnabled { | ||
|
||
address L1MessageAddress; | ||
string crossDomainMessage; | ||
|
||
event ReceiveL1Message ( | ||
string _message | ||
); | ||
|
||
/******************** | ||
* Constructor * | ||
********************/ | ||
/** | ||
* @param _l2CrossDomainMessenger L2 Messenger address being used for sending the cross-chain message. | ||
*/ | ||
constructor ( | ||
address _l2CrossDomainMessenger | ||
) | ||
OVM_CrossDomainEnabled(_l2CrossDomainMessenger) | ||
{} | ||
|
||
function init ( | ||
address _L1MessageAddress | ||
) | ||
public | ||
{ | ||
L1MessageAddress = _L1MessageAddress; | ||
} | ||
|
||
function sendMessageL2ToL1 () public { | ||
bytes memory data = abi.encodeWithSelector( | ||
L1Message.receiveL2Message.selector, | ||
"messageFromL2" | ||
); | ||
|
||
// Send calldata into L1 | ||
sendCrossDomainMessage( | ||
address(L1MessageAddress), | ||
data, | ||
100000 | ||
); | ||
} | ||
|
||
/************************* | ||
* Cross-chain Functions * | ||
*************************/ | ||
|
||
/** | ||
* Receive message from L1 | ||
* @param _message message | ||
*/ | ||
function receiveL1Message( | ||
string memory _message | ||
) | ||
external | ||
onlyFromCrossDomainAccount(address(L1MessageAddress)) | ||
{ | ||
crossDomainMessage = _message; | ||
emit ReceiveL1Message(_message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { HardhatUserConfig } from 'hardhat/types' | ||
import '@nomiclabs/hardhat-ethers' | ||
import '@nomiclabs/hardhat-waffle' | ||
import '@eth-optimism/hardhat-ovm' | ||
import 'hardhat-deploy' | ||
|
||
const config: HardhatUserConfig = { | ||
mocha: { | ||
timeout: 200000, | ||
}, | ||
networks: { | ||
omgx: { | ||
url: 'http://localhost:8545', | ||
// This sets the gas price to 0 for all transactions on L2. We do this | ||
// because account balances are not automatically initiated with an ETH | ||
// balance. | ||
gasPrice: 0, | ||
ovm: true, | ||
}, | ||
localhost: { | ||
url: "http://localhost:9545", | ||
allowUnlimitedContractSize: true, | ||
timeout: 1800000, | ||
accounts: ['0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'] | ||
}, | ||
}, | ||
solidity: '0.7.6', | ||
ovm: { | ||
solcVersion: '0.7.6', | ||
}, | ||
namedAccounts: { | ||
deployer: 0 | ||
} | ||
} | ||
|
||
export default config |
Oops, something went wrong.