Esempio n. 1
0
    def __init__(self, base_db: BaseDB) -> None:
        if not self.vm_configuration:
            raise ValueError(
                "The Chain class cannot be instantiated with an empty `vm_configuration`"
            )
        else:
            validate_vm_configuration(self.vm_configuration)

        self.chaindb = self.get_chaindb_class()(base_db)
        self.headerdb = HeaderDB(base_db)
        if self.gas_estimator is None:
            self.gas_estimator = get_gas_estimator()  # type: ignore
Esempio n. 2
0
    def __init__(self, chaindb: BaseChainDB, header: BlockHeader=None) -> None:
        if not self.vm_configuration:
            raise ValueError(
                "The Chain class cannot be instantiated with an empty `vm_configuration`"
            )
        else:
            validate_vm_configuration(self.vm_configuration)

        self.chaindb = chaindb
        self.header = header
        if self.header is None:
            self.header = self.create_header_from_parent(self.get_canonical_head())
        if self.gas_estimator is None:
            self.gas_estimator = get_gas_estimator()  # type: ignore
Esempio n. 3
0
def test_validate_vm_configuration_bad_configs(value):
    with pytest.raises(ValidationError):
        validate_vm_configuration(value)