constants.ts 1.87 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 10 11 12 13 14 15 16

export const DEFAULT_ACCOUNTS = defaultAccounts
export const DEFAULT_ACCOUNTS_BUIDLER = defaultAccounts.map((account) => {
  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
Kelvin Fichter's avatar
Kelvin Fichter committed
20 21 22 23 24

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')
25

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

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

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

ben-chain's avatar
ben-chain committed
40 41
// 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
42

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

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