def validate_gas_limit(gas_limit: int, parent_gas_limit: int) -> None: low_bound, high_bound = compute_gas_limit_bounds(parent_gas_limit) if gas_limit < low_bound: raise ValidationError( f"The gas limit {gas_limit} is too low. It must be at least {low_bound}" ) elif gas_limit > high_bound: raise ValidationError( f"The gas limit {gas_limit} is too high. It must be at most {high_bound}" )
def validate_gaslimit(self, header: BlockHeaderAPI) -> None: parent_header = self.get_block_header_by_hash(header.parent_hash) low_bound, high_bound = compute_gas_limit_bounds(parent_header) if header.gas_limit < low_bound: raise ValidationError( f"The gas limit on block {encode_hex(header.hash)} " f"is too low: {header.gas_limit}. " f"It must be at least {low_bound}") elif header.gas_limit > high_bound: raise ValidationError( f"The gas limit on block {encode_hex(header.hash)} " f"is too high: {header.gas_limit}. " f"It must be at most {high_bound}")
def validate_gaslimit(self, header: BlockHeader) -> None: """ Validate the gas limit on the given header. """ parent_header = self.get_block_header_by_hash(header.parent_hash) low_bound, high_bound = compute_gas_limit_bounds(parent_header) if header.gas_limit < low_bound: raise ValidationError( "The gas limit on block {0} is too low: {1}. It must be at least {2}" .format(encode_hex(header.hash), header.gas_limit, low_bound)) elif header.gas_limit > high_bound: raise ValidationError( "The gas limit on block {0} is too high: {1}. It must be at most {2}" .format(encode_hex(header.hash), header.gas_limit, high_bound))