constants.ts 1.92 KB
Newer Older
Kelvin Fichter's avatar
Kelvin Fichter committed
1 2 3
/* External Imports */
import { ethers } from 'ethers'
import { defaultAccounts } from 'ethereum-waffle'
4
import xor from 'buffer-xor'
Kelvin Fichter's avatar
Kelvin Fichter committed
5 6

/* Internal Imports */
7
import { makeHexString, makeAddress, fromHexString, toHexString } from './utils'
Kelvin Fichter's avatar
Kelvin Fichter committed
8 9

export const DEFAULT_ACCOUNTS = defaultAccounts
10
export const DEFAULT_ACCOUNTS_HARDHAT = defaultAccounts.map((account) => {
Kelvin Fichter's avatar
Kelvin Fichter committed
11 12 13 14 15 16
  return {
    balance: ethers.BigNumber.from(account.balance).toHexString(),
    privateKey: account.secretKey,
  }
})

17
export const OVM_TX_GAS_LIMIT = 10_000_000
ben-chain's avatar
ben-chain committed
18
export const RUN_OVM_TEST_GAS = 20_000_000
19
export const FORCE_INCLUSION_PERIOD_SECONDS = 600
20
export const FORCE_INCLUSION_PERIOD_BLOCKS = 600 / 12
Kelvin Fichter's avatar
Kelvin Fichter committed
21 22 23 24 25

export const NULL_BYTES32 = makeHexString('00', 32)
export const NON_NULL_BYTES32 = makeHexString('11', 32)
export const ZERO_ADDRESS = makeAddress('00')
export const NON_ZERO_ADDRESS = makeAddress('11')
26

Kelvin Fichter's avatar
Kelvin Fichter committed
27
export const VERIFIED_EMPTY_CONTRACT_HASH =
28
  '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'
ben-chain's avatar
ben-chain committed
29

ben-chain's avatar
ben-chain committed
30 31 32
export const STORAGE_XOR_VALUE =
  '0xFEEDFACECAFEBEEFFEEDFACECAFEBEEFFEEDFACECAFEBEEFFEEDFACECAFEBEEF'

ben-chain's avatar
ben-chain committed
33 34 35
export const NUISANCE_GAS_COSTS = {
  NUISANCE_GAS_SLOAD: 20000,
  NUISANCE_GAS_SSTORE: 20000,
36
  MIN_NUISANCE_GAS_PER_CONTRACT: 30000,
ben-chain's avatar
ben-chain committed
37 38 39 40
  NUISANCE_GAS_PER_CONTRACT_BYTE: 100,
  MIN_GAS_FOR_INVALID_STATE_ACCESS: 30000,
}

ben-chain's avatar
ben-chain committed
41 42
// TODO: get this exported/imported somehow in a way that we can do math on it.  unfortunately using require('.....artifacts/contract.json') is erroring...
export const Helper_TestRunner_BYTELEN = 3654
43

44 45
export const STORAGE_XOR =
  '0xfeedfacecafebeeffeedfacecafebeeffeedfacecafebeeffeedfacecafebeef'
46 47 48
export const getStorageXOR = (key: string): string => {
  return toHexString(xor(fromHexString(key), fromHexString(STORAGE_XOR)))
}
ben-chain's avatar
ben-chain committed
49 50

export const EMPTY_ACCOUNT_CODE_HASH =
51
  '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'
ben-chain's avatar
ben-chain committed
52 53
export const KECCAK_256_NULL =
  '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'