Beispiel #1
0
def _extract_vm_config(vm_config: Dict[str, str]) -> Iterable[VMFork]:
    if 'frontierForkBlock' in vm_config.keys():
        yield to_int(hexstr=vm_config['frontierForkBlock']), FrontierVM
    if 'homesteadForkBlock' in vm_config.keys():
        homestead_fork_block = to_int(hexstr=vm_config['homesteadForkBlock'])
        if 'DAOForkBlock' in vm_config:
            dao_fork_block_number = to_int(hexstr=vm_config['DAOForkBlock'])

            HomesteadVM = MainnetDAOValidatorVM.configure(
                _dao_fork_block_number=dao_fork_block_number, )
            yield homestead_fork_block, HomesteadVM
        else:
            yield homestead_fork_block, BaseHomesteadVM
    if 'EIP150ForkBlock' in vm_config.keys():
        yield to_int(hexstr=vm_config['EIP150ForkBlock']), TangerineWhistleVM
    if 'EIP158ForkBlock' in vm_config.keys():
        yield to_int(hexstr=vm_config['EIP158ForkBlock']), SpuriousDragonVM
    if 'byzantiumForkBlock' in vm_config.keys():
        yield to_int(hexstr=vm_config['byzantiumForkBlock']), ByzantiumVM
    if 'constantinopleForkBlock' in vm_config.keys():
        yield to_int(
            hexstr=vm_config['constantinopleForkBlock']), ConstantinopleVM
    if 'petersburgForkBlock' in vm_config.keys():
        yield to_int(hexstr=vm_config['petersburgForkBlock']), PetersburgVM
    if 'istanbulForkBlock' in vm_config.keys():
        yield to_int(hexstr=vm_config['istanbulForkBlock']), IstanbulVM
Beispiel #2
0
def chain_vm_configuration(fixture: Dict[str, Any]) -> Iterable[Tuple[int, Type[BaseVM]]]:
    network = fixture['network']

    if network == 'Frontier':
        return (
            (0, FrontierVM),
        )
    elif network == 'Homestead':
        HomesteadVM = BaseHomesteadVM.configure(support_dao_fork=False)
        return (
            (0, HomesteadVM),
        )
    elif network == 'EIP150':
        return (
            (0, TangerineWhistleVM),
        )
    elif network == 'EIP158':
        return (
            (0, SpuriousDragonVM),
        )
    elif network == 'Byzantium':
        return (
            (0, ByzantiumVM),
        )
    elif network == 'Constantinople':
        return (
            (0, ConstantinopleVM),
        )
    elif network == 'FrontierToHomesteadAt5':
        HomesteadVM = BaseHomesteadVM.configure(support_dao_fork=False)
        return (
            (0, FrontierVM),
            (5, HomesteadVM),
        )
    elif network == 'HomesteadToEIP150At5':
        HomesteadVM = BaseHomesteadVM.configure(support_dao_fork=False)
        return (
            (0, HomesteadVM),
            (5, TangerineWhistleVM),
        )
    elif network == 'HomesteadToDaoAt5':
        HomesteadVM = MainnetDAOValidatorVM.configure(
            support_dao_fork=True,
            _dao_fork_block_number=5,
        )
        return (
            (0, HomesteadVM),
        )
    elif network == 'EIP158ToByzantiumAt5':
        return (
            (0, SpuriousDragonVM),
            (5, ByzantiumVM),
        )
    elif network == 'ByzantiumToConstantinopleAt5':
        return (
            (0, ByzantiumVM),
            (5, ConstantinopleVM),
        )
    else:
        raise ValueError("Network {0} does not match any known VM rules".format(network))
Beispiel #3
0
def chain_vm_configuration(
    fixture: Dict[str, Any]
) -> Iterable[Tuple[int, Type[VirtualMachineAPI]]]:  # noqa: E501
    network = fixture['network']

    if network == 'Frontier':
        return ((0, FrontierVM), )
    elif network == 'Homestead':
        HomesteadVM = BaseHomesteadVM.configure(support_dao_fork=False)
        return ((0, HomesteadVM), )
    elif network == 'EIP150':
        return ((0, TangerineWhistleVM), )
    elif network == 'EIP158':
        return ((0, SpuriousDragonVM), )
    elif network == 'Byzantium':
        return ((0, ByzantiumVM), )
    elif network == 'Constantinople':
        return ((0, ConstantinopleVM), )
    elif network == 'ConstantinopleFix':
        return ((0, PetersburgVM), )
    elif network == 'Istanbul':
        return ((0, IstanbulVM), )
    elif network == 'Berlin':
        return ((0, BerlinVM), )
    elif network == 'FrontierToHomesteadAt5':
        HomesteadVM = BaseHomesteadVM.configure(support_dao_fork=False)
        return (
            (0, FrontierVM),
            (5, HomesteadVM),
        )
    elif network == 'HomesteadToEIP150At5':
        HomesteadVM = BaseHomesteadVM.configure(support_dao_fork=False)
        return (
            (0, HomesteadVM),
            (5, TangerineWhistleVM),
        )
    elif network == 'HomesteadToDaoAt5':
        HomesteadVM = MainnetDAOValidatorVM.configure(
            support_dao_fork=True,
            _dao_fork_block_number=5,
        )
        return ((0, HomesteadVM), )
    elif network == 'EIP158ToByzantiumAt5':
        return (
            (0, SpuriousDragonVM),
            (5, ByzantiumVM),
        )
    elif network == 'ByzantiumToConstantinopleFixAt5':
        return (
            (0, ByzantiumVM),
            (5, PetersburgVM),
        )
    else:
        raise ValueError(
            f"Network {network} does not match any known VM rules")