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

lint: fix

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