Commit 09eb322e authored by Kelvin Fichter's avatar Kelvin Fichter

lint: fix

parent 3c56126c
...@@ -101,9 +101,7 @@ export class OptimismEnv { ...@@ -101,9 +101,7 @@ export class OptimismEnv {
.connect(l2Wallet) .connect(l2Wallet)
.attach(predeploys.OVM_GasPriceOracle) .attach(predeploys.OVM_GasPriceOracle)
const sccAddress = await addressManager.getAddress( const sccAddress = await addressManager.getAddress('StateCommitmentChain')
'StateCommitmentChain'
)
const scc = getContractFactory('StateCommitmentChain') const scc = getContractFactory('StateCommitmentChain')
.connect(l1Wallet) .connect(l1Wallet)
.attach(sccAddress) .attach(sccAddress)
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
"test:coverage": "yarn lerna run test:coverage --parallel", "test:coverage": "yarn lerna run test:coverage --parallel",
"lint": "yarn lerna run lint", "lint": "yarn lerna run lint",
"lint:check": "yarn lerna run lint:check", "lint:check": "yarn lerna run lint:check",
"lint:fix": "yarn lerna run lint:fix", "lint:fix": "yarn lerna run lint:fix --parallel",
"postinstall": "patch-package", "postinstall": "patch-package",
"ready": "yarn lint && yarn test", "ready": "yarn lint && yarn test",
"prepare": "husky install", "prepare": "husky install",
......
...@@ -50,10 +50,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -50,10 +50,7 @@ const deployFn: DeployFunction = async (hre) => {
) )
} }
await Lib_AddressManager.setAddress( await Lib_AddressManager.setAddress('L1CrossDomainMessenger', result.address)
'L1CrossDomainMessenger',
result.address
)
} }
deployFn.dependencies = ['Lib_AddressManager'] deployFn.dependencies = ['Lib_AddressManager']
......
...@@ -94,10 +94,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -94,10 +94,7 @@ const deployFn: DeployFunction = async (hre) => {
await Proxy__WithChugSplashInterface.setOwner(addressManagerOwner) await Proxy__WithChugSplashInterface.setOwner(addressManagerOwner)
// Todo: remove this after adding chugsplash proxy // Todo: remove this after adding chugsplash proxy
await Lib_AddressManager.setAddress( await Lib_AddressManager.setAddress('Proxy__L1StandardBridge', result.address)
'Proxy__L1StandardBridge',
result.address
)
} }
deployFn.dependencies = ['Lib_AddressManager', 'L1StandardBridge'] deployFn.dependencies = ['Lib_AddressManager', 'L1StandardBridge']
......
...@@ -62,13 +62,9 @@ export const connectL1Contracts = async ( ...@@ -62,13 +62,9 @@ export const connectL1Contracts = async (
return { return {
addressManager: getEthersContract('Lib_AddressManager'), addressManager: getEthersContract('Lib_AddressManager'),
canonicalTransactionChain: getEthersContract( canonicalTransactionChain: getEthersContract('CanonicalTransactionChain'),
'CanonicalTransactionChain'
),
stateCommitmentChain: getEthersContract('StateCommitmentChain'), stateCommitmentChain: getEthersContract('StateCommitmentChain'),
xDomainMessengerProxy: getEthersContract( xDomainMessengerProxy: getEthersContract('Proxy__L1CrossDomainMessenger'),
'Proxy__L1CrossDomainMessenger'
),
bondManager: getEthersContract('mockBondManager'), bondManager: getEthersContract('mockBondManager'),
} }
} }
......
...@@ -96,13 +96,12 @@ describe('L1CrossDomainMessenger', () => { ...@@ -96,13 +96,12 @@ describe('L1CrossDomainMessenger', () => {
Factory__L1CrossDomainMessenger = await ethers.getContractFactory( Factory__L1CrossDomainMessenger = await ethers.getContractFactory(
'L1CrossDomainMessenger' 'L1CrossDomainMessenger'
) )
CanonicalTransactionChain = CanonicalTransactionChain = await Factory__CanonicalTransactionChain.deploy(
await Factory__CanonicalTransactionChain.deploy( AddressManager.address,
AddressManager.address, FORCE_INCLUSION_PERIOD_SECONDS,
FORCE_INCLUSION_PERIOD_SECONDS, FORCE_INCLUSION_PERIOD_BLOCKS,
FORCE_INCLUSION_PERIOD_BLOCKS, MAX_GAS_LIMIT
MAX_GAS_LIMIT )
)
const batches = await Factory__ChainStorageContainer.deploy( const batches = await Factory__ChainStorageContainer.deploy(
AddressManager.address, AddressManager.address,
...@@ -131,8 +130,7 @@ describe('L1CrossDomainMessenger', () => { ...@@ -131,8 +130,7 @@ describe('L1CrossDomainMessenger', () => {
let L1CrossDomainMessenger: Contract let L1CrossDomainMessenger: Contract
beforeEach(async () => { beforeEach(async () => {
const xDomainMessengerImpl = const xDomainMessengerImpl = await Factory__L1CrossDomainMessenger.deploy()
await Factory__L1CrossDomainMessenger.deploy()
// We use an upgradable proxy for the XDomainMessenger--deploy & set up the proxy. // We use an upgradable proxy for the XDomainMessenger--deploy & set up the proxy.
L1CrossDomainMessenger = await deployProxyXDomainMessenger( L1CrossDomainMessenger = await deployProxyXDomainMessenger(
AddressManager, AddressManager,
...@@ -366,13 +364,7 @@ describe('L1CrossDomainMessenger', () => { ...@@ -366,13 +364,7 @@ describe('L1CrossDomainMessenger', () => {
} }
await expect( await expect(
L1CrossDomainMessenger.relayMessage( L1CrossDomainMessenger.relayMessage(target, sender, message, 0, proof1)
target,
sender,
message,
0,
proof1
)
).to.be.revertedWith('Provided message could not be verified.') ).to.be.revertedWith('Provided message could not be verified.')
}) })
...@@ -410,13 +402,7 @@ describe('L1CrossDomainMessenger', () => { ...@@ -410,13 +402,7 @@ describe('L1CrossDomainMessenger', () => {
} }
await expect( await expect(
L1CrossDomainMessenger.relayMessage( L1CrossDomainMessenger.relayMessage(target, sender, message, 0, proof1)
target,
sender,
message,
0,
proof1
)
).to.be.revertedWith('Provided message could not be verified.') ).to.be.revertedWith('Provided message could not be verified.')
}) })
...@@ -493,13 +479,7 @@ describe('L1CrossDomainMessenger', () => { ...@@ -493,13 +479,7 @@ describe('L1CrossDomainMessenger', () => {
) )
await expect( await expect(
L1CrossDomainMessenger.relayMessage( L1CrossDomainMessenger.relayMessage(target, sender, message, 0, proof)
target,
sender,
message,
0,
proof
)
).to.be.revertedWith('Provided message has already been received.') ).to.be.revertedWith('Provided message has already been received.')
}) })
...@@ -507,20 +487,13 @@ describe('L1CrossDomainMessenger', () => { ...@@ -507,20 +487,13 @@ describe('L1CrossDomainMessenger', () => {
await L1CrossDomainMessenger.pause() await L1CrossDomainMessenger.pause()
await expect( await expect(
L1CrossDomainMessenger.relayMessage( L1CrossDomainMessenger.relayMessage(target, sender, message, 0, proof)
target,
sender,
message,
0,
proof
)
).to.be.revertedWith('Pausable: paused') ).to.be.revertedWith('Pausable: paused')
}) })
describe('blockMessage and allowMessage', () => { describe('blockMessage and allowMessage', () => {
it('should revert if called by an account other than the owner', async () => { it('should revert if called by an account other than the owner', async () => {
const L1CrossDomainMessenger2 = const L1CrossDomainMessenger2 = L1CrossDomainMessenger.connect(signer2)
L1CrossDomainMessenger.connect(signer2)
await expect( await expect(
L1CrossDomainMessenger2.blockMessage(keccak256(calldata)) L1CrossDomainMessenger2.blockMessage(keccak256(calldata))
).to.be.revertedWith('Ownable: caller is not the owner') ).to.be.revertedWith('Ownable: caller is not the owner')
...@@ -534,13 +507,7 @@ describe('L1CrossDomainMessenger', () => { ...@@ -534,13 +507,7 @@ describe('L1CrossDomainMessenger', () => {
await L1CrossDomainMessenger.blockMessage(keccak256(calldata)) await L1CrossDomainMessenger.blockMessage(keccak256(calldata))
await expect( await expect(
L1CrossDomainMessenger.relayMessage( L1CrossDomainMessenger.relayMessage(target, sender, message, 0, proof)
target,
sender,
message,
0,
proof
)
).to.be.revertedWith('Provided message has been blocked.') ).to.be.revertedWith('Provided message has been blocked.')
}) })
...@@ -548,25 +515,13 @@ describe('L1CrossDomainMessenger', () => { ...@@ -548,25 +515,13 @@ describe('L1CrossDomainMessenger', () => {
await L1CrossDomainMessenger.blockMessage(keccak256(calldata)) await L1CrossDomainMessenger.blockMessage(keccak256(calldata))
await expect( await expect(
L1CrossDomainMessenger.relayMessage( L1CrossDomainMessenger.relayMessage(target, sender, message, 0, proof)
target,
sender,
message,
0,
proof
)
).to.be.revertedWith('Provided message has been blocked.') ).to.be.revertedWith('Provided message has been blocked.')
await L1CrossDomainMessenger.allowMessage(keccak256(calldata)) await L1CrossDomainMessenger.allowMessage(keccak256(calldata))
await expect( await expect(
L1CrossDomainMessenger.relayMessage( L1CrossDomainMessenger.relayMessage(target, sender, message, 0, proof)
target,
sender,
message,
0,
proof
)
).to.not.be.reverted ).to.not.be.reverted
}) })
}) })
...@@ -580,13 +535,7 @@ describe('L1CrossDomainMessenger', () => { ...@@ -580,13 +535,7 @@ describe('L1CrossDomainMessenger', () => {
) )
await expect( await expect(
L1CrossDomainMessenger.relayMessage( L1CrossDomainMessenger.relayMessage(target, sender, message, 0, proof)
target,
sender,
message,
0,
proof
)
).to.be.revertedWith( ).to.be.revertedWith(
'Only OVM_L2MessageRelayer can relay L2-to-L1 messages.' 'Only OVM_L2MessageRelayer can relay L2-to-L1 messages.'
) )
......
...@@ -298,9 +298,7 @@ describe('L1StandardBridge', () => { ...@@ -298,9 +298,7 @@ describe('L1StandardBridge', () => {
expect(depositerBalance).to.equal(INITIAL_TOTAL_L1_SUPPLY - depositAmount) expect(depositerBalance).to.equal(INITIAL_TOTAL_L1_SUPPLY - depositAmount)
// bridge's balance is increased // bridge's balance is increased
const bridgeBalance = await L1ERC20.balanceOf( const bridgeBalance = await L1ERC20.balanceOf(L1StandardBridge.address)
L1StandardBridge.address
)
expect(bridgeBalance).to.equal(depositAmount) expect(bridgeBalance).to.equal(depositAmount)
// Check the correct cross-chain call was sent: // Check the correct cross-chain call was sent:
...@@ -339,9 +337,7 @@ describe('L1StandardBridge', () => { ...@@ -339,9 +337,7 @@ describe('L1StandardBridge', () => {
expect(depositerBalance).to.equal(INITIAL_TOTAL_L1_SUPPLY - depositAmount) expect(depositerBalance).to.equal(INITIAL_TOTAL_L1_SUPPLY - depositAmount)
// bridge's balance is increased // bridge's balance is increased
const bridgeBalance = await L1ERC20.balanceOf( const bridgeBalance = await L1ERC20.balanceOf(L1StandardBridge.address)
L1StandardBridge.address
)
expect(bridgeBalance).to.equal(depositAmount) expect(bridgeBalance).to.equal(depositAmount)
// Check the correct cross-chain call was sent: // Check the correct cross-chain call was sent:
......
...@@ -81,13 +81,12 @@ describe('[GAS BENCHMARK] CanonicalTransactionChain', () => { ...@@ -81,13 +81,12 @@ describe('[GAS BENCHMARK] CanonicalTransactionChain', () => {
// Use a larger FIP for blocks so that we can send a large number of // Use a larger FIP for blocks so that we can send a large number of
// enqueue() transactions without having to manipulate the block number. // enqueue() transactions without having to manipulate the block number.
const forceInclusionPeriodBlocks = 101 const forceInclusionPeriodBlocks = 101
CanonicalTransactionChain = CanonicalTransactionChain = await Factory__CanonicalTransactionChain.deploy(
await Factory__CanonicalTransactionChain.deploy( AddressManager.address,
AddressManager.address, FORCE_INCLUSION_PERIOD_SECONDS,
FORCE_INCLUSION_PERIOD_SECONDS, forceInclusionPeriodBlocks,
forceInclusionPeriodBlocks, MAX_GAS_LIMIT
MAX_GAS_LIMIT )
)
const batches = await Factory__ChainStorageContainer.deploy( const batches = await Factory__ChainStorageContainer.deploy(
AddressManager.address, AddressManager.address,
...@@ -116,8 +115,7 @@ describe('[GAS BENCHMARK] CanonicalTransactionChain', () => { ...@@ -116,8 +115,7 @@ describe('[GAS BENCHMARK] CanonicalTransactionChain', () => {
describe('appendSequencerBatch [ @skip-on-coverage ]', () => { describe('appendSequencerBatch [ @skip-on-coverage ]', () => {
beforeEach(() => { beforeEach(() => {
CanonicalTransactionChain = CanonicalTransactionChain = CanonicalTransactionChain.connect(sequencer)
CanonicalTransactionChain.connect(sequencer)
}) })
it('200 transactions in a single context', async () => { it('200 transactions in a single context', async () => {
...@@ -255,8 +253,7 @@ describe('[GAS BENCHMARK] CanonicalTransactionChain', () => { ...@@ -255,8 +253,7 @@ describe('[GAS BENCHMARK] CanonicalTransactionChain', () => {
let ENQUEUE_L2_GAS_PREPAID let ENQUEUE_L2_GAS_PREPAID
let data let data
beforeEach(async () => { beforeEach(async () => {
CanonicalTransactionChain = CanonicalTransactionChain = CanonicalTransactionChain.connect(sequencer)
CanonicalTransactionChain.connect(sequencer)
ENQUEUE_L2_GAS_PREPAID = ENQUEUE_L2_GAS_PREPAID =
await CanonicalTransactionChain.ENQUEUE_L2_GAS_PREPAID() await CanonicalTransactionChain.ENQUEUE_L2_GAS_PREPAID()
data = '0x' + '12'.repeat(1234) data = '0x' + '12'.repeat(1234)
......
...@@ -128,13 +128,12 @@ describe('CanonicalTransactionChain', () => { ...@@ -128,13 +128,12 @@ describe('CanonicalTransactionChain', () => {
let CanonicalTransactionChain: Contract let CanonicalTransactionChain: Contract
beforeEach(async () => { beforeEach(async () => {
CanonicalTransactionChain = CanonicalTransactionChain = await Factory__CanonicalTransactionChain.deploy(
await Factory__CanonicalTransactionChain.deploy( AddressManager.address,
AddressManager.address, FORCE_INCLUSION_PERIOD_SECONDS,
FORCE_INCLUSION_PERIOD_SECONDS, FORCE_INCLUSION_PERIOD_BLOCKS,
FORCE_INCLUSION_PERIOD_BLOCKS, MAX_GAS_LIMIT
MAX_GAS_LIMIT )
)
const batches = await Factory__ChainStorageContainer.deploy( const batches = await Factory__ChainStorageContainer.deploy(
AddressManager.address, AddressManager.address,
...@@ -353,11 +352,7 @@ describe('CanonicalTransactionChain', () => { ...@@ -353,11 +352,7 @@ describe('CanonicalTransactionChain', () => {
data data
) )
await CanonicalTransactionChain.enqueue( await CanonicalTransactionChain.enqueue(target, gasLimit, data)
target,
gasLimit,
data
)
} else { } else {
await CanonicalTransactionChain.enqueue( await CanonicalTransactionChain.enqueue(
target, target,
...@@ -400,11 +395,7 @@ describe('CanonicalTransactionChain', () => { ...@@ -400,11 +395,7 @@ describe('CanonicalTransactionChain', () => {
data data
) )
await CanonicalTransactionChain.enqueue( await CanonicalTransactionChain.enqueue(target, gasLimit, data)
target,
gasLimit,
data
)
} else { } else {
await CanonicalTransactionChain.enqueue( await CanonicalTransactionChain.enqueue(
target, target,
...@@ -459,20 +450,14 @@ describe('CanonicalTransactionChain', () => { ...@@ -459,20 +450,14 @@ describe('CanonicalTransactionChain', () => {
describe(`when the queue has ${size} elements`, () => { describe(`when the queue has ${size} elements`, () => {
beforeEach(async () => { beforeEach(async () => {
for (let i = 0; i < size; i++) { for (let i = 0; i < size; i++) {
await CanonicalTransactionChain.enqueue( await CanonicalTransactionChain.enqueue(target, gasLimit, data)
target,
gasLimit,
data
)
} }
}) })
describe('when the sequencer inclusion period has not passed', () => { describe('when the sequencer inclusion period has not passed', () => {
it('should revert if not called by the sequencer', async () => { it('should revert if not called by the sequencer', async () => {
await expect( await expect(
CanonicalTransactionChain.connect(signer).appendQueueBatch( CanonicalTransactionChain.connect(signer).appendQueueBatch(1)
1
)
).to.be.revertedWith( ).to.be.revertedWith(
'Queue transactions cannot be submitted during the sequencer inclusion period.' 'Queue transactions cannot be submitted during the sequencer inclusion period.'
) )
...@@ -480,9 +465,7 @@ describe('CanonicalTransactionChain', () => { ...@@ -480,9 +465,7 @@ describe('CanonicalTransactionChain', () => {
it('should succeed if called by the sequencer', async () => { it('should succeed if called by the sequencer', async () => {
await expect( await expect(
CanonicalTransactionChain.connect( CanonicalTransactionChain.connect(sequencer).appendQueueBatch(1)
sequencer
).appendQueueBatch(1)
) )
.to.emit(CanonicalTransactionChain, 'QueueBatchAppended') .to.emit(CanonicalTransactionChain, 'QueueBatchAppended')
.withArgs(0, 1, 1) .withArgs(0, 1, 1)
...@@ -510,9 +493,7 @@ describe('CanonicalTransactionChain', () => { ...@@ -510,9 +493,7 @@ describe('CanonicalTransactionChain', () => {
}) })
it(`should be able to append ${size} elements even if attempting to append ${size} + 1 elements`, async () => { it(`should be able to append ${size} elements even if attempting to append ${size} + 1 elements`, async () => {
await expect( await expect(CanonicalTransactionChain.appendQueueBatch(size + 1))
CanonicalTransactionChain.appendQueueBatch(size + 1)
)
.to.emit(CanonicalTransactionChain, 'QueueBatchAppended') .to.emit(CanonicalTransactionChain, 'QueueBatchAppended')
.withArgs(0, size, size) .withArgs(0, size, size)
}) })
...@@ -534,22 +515,19 @@ describe('CanonicalTransactionChain', () => { ...@@ -534,22 +515,19 @@ describe('CanonicalTransactionChain', () => {
const blockNumber = await ethers.provider.getBlockNumber() const blockNumber = await ethers.provider.getBlockNumber()
await appendSequencerBatch( await appendSequencerBatch(CanonicalTransactionChain.connect(sequencer), {
CanonicalTransactionChain.connect(sequencer), shouldStartAtElement: 0,
{ totalElementsToAppend: 1,
shouldStartAtElement: 0, contexts: [
totalElementsToAppend: 1, {
contexts: [ numSequencedTransactions: 0,
{ numSubsequentQueueTransactions: 1,
numSequencedTransactions: 0, timestamp,
numSubsequentQueueTransactions: 1, blockNumber,
timestamp, },
blockNumber, ],
}, transactions: [],
], })
transactions: [],
}
)
expect( expect(
await CanonicalTransactionChain.verifyTransaction( await CanonicalTransactionChain.verifyTransaction(
...@@ -638,22 +616,19 @@ describe('CanonicalTransactionChain', () => { ...@@ -638,22 +616,19 @@ describe('CanonicalTransactionChain', () => {
const timestamp = (await getEthTime(ethers.provider)) - 10 const timestamp = (await getEthTime(ethers.provider)) - 10
const blockNumber = (await ethers.provider.getBlockNumber()) - 1 const blockNumber = (await ethers.provider.getBlockNumber()) - 1
await appendSequencerBatch( await appendSequencerBatch(CanonicalTransactionChain.connect(sequencer), {
CanonicalTransactionChain.connect(sequencer), shouldStartAtElement: 0,
{ totalElementsToAppend: 1,
shouldStartAtElement: 0, contexts: [
totalElementsToAppend: 1, {
contexts: [ numSequencedTransactions: 1,
{ numSubsequentQueueTransactions: 0,
numSequencedTransactions: 1, timestamp,
numSubsequentQueueTransactions: 0, blockNumber,
timestamp, },
blockNumber, ],
}, transactions: [data],
], })
transactions: [data],
}
)
expect( expect(
await CanonicalTransactionChain.verifyTransaction( await CanonicalTransactionChain.verifyTransaction(
...@@ -691,8 +666,7 @@ describe('CanonicalTransactionChain', () => { ...@@ -691,8 +666,7 @@ describe('CanonicalTransactionChain', () => {
describe('appendSequencerBatch', () => { describe('appendSequencerBatch', () => {
beforeEach(() => { beforeEach(() => {
CanonicalTransactionChain = CanonicalTransactionChain = CanonicalTransactionChain.connect(sequencer)
CanonicalTransactionChain.connect(sequencer)
}) })
it('should revert if expected start does not match current total batches', async () => { it('should revert if expected start does not match current total batches', async () => {
...@@ -853,10 +827,7 @@ describe('CanonicalTransactionChain', () => { ...@@ -853,10 +827,7 @@ describe('CanonicalTransactionChain', () => {
totalElementsToAppend: size, totalElementsToAppend: size,
}) })
) )
.to.emit( .to.emit(CanonicalTransactionChain, 'SequencerBatchAppended')
CanonicalTransactionChain,
'SequencerBatchAppended'
)
.withArgs(0, 0, size) .withArgs(0, 0, size)
}) })
}) })
...@@ -865,11 +836,7 @@ describe('CanonicalTransactionChain', () => { ...@@ -865,11 +836,7 @@ describe('CanonicalTransactionChain', () => {
describe('when inserting queue elements in between', () => { describe('when inserting queue elements in between', () => {
beforeEach(async () => { beforeEach(async () => {
for (let i = 0; i < size; i++) { for (let i = 0; i < size; i++) {
await CanonicalTransactionChain.enqueue( await CanonicalTransactionChain.enqueue(target, gasLimit, data)
target,
gasLimit,
data
)
} }
}) })
...@@ -904,10 +871,7 @@ describe('CanonicalTransactionChain', () => { ...@@ -904,10 +871,7 @@ describe('CanonicalTransactionChain', () => {
totalElementsToAppend: size * 2, totalElementsToAppend: size * 2,
}) })
) )
.to.emit( .to.emit(CanonicalTransactionChain, 'SequencerBatchAppended')
CanonicalTransactionChain,
'SequencerBatchAppended'
)
.withArgs(0, size, size * 2) .withArgs(0, size, size * 2)
}) })
}) })
...@@ -944,10 +908,7 @@ describe('CanonicalTransactionChain', () => { ...@@ -944,10 +908,7 @@ describe('CanonicalTransactionChain', () => {
totalElementsToAppend: size + spacing, totalElementsToAppend: size + spacing,
}) })
) )
.to.emit( .to.emit(CanonicalTransactionChain, 'SequencerBatchAppended')
CanonicalTransactionChain,
'SequencerBatchAppended'
)
.withArgs(0, spacing, size + spacing) .withArgs(0, spacing, size + spacing)
}) })
}) })
...@@ -993,9 +954,9 @@ describe('CanonicalTransactionChain', () => { ...@@ -993,9 +954,9 @@ describe('CanonicalTransactionChain', () => {
}) })
it(`should return ${size}`, async () => { it(`should return ${size}`, async () => {
expect( expect(await CanonicalTransactionChain.getTotalElements()).to.equal(
await CanonicalTransactionChain.getTotalElements() size
).to.equal(size) )
}) })
}) })
} }
......
...@@ -43,11 +43,7 @@ describe('StateCommitmentChain', () => { ...@@ -43,11 +43,7 @@ describe('StateCommitmentChain', () => {
await ethers.getContractFactory('BondManager') await ethers.getContractFactory('BondManager')
) )
await setProxyTarget( await setProxyTarget(AddressManager, 'BondManager', Mock__BondManager)
AddressManager,
'BondManager',
Mock__BondManager
)
Mock__BondManager.smocked.isCollateralized.will.return.with(true) Mock__BondManager.smocked.isCollateralized.will.return.with(true)
...@@ -141,8 +137,8 @@ describe('StateCommitmentChain', () => { ...@@ -141,8 +137,8 @@ describe('StateCommitmentChain', () => {
}) })
it('should append the state batch', async () => { it('should append the state batch', async () => {
await expect(StateCommitmentChain.appendStateBatch(batch, 0)).to await expect(StateCommitmentChain.appendStateBatch(batch, 0)).to.not
.not.be.reverted .be.reverted
}) })
}) })
...@@ -259,8 +255,8 @@ describe('StateCommitmentChain', () => { ...@@ -259,8 +255,8 @@ describe('StateCommitmentChain', () => {
describe('when the provided batch header is valid', () => { describe('when the provided batch header is valid', () => {
it('should remove the batch and all following batches', async () => { it('should remove the batch and all following batches', async () => {
await expect(StateCommitmentChain.deleteStateBatch(batchHeader)) await expect(StateCommitmentChain.deleteStateBatch(batchHeader)).to
.to.not.be.reverted .not.be.reverted
}) })
}) })
}) })
......
...@@ -51,10 +51,9 @@ describe('L2CrossDomainMessenger', () => { ...@@ -51,10 +51,9 @@ describe('L2CrossDomainMessenger', () => {
let L2CrossDomainMessenger: Contract let L2CrossDomainMessenger: Contract
beforeEach(async () => { beforeEach(async () => {
L2CrossDomainMessenger = L2CrossDomainMessenger = await Factory__L2CrossDomainMessenger.deploy(
await Factory__L2CrossDomainMessenger.deploy( Mock__L1CrossDomainMessenger.address
Mock__L1CrossDomainMessenger.address )
)
}) })
describe('sendMessage', () => { describe('sendMessage', () => {
...@@ -188,10 +187,12 @@ describe('L2CrossDomainMessenger', () => { ...@@ -188,10 +187,12 @@ describe('L2CrossDomainMessenger', () => {
) )
const reentrantMessage = const reentrantMessage =
L2CrossDomainMessenger.interface.encodeFunctionData( L2CrossDomainMessenger.interface.encodeFunctionData('relayMessage', [
'relayMessage', target,
[target, sender, message, 1] sender,
) message,
1,
])
// Calculate xDomainCallData used for indexing // Calculate xDomainCallData used for indexing
// (within the first call to the L2 Messenger). // (within the first call to the L2 Messenger).
...@@ -233,8 +234,7 @@ describe('L2CrossDomainMessenger', () => { ...@@ -233,8 +234,7 @@ describe('L2CrossDomainMessenger', () => {
] ]
) )
expect(await L2CrossDomainMessenger.relayedMessages(relayId)).to.be expect(await L2CrossDomainMessenger.relayedMessages(relayId)).to.be.true
.true
// Criteria 3: the target contract did not receive a call. // Criteria 3: the target contract did not receive a call.
expect(Mock__TargetContract.smocked.setTarget.calls[0]).to.be.undefined expect(Mock__TargetContract.smocked.setTarget.calls[0]).to.be.undefined
......
...@@ -66,12 +66,7 @@ describe('L2StandardBridge', () => { ...@@ -66,12 +66,7 @@ describe('L2StandardBridge', () => {
// Deploy an L2 ERC20 // Deploy an L2 ERC20
L2ERC20 = await ( L2ERC20 = await (
await ethers.getContractFactory('L2StandardERC20', alice) await ethers.getContractFactory('L2StandardERC20', alice)
).deploy( ).deploy(L2StandardBridge.address, DUMMY_L1TOKEN_ADDRESS, 'L2Token', 'L2T')
L2StandardBridge.address,
DUMMY_L1TOKEN_ADDRESS,
'L2Token',
'L2T'
)
}) })
// test the transfer flow of moving a token from L2 to L1 // test the transfer flow of moving a token from L2 to L1
...@@ -133,9 +128,7 @@ describe('L2StandardBridge', () => { ...@@ -133,9 +128,7 @@ describe('L2StandardBridge', () => {
() => DUMMY_L1BRIDGE_ADDRESS () => DUMMY_L1BRIDGE_ADDRESS
) )
await L2StandardBridge.connect( await L2StandardBridge.connect(l2MessengerImpersonator).finalizeDeposit(
l2MessengerImpersonator
).finalizeDeposit(
DUMMY_L1TOKEN_ADDRESS, DUMMY_L1TOKEN_ADDRESS,
NonCompliantERC20.address, NonCompliantERC20.address,
aliceAddress, aliceAddress,
...@@ -173,9 +166,7 @@ describe('L2StandardBridge', () => { ...@@ -173,9 +166,7 @@ describe('L2StandardBridge', () => {
() => DUMMY_L1BRIDGE_ADDRESS () => DUMMY_L1BRIDGE_ADDRESS
) )
await L2StandardBridge.connect( await L2StandardBridge.connect(l2MessengerImpersonator).finalizeDeposit(
l2MessengerImpersonator
).finalizeDeposit(
DUMMY_L1TOKEN_ADDRESS, DUMMY_L1TOKEN_ADDRESS,
L2ERC20.address, L2ERC20.address,
aliceAddress, aliceAddress,
......
...@@ -43,9 +43,7 @@ describe('OVM_SequencerFeeVault', () => { ...@@ -43,9 +43,7 @@ describe('OVM_SequencerFeeVault', () => {
await expect(OVM_SequencerFeeVault.withdraw()).to.not.be.reverted await expect(OVM_SequencerFeeVault.withdraw()).to.not.be.reverted
expect( expect(Mock__L2StandardBridge.smocked.withdrawTo.calls[0]).to.deep.equal([
Mock__L2StandardBridge.smocked.withdrawTo.calls[0]
).to.deep.equal([
predeploys.OVM_ETH, predeploys.OVM_ETH,
await signer1.getAddress(), await signer1.getAddress(),
amount, amount,
...@@ -66,9 +64,7 @@ describe('OVM_SequencerFeeVault', () => { ...@@ -66,9 +64,7 @@ describe('OVM_SequencerFeeVault', () => {
await expect(OVM_SequencerFeeVault.withdraw()).to.not.be.reverted await expect(OVM_SequencerFeeVault.withdraw()).to.not.be.reverted
expect( expect(Mock__L2StandardBridge.smocked.withdrawTo.calls[0]).to.deep.equal([
Mock__L2StandardBridge.smocked.withdrawTo.calls[0]
).to.deep.equal([
predeploys.OVM_ETH, predeploys.OVM_ETH,
await signer1.getAddress(), await signer1.getAddress(),
amount, amount,
......
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