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

Rename L1/rollup contracts to remove the OVM prefix

parent f817d4c3
......@@ -83,9 +83,9 @@ export class OptimismEnv {
.attach(watcher.l2.messengerAddress)
const ctcAddress = await addressManager.getAddress(
'OVM_CanonicalTransactionChain'
'CanonicalTransactionChain'
)
const ctc = getContractFactory('OVM_CanonicalTransactionChain')
const ctc = getContractFactory('CanonicalTransactionChain')
.connect(l1Wallet)
.attach(ctcAddress)
......@@ -94,9 +94,9 @@ export class OptimismEnv {
.attach(predeploys.OVM_GasPriceOracle)
const sccAddress = await addressManager.getAddress(
'OVM_StateCommitmentChain'
'StateCommitmentChain'
)
const scc = getContractFactory('OVM_StateCommitmentChain')
const scc = getContractFactory('StateCommitmentChain')
.connect(l1Wallet)
.attach(sccAddress)
......
......@@ -138,10 +138,10 @@ export abstract class BatchSubmitter {
await getContractFactory('Lib_AddressManager', this.signer)
).attach(this.addressManagerAddress)
const sccAddress = await addressManager.getAddress(
'OVM_StateCommitmentChain'
'StateCommitmentChain'
)
const ctcAddress = await addressManager.getAddress(
'OVM_CanonicalTransactionChain'
'CanonicalTransactionChain'
)
return {
ctcAddress,
......
......@@ -94,10 +94,10 @@ export class StateBatchSubmitter extends BatchSubmitter {
}
this.chainContract = (
await getContractFactory('OVM_StateCommitmentChain', this.signer)
await getContractFactory('StateCommitmentChain', this.signer)
).attach(sccAddress)
this.ctcContract = (
await getContractFactory('OVM_CanonicalTransactionChain', this.signer)
await getContractFactory('CanonicalTransactionChain', this.signer)
).attach(ctcAddress)
this.logger.info('Connected Optimism contracts', {
......
......@@ -107,13 +107,13 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
return
}
const unwrapped_OVM_CanonicalTransactionChain = (
await getContractFactory('OVM_CanonicalTransactionChain', this.signer)
const unwrapped_CanonicalTransactionChain = (
await getContractFactory('CanonicalTransactionChain', this.signer)
).attach(ctcAddress)
this.chainContract = new CanonicalTransactionChainContract(
unwrapped_OVM_CanonicalTransactionChain.address,
getContractInterface('OVM_CanonicalTransactionChain'),
unwrapped_CanonicalTransactionChain.address,
getContractInterface('CanonicalTransactionChain'),
this.signer
)
this.logger.info('Initialized new CTC', {
......@@ -573,11 +573,12 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
)
const addr = await manager.getAddress(
'OVM_ChainStorageContainer-CTC-batches'
'ChainStorageContainer-CTC-batches'
)
const container = new Contract(
addr,
getNewContractInterface('iOVM_ChainStorageContainer'),
getNewContractInterface('IChainStorageContainer'),
this.signer.provider
)
......
......@@ -15,7 +15,7 @@ import {
export { encodeAppendSequencerBatch, BatchContext, AppendSequencerBatchParams }
/*
* OVM_CanonicalTransactionChainContract is a wrapper around a normal Ethers contract
* CanonicalTransactionChainContract is a wrapper around a normal Ethers contract
* where the `appendSequencerBatch(...)` function uses a specialized encoding for improved efficiency.
*/
export class CanonicalTransactionChainContract extends Contract {
......@@ -57,12 +57,12 @@ const APPEND_SEQUENCER_BATCH_METHOD_ID = keccak256(
).slice(2, 10)
const appendSequencerBatch = async (
OVM_CanonicalTransactionChain: Contract,
CanonicalTransactionChain: Contract,
batch: AppendSequencerBatchParams,
options?: TransactionRequest
): Promise<TransactionResponse> => {
return OVM_CanonicalTransactionChain.signer.sendTransaction({
to: OVM_CanonicalTransactionChain.address,
return CanonicalTransactionChain.signer.sendTransaction({
to: CanonicalTransactionChain.address,
data: getEncodedCalldata(batch),
...options,
})
......
......@@ -8,7 +8,7 @@ import ganache from 'ganache-core'
import sinon from 'sinon'
import { Web3Provider } from '@ethersproject/providers'
import scc from '@eth-optimism/contracts/artifacts/contracts/L1/rollup/OVM_StateCommitmentChain.sol/OVM_StateCommitmentChain.json'
import scc from '@eth-optimism/contracts/artifacts/contracts/L1/rollup/StateCommitmentChain.sol/StateCommitmentChain.json'
import { getContractInterface, predeploys } from '@eth-optimism/contracts'
import { smockit, MockContract } from '@eth-optimism/smock'
......@@ -89,7 +89,7 @@ describe('BatchSubmitter', () => {
let AddressManager: Contract
let Mock__OVM_ExecutionManager: MockContract
let Mock__OVM_BondManager: MockContract
let Mock__OVM_StateCommitmentChain: MockContract
let Mock__StateCommitmentChain: MockContract
before(async () => {
AddressManager = await makeAddressManager()
await AddressManager.setAddress(
......@@ -105,8 +105,8 @@ describe('BatchSubmitter', () => {
await getContractFactory('OVM_BondManager')
)
Mock__OVM_StateCommitmentChain = await smockit(
await getContractFactory('OVM_StateCommitmentChain')
Mock__StateCommitmentChain = await smockit(
await getContractFactory('StateCommitmentChain')
)
await setProxyTarget(
......@@ -123,74 +123,76 @@ describe('BatchSubmitter', () => {
await setProxyTarget(
AddressManager,
'OVM_StateCommitmentChain',
Mock__OVM_StateCommitmentChain
'StateCommitmentChain',
Mock__StateCommitmentChain
)
Mock__OVM_StateCommitmentChain.smocked.canOverwrite.will.return.with(false)
Mock__StateCommitmentChain.smocked.canOverwrite.will.return.with(false)
Mock__OVM_ExecutionManager.smocked.getMaxTransactionGasLimit.will.return.with(
MAX_GAS_LIMIT
)
Mock__OVM_BondManager.smocked.isCollateralized.will.return.with(true)
})
let Factory__OVM_CanonicalTransactionChain: ContractFactory
let Factory__OVM_StateCommitmentChain: ContractFactory
let Factory__CanonicalTransactionChain: ContractFactory
let Factory__StateCommitmentChain: ContractFactory
before(async () => {
Factory__OVM_CanonicalTransactionChain = await getContractFactory(
'OVM_CanonicalTransactionChain'
Factory__CanonicalTransactionChain = await getContractFactory(
'CanonicalTransactionChain'
)
Factory__OVM_StateCommitmentChain = await getContractFactory(
'OVM_StateCommitmentChain'
Factory__StateCommitmentChain = await getContractFactory(
'StateCommitmentChain'
)
Factory__StateCommitmentChain = Factory__StateCommitmentChain.connect(signer)
})
let OVM_CanonicalTransactionChain: CanonicalTransactionChainContract
let OVM_StateCommitmentChain: Contract
let CanonicalTransactionChain: CanonicalTransactionChainContract
let StateCommitmentChain: Contract
let l2Provider: MockchainProvider
beforeEach(async () => {
const unwrapped_OVM_CanonicalTransactionChain =
await Factory__OVM_CanonicalTransactionChain.deploy(
const unwrapped_CanonicalTransactionChain =
await Factory__CanonicalTransactionChain.deploy(
AddressManager.address,
FORCE_INCLUSION_PERIOD_SECONDS
)
await unwrapped_OVM_CanonicalTransactionChain.init()
await unwrapped_CanonicalTransactionChain.init()
await AddressManager.setAddress(
'OVM_CanonicalTransactionChain',
unwrapped_OVM_CanonicalTransactionChain.address
'CanonicalTransactionChain',
unwrapped_CanonicalTransactionChain.address
)
OVM_CanonicalTransactionChain = new CanonicalTransactionChainContract(
unwrapped_OVM_CanonicalTransactionChain.address,
getContractInterface('OVM_CanonicalTransactionChain'),
CanonicalTransactionChain = new CanonicalTransactionChainContract(
unwrapped_CanonicalTransactionChain.address,
getContractInterface('CanonicalTransactionChain'),
sequencer
)
const unwrapped_OVM_StateCommitmentChain =
await Factory__OVM_StateCommitmentChain.deploy(
const unwrapped_StateCommitmentChain =
await Factory__StateCommitmentChain.deploy(
AddressManager.address,
0, // fraudProofWindowSeconds
0 // sequencerPublishWindowSeconds
)
await unwrapped_OVM_StateCommitmentChain.init()
await unwrapped_StateCommitmentChain.init()
await AddressManager.setAddress(
'OVM_StateCommitmentChain',
unwrapped_OVM_StateCommitmentChain.address
'StateCommitmentChain',
unwrapped_StateCommitmentChain.address
)
OVM_StateCommitmentChain = new Contract(
unwrapped_OVM_StateCommitmentChain.address,
getContractInterface('OVM_StateCommitmentChain'),
StateCommitmentChain = new Contract(
unwrapped_StateCommitmentChain.address,
getContractInterface('StateCommitmentChain'),
sequencer
)
l2Provider = new MockchainProvider(
OVM_CanonicalTransactionChain.address,
OVM_StateCommitmentChain.address
CanonicalTransactionChain.address,
StateCommitmentChain.address
)
})
......@@ -239,7 +241,7 @@ describe('BatchSubmitter', () => {
let batchSubmitter
beforeEach(async () => {
for (let i = 1; i < 15; i++) {
await OVM_CanonicalTransactionChain.enqueue(
await CanonicalTransactionChain.enqueue(
'0x' + '01'.repeat(20),
50_000,
'0x' + i.toString().repeat(64),
......@@ -254,7 +256,7 @@ describe('BatchSubmitter', () => {
it('should submit a sequencer batch correctly', async () => {
l2Provider.setNumBlocksToReturn(5)
const nextQueueElement = await getQueueElement(
OVM_CanonicalTransactionChain
CanonicalTransactionChain
)
l2Provider.setL2BlockData(
{
......@@ -302,7 +304,7 @@ describe('BatchSubmitter', () => {
} as any)
// Turn blocks 3-5 into sequencer txs
const nextQueueElement = await getQueueElement(
OVM_CanonicalTransactionChain,
CanonicalTransactionChain,
2
)
l2Provider.setL2BlockData(
......@@ -393,7 +395,7 @@ describe('BatchSubmitter', () => {
let stateBatchSubmitter
beforeEach(async () => {
for (let i = 1; i < 15; i++) {
await OVM_CanonicalTransactionChain.enqueue(
await CanonicalTransactionChain.enqueue(
'0x' + '01'.repeat(20),
50_000,
'0x' + i.toString().repeat(64),
......@@ -407,7 +409,7 @@ describe('BatchSubmitter', () => {
l2Provider.setNumBlocksToReturn(5)
const nextQueueElement = await getQueueElement(
OVM_CanonicalTransactionChain
CanonicalTransactionChain
)
l2Provider.setL2BlockData(
{
......
......@@ -13,8 +13,8 @@ import { Lib_CrossDomainUtils } from "../../libraries/bridge/Lib_CrossDomainUtil
/* Interface Imports */
import { IL1CrossDomainMessenger } from "./IL1CrossDomainMessenger.sol";
import { iOVM_CanonicalTransactionChain } from "../rollup/iOVM_CanonicalTransactionChain.sol";
import { iOVM_StateCommitmentChain } from "../rollup/iOVM_StateCommitmentChain.sol";
import { ICanonicalTransactionChain } from "../rollup/ICanonicalTransactionChain.sol";
import { IStateCommitmentChain } from "../rollup/IStateCommitmentChain.sol";
/* External Imports */
import { OwnableUpgradeable } from
......@@ -187,10 +187,10 @@ contract L1CrossDomainMessenger is
override
public
{
address ovmCanonicalTransactionChain = resolve("OVM_CanonicalTransactionChain");
address ovmCanonicalTransactionChain = resolve("CanonicalTransactionChain");
// Use the CTC queue length as nonce
uint40 nonce =
iOVM_CanonicalTransactionChain(ovmCanonicalTransactionChain).getQueueLength();
ICanonicalTransactionChain(ovmCanonicalTransactionChain).getQueueLength();
bytes memory xDomainCalldata = Lib_CrossDomainUtils.encodeXDomainCalldata(
_target,
......@@ -253,7 +253,7 @@ contract L1CrossDomainMessenger is
);
require(
_target != resolve("OVM_CanonicalTransactionChain"),
_target != resolve("CanonicalTransactionChain"),
"Cannot send L2->L1 messages to L1 system contracts."
);
......@@ -297,9 +297,9 @@ contract L1CrossDomainMessenger is
public
{
// Verify that the message is in the queue:
address canonicalTransactionChain = resolve("OVM_CanonicalTransactionChain");
address canonicalTransactionChain = resolve("CanonicalTransactionChain");
Lib_OVMCodec.QueueElement memory element =
iOVM_CanonicalTransactionChain(canonicalTransactionChain).getQueueElement(_queueIndex);
ICanonicalTransactionChain(canonicalTransactionChain).getQueueElement(_queueIndex);
// Compute the transactionHash
bytes32 transactionHash = keccak256(
......@@ -371,8 +371,8 @@ contract L1CrossDomainMessenger is
bool
)
{
iOVM_StateCommitmentChain ovmStateCommitmentChain = iOVM_StateCommitmentChain(
resolve("OVM_StateCommitmentChain")
IStateCommitmentChain ovmStateCommitmentChain = IStateCommitmentChain(
resolve("StateCommitmentChain")
);
return (
......@@ -441,7 +441,7 @@ contract L1CrossDomainMessenger is
/**
* Sends a cross domain message.
* @param _canonicalTransactionChain Address of the OVM_CanonicalTransactionChain instance.
* @param _canonicalTransactionChain Address of the CanonicalTransactionChain instance.
* @param _message Message to send.
* @param _gasLimit OVM gas limit for the message.
*/
......@@ -452,7 +452,7 @@ contract L1CrossDomainMessenger is
)
internal
{
iOVM_CanonicalTransactionChain(_canonicalTransactionChain).enqueue(
ICanonicalTransactionChain(_canonicalTransactionChain).enqueue(
Lib_PredeployAddresses.L2_CROSS_DOMAIN_MESSENGER,
_gasLimit,
_message
......
......@@ -9,14 +9,14 @@ import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolve
import { Lib_MerkleTree } from "../../libraries/utils/Lib_MerkleTree.sol";
/* Interface Imports */
import { iOVM_CanonicalTransactionChain } from "./iOVM_CanonicalTransactionChain.sol";
import { iOVM_ChainStorageContainer } from "./iOVM_ChainStorageContainer.sol";
import { ICanonicalTransactionChain } from "./ICanonicalTransactionChain.sol";
import { IChainStorageContainer } from "./IChainStorageContainer.sol";
/* External Imports */
import { Math } from "@openzeppelin/contracts/math/Math.sol";
/**
* @title OVM_CanonicalTransactionChain
* @title CanonicalTransactionChain
* @dev The Canonical Transaction Chain (CTC) contract is an append-only log of transactions
* which must be applied to the rollup state. It defines the ordering of rollup transactions by
* writing them to the 'CTC:batches' instance of the Chain Storage Container.
......@@ -27,7 +27,7 @@ import { Math } from "@openzeppelin/contracts/math/Math.sol";
*
* Runtime target: EVM
*/
contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_AddressResolver {
contract CanonicalTransactionChain is ICanonicalTransactionChain, Lib_AddressResolver {
/*************
* Constants *
......@@ -88,11 +88,11 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
public
view
returns (
iOVM_ChainStorageContainer
IChainStorageContainer
)
{
return iOVM_ChainStorageContainer(
resolve("OVM_ChainStorageContainer-CTC-batches")
return IChainStorageContainer(
resolve("ChainStorageContainer-CTC-batches")
);
}
......@@ -105,11 +105,11 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
public
view
returns (
iOVM_ChainStorageContainer
IChainStorageContainer
)
{
return iOVM_ChainStorageContainer(
resolve("OVM_ChainStorageContainer-CTC-queue")
return IChainStorageContainer(
resolve("ChainStorageContainer-CTC-queue")
);
}
......@@ -314,7 +314,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
timestampAndBlockNumber := or(timestampAndBlockNumber, shl(40, number()))
}
iOVM_ChainStorageContainer queueRef = queue();
IChainStorageContainer queueRef = queue();
queueRef.push(transactionHash);
queueRef.push(timestampAndBlockNumber);
......@@ -430,7 +430,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
// Take a reference to the queue and its length so we don't have to keep resolving it.
// Length isn't going to change during the course of execution, so it's fine to simply
// resolve this once at the start. Saves gas.
iOVM_ChainStorageContainer queueRef = queue();
IChainStorageContainer queueRef = queue();
uint40 queueLength = _getQueueLength(queueRef);
// Reserve some memory to save gas on hashing later on. This is a relatively safe estimate
......@@ -718,7 +718,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
*/
function _getQueueElement(
uint256 _index,
iOVM_ChainStorageContainer _queueRef
IChainStorageContainer _queueRef
)
internal
view
......@@ -754,7 +754,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
* @return Length of the queue.
*/
function _getQueueLength(
iOVM_ChainStorageContainer _queueRef
IChainStorageContainer _queueRef
)
internal
view
......@@ -875,7 +875,7 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
)
internal
{
iOVM_ChainStorageContainer batchesRef = batches();
IChainStorageContainer batchesRef = batches();
(uint40 totalElements, uint40 nextQueueIndex,,) = _getBatchExtraData();
Lib_OVMCodec.ChainBatchHeader memory header = Lib_OVMCodec.ChainBatchHeader({
......
......@@ -6,10 +6,10 @@ import { Lib_Buffer } from "../../libraries/utils/Lib_Buffer.sol";
import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolver.sol";
/* Interface Imports */
import { iOVM_ChainStorageContainer } from "./iOVM_ChainStorageContainer.sol";
import { IChainStorageContainer } from "./IChainStorageContainer.sol";
/**
* @title OVM_ChainStorageContainer
* @title ChainStorageContainer
* @dev The Chain Storage Container provides its owner contract with read, write and delete
* functionality. This provides gas efficiency gains by enabling it to overwrite storage slots which
* can no longer be used in a fraud proof due to the fraud window having passed, and the associated
......@@ -21,7 +21,7 @@ import { iOVM_ChainStorageContainer } from "./iOVM_ChainStorageContainer.sol";
*
* Runtime target: EVM
*/
contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressResolver {
contract ChainStorageContainer is IChainStorageContainer, Lib_AddressResolver {
/*************
* Libraries *
......@@ -63,7 +63,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
modifier onlyOwner() {
require(
msg.sender == resolve(owner),
"OVM_ChainStorageContainer: Function can only be called by the owner."
"ChainStorageContainer: Function can only be called by the owner."
);
_;
}
......@@ -74,7 +74,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
********************/
/**
* @inheritdoc iOVM_ChainStorageContainer
* @inheritdoc IChainStorageContainer
*/
function setGlobalMetadata(
bytes27 _globalMetadata
......@@ -87,7 +87,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
}
/**
* @inheritdoc iOVM_ChainStorageContainer
* @inheritdoc IChainStorageContainer
*/
function getGlobalMetadata()
override
......@@ -101,7 +101,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
}
/**
* @inheritdoc iOVM_ChainStorageContainer
* @inheritdoc IChainStorageContainer
*/
function length()
override
......@@ -115,7 +115,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
}
/**
* @inheritdoc iOVM_ChainStorageContainer
* @inheritdoc IChainStorageContainer
*/
function push(
bytes32 _object
......@@ -128,7 +128,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
}
/**
* @inheritdoc iOVM_ChainStorageContainer
* @inheritdoc IChainStorageContainer
*/
function push(
bytes32 _object,
......@@ -142,7 +142,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
}
/**
* @inheritdoc iOVM_ChainStorageContainer
* @inheritdoc IChainStorageContainer
*/
function get(
uint256 _index
......@@ -158,7 +158,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
}
/**
* @inheritdoc iOVM_ChainStorageContainer
* @inheritdoc IChainStorageContainer
*/
function deleteElementsAfterInclusive(
uint256 _index
......@@ -173,7 +173,7 @@ contract OVM_ChainStorageContainer is iOVM_ChainStorageContainer, Lib_AddressRes
}
/**
* @inheritdoc iOVM_ChainStorageContainer
* @inheritdoc IChainStorageContainer
*/
function deleteElementsAfterInclusive(
uint256 _index,
......
......@@ -6,12 +6,12 @@ pragma experimental ABIEncoderV2;
import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol";
/* Interface Imports */
import { iOVM_ChainStorageContainer } from "./iOVM_ChainStorageContainer.sol";
import { IChainStorageContainer } from "./IChainStorageContainer.sol";
/**
* @title iOVM_CanonicalTransactionChain
* @title ICanonicalTransactionChain
*/
interface iOVM_CanonicalTransactionChain {
interface ICanonicalTransactionChain {
/**********
* Events *
......@@ -72,7 +72,7 @@ interface iOVM_CanonicalTransactionChain {
external
view
returns (
iOVM_ChainStorageContainer
IChainStorageContainer
);
/**
......@@ -83,7 +83,7 @@ interface iOVM_CanonicalTransactionChain {
external
view
returns (
iOVM_ChainStorageContainer
IChainStorageContainer
);
/**
......
......@@ -2,9 +2,9 @@
pragma solidity >0.5.0 <0.8.0;
/**
* @title iOVM_ChainStorageContainer
* @title IChainStorageContainer
*/
interface iOVM_ChainStorageContainer {
interface IChainStorageContainer {
/********************
* Public Functions *
......
......@@ -6,9 +6,9 @@ pragma experimental ABIEncoderV2;
import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol";
/**
* @title iOVM_StateCommitmentChain
* @title IStateCommitmentChain
*/
interface iOVM_StateCommitmentChain {
interface IStateCommitmentChain {
/**********
* Events *
......
......@@ -8,16 +8,16 @@ import { Lib_AddressResolver } from "../../libraries/resolver/Lib_AddressResolve
import { Lib_MerkleTree } from "../../libraries/utils/Lib_MerkleTree.sol";
/* Interface Imports */
import { iOVM_StateCommitmentChain } from "./iOVM_StateCommitmentChain.sol";
import { iOVM_CanonicalTransactionChain } from "./iOVM_CanonicalTransactionChain.sol";
import { IStateCommitmentChain } from "./IStateCommitmentChain.sol";
import { ICanonicalTransactionChain } from "./ICanonicalTransactionChain.sol";
import { iOVM_BondManager } from "../verification/iOVM_BondManager.sol";
import { iOVM_ChainStorageContainer } from "./iOVM_ChainStorageContainer.sol";
import { IChainStorageContainer } from "./IChainStorageContainer.sol";
/* External Imports */
import "@openzeppelin/contracts/math/SafeMath.sol";
/**
* @title OVM_StateCommitmentChain
* @title StateCommitmentChain
* @dev The State Commitment Chain (SCC) contract contains a list of proposed state roots which
* Proposers assert to be a result of each transaction in the Canonical Transaction Chain (CTC).
* Elements here have a 1:1 correspondence with transactions in the CTC, and should be the unique
......@@ -25,7 +25,7 @@ import "@openzeppelin/contracts/math/SafeMath.sol";
*
* Runtime target: EVM
*/
contract OVM_StateCommitmentChain is iOVM_StateCommitmentChain, Lib_AddressResolver {
contract StateCommitmentChain is IStateCommitmentChain, Lib_AddressResolver {
/*************
* Constants *
......@@ -66,16 +66,16 @@ contract OVM_StateCommitmentChain is iOVM_StateCommitmentChain, Lib_AddressResol
public
view
returns (
iOVM_ChainStorageContainer
IChainStorageContainer
)
{
return iOVM_ChainStorageContainer(
resolve("OVM_ChainStorageContainer-SCC-batches")
return IChainStorageContainer(
resolve("ChainStorageContainer-SCC-batches")
);
}
/**
* @inheritdoc iOVM_StateCommitmentChain
* @inheritdoc IStateCommitmentChain
*/
function getTotalElements()
override
......@@ -90,7 +90,7 @@ contract OVM_StateCommitmentChain is iOVM_StateCommitmentChain, Lib_AddressResol
}
/**
* @inheritdoc iOVM_StateCommitmentChain
* @inheritdoc IStateCommitmentChain
*/
function getTotalBatches()
override
......@@ -104,7 +104,7 @@ contract OVM_StateCommitmentChain is iOVM_StateCommitmentChain, Lib_AddressResol
}
/**
* @inheritdoc iOVM_StateCommitmentChain
* @inheritdoc IStateCommitmentChain
*/
function getLastSequencerTimestamp()
override
......@@ -119,7 +119,7 @@ contract OVM_StateCommitmentChain is iOVM_StateCommitmentChain, Lib_AddressResol
}
/**
* @inheritdoc iOVM_StateCommitmentChain
* @inheritdoc IStateCommitmentChain
*/
function appendStateBatch(
bytes32[] memory _batch,
......@@ -148,7 +148,7 @@ contract OVM_StateCommitmentChain is iOVM_StateCommitmentChain, Lib_AddressResol
require(
getTotalElements() + _batch.length <=
iOVM_CanonicalTransactionChain(resolve("OVM_CanonicalTransactionChain"))
ICanonicalTransactionChain(resolve("CanonicalTransactionChain"))
.getTotalElements(),
"Number of state roots cannot exceed the number of canonical transactions."
);
......@@ -162,7 +162,7 @@ contract OVM_StateCommitmentChain is iOVM_StateCommitmentChain, Lib_AddressResol
}
/**
* @inheritdoc iOVM_StateCommitmentChain
* @inheritdoc IStateCommitmentChain
*/
function deleteStateBatch(
Lib_OVMCodec.ChainBatchHeader memory _batchHeader
......@@ -189,7 +189,7 @@ contract OVM_StateCommitmentChain is iOVM_StateCommitmentChain, Lib_AddressResol
}
/**
* @inheritdoc iOVM_StateCommitmentChain
* @inheritdoc IStateCommitmentChain
*/
function verifyStateCommitment(
bytes32 _element,
......@@ -223,7 +223,7 @@ contract OVM_StateCommitmentChain is iOVM_StateCommitmentChain, Lib_AddressResol
}
/**
* @inheritdoc iOVM_StateCommitmentChain
* @inheritdoc IStateCommitmentChain
*/
function insideFraudProofWindow(
Lib_OVMCodec.ChainBatchHeader memory _batchHeader
......
......@@ -15,13 +15,13 @@ const deployFn: DeployFunction = async (hre) => {
await deployAndRegister({
hre,
name: 'OVM_ChainStorageContainer-CTC-batches',
contract: 'OVM_ChainStorageContainer',
args: [Lib_AddressManager.address, 'OVM_CanonicalTransactionChain'],
name: 'ChainStorageContainer-CTC-batches',
contract: 'ChainStorageContainer',
args: [Lib_AddressManager.address, 'CanonicalTransactionChain'],
})
}
deployFn.dependencies = ['Lib_AddressManager']
deployFn.tags = ['OVM_ChainStorageContainer_ctc_batches']
deployFn.tags = ['ChainStorageContainer_ctc_batches']
export default deployFn
......@@ -15,13 +15,13 @@ const deployFn: DeployFunction = async (hre) => {
await deployAndRegister({
hre,
name: 'OVM_ChainStorageContainer-CTC-queue',
contract: 'OVM_ChainStorageContainer',
args: [Lib_AddressManager.address, 'OVM_CanonicalTransactionChain'],
name: 'ChainStorageContainer-CTC-queue',
contract: 'ChainStorageContainer',
args: [Lib_AddressManager.address, 'CanonicalTransactionChain'],
})
}
deployFn.dependencies = ['Lib_AddressManager']
deployFn.tags = ['OVM_ChainStorageContainer_ctc_queue']
deployFn.tags = ['ChainStorageContainer_ctc_queue']
export default deployFn
......@@ -15,13 +15,13 @@ const deployFn: DeployFunction = async (hre) => {
await deployAndRegister({
hre,
name: 'OVM_ChainStorageContainer-SCC-batches',
contract: 'OVM_ChainStorageContainer',
args: [Lib_AddressManager.address, 'OVM_StateCommitmentChain'],
name: 'ChainStorageContainer-SCC-batches',
contract: 'ChainStorageContainer',
args: [Lib_AddressManager.address, 'StateCommitmentChain'],
})
}
deployFn.dependencies = ['Lib_AddressManager']
deployFn.tags = ['OVM_ChainStorageContainer_scc_batches']
deployFn.tags = ['ChainStorageContainer_scc_batches']
export default deployFn
......@@ -15,7 +15,7 @@ const deployFn: DeployFunction = async (hre) => {
await deployAndRegister({
hre,
name: 'OVM_CanonicalTransactionChain',
name: 'CanonicalTransactionChain',
args: [
Lib_AddressManager.address,
(hre as any).deployConfig.ctcForceInclusionPeriodSeconds,
......@@ -26,6 +26,6 @@ const deployFn: DeployFunction = async (hre) => {
}
deployFn.dependencies = ['Lib_AddressManager']
deployFn.tags = ['OVM_CanonicalTransactionChain']
deployFn.tags = ['CanonicalTransactionChain']
export default deployFn
......@@ -15,7 +15,7 @@ const deployFn: DeployFunction = async (hre) => {
await deployAndRegister({
hre,
name: 'OVM_StateCommitmentChain',
name: 'StateCommitmentChain',
args: [
Lib_AddressManager.address,
(hre as any).deployConfig.sccFraudProofWindow,
......@@ -25,6 +25,6 @@ const deployFn: DeployFunction = async (hre) => {
}
deployFn.dependencies = ['Lib_AddressManager']
deployFn.tags = ['OVM_StateCommitmentChain']
deployFn.tags = ['StateCommitmentChain']
export default deployFn
......@@ -63,9 +63,9 @@ export const connectL1Contracts = async (
return {
addressManager: getEthersContract('Lib_AddressManager'),
canonicalTransactionChain: getEthersContract(
'OVM_CanonicalTransactionChain'
'CanonicalTransactionChain'
),
stateCommitmentChain: getEthersContract('OVM_StateCommitmentChain'),
stateCommitmentChain: getEthersContract('StateCommitmentChain'),
xDomainMessengerProxy: getEthersContract(
'Proxy__OVM_L1CrossDomainMessenger'
),
......
......@@ -9,23 +9,23 @@ 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__CanonicalTransactionChain = require('../deployments/mainnet/CanonicalTransactionChain.json')
const Mainnet__OVM_L1CrossDomainMessenger = require('../deployments/mainnet/L1CrossDomainMessenger.json')
const Mainnet__OVM_StateCommitmentChain = require('../deployments/mainnet/OVM_StateCommitmentChain.json')
const Mainnet__StateCommitmentChain = require('../deployments/mainnet/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__CanonicalTransactionChain = require('../deployments/kovan/CanonicalTransactionChain.json')
const Kovan__OVM_L1CrossDomainMessenger = require('../deployments/kovan/L1CrossDomainMessenger.json')
const Kovan__OVM_StateCommitmentChain = require('../deployments/kovan/OVM_StateCommitmentChain.json')
const Kovan__StateCommitmentChain = require('../deployments/kovan/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__CanonicalTransactionChain = require('../deployments/goerli/CanonicalTransactionChain.json')
const Goerli__OVM_L1CrossDomainMessenger = require('../deployments/goerli/L1CrossDomainMessenger.json')
const Goerli__OVM_StateCommitmentChain = require('../deployments/goerli/OVM_StateCommitmentChain.json')
const Goerli__StateCommitmentChain = require('../deployments/goerli/StateCommitmentChain.json')
const Goerli__Proxy__OVM_L1CrossDomainMessenger = require('../deployments/goerli/Proxy__OVM_L1CrossDomainMessenger.json')
const Goerli__OVM_BondManager = require('../deployments/goerli/mockOVM_BondManager.json')
......@@ -36,20 +36,20 @@ export const getL1ContractData = (network: Network) => {
kovan: Kovan__Lib_AddressManager,
goerli: Goerli__Lib_AddressManager,
}[network],
OVM_CanonicalTransactionChain: {
mainnet: Mainnet__OVM_CanonicalTransactionChain,
kovan: Kovan__OVM_CanonicalTransactionChain,
goerli: Goerli__OVM_CanonicalTransactionChain,
CanonicalTransactionChain: {
mainnet: Mainnet__CanonicalTransactionChain,
kovan: Kovan__CanonicalTransactionChain,
goerli: Goerli__CanonicalTransactionChain,
}[network],
L1CrossDomainMessenger: {
mainnet: Mainnet__OVM_L1CrossDomainMessenger,
kovan: Kovan__OVM_L1CrossDomainMessenger,
goerli: Goerli__OVM_L1CrossDomainMessenger,
}[network],
OVM_StateCommitmentChain: {
mainnet: Mainnet__OVM_StateCommitmentChain,
kovan: Kovan__OVM_StateCommitmentChain,
goerli: Goerli__OVM_StateCommitmentChain,
StateCommitmentChain: {
mainnet: Mainnet__StateCommitmentChain,
kovan: Kovan__StateCommitmentChain,
goerli: Goerli__StateCommitmentChain,
}[network],
Proxy__OVM_L1CrossDomainMessenger: {
mainnet: Mainnet__Proxy__OVM_L1CrossDomainMessenger,
......
......@@ -53,13 +53,13 @@ describe('L1CrossDomainMessenger', () => {
let Mock__TargetContract: MockContract
let Mock__L2CrossDomainMessenger: MockContract
let Mock__OVM_StateCommitmentChain: MockContract
let Mock__StateCommitmentChain: MockContract
let Factory__OVM_CanonicalTransactionChain: ContractFactory
let Factory__OVM_ChainStorageContainer: ContractFactory
let Factory__CanonicalTransactionChain: ContractFactory
let Factory__ChainStorageContainer: ContractFactory
let Factory__OVM_L1CrossDomainMessenger: ContractFactory
let OVM_CanonicalTransactionChain: Contract
let CanonicalTransactionChain: Contract
before(async () => {
Mock__TargetContract = await smockit(
await ethers.getContractFactory('Helper_SimpleProxy')
......@@ -70,8 +70,8 @@ describe('L1CrossDomainMessenger', () => {
address: predeploys.L2CrossDomainMessenger,
}
)
Mock__OVM_StateCommitmentChain = await smockit(
await ethers.getContractFactory('OVM_StateCommitmentChain')
Mock__StateCommitmentChain = await smockit(
await ethers.getContractFactory('StateCommitmentChain')
)
await AddressManager.setAddress(
......@@ -81,51 +81,51 @@ describe('L1CrossDomainMessenger', () => {
await setProxyTarget(
AddressManager,
'OVM_StateCommitmentChain',
Mock__OVM_StateCommitmentChain
'StateCommitmentChain',
Mock__StateCommitmentChain
)
Factory__OVM_CanonicalTransactionChain = await ethers.getContractFactory(
'OVM_CanonicalTransactionChain'
Factory__CanonicalTransactionChain = await ethers.getContractFactory(
'CanonicalTransactionChain'
)
Factory__OVM_ChainStorageContainer = await ethers.getContractFactory(
'OVM_ChainStorageContainer'
Factory__ChainStorageContainer = await ethers.getContractFactory(
'ChainStorageContainer'
)
Factory__OVM_L1CrossDomainMessenger = await ethers.getContractFactory(
'L1CrossDomainMessenger'
)
OVM_CanonicalTransactionChain =
await Factory__OVM_CanonicalTransactionChain.deploy(
CanonicalTransactionChain =
await Factory__CanonicalTransactionChain.deploy(
AddressManager.address,
FORCE_INCLUSION_PERIOD_SECONDS,
FORCE_INCLUSION_PERIOD_BLOCKS,
MAX_GAS_LIMIT
)
const batches = await Factory__OVM_ChainStorageContainer.deploy(
const batches = await Factory__ChainStorageContainer.deploy(
AddressManager.address,
'OVM_CanonicalTransactionChain'
'CanonicalTransactionChain'
)
const queue = await Factory__OVM_ChainStorageContainer.deploy(
const queue = await Factory__ChainStorageContainer.deploy(
AddressManager.address,
'OVM_CanonicalTransactionChain'
'CanonicalTransactionChain'
)
await AddressManager.setAddress(
'OVM_ChainStorageContainer-CTC-batches',
'ChainStorageContainer-CTC-batches',
batches.address
)
await AddressManager.setAddress(
'OVM_ChainStorageContainer-CTC-queue',
'ChainStorageContainer-CTC-queue',
queue.address
)
await AddressManager.setAddress(
'OVM_CanonicalTransactionChain',
OVM_CanonicalTransactionChain.address
'CanonicalTransactionChain',
CanonicalTransactionChain.address
)
})
......@@ -202,8 +202,8 @@ describe('L1CrossDomainMessenger', () => {
calldata
)
const queueLength = await OVM_CanonicalTransactionChain.getQueueLength()
const queueElement = await OVM_CanonicalTransactionChain.getQueueElement(
const queueLength = await CanonicalTransactionChain.getQueueLength()
const queueElement = await CanonicalTransactionChain.getQueueElement(
queueLength - 1
)
expect(queueElement[0]).to.equal(transactionHash)
......@@ -226,7 +226,7 @@ describe('L1CrossDomainMessenger', () => {
it('should revert if given the wrong queue index', async () => {
await L1CrossDomainMessenger.sendMessage(target, message, 100_001)
const queueLength = await OVM_CanonicalTransactionChain.getQueueLength()
const queueLength = await CanonicalTransactionChain.getQueueLength()
await expect(
L1CrossDomainMessenger.replayMessage(
target,
......@@ -240,7 +240,7 @@ describe('L1CrossDomainMessenger', () => {
it('should succeed if the message exists', async () => {
await L1CrossDomainMessenger.sendMessage(target, message, gasLimit)
const queueLength = await OVM_CanonicalTransactionChain.getQueueLength()
const queueLength = await CanonicalTransactionChain.getQueueLength()
const calldata = encodeXDomainCalldata(
target,
......@@ -344,16 +344,16 @@ describe('L1CrossDomainMessenger', () => {
})
beforeEach(async () => {
Mock__OVM_StateCommitmentChain.smocked.verifyStateCommitment.will.return.with(
Mock__StateCommitmentChain.smocked.verifyStateCommitment.will.return.with(
true
)
Mock__OVM_StateCommitmentChain.smocked.insideFraudProofWindow.will.return.with(
Mock__StateCommitmentChain.smocked.insideFraudProofWindow.will.return.with(
false
)
})
it('should revert if still inside the fraud proof window', async () => {
Mock__OVM_StateCommitmentChain.smocked.insideFraudProofWindow.will.return.with(
Mock__StateCommitmentChain.smocked.insideFraudProofWindow.will.return.with(
true
)
......@@ -378,14 +378,14 @@ describe('L1CrossDomainMessenger', () => {
it('should revert if attempting to relay a message sent to an L1 system contract', async () => {
const maliciousProof = await generateMockRelayMessageProof(
OVM_CanonicalTransactionChain.address,
CanonicalTransactionChain.address,
sender,
message
)
await expect(
L1CrossDomainMessenger.relayMessage(
OVM_CanonicalTransactionChain.address,
CanonicalTransactionChain.address,
sender,
message,
0,
......@@ -397,7 +397,7 @@ describe('L1CrossDomainMessenger', () => {
})
it('should revert if provided an invalid state root proof', async () => {
Mock__OVM_StateCommitmentChain.smocked.verifyStateCommitment.will.return.with(
Mock__StateCommitmentChain.smocked.verifyStateCommitment.will.return.with(
false
)
......
......@@ -21,31 +21,31 @@ import {
NON_ZERO_ADDRESS,
} from '../../../helpers'
// Still have some duplication from OVM_CanonicalTransactionChain.spec.ts, but it's so minimal that
// Still have some duplication from CanonicalTransactionChain.spec.ts, but it's so minimal that
// this is probably cleaner for now. Particularly since we're planning to move all of this out into
// core-utils soon anyway.
const MAX_GAS_LIMIT = 8_000_000
const appendSequencerBatch = async (
OVM_CanonicalTransactionChain: Contract,
CanonicalTransactionChain: Contract,
batch: AppendSequencerBatchParams
): Promise<TransactionResponse> => {
const methodId = keccak256(Buffer.from('appendSequencerBatch()')).slice(2, 10)
const calldata = encodeAppendSequencerBatch(batch)
return OVM_CanonicalTransactionChain.signer.sendTransaction({
to: OVM_CanonicalTransactionChain.address,
return CanonicalTransactionChain.signer.sendTransaction({
to: CanonicalTransactionChain.address,
data: '0x' + methodId + calldata,
})
}
describe('[GAS BENCHMARK] OVM_CanonicalTransactionChain', () => {
describe('[GAS BENCHMARK] CanonicalTransactionChain', () => {
let sequencer: Signer
before(async () => {
;[sequencer] = await ethers.getSigners()
})
let AddressManager: Contract
let Mock__OVM_StateCommitmentChain: MockContract
let Mock__StateCommitmentChain: MockContract
before(async () => {
AddressManager = await makeAddressManager()
await AddressManager.setAddress(
......@@ -53,71 +53,71 @@ describe('[GAS BENCHMARK] OVM_CanonicalTransactionChain', () => {
await sequencer.getAddress()
)
Mock__OVM_StateCommitmentChain = await smockit(
await ethers.getContractFactory('OVM_StateCommitmentChain')
Mock__StateCommitmentChain = await smockit(
await ethers.getContractFactory('StateCommitmentChain')
)
await setProxyTarget(
AddressManager,
'OVM_StateCommitmentChain',
Mock__OVM_StateCommitmentChain
'StateCommitmentChain',
Mock__StateCommitmentChain
)
})
let Factory__OVM_CanonicalTransactionChain: ContractFactory
let Factory__OVM_ChainStorageContainer: ContractFactory
let Factory__CanonicalTransactionChain: ContractFactory
let Factory__ChainStorageContainer: ContractFactory
before(async () => {
Factory__OVM_CanonicalTransactionChain = await ethers.getContractFactory(
'OVM_CanonicalTransactionChain'
Factory__CanonicalTransactionChain = await ethers.getContractFactory(
'CanonicalTransactionChain'
)
Factory__OVM_ChainStorageContainer = await ethers.getContractFactory(
'OVM_ChainStorageContainer'
Factory__ChainStorageContainer = await ethers.getContractFactory(
'ChainStorageContainer'
)
})
let OVM_CanonicalTransactionChain: Contract
let CanonicalTransactionChain: Contract
beforeEach(async () => {
// Use a larger FIP for blocks so that we can send a large number of
// enqueue() transactions without having to manipulate the block number.
const forceInclusionPeriodBlocks = 101
OVM_CanonicalTransactionChain =
await Factory__OVM_CanonicalTransactionChain.deploy(
CanonicalTransactionChain =
await Factory__CanonicalTransactionChain.deploy(
AddressManager.address,
FORCE_INCLUSION_PERIOD_SECONDS,
forceInclusionPeriodBlocks,
MAX_GAS_LIMIT
)
const batches = await Factory__OVM_ChainStorageContainer.deploy(
const batches = await Factory__ChainStorageContainer.deploy(
AddressManager.address,
'OVM_CanonicalTransactionChain'
'CanonicalTransactionChain'
)
const queue = await Factory__OVM_ChainStorageContainer.deploy(
const queue = await Factory__ChainStorageContainer.deploy(
AddressManager.address,
'OVM_CanonicalTransactionChain'
'CanonicalTransactionChain'
)
await AddressManager.setAddress(
'OVM_ChainStorageContainer-CTC-batches',
'ChainStorageContainer-CTC-batches',
batches.address
)
await AddressManager.setAddress(
'OVM_ChainStorageContainer-CTC-queue',
'ChainStorageContainer-CTC-queue',
queue.address
)
await AddressManager.setAddress(
'OVM_CanonicalTransactionChain',
OVM_CanonicalTransactionChain.address
'CanonicalTransactionChain',
CanonicalTransactionChain.address
)
})
describe('appendSequencerBatch [ @skip-on-coverage ]', () => {
beforeEach(() => {
OVM_CanonicalTransactionChain =
OVM_CanonicalTransactionChain.connect(sequencer)
CanonicalTransactionChain =
CanonicalTransactionChain.connect(sequencer)
})
it('200 transactions in a single context', async () => {
......@@ -135,7 +135,7 @@ describe('[GAS BENCHMARK] OVM_CanonicalTransactionChain', () => {
const fixedCalldataCost =
(transactionTemplate.slice(2).length / 2) * 16 * numTxs
const res = await appendSequencerBatch(OVM_CanonicalTransactionChain, {
const res = await appendSequencerBatch(CanonicalTransactionChain, {
shouldStartAtElement: 0,
totalElementsToAppend: numTxs,
contexts: [
......@@ -175,7 +175,7 @@ describe('[GAS BENCHMARK] OVM_CanonicalTransactionChain', () => {
const fixedCalldataCost =
(transactionTemplate.slice(2).length / 2) * 16 * numTxs
const res = await appendSequencerBatch(OVM_CanonicalTransactionChain, {
const res = await appendSequencerBatch(CanonicalTransactionChain, {
shouldStartAtElement: 0,
totalElementsToAppend: numTxs,
contexts: [...Array(numTxs)].map(() => {
......
......@@ -5,8 +5,8 @@
The Optimistic Ethereum Data Transport Layer is a long-running software service (written in TypeScript) designed to reliably index Optimistic Ethereum transaction data from Layer 1 (Ethereum). Specifically, this service indexes:
* Transactions that have been enqueued for submission to the CanonicalTransactionChain via [`enqueue`](https://github.com/ethereum-optimism/contracts-v2/blob/13b7deef60f773241723ea874fc6e81b4003b164/contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol#L225-L231).
* Transactions that have been included in the CanonicalTransactionChain via [`appendQueueBatch`](https://github.com/ethereum-optimism/contracts-v2/blob/13b7deef60f773241723ea874fc6e81b4003b164/contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol#L302-L306) or [`appendSequencerBatch`](https://github.com/ethereum-optimism/contracts-v2/blob/13b7deef60f773241723ea874fc6e81b4003b164/contracts/optimistic-ethereum/OVM/chain/OVM_CanonicalTransactionChain.sol#L352-L354).
* Transactions that have been enqueued for submission to the CanonicalTransactionChain via [`enqueue`](https://github.com/ethereum-optimism/contracts-v2/blob/13b7deef60f773241723ea874fc6e81b4003b164/contracts/optimistic-ethereum/OVM/chain/CanonicalTransactionChain.sol#L225-L231).
* Transactions that have been included in the CanonicalTransactionChain via [`appendQueueBatch`](https://github.com/ethereum-optimism/contracts-v2/blob/13b7deef60f773241723ea874fc6e81b4003b164/contracts/optimistic-ethereum/OVM/chain/CanonicalTransactionChain.sol#L302-L306) or [`appendSequencerBatch`](https://github.com/ethereum-optimism/contracts-v2/blob/13b7deef60f773241723ea874fc6e81b4003b164/contracts/optimistic-ethereum/OVM/chain/CanonicalTransactionChain.sol#L352-L354).
* State roots (transaction results) that have been published to the StateCommitmentChain via [`appendStateBatch`](https://github.com/ethereum-optimism/contracts-v2/blob/13b7deef60f773241723ea874fc6e81b4003b164/contracts/optimistic-ethereum/OVM/chain/OVM_StateCommitmentChain.sol#L127-L132).
## How does it work?
......
......@@ -36,15 +36,15 @@ export const handleEventsSequencerBatchAppended: EventHandlerSet<
// TODO: We need to update our events so that we actually have enough information to parse this
// batch without having to pull out this extra event. For the meantime, we need to find this
// "TransactonBatchAppended" event to get the rest of the data.
const OVM_CanonicalTransactionChain = getContractFactory(
'OVM_CanonicalTransactionChain'
const CanonicalTransactionChain = getContractFactory(
'CanonicalTransactionChain'
)
.attach(event.address)
.connect(l1RpcProvider)
const batchSubmissionEvent = (
await OVM_CanonicalTransactionChain.queryFilter(
OVM_CanonicalTransactionChain.filters.TransactionBatchAppended(),
await CanonicalTransactionChain.queryFilter(
CanonicalTransactionChain.filters.TransactionBatchAppended(),
eventBlock.number,
eventBlock.number
)
......
......@@ -32,7 +32,7 @@ export const handleEventsStateBatchAppended: EventHandlerSet<
},
parseEvent: (event, extraData) => {
const stateRoots = getContractFactory(
'OVM_StateCommitmentChain'
'StateCommitmentChain'
).interface.decodeFunctionData(
'appendStateBatch',
extraData.l1TransactionData
......
......@@ -170,7 +170,7 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
// Store the total number of submitted transactions so the server can tell clients if we're
// done syncing or not
const totalElements =
await this.state.contracts.OVM_CanonicalTransactionChain.getTotalElements()
await this.state.contracts.CanonicalTransactionChain.getTotalElements()
if (totalElements > 0) {
await this.state.db.putHighestL2BlockNumber(totalElements - 1)
}
......@@ -207,7 +207,7 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
// using Promise.all if necessary, but I don't see a good reason to do so unless parsing is
// really, really slow for all event types.
await this._syncEvents(
'OVM_CanonicalTransactionChain',
'CanonicalTransactionChain',
'TransactionEnqueued',
highestSyncedL1Block,
targetL1Block,
......@@ -215,7 +215,7 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
)
await this._syncEvents(
'OVM_CanonicalTransactionChain',
'CanonicalTransactionChain',
'SequencerBatchAppended',
highestSyncedL1Block,
targetL1Block,
......@@ -223,7 +223,7 @@ export class L1IngestionService extends BaseService<L1IngestionServiceOptions> {
)
await this._syncEvents(
'OVM_StateCommitmentChain',
'StateCommitmentChain',
'StateBatchAppended',
highestSyncedL1Block,
targetL1Block,
......
......@@ -30,8 +30,8 @@ export const loadProxyFromManager = async (
export interface OptimismContracts {
Lib_AddressManager: Contract
OVM_StateCommitmentChain: Contract
OVM_CanonicalTransactionChain: Contract
StateCommitmentChain: Contract
CanonicalTransactionChain: Contract
}
export const loadOptimismContracts = async (
......@@ -47,12 +47,12 @@ export const loadOptimismContracts = async (
const inputs = [
{
name: 'OVM_StateCommitmentChain',
interface: 'iOVM_StateCommitmentChain',
name: 'StateCommitmentChain',
interface: 'IStateCommitmentChain',
},
{
name: 'OVM_CanonicalTransactionChain',
interface: 'iOVM_CanonicalTransactionChain',
name: 'CanonicalTransactionChain',
interface: 'ICanonicalTransactionChain',
},
]
......
......@@ -5,7 +5,7 @@ import { expect } from '../../../../setup'
import { handleEventsSequencerBatchAppended } from '../../../../../src/services/l1-ingestion/handlers/sequencer-batch-appended'
import { SequencerBatchAppendedExtraData } from '../../../../../src/types'
describe('Event Handlers: OVM_CanonicalTransactionChain.SequencerBatchAppended', () => {
describe('Event Handlers: CanonicalTransactionChain.SequencerBatchAppended', () => {
describe('handleEventsSequencerBatchAppended.parseEvent', () => {
// This tests the behavior of parsing a real mainnet transaction,
// so it will break if the encoding scheme changes.
......
......@@ -9,7 +9,7 @@ import { handleEventsStateBatchAppended } from '../../../../../src/services/l1-i
import { StateBatchAppendedExtraData } from '../../../../../src/types'
import { l1StateBatchData } from '../../../examples/l1-data'
describe('Event Handlers: OVM_CanonicalTransactionChain.StateBatchAppended', () => {
describe('Event Handlers: CanonicalTransactionChain.StateBatchAppended', () => {
describe('getExtraData', () => {
it('should return event block and transaction', async () => {
// Source: https://etherscan.io/tx/0x4ca72484e93cdb50fe1089984db152258c2bbffc2534dcafbfe032b596bd5b49
......
......@@ -8,7 +8,7 @@ import { handleEventsTransactionEnqueued } from '../../../../../src/services/l1-
const MAX_ITERATIONS = 128
describe('Event Handlers: OVM_CanonicalTransactionChain.TransactionEnqueued', () => {
describe('Event Handlers: CanonicalTransactionChain.TransactionEnqueued', () => {
describe('getExtraData', () => {
it('should return null', async () => {
const output1 = await handleEventsTransactionEnqueued.getExtraData()
......
......@@ -26,7 +26,7 @@ import { getMessagesAndProofsForL2Transaction } from '@eth-optimism/message-rela
const main = async () => {
const l1RpcProviderUrl = 'https://layer1.endpoint'
const l2RpcProviderUrl = 'https://layer2.endpoint'
const l1StateCommitmentChainAddress = 'address of OVM_StateCommitmentChain from deployments page'
const l1StateCommitmentChainAddress = 'address of StateCommitmentChain from deployments page'
const l2CrossDomainMessengerAddress = 'address of L2CrossDomainMessenger from deployments page'
const l2TransactionHash = 'hash of the transaction with messages to relay'
......
......@@ -131,7 +131,7 @@ export const getStateBatchAppendedEventByTransactionIndex = async (
): Promise<ethers.Event | null> => {
const l1StateCommitmentChain = new ethers.Contract(
l1StateCommitmentChainAddress,
getContractInterface('OVM_StateCommitmentChain'),
getContractInterface('StateCommitmentChain'),
l1RpcProvider
)
......@@ -213,7 +213,7 @@ export const getStateRootBatchByTransactionIndex = async (
): Promise<StateRootBatch | null> => {
const l1StateCommitmentChain = new ethers.Contract(
l1StateCommitmentChainAddress,
getContractInterface('OVM_StateCommitmentChain'),
getContractInterface('StateCommitmentChain'),
l1RpcProvider
)
......
......@@ -72,7 +72,7 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
lastQueriedL1Block: number
eventCache: ethers.Event[]
Lib_AddressManager: Contract
OVM_StateCommitmentChain: Contract
StateCommitmentChain: Contract
L1CrossDomainMessenger: Contract
L2CrossDomainMessenger: Contract
OVM_L2ToL1MessagePasser: Contract
......@@ -98,14 +98,14 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
this.options.l1RpcProvider
)
this.logger.info('Connecting to OVM_StateCommitmentChain...')
this.state.OVM_StateCommitmentChain = await loadContractFromManager({
name: 'OVM_StateCommitmentChain',
this.logger.info('Connecting to StateCommitmentChain...')
this.state.StateCommitmentChain = await loadContractFromManager({
name: 'StateCommitmentChain',
Lib_AddressManager: this.state.Lib_AddressManager,
provider: this.options.l1RpcProvider,
})
this.logger.info('Connected to OVM_StateCommitmentChain', {
address: this.state.OVM_StateCommitmentChain.address,
this.logger.info('Connected to StateCommitmentChain', {
address: this.state.StateCommitmentChain.address,
})
this.logger.info('Connecting to L1CrossDomainMessenger...')
......@@ -307,8 +307,8 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
})
const events: ethers.Event[] =
await this.state.OVM_StateCommitmentChain.queryFilter(
this.state.OVM_StateCommitmentChain.filters.StateBatchAppended(),
await this.state.StateCommitmentChain.queryFilter(
this.state.StateCommitmentChain.filters.StateBatchAppended(),
startingBlock,
startingBlock + this.options.getLogsInterval
)
......@@ -333,7 +333,7 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
)
const [stateRoots] =
this.state.OVM_StateCommitmentChain.interface.decodeFunctionData(
this.state.StateCommitmentChain.interface.decodeFunctionData(
'appendStateBatch',
transaction.data
)
......@@ -361,7 +361,7 @@ export class MessageRelayerService extends BaseService<MessageRelayerOptions> {
this.logger.info('Got state batch header', { header })
}
return !(await this.state.OVM_StateCommitmentChain.insideFraudProofWindow(
return !(await this.state.StateCommitmentChain.insideFraudProofWindow(
header.batch
))
}
......
......@@ -37,12 +37,12 @@ describe('relay transaction generation functions', () => {
let StateCommitmentChain: Contract
beforeEach(async () => {
const factory1 = getContractFactory('Lib_AddressManager')
const factory2 = getContractFactory('OVM_ChainStorageContainer')
const factory3 = getContractFactory('OVM_StateCommitmentChain')
const factory2 = getContractFactory('ChainStorageContainer')
const factory3 = getContractFactory('StateCommitmentChain')
const mockBondManager = await smockit(getContractFactory('OVM_BondManager'))
const mockCanonicalTransactionChain = await smockit(
getContractFactory('OVM_CanonicalTransactionChain')
getContractFactory('CanonicalTransactionChain')
)
mockBondManager.smocked.isCollateralized.will.return.with(true)
......@@ -53,25 +53,25 @@ describe('relay transaction generation functions', () => {
const AddressManager = await factory1.connect(signer1).deploy()
const ChainStorageContainer = await factory2
.connect(signer1)
.deploy(AddressManager.address, 'OVM_StateCommitmentChain')
.deploy(AddressManager.address, 'StateCommitmentChain')
StateCommitmentChain = await factory3
.connect(signer1)
.deploy(AddressManager.address, 0, 0)
await AddressManager.setAddress(
'OVM_ChainStorageContainer-SCC-batches',
'ChainStorageContainer-SCC-batches',
ChainStorageContainer.address
)
await AddressManager.setAddress(
'OVM_StateCommitmentChain',
'StateCommitmentChain',
StateCommitmentChain.address
)
await AddressManager.setAddress('OVM_BondManager', mockBondManager.address)
await AddressManager.setAddress(
'OVM_CanonicalTransactionChain',
'CanonicalTransactionChain',
mockCanonicalTransactionChain.address
)
})
......
......@@ -65,14 +65,14 @@ We need to retrieve the following information reliably:
All relevant data can be retrieved by parsing data from the following functions:
- `OVM_CanonicalTransactionChain.enqueue`
- `OVM_CanonicalTransactionChain.appendQueueBatch`
- `OVM_CanonicalTransactionChain.appendSequencerBatch`
- `OVM_StateCommitmentChain.appendStateBatch`
- `CanonicalTransactionChain.enqueue`
- `CanonicalTransactionChain.appendQueueBatch`
- `CanonicalTransactionChain.appendSequencerBatch`
- `StateCommitmentChain.appendStateBatch`
#### Enqueued Transactions
Transactions are "enqueued" when users make calls to `OVM_CanonicalTransactionChain.enqueue`.
Transactions are "enqueued" when users make calls to `CanonicalTransactionChain.enqueue`.
Calls to this function can be detected by searching for [`TransactionEnqueued`](#transactionenqueued) events.
All relevant transaction data can be pulled out of the event, here's a pseudocode function for doing so:
......
......@@ -28,7 +28,7 @@ There are two 'low level' bridge contracts (the L1 and L2 Cross Domain Messenger
- 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.
- checks that the batch is stored in the `OVM_ChainStorageContainer`.
- checks that the batch is stored in the `ChainStorageContainer`.
- `_verifyStorageProof()`:
- 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.
......
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