/// <summary> /// Performs code checks. /// </summary> /// <param name="code">The code to be checked.</param> /// <param name="isPrivileged">Is the contract deployed by system user.</param> /// <exception cref="InvalidCodeException">Thrown when issues are found in the code.</exception> public void CodeCheck(byte[] code, bool isPrivileged) { #if !DEBUG // TODO: Enable ContractAuditor in DEBUG mode until test cases timeout issue is solved _contractAuditor.Audit(code, isPrivileged); #endif }
public void ContractAuditor_Basic_Test() { var whiteList = new List <string> { "System.Collection", "System.Linq" }; var blackList = new List <string> { "System.Random", "System.DateTime" }; _auditor = new ContractAuditor(whiteList, blackList); Should.Throw <InvalidCodeException>(() => _auditor.Audit(_badContractCode, true)); }
/// <summary> /// Performs code checks. /// </summary> /// <param name="code">The code to be checked.</param> /// <param name="isPrivileged">Is the contract deployed by system user.</param> /// <exception cref="InvalidCodeException">Thrown when issues are found in the code.</exception> public void CodeCheck(byte[] code, bool isPrivileged) { #if !UNIT_TEST _contractAuditor.Audit(code, isPrivileged); #endif }