def check_chain_version(config): key = '__chain_version__' chain_version = str(Packeter.ETHEREUM_PROTOCOL_VERSION) db = DB(db_path(config.get('misc', 'data_dir'))) if not key in db: db.put(key, chain_version) if db.get(key) != chain_version: log.critical('db version mismatch', db_version=db.get( key), chain_version=chain_version, db_path=db_path) time.sleep(5)
def check_chain_version(config): key = '__chain_version__' chain_version = str(Packeter.ETHEREUM_PROTOCOL_VERSION) db = DB(db_path(config.get('misc', 'data_dir'))) if not key in db: db.put(key, chain_version) if db.get(key) != chain_version: log.critical('db version mismatch', db_version=db.get(key), chain_version=chain_version, db_path=db_path) time.sleep(5)
from pyethereum import opcodes, utils, blocks, vm, processblock, transactions from pyethereum.db import DB import tempfile import random import json pb, u = processblock, utils db = DB(utils.db_path(tempfile.mktemp())) push_params = [range(1, 3), range(4, 8), range(9, 16), range(17, 32)] codesize_params = [[50, 50]] def generate_op_tests(): outs = {} for opcode, (name, inargs, outargs, _) in opcodes.opcodes.items(): _subid = 0 for push_depths in push_params: for jump_num, code_size in codesize_params: if name in ['CALL', 'CREATE', 'CALLCODE', 'LOG', 'POP', 'RETURN', 'STOP', 'INVALID', 'JUMP', 'JUMPI', 'CALLDATALOAD', 'CALLDATACOPY', 'CODECOPY', 'EXTCODECOPY', 'SHA3', 'MLOAD', 'MSTORE', 'MSTORE8', 'SUICIDE']: continue if name[:3] in ['DUP', 'SWA', 'LOG']: continue if name == 'SSTORE': jump_num /= 10 c = '\x5b' if name[:4] == 'PUSH': if push_depths != push_params[0]: continue for i in range(code_size): v = int(name[4:])
import json, ast from pyethereum import transactions from pyethereum import blocks from pyethereum import processblock as pb from pyethereum import utils as u from pyethereum import vm from pyethereum.slogging import get_logger, LogRecorder, configure_logging import time from pyethereum.db import DB import tempfile import os import sys sys.setrecursionlimit(10000) db = DB(u.db_path(tempfile.mktemp())) def profile_vm_test(params): pre = params['pre'] exek = params['exec'] env = params['env'] # setup env blk = blocks.Block(db, prevhash=env['previousHash'].decode('hex'), number=int(env['currentNumber']), coinbase=env['currentCoinbase'], difficulty=int(env['currentDifficulty']), gas_limit=int(env['currentGasLimit']), timestamp=int(env['currentTimestamp']))
def new_db(): return DB(utils.db_path(tempfile.mktemp()))
from pyethereum import opcodes, utils, blocks, vm, processblock, transactions from pyethereum.db import DB import tempfile import random import json pb, u = processblock, utils db = DB(utils.db_path(tempfile.mktemp())) push_params = [range(1, 3), range(4, 8), range(9, 16), range(17, 32)] codesize_params = [[50, 50]] def generate_op_tests(): outs = {} for opcode, (name, inargs, outargs, _) in opcodes.opcodes.items(): _subid = 0 for push_depths in push_params: for jump_num, code_size in codesize_params: if name in [ 'CALL', 'CREATE', 'CALLCODE', 'LOG', 'POP', 'RETURN', 'STOP', 'INVALID', 'JUMP', 'JUMPI', 'CALLDATALOAD', 'CALLDATACOPY', 'CODECOPY', 'EXTCODECOPY', 'SHA3', 'MLOAD', 'MSTORE', 'MSTORE8', 'SUICIDE' ]: continue if name[:3] in ['DUP', 'SWA', 'LOG']: continue if name == 'SSTORE': jump_num /= 10 c = '\x5b'