/// <inheritdoc/>
        public SmartContractValidationResult Validate(SmartContractDecompilation decompilation)
        {
            ValidationPolicy policy = DeterminismPolicy.Default;
            var validator           = new ModulePolicyValidator(policy);
            IEnumerable <ValidationResult> validationResults = validator.Validate(decompilation.ModuleDefinition);

            return(new SmartContractValidationResult(validationResults));
        }
Exemplo n.º 2
0
        public SmartContractValidationResult Validate(SmartContractDecompilation decompilation)
        {
            var policy    = ValidationPolicy.FromExisting(new[] { FormatPolicy.Default, DeterminismPolicy.Default });
            var validator = new ModulePolicyValidator(policy);

            var results = validator.Validate(decompilation.ModuleDefinition).ToList();

            return(new SmartContractValidationResult(results));
        }
        public SmartContractValidationResult Validate(SmartContractDecompilation decompilation)
        {
            ValidationPolicy policy = FormatPolicy.Default;

            var validator = new ModulePolicyValidator(policy);

            var results = validator.Validate(decompilation.ModuleDefinition).ToList();

            return(new SmartContractValidationResult(results));
        }
        public SmartContractValidationResult Validate(SmartContractDecompilation decompilation)
        {
            var errors = new List <ValidationResult>();

            foreach (IModuleDefinitionValidator moduleDefValidator in ModuleDefinitionValidators)
            {
                errors.AddRange(moduleDefValidator.Validate(decompilation.ModuleDefinition));
            }

            return(new SmartContractValidationResult(errors));
        }
Exemplo n.º 5
0
        public SmartContractValidationResult Validate(SmartContractDecompilation decompilation)
        {
            var errors = new List <ValidationResult>();

            foreach (ISmartContractValidator validator in this.validators)
            {
                SmartContractValidationResult result = validator.Validate(decompilation);
                errors.AddRange(result.Errors);
            }

            return(new SmartContractValidationResult(errors));
        }
        public SmartContractValidationResult Validate(SmartContractDecompilation decompilation)
        {
            var warnings     = new List <ValidationResult>();
            var contractType = Enumerable.FirstOrDefault <TypeDefinition>(decompilation.ModuleDefinition.Types, x => x.FullName != "<Module>");

            foreach (ITypeDefinitionValidator typeDefinitionValidator in TypeDefinitionValidators)
            {
                warnings.AddRange(typeDefinitionValidator.Validate(contractType));
            }

            return(new SmartContractValidationResult(warnings));
        }
        public SmartContractValidationResult Validate(SmartContractDecompilation decompilation)
        {
            var warnings = new List <ValidationResult>();
            IEnumerable <TypeDefinition> contractTypes = decompilation.ModuleDefinition.GetDevelopedTypes();

            foreach (TypeDefinition contractType in contractTypes)
            {
                foreach (ITypeDefinitionValidator typeDefinitionValidator in TypeDefinitionValidators)
                {
                    warnings.AddRange(typeDefinitionValidator.Validate(contractType));
                }
            }

            return(new SmartContractValidationResult(warnings));
        }
Exemplo n.º 8
0
        /// <inheritdoc/>
        public SmartContractValidationResult Validate(SmartContractDecompilation decompilation)
        {
            var errors       = new List <ValidationResult>();
            var visited      = new Dictionary <string, List <ValidationResult> >();
            var contractType = Enumerable.FirstOrDefault <TypeDefinition>(decompilation.ModuleDefinition.Types, x => x.FullName != "<Module>");

            List <MethodDefinition> userMethods = contractType.Methods.Where(method => method.Body != null).ToList();

            foreach (MethodDefinition userMethod in userMethods)
            {
                ValidateUserMethod(errors, visited, userMethod);
                ValidatedReferencedMethods(errors, visited, userMethods, userMethod);
            }

            return(new SmartContractValidationResult(errors));
        }
        /// <inheritdoc/>
        public SmartContractValidationResult Validate(SmartContractDecompilation decompilation)
        {
            var errors  = new List <ValidationResult>();
            var visited = new Dictionary <string, List <ValidationResult> >();
            IEnumerable <TypeDefinition> contractTypes = decompilation.ModuleDefinition.GetDevelopedTypes();

            foreach (TypeDefinition contractType in contractTypes)
            {
                List <MethodDefinition> userMethods = contractType.Methods.Where(method => method.Body != null).ToList();
                foreach (MethodDefinition userMethod in userMethods)
                {
                    ValidateUserMethod(errors, visited, userMethod);
                    ValidatedReferencedMethods(errors, visited, userMethods, userMethod);
                }
            }

            return(new SmartContractValidationResult(errors));
        }