Validate that address and block hash found in deployment data match what is found on-chain.
    :allow_missing_data: by default, enforces validation of address and blockHash.
428581
def validate_deployments_tx_receipt(
    deployments: Dict[str, Any], w3: Web3, allow_missing_data: bool = False
) -> None:
    
    # todo: provide hook to lazily look up tx receipt via binary search if missing data
    for name, data in deployments.items():
        if "transaction" in data:
            tx_hash = data["transaction"]
            tx_receipt = w3.eth.getTransactionReceipt(tx_hash)
            # tx_address will be None if contract created via contract factory
            tx_address = tx_receipt["contractAddress"]

            if tx_address is None and allow_missing_data is False:
                raise ValidationError(
                    "No contract address found in tx receipt. Unable to verify "
                    "address found in tx receipt matches address in manifest's deployment data. "
                    "If this validation is not necessary, please enable `allow_missing_data` arg. "
                )

            if tx_address is not None and not is_same_address(
                tx_address, data["address"]
            ):
                raise ValidationError(
                    f"Error validating tx_receipt for {name} deployment. "
                    f"Address found in manifest's deployment data: {data['address']} "
                    f"Does not match address found on tx_receipt: {tx_address}."
                )

            if "block" in data:
                if tx_receipt["blockHash"] != to_bytes(hexstr=data["block"]):
                    raise ValidationError(
                        f"Error validating tx_receipt for {name} deployment. "
                        f"Block found in manifest's deployment data: {data['block']} does not "
                        f"Does not match block found on tx_receipt: {tx_receipt['blockHash']}."
                    )
            elif allow_missing_data is False:
                raise ValidationError(
                    "No block hash found in deployment data. "
                    "Unable to verify block hash on tx receipt. "
                    "If this validation is not necessary, please enable `allow_missing_data` arg."
                )
        elif allow_missing_data is False:
            raise ValidationError(
                "No transaction hash found in deployment data. "
                "Unable to validate tx_receipt. "
                "If this validation is not necessary, please enable `allow_missing_data` arg."
            )
611025
def validated_provides!
      if missing_requirements.any?
        raise Coach::Errors::MiddlewareDependencyNotMet.new(
          @middleware, @previous_middlewares, missing_requirements
        )
      end

      @middleware.provided + provided_by_chain
    end
61654
def validate_attributes
      unless address.present? || (lat.present? && lng.present?)
        raise ArgumentError, 'Must provide an address, or lat and lng.'
      end

      if address.present? && lat.present? && lng.present?
        raise ArgumentError, 'Cannot provide address, lat and lng.'
      end
    end
672785
def _validate_features(self, data):
        
        if self.feature_names is None:
            self.feature_names = data.feature_names
            self.feature_types = data.feature_types
        else:
            # Booster can't accept data with different feature names
            if self.feature_names != data.feature_names:
                dat_missing = set(self.feature_names) - set(data.feature_names)
                my_missing = set(data.feature_names) - set(self.feature_names)

                msg = 'feature_names mismatch: {0} {1}'

                if dat_missing:
                    msg += ('\nexpected ' + ', '.join(str(s) for s in dat_missing) +
                            ' in input data')

                if my_missing:
                    msg += ('\ntraining data did not have the following fields: ' +
                            ', '.join(str(s) for s in my_missing))

                raise ValueError(msg.format(self.feature_names,
                                            data.feature_names))
1340260
def verify_default_value_matches_verify_block
      @available_options.each do |item|
        next unless item.verify_block && item.default_value

        begin
          unless @values[item.key] # this is important to not verify if there already is a value there
            item.verify_block.call(item.default_value)
          end
        rescue => ex
          UI.error(ex)
          UI.user_error!("Invalid default value for #{item.key}, doesn't match verify_block")
        end
      end
    end
440952
def validate(self, data):
        
        for s in [self._schema(s, error=self._error, ignore_extra_keys=self._ignore_extra_keys) for s in self._args]:
            data = s.validate(data)
        return data
98297
def verify_header_chain(cls, path, chain=None):
        
        if chain is None:
            chain = SPVClient.load_header_chain( path )

        prev_header = chain[0]
        
        for i in xrange(1, len(chain)):
            header = chain[i]
            height = header.get('block_height')
            prev_hash = prev_header.get('hash')
            if prev_hash != header.get('prev_block_hash'):
                log.error("prev hash mismatch: %s vs %s" % (prev_hash, header.get('prev_block_hash')))
                return False

            bits, target = SPVClient.get_target( path, height/BLOCK_DIFFICULTY_CHUNK_SIZE, chain)
            if bits != header.get('bits'):
                log.error("bits mismatch: %s vs %s" % (bits, header.get('bits')))
                return False

            _hash = header.get('hash')
            if int('0x'+_hash, 16) > target:
                log.error("insufficient proof of work: %s vs target %s" % (int('0x'+_hash, 16), target))
                return False

            prev_header = header

        return True
470880
function validateUnit( objUnit, bRequireDefinitionOrChange, cb2 )
	{
		let bFound = false;
		_async.eachSeries
		(
			objUnit.authors,
			function( author, cb3 )
			{
				let sAddress = author.address;
				if ( -1 === arrFoundTrustMEAuthors.indexOf( sAddress ) )
				{
					//	not a witness - skip it
					return cb3();
				}

				//
				//	the latest definition chash of the witness
				//
				let definition_chash = assocDefinitionChashes[ sAddress ];
				if ( ! definition_chash )
				{
					throw Error( "definition chash not known for address " + sAddress );
				}
				if ( author.definition )
				{
					//
					//	do transaction for the first time
					//
					if ( _object_hash.getChash160( author.definition ) !== definition_chash )
					{
						return cb3( "definition doesn't hash to the expected value" );
					}

					assocDefinitions[ definition_chash ] = author.definition;
					bFound = true;
				}


				function handleAuthor()
				{
					//	FIX
					_validation.validateAuthorSignaturesWithoutReferences
					(
						author,
						objUnit,
						assocDefinitions[ definition_chash ],	//	definition JSON
						function( err )
						{
							if ( err )
							{
								return cb3( err );
							}

							//
							//	okay, definition is valid
							//
							for ( let i = 0; i < objUnit.messages.length; i++ )
							{
								let message = objUnit.messages[ i ];
								if ( 'address_definition_change' === message.app
									&& ( message.payload.address === sAddress ||
										1 === objUnit.authors.length && objUnit.authors[ 0 ].address === sAddress ) )
								{
									assocDefinitionChashes[ sAddress ] = message.payload.definition_chash;
									bFound = true;
								}
							}

							//	...
							cb3();
						}
					);
				}

				if ( assocDefinitions[ definition_chash ] )
				{
					return handleAuthor();
				}

				//
				//	only an address with money
				//	there is no transaction any more
				//
				_storage.readDefinition( _db, definition_chash,
				{
					ifFound : function( arrDefinition )
					{
						assocDefinitions[ definition_chash ] = arrDefinition;
						handleAuthor();
					},
					ifDefinitionNotFound : function( sDefinitionCHash )
					{
						throw Error( "definition " + definition_chash + " not found, address " + sAddress );
					}
				});
			},
			function( err )
			{
				if ( err )
				{
					return cb2( err );
				}

				if ( bRequireDefinitionOrChange && ! bFound )
				{
					//
					//	bRequireDefinitionOrChange always be false
					//	so, you will never arrive here so far
					//
					return cb2( "neither definition nor change" );
				}

				//	...
				cb2();
			}

		); // each authors
	}
550882
def json_validate(schema, resp):
    
    # is this an error?
    try:
        json_validate_error(resp)
    except ValidationError:
        if json_is_exception(resp):
            # got a traceback 
            if BLOCKSTACK_TEST:
                log.error('\n{}'.format(resp['traceback']))

            return {'error': 'Blockstack Core encountered an exception. See `traceback` for details', 'traceback': resp['traceback'], 'http_status': 500}

        if 'error' in resp and 'http_status' not in resp:
            # bad error message
            raise 

        # not an error.
        jsonschema.validate(resp, schema)

    return resp
232347
def validate_data(args={})
      args = args.slice(:file_path, :data)
      args = args.compact
      file_path = args[:file_path]
      data = args[:data]

      utf_result = validate_csv(file_path) if file_path
      utf_result = validate_hashes(data) if data
      utf_result
    end
1148452
def verify_data(self, data):
        '''
        
        '''
        errors = []
        if 'state' not in data:
            errors.append('Missing "state" data')
        if 'fun' not in data:
            errors.append('Missing "fun" data')
        if 'name' not in data:
            errors.append('Missing "name" data')
        if data['name'] and not isinstance(data['name'], six.string_types):
            errors.append(
                'ID \'{0}\' {1}is not formed as a string, but is a {2}'.format(
                    data['name'],
                    'in SLS \'{0}\' '.format(data['__sls__'])
                        if '__sls__' in data else '',
                    type(data['name']).__name__
                )
            )
        if errors:
            return errors
        full = data['state'] + '.' + data['fun']
        if full not in self.states:
            if '__sls__' in data:
                errors.append(
                    'State \'{0}\' was not found in SLS \'{1}\''.format(
                        full,
                        data['__sls__']
                        )
                    )
                reason = self.states.missing_fun_string(full)
                if reason:
                    errors.append('Reason: {0}'.format(reason))
            else:
                errors.append(
                        'Specified state \'{0}\' was not found'.format(
                            full
                            )
                        )
        else:
            # First verify that the parameters are met
            aspec = salt.utils.args.get_function_argspec(self.states[full])
            arglen = 0
            deflen = 0
            if isinstance(aspec.args, list):
                arglen = len(aspec.args)
            if isinstance(aspec.defaults, tuple):
                deflen = len(aspec.defaults)
            for ind in range(arglen - deflen):
                if aspec.args[ind] not in data:
                    errors.append(
                        'Missing parameter {0} for state {1}'.format(
                            aspec.args[ind],
                            full
                        )
                    )
        # If this chunk has a recursive require, then it will cause a
        # recursive loop when executing, check for it
        reqdec = ''
        if 'require' in data:
            reqdec = 'require'
        if 'watch' in data:
            # Check to see if the service has a mod_watch function, if it does
            # not, then just require
            # to just require extend the require statement with the contents
            # of watch so that the mod_watch function is not called and the
            # requisite capability is still used
            if '{0}.mod_watch'.format(data['state']) not in self.states:
                if 'require' in data:
                    data['require'].extend(data.pop('watch'))
                else:
                    data['require'] = data.pop('watch')
                reqdec = 'require'
            else:
                reqdec = 'watch'
        if reqdec:
            for req in data[reqdec]:
                reqfirst = next(iter(req))
                if data['state'] == reqfirst:
                    if (fnmatch.fnmatch(data['name'], req[reqfirst])
                            or fnmatch.fnmatch(data['__id__'], req[reqfirst])):
                        err = ('Recursive require detected in SLS {0} for'
                               ' require {1} in ID {2}').format(
                                   data['__sls__'],
                                   req,
                                   data['__id__'])
                        errors.append(err)
        return errors
1198352
def check_addr_status(hsh)
      full_addr = hsh[:full_addr]
      full_addr_f = hsh[:full_addr_f]
      status = nil

      if full_addr && full_addr_f
        status = full_addr != full_addr_f ? 'formatted' : 'unchanged'
      end

      hsh[:address_status] = status
      hsh
    end
954902
def validate(self, data):
        
        autos, errors = [], []
        for s in [self._schema(s, error=self._error, ignore_extra_keys=self._ignore_extra_keys) for s in self._args]:
            try:
                validation = s.validate(data)
                self.match_count += 1
                if self.match_count > 1 and self.only_one:
                    break
                return validation
            except SchemaError as _x:
                autos, errors = _x.autos, _x.errors
        raise SchemaError(
            ["%r did not validate %r" % (self, data)] + autos,
            [self._error.format(data) if self._error else None] + errors,
        )
255497
def validate_required(self, value):
        ''' 
        '''
        if self.required and (value is None or value==''):
            raise MissingFieldError(self.name)
218525
def validate(self,
                 asset,
                 amount,
                 portfolio,
                 algo_datetime,
                 algo_current_data):
        
        if portfolio.positions[asset].amount + amount < 0:
            self.handle_violation(asset, amount, algo_datetime)
1024984
def validate_payment_transaction(payment_transaction)
      validate_query_config payment_transaction

      error_message   = ''
      missed_fields   = []
      invalid_fields  = []

      request_fields_definition.each do |field_name, property_path, is_field_required, validation_rule|
        field_value = PropertyAccessor.get_value payment_transaction, property_path, false

        if field_value
          begin
            Validator.validate_by_rule field_value, validation_rule
          rescue ValidationError => error
            invalid_fields << "Field '#{field_name}' from property path '#{property_path}', #{error.message}."
          end
        elsif is_field_required
          missed_fields << "Field '#{field_name}' from property path '#{property_path}' missed or empty."
        end
      end

      unless missed_fields.empty?
        error_message << "Some required fields missed or empty in PaymentTransaction: \n#{missed_fields.join "\n"}\n"
      end

      unless invalid_fields.empty?
        error_message << "Some fields invalid in PaymentTransaction: \n#{invalid_fields.join "\n"}\n"
      end

      unless error_message.empty?
        raise ValidationError, error_message
      end
    end
243702
def validate_mandatory_attributes
      invalid = missing_mandatory_attributes
      unless invalid.empty? then
        logger.error("Validation of #{qp} unsuccessful - missing #{invalid.join(', ')}:\n#{dump}")
        raise ValidationError.new("Required attribute value missing for #{self}: #{invalid.join(', ')}")
      end
      validate_owner
    end