-
Notifications
You must be signed in to change notification settings - Fork 106
Add analyzer for hash return types #1427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
shargon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not be converted by the compiler to the right type?
its impossible, UInt160 has its own format, while string could be any value. we dont have native methods/syscall/opcode to perform the conversion, unless its constent string. |
wait, maybe i can add a method? will update this pr later. |
278c3af to
0b46a15
Compare
I know, but here the compiler knows that it's a string, and want a UInt160, so it can convert from hex directly, isn't it? |
* fix: resolve nullable reference type warnings in Neo.SmartContract.Framework This commit fixes all nullable reference type warnings (CS8618, CS8625, CS8604, CS8602, CS8600) in the Neo.SmartContract.Framework project to ensure clean builds with nullable reference types enabled. Changes include: - Added nullable annotations to method parameters accepting null values (GAS, NEO, Runtime) - Used null-forgiving operators for fields initialized at runtime (Native classes, token states) - Added pragma directives to suppress CS8618 for runtime-populated service classes - Fixed nullable parameter types in delegate signatures and PostTransfer methods - Used null-forgiving operators in storage access and Contract.Call invocations This resolves all nullable reference warnings in the Framework project, resulting in a clean build. * fix: remove non-existent OnNewSnapshot event from RpcStore The RpcStore was referencing IStore.OnNewSnapshotDelegate which doesn't exist in the IStore interface, causing compilation errors. This removes the undefined event and its invocation from the GetSnapshot method. This resolves build errors CS0426 and CS0066 in the Testing project. * Fix GitHub Actions failure by implementing IStore.OnNewSnapshot event in RpcStore - Add OnNewSnapshot event implementation to comply with IStore interface requirements - Event is properly invoked when GetSnapshot() is called - Resolves CS0535 compilation error in GitHub Actions CI/CD pipeline 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Update NEO.cs * Update Contract.cs * Apply suggestions from code review * Update src/Neo.SmartContract.Framework/Nep17Token.cs * Update src/Neo.SmartContract.Framework/Nep11Token.cs --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Shargon <[email protected]>
* Update neo * Clean --------- Co-authored-by: Jimmy <[email protected]>
* chore: update neo submodule to latest master Update neo submodule reference to include latest changes from master branch * chore: update neo submodule to latest dev branch Update neo submodule from 9b9be473 to 257756e7 to include: - unit-tests: Use proper 'Assert' methods - Allow HF in syscalls - IComparable, Casting to UInt160 & UInt256 - Clean JsonSerializer - Fix RpcSendByHashOrIndexAsync comment
…1381) * feat: Add GuardHelpers utility class for smart contract validation Introduces a comprehensive validation helper library to standardize precondition and postcondition checks in Neo smart contracts. Features: - Basic validation: Require(), Ensure(), Revert() - Null checks: RequireNotNull() - Numeric validation: RequireNonNegative(), RequirePositive(), RequireInRange() - Address validation: RequireValidAddress(), RequireWitness() - Security checks: RequireCaller(), RequireEquals() - String validation: RequireNotEmpty() Benefits: - Reduces boilerplate validation code - Standardizes error messages with short codes for gas efficiency - Improves contract security and reliability - Makes smart contracts more readable and maintainable * feat: add GuardHelpers utility class for smart contract validation Introduces a new GuardHelpers static class that provides common validation patterns for Neo smart contracts with gas-efficient error codes. Features: - Require/Ensure methods for preconditions and postconditions - Common validation helpers (RequireNotNull, RequirePositive, etc.) - Address validation (RequireValidAddress, RequireWitness) - Range and equality checks (RequireInRange, RequireEquals) - Caller verification (RequireCaller) - String validation (RequireNotEmpty) All methods use short error codes to minimize GAS consumption while maintaining clear error identification. * test: add comprehensive unit tests for GuardHelpers Adds test contract and unit tests covering all GuardHelpers methods: - Basic validation tests (Require, Ensure, Revert) - Type validation tests (RequireNotNull, RequireNonNegative, RequirePositive) - Address validation tests (RequireValidAddress, RequireWitness) - Range and equality tests (RequireInRange, RequireEquals) - Caller verification tests (RequireCaller) - String validation tests (RequireNotEmpty) - Real-world Transfer scenario test All tests verify both success and failure cases with appropriate error messages. * style: fix formatting and remove duplicate generated file - Remove duplicate Contract_GuardHelpers_Inline.cs from TestingArtifacts - Fix minor formatting issues in source files - Ensure no file conflicts during build * fix: resolve GitHub Actions build failure for GuardHelpers tests - Remove duplicate and conflicting artifact files - Keep only the generated wrapper (Contract_GuardHelpers_Inline.cs) - Follow existing test artifact pattern used by other test contracts - Binary artifacts (.nef, .manifest.json, etc.) are generated during build * Revert "fix: resolve GitHub Actions build failure for GuardHelpers tests" This reverts commit 47b7336. * fix: resolve artifact naming conflict for GuardHelpers tests - Rename Contract_GuardHelpers_Inline.artifacts.cs to Contract_GuardHelpers_Inline.cs - Keep all test artifacts (.nef, .manifest.json, .nefdbgnfo) as required - This follows the consistent naming pattern and avoids build conflicts * Update tests/Neo.SmartContract.Framework.UnitTests/GuardHelpersTest.cs * Update src/Neo.SmartContract.Framework/Helpers/GuardHelpers.cs Co-authored-by: Will <[email protected]> * Update src/Neo.SmartContract.Framework/Helpers/GuardHelpers.cs Co-authored-by: Will <[email protected]> --------- Co-authored-by: Shargon <[email protected]> Co-authored-by: Will <[email protected]>
* #4148 * change summary * Update submodule * Template * fix artifacts --------- Co-authored-by: Alvaro <[email protected]>
* Update WriteInTry artifact and ensure temp projects target net9 * Refresh WriteInTry artifacts and include local storage syscalls
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Will <[email protected]>
b71fe37 to
5a7b477
Compare
|
will create a new one based on master to replace this one |
Summary