Commit b860fc66 authored by elenadimitrova's avatar elenadimitrova Committed by Kelvin Fichter

Rename OVM_L1CrossDomainMessenger to L1CrossDomainMessenger

parent a1c899ff
......@@ -31,7 +31,7 @@ fi
envSet L1_CROSS_DOMAIN_MESSENGER_ADDRESS Proxy__OVM_L1CrossDomainMessenger
if [ $L1_CROSS_DOMAIN_MESSENGER_ADDRESS == null ]; then
envSet L1_CROSS_DOMAIN_MESSENGER_ADDRESS OVM_L1CrossDomainMessenger
envSet L1_CROSS_DOMAIN_MESSENGER_ADDRESS L1CrossDomainMessenger
fi
# build the dump file
......
......@@ -25,14 +25,14 @@ import { ReentrancyGuardUpgradeable } from
"@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
/**
* @title OVM_L1CrossDomainMessenger
* @title L1CrossDomainMessenger
* @dev The L1 Cross Domain Messenger contract sends messages from L1 to L2, and relays messages
* from L2 onto L1. In the event that a message sent from L1 to L2 is rejected for exceeding the L2
* epoch gas limit, it can be resubmitted via this contract's replay function.
*
* Runtime target: EVM
*/
contract OVM_L1CrossDomainMessenger is
contract L1CrossDomainMessenger is
IL1CrossDomainMessenger,
Lib_AddressResolver,
OwnableUpgradeable,
......
......@@ -36,8 +36,8 @@ contract OVM_L2ToL1MessagePasser is iOVM_L2ToL1MessagePasser {
public
{
// Note: although this function is public, only messages sent from the
// OVM_L2CrossDomainMessenger will be relayed by the OVM_L1CrossDomainMessenger.
// This is enforced by a check in OVM_L1CrossDomainMessenger._verifyStorageProof().
// OVM_L2CrossDomainMessenger will be relayed by the L1CrossDomainMessenger.
// This is enforced by a check in L1CrossDomainMessenger._verifyStorageProof().
sentMessages[keccak256(
abi.encodePacked(
_message,
......
......@@ -16,7 +16,7 @@ const deployFn: DeployFunction = async (hre) => {
}
)
const result = await deploy('OVM_L1CrossDomainMessenger', {
const result = await deploy('L1CrossDomainMessenger', {
from: deployer,
args: [],
log: true,
......@@ -26,9 +26,9 @@ const deployFn: DeployFunction = async (hre) => {
return
}
const OVM_L1CrossDomainMessenger = await getDeployedContract(
const L1CrossDomainMessenger = await getDeployedContract(
hre,
'OVM_L1CrossDomainMessenger',
'L1CrossDomainMessenger',
{
signerOrProvider: deployer,
}
......@@ -37,13 +37,13 @@ const deployFn: DeployFunction = async (hre) => {
// NOTE: this initialization is *not* technically required (we only need to initialize the proxy)
// but it feels safer to initialize this anyway. Otherwise someone else could come along and
// initialize this.
await OVM_L1CrossDomainMessenger.initialize(Lib_AddressManager.address)
await L1CrossDomainMessenger.initialize(Lib_AddressManager.address)
const libAddressManager = await OVM_L1CrossDomainMessenger.libAddressManager()
const libAddressManager = await L1CrossDomainMessenger.libAddressManager()
if (libAddressManager !== Lib_AddressManager.address) {
throw new Error(
`\n**FATAL ERROR. THIS SHOULD NEVER HAPPEN. CHECK YOUR DEPLOYMENT.**:\n` +
`OVM_L1CrossDomainMessenger could not be succesfully initialized.\n` +
`L1CrossDomainMessenger could not be succesfully initialized.\n` +
`Attempted to set Lib_AddressManager to: ${Lib_AddressManager.address}\n` +
`Actual address after initialization: ${libAddressManager}\n` +
`This could indicate a compromised deployment.`
......@@ -51,12 +51,12 @@ const deployFn: DeployFunction = async (hre) => {
}
await Lib_AddressManager.setAddress(
'OVM_L1CrossDomainMessenger',
'L1CrossDomainMessenger',
result.address
)
}
deployFn.dependencies = ['Lib_AddressManager']
deployFn.tags = ['OVM_L1CrossDomainMessenger']
deployFn.tags = ['L1CrossDomainMessenger']
export default deployFn
......@@ -19,7 +19,7 @@ const deployFn: DeployFunction = async (hre) => {
const result = await deploy('Proxy__OVM_L1CrossDomainMessenger', {
contract: 'Lib_ResolvedDelegateProxy',
from: deployer,
args: [Lib_AddressManager.address, 'OVM_L1CrossDomainMessenger'],
args: [Lib_AddressManager.address, 'L1CrossDomainMessenger'],
log: true,
})
......@@ -32,7 +32,7 @@ const deployFn: DeployFunction = async (hre) => {
'Proxy__OVM_L1CrossDomainMessenger',
{
signerOrProvider: deployer,
iface: 'OVM_L1CrossDomainMessenger',
iface: 'L1CrossDomainMessenger',
}
)
......@@ -56,7 +56,7 @@ const deployFn: DeployFunction = async (hre) => {
)
}
deployFn.dependencies = ['Lib_AddressManager', 'OVM_L1CrossDomainMessenger']
deployFn.dependencies = ['Lib_AddressManager', 'L1CrossDomainMessenger']
deployFn.tags = ['Proxy__OVM_L1CrossDomainMessenger']
export default deployFn
......@@ -71,7 +71,7 @@ const networks = {
proxiedContracts = []
for (let i = 0; i < contracts.length; i++) {
if (contracts[i] === 'OVM_L1CrossDomainMessenger') {
if (contracts[i] === 'L1CrossDomainMessenger') {
proxiedContracts.push(contracts.splice(i, 1)[0])
}
if (contracts[i] === 'OVM_L1ETHGateway') {
......
......@@ -10,21 +10,21 @@ import { Network } from './connect-contracts'
const Mainnet__Lib_AddressManager = require('../deployments/mainnet/Lib_AddressManager.json')
const Mainnet__OVM_CanonicalTransactionChain = require('../deployments/mainnet/OVM_CanonicalTransactionChain.json')
const Mainnet__OVM_L1CrossDomainMessenger = require('../deployments/mainnet/OVM_L1CrossDomainMessenger.json')
const Mainnet__OVM_L1CrossDomainMessenger = require('../deployments/mainnet/L1CrossDomainMessenger.json')
const Mainnet__OVM_StateCommitmentChain = require('../deployments/mainnet/OVM_StateCommitmentChain.json')
const Mainnet__Proxy__OVM_L1CrossDomainMessenger = require('../deployments/mainnet/Proxy__OVM_L1CrossDomainMessenger.json')
const Mainnet__OVM_BondManager = require('../deployments/mainnet/mockOVM_BondManager.json')
const Kovan__Lib_AddressManager = require('../deployments/kovan/Lib_AddressManager.json')
const Kovan__OVM_CanonicalTransactionChain = require('../deployments/kovan/OVM_CanonicalTransactionChain.json')
const Kovan__OVM_L1CrossDomainMessenger = require('../deployments/kovan/OVM_L1CrossDomainMessenger.json')
const Kovan__OVM_L1CrossDomainMessenger = require('../deployments/kovan/L1CrossDomainMessenger.json')
const Kovan__OVM_StateCommitmentChain = require('../deployments/kovan/OVM_StateCommitmentChain.json')
const Kovan__Proxy__OVM_L1CrossDomainMessenger = require('../deployments/kovan/Proxy__OVM_L1CrossDomainMessenger.json')
const Kovan__OVM_BondManager = require('../deployments/kovan/mockOVM_BondManager.json')
const Goerli__Lib_AddressManager = require('../deployments/goerli/Lib_AddressManager.json')
const Goerli__OVM_CanonicalTransactionChain = require('../deployments/goerli/OVM_CanonicalTransactionChain.json')
const Goerli__OVM_L1CrossDomainMessenger = require('../deployments/goerli/OVM_L1CrossDomainMessenger.json')
const Goerli__OVM_L1CrossDomainMessenger = require('../deployments/goerli/L1CrossDomainMessenger.json')
const Goerli__OVM_StateCommitmentChain = require('../deployments/goerli/OVM_StateCommitmentChain.json')
const Goerli__Proxy__OVM_L1CrossDomainMessenger = require('../deployments/goerli/Proxy__OVM_L1CrossDomainMessenger.json')
const Goerli__OVM_BondManager = require('../deployments/goerli/mockOVM_BondManager.json')
......@@ -41,7 +41,7 @@ export const getL1ContractData = (network: Network) => {
kovan: Kovan__OVM_CanonicalTransactionChain,
goerli: Goerli__OVM_CanonicalTransactionChain,
}[network],
OVM_L1CrossDomainMessenger: {
L1CrossDomainMessenger: {
mainnet: Mainnet__OVM_L1CrossDomainMessenger,
kovan: Kovan__OVM_L1CrossDomainMessenger,
goerli: Goerli__OVM_L1CrossDomainMessenger,
......
......@@ -57,7 +57,7 @@ describe('OVM_L1StandardBridge', () => {
beforeEach(async () => {
// Get a new mock L1 messenger
Mock__OVM_L1CrossDomainMessenger = await smockit(
await ethers.getContractFactory('OVM_L1CrossDomainMessenger'),
await ethers.getContractFactory('L1CrossDomainMessenger'),
{ address: await l1MessengerImpersonator.getAddress() } // This allows us to use an ethers override {from: Mock__OVM_L2CrossDomainMessenger.address} to mock calls
)
......
......@@ -30,7 +30,7 @@ describe('OVM_L2CrossDomainMessenger', () => {
await ethers.getContractFactory('Helper_SimpleProxy')
)
Mock__OVM_L1CrossDomainMessenger = await smockit(
await ethers.getContractFactory('OVM_L1CrossDomainMessenger')
await ethers.getContractFactory('L1CrossDomainMessenger')
)
Mock__OVM_L1MessageSender = await smockit(
getContractInterface('iOVM_L1MessageSender'),
......@@ -101,7 +101,7 @@ describe('OVM_L2CrossDomainMessenger', () => {
)
})
it('should revert if the L1 message sender is not the OVM_L1CrossDomainMessenger', async () => {
it('should revert if the L1 message sender is not the L1CrossDomainMessenger', async () => {
Mock__OVM_L1MessageSender.smocked.getL1MessageSender.will.return.with(
constants.AddressZero
)
......
......@@ -36,7 +36,7 @@ const main = async () => {
const l1CrossDomainMessenger = new ethers.Contract(
l1CrossDomainMessengerAddress,
getContractInterface('OVM_L1CrossDomainMessenger'),
getContractInterface('L1CrossDomainMessenger'),
l1Wallet
)
......
......@@ -73,7 +73,7 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
eventCache: ethers.Event[]
Lib_AddressManager: Contract
OVM_StateCommitmentChain: Contract
OVM_L1CrossDomainMessenger: Contract
L1CrossDomainMessenger: Contract
OVM_L2CrossDomainMessenger: Contract
OVM_L2ToL1MessagePasser: Contract
}
......@@ -108,15 +108,15 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
address: this.state.OVM_StateCommitmentChain.address,
})
this.logger.info('Connecting to OVM_L1CrossDomainMessenger...')
this.state.OVM_L1CrossDomainMessenger = await loadContractFromManager({
name: 'OVM_L1CrossDomainMessenger',
this.logger.info('Connecting to L1CrossDomainMessenger...')
this.state.L1CrossDomainMessenger = await loadContractFromManager({
name: 'L1CrossDomainMessenger',
proxy: 'Proxy__OVM_L1CrossDomainMessenger',
Lib_AddressManager: this.state.Lib_AddressManager,
provider: this.options.l1RpcProvider,
})
this.logger.info('Connected to OVM_L1CrossDomainMessenger', {
address: this.state.OVM_L1CrossDomainMessenger.address,
this.logger.info('Connected to L1CrossDomainMessenger', {
address: this.state.L1CrossDomainMessenger.address,
})
this.logger.info('Connecting to OVM_L2CrossDomainMessenger...')
......@@ -417,7 +417,7 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
}
private async _wasMessageRelayed(message: SentMessage): Promise<boolean> {
return this.state.OVM_L1CrossDomainMessenger.successfulMessages(
return this.state.L1CrossDomainMessenger.successfulMessages(
message.encodedMessageHash
)
}
......@@ -497,7 +497,7 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
try {
this.logger.info('Dry-run, checking to make sure proof would succeed...')
await this.state.OVM_L1CrossDomainMessenger.connect(
await this.state.L1CrossDomainMessenger.connect(
this.options.l1Wallet
).callStatic.relayMessage(
message.target,
......@@ -520,7 +520,7 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
return
}
const result = await this.state.OVM_L1CrossDomainMessenger.connect(
const result = await this.state.L1CrossDomainMessenger.connect(
this.options.l1Wallet
).relayMessage(
message.target,
......
......@@ -24,7 +24,7 @@ There are two 'low level' bridge contracts (the L1 and L2 Cross Domain Messenger
**Then on L1:**
- The `Relayer` (and currently only the `Relayer`) may call `OVM_L1CrossDomainMessenger.relayMessage()` providing the raw message inputs and an L2 inclusion proof.
- The `Relayer` (and currently only the `Relayer`) may call `L1CrossDomainMessenger.relayMessage()` providing the raw message inputs and an L2 inclusion proof.
- The validity of the message is confirmed by the following functions:
- `_verifyStateRootProof()`:
- checks that the fraud proof window has closed for the batch to which the transaction belongs.
......@@ -33,13 +33,13 @@ There are two 'low level' bridge contracts (the L1 and L2 Cross Domain Messenger
- checks the proof to confirm that the message data provided is in the `OVM_L2ToL1MessagePasser.sentMessages` mapping
- checks that this transaction has not already been written to the `successfulMessages` mapping.
- The address of the L2 `ovmCALLER` is then written to the `xDomainMessageSender` state variable
- the call is then executed, allow the `target` to query the value of the `OVM_L1CrossDomainMessenger.xDomainMessageSender` for authorization.
- the call is then executed, allow the `target` to query the value of the `L1CrossDomainMessenger.xDomainMessageSender` for authorization.
- if it succeeds it is added to the `successfulMessages` and cannot be relayed again.
- regardless of success, an entry is written to the `relayedMessages` mapping.
**Then the receiver (ie. `SynthetixBridgeToOptimism`):**
- Checks that the caller is the `OVM_L1CrossDomainMessenger` and that the `xDomainMessageSender` is the `synthetixBridgeToBase` on L2.
- Checks that the caller is the `L1CrossDomainMessenger` and that the `xDomainMessageSender` is the `synthetixBridgeToBase` on L2.
## L1 to L2 messaging flow
......@@ -52,7 +52,7 @@ There are two 'low level' bridge contracts (the L1 and L2 Cross Domain Messenger
**Then on L2:**
- A transaction will be sent to the `OVM_L2CrossDomainMessenger`.
- The cross-domain message is deemed valid if the `ovmL1TXORIGIN` is the `OVM_L1CrossDomainMessenger`.
- The cross-domain message is deemed valid if the `ovmL1TXORIGIN` is the `L1CrossDomainMessenger`.
- If not valid, execution reverts.
- If the message is valid, the arguments are ABI encoded and keccak256 hashed to `xDomainCalldataHash`.
- The `succesfulMessages` mapping is checked to verify that `xDomainCalldataHash` has not already been executed successfully.
......@@ -61,5 +61,5 @@ There are two 'low level' bridge contracts (the L1 and L2 Cross Domain Messenger
- Execution reverts if the check fails.
- **Future note:** The `OVM_L2ToL1MessagePasser`, and this check should be removed, in favor of putting the `sentMessages` mapping into the L2xDM.
- The address of the L2 `ovmCALLER` is then written to the `xDomainMessageSender` state variable
- the call is then executed, allow the `target` to query the value of the `OVM_L1CrossDomainMessenger.xDomainMessageSender` for authorization.
- the call is then executed, allow the `target` to query the value of the `L1CrossDomainMessenger.xDomainMessageSender` for authorization.
- If it succeeds it is added to the `successfulMessages`.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment