You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -928,4 +928,4 @@ public class AccessControlTests : TestBase<RBACContract>
928
928
}
929
929
```
930
930
931
-
Access control is the foundation of smart contract security. Always implement multiple layers of protection, test thoroughly, and follow the principle of least privilege to maintain a secure contract ecosystem.
931
+
Access control is the foundation of smart contract security. Always implement multiple layers of protection, test thoroughly, and follow the principle of least privilege to maintain a secure contract ecosystem.
@@ -110,6 +110,9 @@ public class RoleBasedContract : SmartContract
110
110
}
111
111
```
112
112
113
+
> **Note**
114
+
> When a script hash originates from runtime data, convert the value with `UInt160.Parse` (or cast from a validated byte array) before you return it. This keeps return statements strongly typed and prevents the NC4032 ReturnValueTypeAnalyzer from flagging implicit string conversions.
115
+
113
116
### Multi-Signature Security
114
117
115
118
```csharp
@@ -524,4 +527,4 @@ public class SecurityTests : TestBase<MyContract>
524
527
}
525
528
```
526
529
527
-
This comprehensive security guide provides the foundation for developing secure Neo smart contracts. Remember that security is an ongoing process, and you should regularly review and update your security practices as the ecosystem evolves.
530
+
This comprehensive security guide provides the foundation for developing secure Neo smart contracts. Remember that security is an ongoing process, and you should regularly review and update your security practices as the ecosystem evolves.
> The same `UInt160.Parse` helper is available inside contracts, so your tests can mimic the strongly typed returns enforced by analyzer NC4032.
121
+
119
122
## Unit Testing for Security
120
123
121
124
### Input Validation Testing
@@ -929,4 +932,4 @@ public class SecurityTestReport
929
932
}
930
933
```
931
934
932
-
Security testing is an ongoing process that should be integrated throughout the development lifecycle. Regular testing, automated scans, and comprehensive reporting ensure that your Neo smart contracts maintain high security standards and protect user assets effectively.
935
+
Security testing is an ongoing process that should be integrated throughout the development lifecycle. Regular testing, automated scans, and comprehensive reporting ensure that your Neo smart contracts maintain high security standards and protect user assets effectively.
"Return statements for '{0}' must return '{0}' values, but the expression has type '{1}'. Convert explicitly to '{0}'.",
27
+
"Return statements for '{0}' must return '{0}' values, but the expression has type '{1}'. Convert explicitly to '{0}' (e.g., cast or parse the runtime value).",
0 commit comments