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

Reset the batch submitter to use old contracts

parent 3f590e33
......@@ -138,10 +138,10 @@ export abstract class BatchSubmitter {
await getContractFactory('Lib_AddressManager', this.signer)
).attach(this.addressManagerAddress)
const sccAddress = await addressManager.getAddress(
'StateCommitmentChain'
'OVM_StateCommitmentChain'
)
const ctcAddress = await addressManager.getAddress(
'CanonicalTransactionChain'
'OVM_CanonicalTransactionChain'
)
return {
ctcAddress,
......
......@@ -94,10 +94,10 @@ export class StateBatchSubmitter extends BatchSubmitter {
}
this.chainContract = (
await getContractFactory('StateCommitmentChain', this.signer)
await getContractFactory('OVM_StateCommitmentChain', this.signer)
).attach(sccAddress)
this.ctcContract = (
await getContractFactory('CanonicalTransactionChain', this.signer)
await getContractFactory('OVM_CanonicalTransactionChain', this.signer)
).attach(ctcAddress)
this.logger.info('Connected Optimism contracts', {
......
......@@ -107,13 +107,13 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
return
}
const unwrapped_CanonicalTransactionChain = (
await getContractFactory('CanonicalTransactionChain', this.signer)
const unwrapped_OVM_CanonicalTransactionChain = (
await getContractFactory('OVM_CanonicalTransactionChain', this.signer)
).attach(ctcAddress)
this.chainContract = new CanonicalTransactionChainContract(
unwrapped_CanonicalTransactionChain.address,
getContractInterface('CanonicalTransactionChain'),
unwrapped_OVM_CanonicalTransactionChain.address,
getContractInterface('OVM_CanonicalTransactionChain'),
this.signer
)
this.logger.info('Initialized new CTC', {
......@@ -573,12 +573,12 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
)
const addr = await manager.getAddress(
'ChainStorageContainer-CTC-batches'
'OVM_ChainStorageContainer-CTC-batches'
)
const container = new Contract(
addr,
getNewContractInterface('IChainStorageContainer'),
getNewContractInterface('iOVM_ChainStorageContainer'),
this.signer.provider
)
......
......@@ -15,7 +15,7 @@ import {
export { encodeAppendSequencerBatch, BatchContext, AppendSequencerBatchParams }
/*
* CanonicalTransactionChainContract is a wrapper around a normal Ethers contract
* OVM_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 (
CanonicalTransactionChain: Contract,
OVM_CanonicalTransactionChain: Contract,
batch: AppendSequencerBatchParams,
options?: TransactionRequest
): Promise<TransactionResponse> => {
return CanonicalTransactionChain.signer.sendTransaction({
to: CanonicalTransactionChain.address,
return OVM_CanonicalTransactionChain.signer.sendTransaction({
to: OVM_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/StateCommitmentChain.sol/StateCommitmentChain.json'
import scc from '@eth-optimism/contracts/artifacts/contracts/L1/rollup/OVM_StateCommitmentChain.sol/OVM_StateCommitmentChain.json'
import { getContractInterface, predeploys } from '@eth-optimism/contracts'
import { smockit, MockContract } from '@eth-optimism/smock'
......@@ -88,8 +88,8 @@ describe('BatchSubmitter', () => {
let AddressManager: Contract
let Mock__OVM_ExecutionManager: MockContract
let Mock__BondManager: MockContract
let Mock__StateCommitmentChain: MockContract
let Mock__OVM_BondManager: MockContract
let Mock__OVM_StateCommitmentChain: MockContract
before(async () => {
AddressManager = await makeAddressManager()
await AddressManager.setAddress(
......@@ -101,12 +101,12 @@ describe('BatchSubmitter', () => {
await getContractFactory('OVM_ExecutionManager')
)
Mock__BondManager = await smockit(
await getContractFactory('BondManager')
Mock__OVM_BondManager = await smockit(
await getContractFactory('OVM_BondManager')
)
Mock__StateCommitmentChain = await smockit(
await getContractFactory('StateCommitmentChain')
Mock__OVM_StateCommitmentChain = await smockit(
await getContractFactory('OVM_StateCommitmentChain')
)
await setProxyTarget(
......@@ -117,82 +117,82 @@ describe('BatchSubmitter', () => {
await setProxyTarget(
AddressManager,
'BondManager',
Mock__BondManager
'OVM_BondManager',
Mock__OVM_BondManager
)
await setProxyTarget(
AddressManager,
'StateCommitmentChain',
Mock__StateCommitmentChain
'OVM_StateCommitmentChain',
Mock__OVM_StateCommitmentChain
)
Mock__StateCommitmentChain.smocked.canOverwrite.will.return.with(false)
Mock__OVM_StateCommitmentChain.smocked.canOverwrite.will.return.with(false)
Mock__OVM_ExecutionManager.smocked.getMaxTransactionGasLimit.will.return.with(
MAX_GAS_LIMIT
)
Mock__BondManager.smocked.isCollateralized.will.return.with(true)
Mock__OVM_BondManager.smocked.isCollateralized.will.return.with(true)
})
let Factory__CanonicalTransactionChain: ContractFactory
let Factory__StateCommitmentChain: ContractFactory
let Factory__OVM_CanonicalTransactionChain: ContractFactory
let Factory__OVM_StateCommitmentChain: ContractFactory
before(async () => {
Factory__CanonicalTransactionChain = await getContractFactory(
'CanonicalTransactionChain'
Factory__OVM_CanonicalTransactionChain = await getContractFactory(
'OVM_CanonicalTransactionChain'
)
Factory__StateCommitmentChain = await getContractFactory(
'StateCommitmentChain'
Factory__OVM_StateCommitmentChain = await getContractFactory(
'OVM_StateCommitmentChain'
)
Factory__StateCommitmentChain = Factory__StateCommitmentChain.connect(signer)
})
let CanonicalTransactionChain: CanonicalTransactionChainContract
let StateCommitmentChain: Contract
let OVM_CanonicalTransactionChain: CanonicalTransactionChainContract
let OVM_StateCommitmentChain: Contract
let l2Provider: MockchainProvider
beforeEach(async () => {
const unwrapped_CanonicalTransactionChain =
await Factory__CanonicalTransactionChain.deploy(
const unwrapped_OVM_CanonicalTransactionChain =
await Factory__OVM_CanonicalTransactionChain.deploy(
AddressManager.address,
FORCE_INCLUSION_PERIOD_SECONDS
)
await unwrapped_CanonicalTransactionChain.init()
await unwrapped_OVM_CanonicalTransactionChain.init()
await AddressManager.setAddress(
'CanonicalTransactionChain',
unwrapped_CanonicalTransactionChain.address
'OVM_CanonicalTransactionChain',
unwrapped_OVM_CanonicalTransactionChain.address
)
CanonicalTransactionChain = new CanonicalTransactionChainContract(
unwrapped_CanonicalTransactionChain.address,
getContractInterface('CanonicalTransactionChain'),
OVM_CanonicalTransactionChain = new CanonicalTransactionChainContract(
unwrapped_OVM_CanonicalTransactionChain.address,
getContractInterface('OVM_CanonicalTransactionChain'),
sequencer
)
const unwrapped_StateCommitmentChain =
await Factory__StateCommitmentChain.deploy(
const unwrapped_OVM_StateCommitmentChain =
await Factory__OVM_StateCommitmentChain.deploy(
AddressManager.address,
0, // fraudProofWindowSeconds
0 // sequencerPublishWindowSeconds
)
await unwrapped_StateCommitmentChain.init()
await unwrapped_OVM_StateCommitmentChain.init()
await AddressManager.setAddress(
'StateCommitmentChain',
unwrapped_StateCommitmentChain.address
'OVM_StateCommitmentChain',
unwrapped_OVM_StateCommitmentChain.address
)
StateCommitmentChain = new Contract(
unwrapped_StateCommitmentChain.address,
getContractInterface('StateCommitmentChain'),
OVM_StateCommitmentChain = new Contract(
unwrapped_OVM_StateCommitmentChain.address,
getContractInterface('OVM_StateCommitmentChain'),
sequencer
)
l2Provider = new MockchainProvider(
CanonicalTransactionChain.address,
StateCommitmentChain.address
OVM_CanonicalTransactionChain.address,
OVM_StateCommitmentChain.address
)
})
......@@ -241,7 +241,7 @@ describe('BatchSubmitter', () => {
let batchSubmitter
beforeEach(async () => {
for (let i = 1; i < 15; i++) {
await CanonicalTransactionChain.enqueue(
await OVM_CanonicalTransactionChain.enqueue(
'0x' + '01'.repeat(20),
50_000,
'0x' + i.toString().repeat(64),
......@@ -256,7 +256,7 @@ describe('BatchSubmitter', () => {
it('should submit a sequencer batch correctly', async () => {
l2Provider.setNumBlocksToReturn(5)
const nextQueueElement = await getQueueElement(
CanonicalTransactionChain
OVM_CanonicalTransactionChain
)
l2Provider.setL2BlockData(
{
......@@ -304,7 +304,7 @@ describe('BatchSubmitter', () => {
} as any)
// Turn blocks 3-5 into sequencer txs
const nextQueueElement = await getQueueElement(
CanonicalTransactionChain,
OVM_CanonicalTransactionChain,
2
)
l2Provider.setL2BlockData(
......@@ -395,7 +395,7 @@ describe('BatchSubmitter', () => {
let stateBatchSubmitter
beforeEach(async () => {
for (let i = 1; i < 15; i++) {
await CanonicalTransactionChain.enqueue(
await OVM_CanonicalTransactionChain.enqueue(
'0x' + '01'.repeat(20),
50_000,
'0x' + i.toString().repeat(64),
......@@ -409,7 +409,7 @@ describe('BatchSubmitter', () => {
l2Provider.setNumBlocksToReturn(5)
const nextQueueElement = await getQueueElement(
CanonicalTransactionChain
OVM_CanonicalTransactionChain
)
l2Provider.setL2BlockData(
{
......
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