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