Commit 07d4fd3a authored by Janek Rahrt's avatar Janek Rahrt Committed by GitHub

style: use ethers Null Address (#331)

Co-authored-by: default avatarJanek Rahrt <janek.rahrt@joyn.de>
parent ed6bf9e9
...@@ -2,11 +2,11 @@ import { expect } from '../../../../setup' ...@@ -2,11 +2,11 @@ import { expect } from '../../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract } from 'ethers' import { Signer, ContractFactory, Contract, constants } from 'ethers'
import { smockit, MockContract, smoddit } from '@eth-optimism/smock' import { smockit, MockContract, smoddit } from '@eth-optimism/smock'
/* Internal Imports */ /* Internal Imports */
import { NON_ZERO_ADDRESS, ZERO_ADDRESS } from '../../../../helpers' import { NON_ZERO_ADDRESS } from '../../../../helpers'
const INITIAL_TOTAL_L1_SUPPLY = 3000 const INITIAL_TOTAL_L1_SUPPLY = 3000
...@@ -81,7 +81,7 @@ describe('OVM_L1ERC20Gateway', () => { ...@@ -81,7 +81,7 @@ describe('OVM_L1ERC20Gateway', () => {
) )
await expect( await expect(
OVM_L1ERC20Gateway.finalizeWithdrawal(ZERO_ADDRESS, 1) OVM_L1ERC20Gateway.finalizeWithdrawal(constants.AddressZero, 1)
).to.be.revertedWith(ERR_INVALID_MESSENGER) ).to.be.revertedWith(ERR_INVALID_MESSENGER)
}) })
...@@ -91,7 +91,7 @@ describe('OVM_L1ERC20Gateway', () => { ...@@ -91,7 +91,7 @@ describe('OVM_L1ERC20Gateway', () => {
) )
await expect( await expect(
OVM_L1ERC20Gateway.finalizeWithdrawal(ZERO_ADDRESS, 1, { OVM_L1ERC20Gateway.finalizeWithdrawal(constants.AddressZero, 1, {
from: Mock__OVM_L1CrossDomainMessenger.address, from: Mock__OVM_L1CrossDomainMessenger.address,
}) })
).to.be.revertedWith(ERR_INVALID_X_DOMAIN_MSG_SENDER) ).to.be.revertedWith(ERR_INVALID_X_DOMAIN_MSG_SENDER)
...@@ -124,7 +124,7 @@ describe('OVM_L1ERC20Gateway', () => { ...@@ -124,7 +124,7 @@ describe('OVM_L1ERC20Gateway', () => {
const OVM_L2DepositedERC20 = await ( const OVM_L2DepositedERC20 = await (
await ethers.getContractFactory('OVM_L2DepositedERC20') await ethers.getContractFactory('OVM_L2DepositedERC20')
).deploy(ZERO_ADDRESS, '', '') ).deploy(constants.AddressZero, '', '')
const defaultFinalizeWithdrawalGas = await OVM_L2DepositedERC20.getFinalizeWithdrawalL1Gas() const defaultFinalizeWithdrawalGas = await OVM_L2DepositedERC20.getFinalizeWithdrawalL1Gas()
await expect(gasUsed.gt((defaultFinalizeWithdrawalGas * 11) / 10)) await expect(gasUsed.gt((defaultFinalizeWithdrawalGas * 11) / 10))
}) })
......
...@@ -2,15 +2,11 @@ import { expect } from '../../../../setup' ...@@ -2,15 +2,11 @@ import { expect } from '../../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Signer, Contract } from 'ethers' import { Signer, Contract, constants } from 'ethers'
import { smockit, MockContract } from '@eth-optimism/smock' import { smockit, MockContract } from '@eth-optimism/smock'
/* Internal Imports */ /* Internal Imports */
import { import { NON_ZERO_ADDRESS, makeAddressManager } from '../../../../helpers'
NON_ZERO_ADDRESS,
ZERO_ADDRESS,
makeAddressManager,
} from '../../../../helpers'
const L1_ETH_GATEWAY_NAME = 'Proxy__OVM_L1CrossDomainMessenger' const L1_ETH_GATEWAY_NAME = 'Proxy__OVM_L1CrossDomainMessenger'
...@@ -61,7 +57,10 @@ describe('OVM_L1ETHGateway', () => { ...@@ -61,7 +57,10 @@ describe('OVM_L1ETHGateway', () => {
it('onlyFromCrossDomainAccount: should revert on calls from a non-crossDomainMessenger L1 account', async () => { it('onlyFromCrossDomainAccount: should revert on calls from a non-crossDomainMessenger L1 account', async () => {
// Deploy new gateway, initialize with random messenger // Deploy new gateway, initialize with random messenger
await expect( await expect(
OVM_L1ETHGateway.connect(alice).finalizeWithdrawal(ZERO_ADDRESS, 1) OVM_L1ETHGateway.connect(alice).finalizeWithdrawal(
constants.AddressZero,
1
)
).to.be.revertedWith(ERR_INVALID_MESSENGER) ).to.be.revertedWith(ERR_INVALID_MESSENGER)
}) })
...@@ -80,7 +79,7 @@ describe('OVM_L1ETHGateway', () => { ...@@ -80,7 +79,7 @@ describe('OVM_L1ETHGateway', () => {
) )
await expect( await expect(
OVM_L1ETHGateway.finalizeWithdrawal(ZERO_ADDRESS, 1) OVM_L1ETHGateway.finalizeWithdrawal(constants.AddressZero, 1)
).to.be.revertedWith(ERR_INVALID_X_DOMAIN_MSG_SENDER) ).to.be.revertedWith(ERR_INVALID_X_DOMAIN_MSG_SENDER)
}) })
...@@ -118,7 +117,7 @@ describe('OVM_L1ETHGateway', () => { ...@@ -118,7 +117,7 @@ describe('OVM_L1ETHGateway', () => {
// Deploy this just for the getter // Deploy this just for the getter
const OVM_L2DepositedERC20 = await ( const OVM_L2DepositedERC20 = await (
await ethers.getContractFactory('OVM_L2DepositedERC20') await ethers.getContractFactory('OVM_L2DepositedERC20')
).deploy(ZERO_ADDRESS, '', '') ).deploy(constants.AddressZero, '', '')
await expect( await expect(
gasUsed.gt( gasUsed.gt(
......
...@@ -2,7 +2,7 @@ import { expect } from '../../../../setup' ...@@ -2,7 +2,7 @@ import { expect } from '../../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract } from 'ethers' import { Signer, ContractFactory, Contract, constants } from 'ethers'
import { import {
smockit, smockit,
MockContract, MockContract,
...@@ -11,7 +11,7 @@ import { ...@@ -11,7 +11,7 @@ import {
} from '@eth-optimism/smock' } from '@eth-optimism/smock'
/* Internal Imports */ /* Internal Imports */
import { NON_ZERO_ADDRESS, ZERO_ADDRESS } from '../../../../helpers' import { NON_ZERO_ADDRESS } from '../../../../helpers'
const ERR_INVALID_MESSENGER = 'OVM_XCHAIN: messenger contract unauthenticated' const ERR_INVALID_MESSENGER = 'OVM_XCHAIN: messenger contract unauthenticated'
const ERR_INVALID_X_DOMAIN_MSG_SENDER = const ERR_INVALID_X_DOMAIN_MSG_SENDER =
...@@ -66,7 +66,7 @@ describe('OVM_L2DepositedERC20', () => { ...@@ -66,7 +66,7 @@ describe('OVM_L2DepositedERC20', () => {
await OVM_L2DepositedERC20.init(NON_ZERO_ADDRESS) await OVM_L2DepositedERC20.init(NON_ZERO_ADDRESS)
await expect( await expect(
OVM_L2DepositedERC20.finalizeDeposit(ZERO_ADDRESS, 0) OVM_L2DepositedERC20.finalizeDeposit(constants.AddressZero, 0)
).to.be.revertedWith(ERR_INVALID_MESSENGER) ).to.be.revertedWith(ERR_INVALID_MESSENGER)
}) })
...@@ -76,7 +76,7 @@ describe('OVM_L2DepositedERC20', () => { ...@@ -76,7 +76,7 @@ describe('OVM_L2DepositedERC20', () => {
) )
await expect( await expect(
OVM_L2DepositedERC20.finalizeDeposit(ZERO_ADDRESS, 0, { OVM_L2DepositedERC20.finalizeDeposit(constants.AddressZero, 0, {
from: Mock__OVM_L2CrossDomainMessenger.address, from: Mock__OVM_L2CrossDomainMessenger.address,
}) })
).to.be.revertedWith(ERR_INVALID_X_DOMAIN_MSG_SENDER) ).to.be.revertedWith(ERR_INVALID_X_DOMAIN_MSG_SENDER)
......
...@@ -2,7 +2,7 @@ import { expect } from '../../../../setup' ...@@ -2,7 +2,7 @@ import { expect } from '../../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract } from 'ethers' import { Signer, ContractFactory, Contract, constants } from 'ethers'
import { smockit, MockContract } from '@eth-optimism/smock' import { smockit, MockContract } from '@eth-optimism/smock'
/* Internal Imports */ /* Internal Imports */
...@@ -10,7 +10,6 @@ import { ...@@ -10,7 +10,6 @@ import {
makeAddressManager, makeAddressManager,
setProxyTarget, setProxyTarget,
NON_NULL_BYTES32, NON_NULL_BYTES32,
ZERO_ADDRESS,
NON_ZERO_ADDRESS, NON_ZERO_ADDRESS,
getXDomainCalldata, getXDomainCalldata,
} from '../../../../helpers' } from '../../../../helpers'
...@@ -121,7 +120,7 @@ describe('OVM_L2CrossDomainMessenger', () => { ...@@ -121,7 +120,7 @@ describe('OVM_L2CrossDomainMessenger', () => {
it('should revert if the L1 message sender is not the OVM_L1CrossDomainMessenger', async () => { it('should revert if the L1 message sender is not the OVM_L1CrossDomainMessenger', async () => {
Mock__OVM_L1MessageSender.smocked.getL1MessageSender.will.return.with( Mock__OVM_L1MessageSender.smocked.getL1MessageSender.will.return.with(
ZERO_ADDRESS constants.AddressZero
) )
await expect( await expect(
......
...@@ -2,7 +2,7 @@ import { expect } from '../../../setup' ...@@ -2,7 +2,7 @@ import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract, BigNumber } from 'ethers' import { Signer, ContractFactory, Contract, BigNumber, constants } from 'ethers'
import { smockit, MockContract } from '@eth-optimism/smock' import { smockit, MockContract } from '@eth-optimism/smock'
import { import {
AppendSequencerBatchParams, AppendSequencerBatchParams,
...@@ -25,7 +25,6 @@ import { ...@@ -25,7 +25,6 @@ import {
getNextBlockNumber, getNextBlockNumber,
increaseEthTime, increaseEthTime,
getBlockTime, getBlockTime,
ZERO_ADDRESS,
mineBlock, mineBlock,
} from '../../../helpers' } from '../../../helpers'
...@@ -632,7 +631,7 @@ describe('OVM_CanonicalTransactionChain', () => { ...@@ -632,7 +631,7 @@ describe('OVM_CanonicalTransactionChain', () => {
timestamp, timestamp,
blockNumber, blockNumber,
l1QueueOrigin: 0, l1QueueOrigin: 0,
l1TxOrigin: ZERO_ADDRESS, l1TxOrigin: constants.AddressZero,
entrypoint, entrypoint,
gasLimit, gasLimit,
data, data,
......
...@@ -2,7 +2,7 @@ import { expect } from '../../../setup' ...@@ -2,7 +2,7 @@ import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Signer, ContractFactory, Contract } from 'ethers' import { Signer, ContractFactory, Contract, constants } from 'ethers'
import { smockit, MockContract } from '@eth-optimism/smock' import { smockit, MockContract } from '@eth-optimism/smock'
/* Internal Imports */ /* Internal Imports */
...@@ -10,7 +10,6 @@ import { ...@@ -10,7 +10,6 @@ import {
makeAddressManager, makeAddressManager,
setProxyTarget, setProxyTarget,
NON_NULL_BYTES32, NON_NULL_BYTES32,
ZERO_ADDRESS,
getEthTime, getEthTime,
NULL_BYTES32, NULL_BYTES32,
increaseEthTime, increaseEthTime,
...@@ -212,7 +211,10 @@ describe('OVM_StateCommitmentChain', () => { ...@@ -212,7 +211,10 @@ describe('OVM_StateCommitmentChain', () => {
describe('when the sender is not the OVM_FraudVerifier', () => { describe('when the sender is not the OVM_FraudVerifier', () => {
before(async () => { before(async () => {
await AddressManager.setAddress('OVM_FraudVerifier', ZERO_ADDRESS) await AddressManager.setAddress(
'OVM_FraudVerifier',
constants.AddressZero
)
}) })
it('should revert', async () => { it('should revert', async () => {
......
/* Internal Imports */ /* Internal Imports */
import { constants } from 'ethers'
import { import {
ExecutionManagerTestRunner, ExecutionManagerTestRunner,
TestDefinition, TestDefinition,
...@@ -7,7 +8,6 @@ import { ...@@ -7,7 +8,6 @@ import {
VERIFIED_EMPTY_CONTRACT_HASH, VERIFIED_EMPTY_CONTRACT_HASH,
NUISANCE_GAS_COSTS, NUISANCE_GAS_COSTS,
Helper_TestRunner_BYTELEN, Helper_TestRunner_BYTELEN,
ZERO_ADDRESS,
} from '../../../../helpers' } from '../../../../helpers'
const CREATED_CONTRACT_1 = '0x2bda4a99d5be88609d23b1e4ab5d1d34fb1c2feb' const CREATED_CONTRACT_1 = '0x2bda4a99d5be88609d23b1e4ab5d1d34fb1c2feb'
...@@ -212,7 +212,7 @@ const test_nuisanceGas: TestDefinition = { ...@@ -212,7 +212,7 @@ const test_nuisanceGas: TestDefinition = {
], ],
}, },
expectedReturnStatus: true, expectedReturnStatus: true,
expectedReturnValue: ZERO_ADDRESS, expectedReturnValue: constants.AddressZero,
}, },
], ],
}, },
......
/* Internal Imports */ /* Internal Imports */
import { constants } from 'ethers'
import { import {
ExecutionManagerTestRunner, ExecutionManagerTestRunner,
TestDefinition, TestDefinition,
...@@ -8,7 +9,6 @@ import { ...@@ -8,7 +9,6 @@ import {
REVERT_FLAGS, REVERT_FLAGS,
DUMMY_BYTECODE, DUMMY_BYTECODE,
UNSAFE_BYTECODE, UNSAFE_BYTECODE,
ZERO_ADDRESS,
VERIFIED_EMPTY_CONTRACT_HASH, VERIFIED_EMPTY_CONTRACT_HASH,
DUMMY_BYTECODE_BYTELEN, DUMMY_BYTECODE_BYTELEN,
DUMMY_BYTECODE_HASH, DUMMY_BYTECODE_HASH,
...@@ -181,7 +181,7 @@ const test_ovmCREATE: TestDefinition = { ...@@ -181,7 +181,7 @@ const test_ovmCREATE: TestDefinition = {
}, },
expectedReturnStatus: true, expectedReturnStatus: true,
expectedReturnValue: { expectedReturnValue: {
address: ZERO_ADDRESS, address: constants.AddressZero,
revertData: DUMMY_REVERT_DATA, revertData: DUMMY_REVERT_DATA,
}, },
}, },
...@@ -207,7 +207,7 @@ const test_ovmCREATE: TestDefinition = { ...@@ -207,7 +207,7 @@ const test_ovmCREATE: TestDefinition = {
}, },
expectedReturnStatus: true, expectedReturnStatus: true,
expectedReturnValue: { expectedReturnValue: {
address: ZERO_ADDRESS, address: constants.AddressZero,
revertData: DUMMY_REVERT_DATA, revertData: DUMMY_REVERT_DATA,
}, },
}, },
...@@ -241,7 +241,7 @@ const test_ovmCREATE: TestDefinition = { ...@@ -241,7 +241,7 @@ const test_ovmCREATE: TestDefinition = {
}, },
expectedReturnStatus: true, expectedReturnStatus: true,
expectedReturnValue: { expectedReturnValue: {
address: ZERO_ADDRESS, address: constants.AddressZero,
revertData: DUMMY_REVERT_DATA, revertData: DUMMY_REVERT_DATA,
}, },
}, },
...@@ -275,7 +275,7 @@ const test_ovmCREATE: TestDefinition = { ...@@ -275,7 +275,7 @@ const test_ovmCREATE: TestDefinition = {
}, },
expectedReturnStatus: true, expectedReturnStatus: true,
expectedReturnValue: { expectedReturnValue: {
address: ZERO_ADDRESS, address: constants.AddressZero,
revertData: DUMMY_REVERT_DATA, revertData: DUMMY_REVERT_DATA,
}, },
}, },
...@@ -542,7 +542,7 @@ const test_ovmCREATE: TestDefinition = { ...@@ -542,7 +542,7 @@ const test_ovmCREATE: TestDefinition = {
}, },
expectedReturnStatus: true, expectedReturnStatus: true,
expectedReturnValue: { expectedReturnValue: {
address: ZERO_ADDRESS, address: constants.AddressZero,
revertData: DUMMY_REVERT_DATA, revertData: DUMMY_REVERT_DATA,
}, },
}, },
...@@ -704,7 +704,7 @@ const test_ovmCREATE: TestDefinition = { ...@@ -704,7 +704,7 @@ const test_ovmCREATE: TestDefinition = {
}, },
expectedReturnStatus: true, expectedReturnStatus: true,
expectedReturnValue: { expectedReturnValue: {
address: ZERO_ADDRESS, address: constants.AddressZero,
revertData: DUMMY_REVERT_DATA, revertData: DUMMY_REVERT_DATA,
}, },
}, },
...@@ -723,7 +723,7 @@ const test_ovmCREATE: TestDefinition = { ...@@ -723,7 +723,7 @@ const test_ovmCREATE: TestDefinition = {
], ],
}, },
expectedReturnStatus: true, expectedReturnStatus: true,
expectedReturnValue: ZERO_ADDRESS, expectedReturnValue: constants.AddressZero,
}, },
], ],
}, },
...@@ -737,7 +737,7 @@ const test_ovmCREATE: TestDefinition = { ...@@ -737,7 +737,7 @@ const test_ovmCREATE: TestDefinition = {
}, },
expectedReturnStatus: true, expectedReturnStatus: true,
expectedReturnValue: { expectedReturnValue: {
address: ZERO_ADDRESS, address: constants.AddressZero,
revertData: encodeSolidityError( revertData: encodeSolidityError(
'Constructor attempted to deploy unsafe bytecode.' 'Constructor attempted to deploy unsafe bytecode.'
), ),
......
/* Internal Imports */ /* Internal Imports */
import { constants } from 'ethers'
import { import {
ExecutionManagerTestRunner, ExecutionManagerTestRunner,
TestDefinition, TestDefinition,
OVM_TX_GAS_LIMIT, OVM_TX_GAS_LIMIT,
NON_NULL_BYTES32, NON_NULL_BYTES32,
ZERO_ADDRESS,
VERIFIED_EMPTY_CONTRACT_HASH, VERIFIED_EMPTY_CONTRACT_HASH,
} from '../../../../helpers' } from '../../../../helpers'
...@@ -80,8 +80,8 @@ const test_run: TestDefinition = { ...@@ -80,8 +80,8 @@ const test_run: TestDefinition = {
timestamp: 0, timestamp: 0,
queueOrigin: 0, queueOrigin: 0,
entrypoint: '$OVM_CALL_HELPER', entrypoint: '$OVM_CALL_HELPER',
origin: ZERO_ADDRESS, origin: constants.AddressZero,
msgSender: ZERO_ADDRESS, msgSender: constants.AddressZero,
gasLimit: OVM_TX_GAS_LIMIT, gasLimit: OVM_TX_GAS_LIMIT,
subSteps: [ subSteps: [
{ {
...@@ -115,8 +115,8 @@ const test_run: TestDefinition = { ...@@ -115,8 +115,8 @@ const test_run: TestDefinition = {
// timestamp: 0, // timestamp: 0,
// queueOrigin: 0, // queueOrigin: 0,
// entrypoint: '$OVM_CALL_HELPER', // entrypoint: '$OVM_CALL_HELPER',
// origin: ZERO_ADDRESS, // origin: constants.AddressZero,
// msgSender: ZERO_ADDRESS, // msgSender: constants.AddressZero,
// gasLimit: OVM_TX_GAS_LIMIT, // gasLimit: OVM_TX_GAS_LIMIT,
// subSteps: [], // subSteps: [],
// }, // },
......
...@@ -2,14 +2,13 @@ import '../../../setup' ...@@ -2,14 +2,13 @@ import '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Contract, ContractFactory, Signer } from 'ethers' import { constants, Contract, ContractFactory, Signer } from 'ethers'
import _ from 'lodash' import _ from 'lodash'
/* Internal Imports */ /* Internal Imports */
import { import {
DUMMY_ACCOUNTS, DUMMY_ACCOUNTS,
DUMMY_BYTES32, DUMMY_BYTES32,
ZERO_ADDRESS,
EMPTY_ACCOUNT_CODE_HASH, EMPTY_ACCOUNT_CODE_HASH,
NON_ZERO_ADDRESS, NON_ZERO_ADDRESS,
NON_NULL_BYTES32, NON_NULL_BYTES32,
...@@ -301,7 +300,7 @@ describe('OVM_StateManager gas consumption', () => { ...@@ -301,7 +300,7 @@ describe('OVM_StateManager gas consumption', () => {
measure('getAccountEthAddress', [DUMMY_ACCOUNT.address], async () => { measure('getAccountEthAddress', [DUMMY_ACCOUNT.address], async () => {
await OVM_StateManager.putAccount(DUMMY_ACCOUNT.address, { await OVM_StateManager.putAccount(DUMMY_ACCOUNT.address, {
...DUMMY_ACCOUNT.data, ...DUMMY_ACCOUNT.data,
ethAddress: ZERO_ADDRESS, ethAddress: constants.AddressZero,
}) })
}) })
}) })
......
...@@ -2,14 +2,13 @@ import { expect } from '../../../setup' ...@@ -2,14 +2,13 @@ import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Contract, ContractFactory, Signer, BigNumber } from 'ethers' import { Contract, ContractFactory, Signer, BigNumber, constants } from 'ethers'
import _ from 'lodash' import _ from 'lodash'
/* Internal Imports */ /* Internal Imports */
import { import {
DUMMY_ACCOUNTS, DUMMY_ACCOUNTS,
DUMMY_BYTES32, DUMMY_BYTES32,
ZERO_ADDRESS,
EMPTY_ACCOUNT_CODE_HASH, EMPTY_ACCOUNT_CODE_HASH,
KECCAK_256_NULL, KECCAK_256_NULL,
} from '../../../helpers' } from '../../../helpers'
...@@ -304,7 +303,7 @@ describe('OVM_StateManager', () => { ...@@ -304,7 +303,7 @@ describe('OVM_StateManager', () => {
it('should return the zero address', async () => { it('should return the zero address', async () => {
expect( expect(
await OVM_StateManager.getAccountEthAddress(DUMMY_ACCOUNTS[0].address) await OVM_StateManager.getAccountEthAddress(DUMMY_ACCOUNTS[0].address)
).to.equal(ZERO_ADDRESS) ).to.equal(constants.AddressZero)
}) })
}) })
}) })
......
...@@ -2,9 +2,9 @@ import { expect } from '../../../setup' ...@@ -2,9 +2,9 @@ import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers, waffle } from 'hardhat' import { ethers, waffle } from 'hardhat'
import { ContractFactory, Contract, Wallet } from 'ethers' import { ContractFactory, Contract, Wallet, constants } from 'ethers'
import { MockContract, smockit } from '@eth-optimism/smock' import { MockContract, smockit } from '@eth-optimism/smock'
import { ZERO_ADDRESS, remove0x } from '@eth-optimism/core-utils' import { remove0x } from '@eth-optimism/core-utils'
/* Internal Imports */ /* Internal Imports */
import { decodeSolidityError } from '../../../helpers' import { decodeSolidityError } from '../../../helpers'
...@@ -102,7 +102,7 @@ describe('OVM_ProxySequencerEntrypoint', () => { ...@@ -102,7 +102,7 @@ describe('OVM_ProxySequencerEntrypoint', () => {
Helper_PrecompileCaller, Helper_PrecompileCaller,
OVM_ProxySequencerEntrypoint, OVM_ProxySequencerEntrypoint,
'init', 'init',
[ZERO_ADDRESS, ZERO_ADDRESS] [constants.AddressZero, constants.AddressZero]
) )
const ovmREVERT: any = Mock__OVM_ExecutionManager.smocked.ovmREVERT.calls[0] const ovmREVERT: any = Mock__OVM_ExecutionManager.smocked.ovmREVERT.calls[0]
......
...@@ -3,7 +3,7 @@ import { expect } from '../../../setup' ...@@ -3,7 +3,7 @@ import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { BigNumber, Contract } from 'ethers' import { BigNumber, constants, Contract } from 'ethers'
import * as rlp from 'rlp' import * as rlp from 'rlp'
/* Internal Imports */ /* Internal Imports */
...@@ -14,7 +14,6 @@ import { ...@@ -14,7 +14,6 @@ import {
NULL_BYTES32, NULL_BYTES32,
setProxyTarget, setProxyTarget,
TrieTestGenerator, TrieTestGenerator,
ZERO_ADDRESS,
} from '../../../helpers' } from '../../../helpers'
import { import {
MockContract, MockContract,
...@@ -92,7 +91,7 @@ describe('OVM_StateTransitioner', () => { ...@@ -92,7 +91,7 @@ describe('OVM_StateTransitioner', () => {
describe('proveContractState', () => { describe('proveContractState', () => {
const ovmContractAddress = NON_ZERO_ADDRESS const ovmContractAddress = NON_ZERO_ADDRESS
let ethContractAddress = ZERO_ADDRESS let ethContractAddress = constants.AddressZero
let account: any let account: any
beforeEach(() => { beforeEach(() => {
Mock__OVM_StateManager.smocked.hasAccount.will.return.with(false) Mock__OVM_StateManager.smocked.hasAccount.will.return.with(false)
...@@ -229,7 +228,11 @@ describe('OVM_StateTransitioner', () => { ...@@ -229,7 +228,11 @@ describe('OVM_StateTransitioner', () => {
it('should revert', async () => { it('should revert', async () => {
await expect( await expect(
OVM_StateTransitioner.proveStorageSlot(ZERO_ADDRESS, key, proof) OVM_StateTransitioner.proveStorageSlot(
constants.AddressZero,
key,
proof
)
).to.be.reverted ).to.be.reverted
}) })
}) })
...@@ -259,12 +262,16 @@ describe('OVM_StateTransitioner', () => { ...@@ -259,12 +262,16 @@ describe('OVM_StateTransitioner', () => {
it('should insert the storage slot', async () => { it('should insert the storage slot', async () => {
await expect( await expect(
OVM_StateTransitioner.proveStorageSlot(ZERO_ADDRESS, key, proof) OVM_StateTransitioner.proveStorageSlot(
constants.AddressZero,
key,
proof
)
).to.not.be.reverted ).to.not.be.reverted
expect( expect(
Mock__OVM_StateManager.smocked.putContractStorage.calls[0] Mock__OVM_StateManager.smocked.putContractStorage.calls[0]
).to.deep.equal([ZERO_ADDRESS, key, val]) ).to.deep.equal([constants.AddressZero, key, val])
}) })
}) })
}) })
...@@ -277,8 +284,8 @@ describe('OVM_StateTransitioner', () => { ...@@ -277,8 +284,8 @@ describe('OVM_StateTransitioner', () => {
timestamp: '0x12', timestamp: '0x12',
blockNumber: '0x34', blockNumber: '0x34',
l1QueueOrigin: '0x00', l1QueueOrigin: '0x00',
l1TxOrigin: ZERO_ADDRESS, l1TxOrigin: constants.AddressZero,
entrypoint: ZERO_ADDRESS, entrypoint: constants.AddressZero,
gasLimit: toHexString(gasLimit), gasLimit: toHexString(gasLimit),
data: '0x1234', data: '0x1234',
} }
...@@ -336,7 +343,7 @@ describe('OVM_StateTransitioner', () => { ...@@ -336,7 +343,7 @@ describe('OVM_StateTransitioner', () => {
balance: 0, balance: 0,
storageRoot: NULL_BYTES32, storageRoot: NULL_BYTES32,
codeHash: NULL_BYTES32, codeHash: NULL_BYTES32,
ethAddress: ZERO_ADDRESS, ethAddress: constants.AddressZero,
isFresh: false, isFresh: false,
} }
Mock__OVM_StateManager.smocked.hasAccount.will.return.with(false) Mock__OVM_StateManager.smocked.hasAccount.will.return.with(false)
...@@ -428,7 +435,7 @@ describe('OVM_StateTransitioner', () => { ...@@ -428,7 +435,7 @@ describe('OVM_StateTransitioner', () => {
Mock__OVM_StateManager.smocked.getAccount.will.return.with({ Mock__OVM_StateManager.smocked.getAccount.will.return.with({
...account, ...account,
ethAddress: ZERO_ADDRESS, ethAddress: constants.AddressZero,
isFresh: false, isFresh: false,
}) })
...@@ -498,7 +505,7 @@ describe('OVM_StateTransitioner', () => { ...@@ -498,7 +505,7 @@ describe('OVM_StateTransitioner', () => {
Mock__OVM_StateManager.smocked.getAccount.will.return.with({ Mock__OVM_StateManager.smocked.getAccount.will.return.with({
...account, ...account,
storageRoot: storageTest.root, storageRoot: storageTest.root,
ethAddress: ZERO_ADDRESS, ethAddress: constants.AddressZero,
isFresh: false, isFresh: false,
}) })
......
...@@ -2,12 +2,11 @@ import { expect } from '../../../setup' ...@@ -2,12 +2,11 @@ import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { ContractFactory, Contract } from 'ethers' import { ContractFactory, Contract, constants } from 'ethers'
/* Internal Imports */ /* Internal Imports */
import { import {
makeAddressManager, makeAddressManager,
ZERO_ADDRESS,
DUMMY_OVM_TRANSACTIONS, DUMMY_OVM_TRANSACTIONS,
NULL_BYTES32, NULL_BYTES32,
hashTransaction, hashTransaction,
...@@ -38,7 +37,10 @@ describe('OVM_StateTransitionerFactory', () => { ...@@ -38,7 +37,10 @@ describe('OVM_StateTransitionerFactory', () => {
describe('create', () => { describe('create', () => {
describe('when the sender is not the OVM_FraudVerifier', () => { describe('when the sender is not the OVM_FraudVerifier', () => {
before(async () => { before(async () => {
await AddressManager.setAddress('OVM_FraudVerifier', ZERO_ADDRESS) await AddressManager.setAddress(
'OVM_FraudVerifier',
constants.AddressZero
)
}) })
it('should revert', async () => { it('should revert', async () => {
......
...@@ -3,12 +3,9 @@ import { expect } from '../../../setup' ...@@ -3,12 +3,9 @@ import { expect } from '../../../setup'
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Contract, Signer } from 'ethers' import { Contract, Signer, constants } from 'ethers'
import { fromHexString, toHexString } from '@eth-optimism/core-utils' import { fromHexString, toHexString } from '@eth-optimism/core-utils'
/* Internal Imports */
import { ZERO_ADDRESS } from '../../../helpers'
// Leaving this here for now. If it's sufficiently useful we can throw it in core-utils. // Leaving this here for now. If it's sufficiently useful we can throw it in core-utils.
const getHexSlice = ( const getHexSlice = (
input: Buffer | string, input: Buffer | string,
...@@ -33,7 +30,7 @@ describe('Lib_EthUtils', () => { ...@@ -33,7 +30,7 @@ describe('Lib_EthUtils', () => {
describe('getCode(address,uint256,uint256)', () => { describe('getCode(address,uint256,uint256)', () => {
describe('when the contract does not exist', () => { describe('when the contract does not exist', () => {
const address = ZERO_ADDRESS const address = constants.AddressZero
describe('when offset = 0', () => { describe('when offset = 0', () => {
const offset = 0 const offset = 0
......
/* External Imports */ /* External Imports */
import { ethers } from 'hardhat' import { ethers } from 'hardhat'
import { Wallet } from 'ethers' import { constants, Wallet } from 'ethers'
/* Internal Imports */ /* Internal Imports */
import { remove0x, fromHexString } from '@eth-optimism/core-utils' import { remove0x, fromHexString } from '@eth-optimism/core-utils'
import { ZERO_ADDRESS } from '../constants'
export interface EIP155Transaction { export interface EIP155Transaction {
nonce: number nonce: number
...@@ -47,7 +46,7 @@ export const encodeCompactTransaction = (transaction: any): string => { ...@@ -47,7 +46,7 @@ export const encodeCompactTransaction = (transaction: any): string => {
const compressedGasPrice: any = transaction.gasPrice / 1000000 const compressedGasPrice: any = transaction.gasPrice / 1000000
const gasPrice = ethers.utils.zeroPad(compressedGasPrice, 3) const gasPrice = ethers.utils.zeroPad(compressedGasPrice, 3)
const to = !transaction.to.length const to = !transaction.to.length
? fromHexString(ZERO_ADDRESS) ? fromHexString(constants.AddressZero)
: fromHexString(transaction.to) : fromHexString(transaction.to)
const data = fromHexString(transaction.data) const data = fromHexString(transaction.data)
......
...@@ -21,7 +21,6 @@ export const NULL_BYTES32 = ...@@ -21,7 +21,6 @@ export const NULL_BYTES32 =
'0x0000000000000000000000000000000000000000000000000000000000000000' '0x0000000000000000000000000000000000000000000000000000000000000000'
export const NON_NULL_BYTES32 = export const NON_NULL_BYTES32 =
'0x1111111111111111111111111111111111111111111111111111111111111111' '0x1111111111111111111111111111111111111111111111111111111111111111'
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
export const NON_ZERO_ADDRESS = '0x1111111111111111111111111111111111111111' export const NON_ZERO_ADDRESS = '0x1111111111111111111111111111111111111111'
export const VERIFIED_EMPTY_CONTRACT_HASH = export const VERIFIED_EMPTY_CONTRACT_HASH =
......
/* External Imports */ /* External Imports */
import { BigNumber } from 'ethers' import { BigNumber, constants } from 'ethers'
/* Internal Imports */ /* Internal Imports */
import { DUMMY_BYTES32 } from './bytes32' import { DUMMY_BYTES32 } from './bytes32'
import { ZERO_ADDRESS, NON_ZERO_ADDRESS } from '../constants' import { NON_ZERO_ADDRESS } from '../constants'
import { OVMAccount } from '../types/ovm-types' import { OVMAccount } from '../types/ovm-types'
export const DUMMY_ACCOUNTS: Array<{ export const DUMMY_ACCOUNTS: Array<{
...@@ -17,7 +17,7 @@ export const DUMMY_ACCOUNTS: Array<{ ...@@ -17,7 +17,7 @@ export const DUMMY_ACCOUNTS: Array<{
balance: BigNumber.from(456), balance: BigNumber.from(456),
storageRoot: DUMMY_BYTES32[0], storageRoot: DUMMY_BYTES32[0],
codeHash: DUMMY_BYTES32[1], codeHash: DUMMY_BYTES32[1],
ethAddress: ZERO_ADDRESS, ethAddress: constants.AddressZero,
}, },
}, },
{ {
......
import { ZERO_ADDRESS, NULL_BYTES32 } from '../constants' import { NULL_BYTES32 } from '../constants'
import { ethers } from 'ethers' import { constants, ethers } from 'ethers'
export interface Transaction { export interface Transaction {
timestamp: number timestamp: number
...@@ -18,8 +18,8 @@ export const DUMMY_OVM_TRANSACTIONS: Array<Transaction> = [ ...@@ -18,8 +18,8 @@ export const DUMMY_OVM_TRANSACTIONS: Array<Transaction> = [
timestamp: i, timestamp: i,
blockNumber: 0, blockNumber: 0,
l1QueueOrigin: 0, l1QueueOrigin: 0,
l1TxOrigin: ZERO_ADDRESS, l1TxOrigin: constants.AddressZero,
entrypoint: ZERO_ADDRESS, entrypoint: constants.AddressZero,
gasLimit: 0, gasLimit: 0,
data: NULL_BYTES32, data: NULL_BYTES32,
} }
......
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