Add UInt160, UInt256 and ECPoint to SmartContract Framework#362
Merged
erikzhang merged 44 commits intoneo-project:masterfrom Nov 10, 2020
devhawk:devhawk/unify1
Merged
Add UInt160, UInt256 and ECPoint to SmartContract Framework#362erikzhang merged 44 commits intoneo-project:masterfrom devhawk:devhawk/unify1
erikzhang merged 44 commits intoneo-project:masterfrom
devhawk:devhawk/unify1
Conversation
added 15 commits
September 18, 2020 10:00
Contributor
Author
|
@ShawnYun GitHub wouldn't let me request you as an official reviewer. Please review this PR if you have a chance. |
Tommo-L
reviewed
Sep 21, 2020
Tommo-L
reviewed
Sep 21, 2020
erikzhang
reviewed
Sep 22, 2020
44 tasks
Member
|
We should add |
igormcoelho
reviewed
Oct 31, 2020
Contributor
Author
|
@shargon Shouldn't |
Tommo-L
previously approved these changes
Nov 3, 2020
shargon
previously approved these changes
Nov 3, 2020
erikzhang
reviewed
Nov 3, 2020
erikzhang
reviewed
Nov 5, 2020
Co-authored-by: Erik Zhang <erik@neo.org>
erikzhang
reviewed
Nov 6, 2020
erikzhang
previously approved these changes
Nov 8, 2020
erikzhang
approved these changes
Nov 8, 2020
Contributor
Author
|
Am I supposed to squash and merge this PR now that it's approved? |
Contributor
I have tested it again, calling all methods using the contract, everything is normal, except for one place it should be |
Jim8y
pushed a commit
that referenced
this pull request
Aug 3, 2025
Jim8y
pushed a commit
that referenced
this pull request
Aug 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #208, part of neo-project/neo#1866
Obsoletes #347
This PR introduces
Neo.UInt160,Neo.UInt256andNeo.Cryptography.ECC.ECPointto the Neo.SmartContract.Framework assembly. Note, these type namespaces were explicitly chosen to match their corresponding types in Neo.dll. Over the next few weeks, I'll be introducing additional PRs to further unify types in Neo and Neo.SmartContract.Framework as part of neo-project/neo#1866.Because these types in the two assemblies have the same fully qualified namespace, an assembly that needs to reference Neo and Neo.SmartContract.Framework needs to use a reference alias to disambiguate. I've added appropriate reference aliases in Neo.Compiler.MSIL and the relevant unit tests projects.
Under the hood, these types are simple byte arrays, like how strings are handled in Neo smart contracts. These types are merely there to provide a small amount of compile time type safety + familiarity to the developer. Relevant service methods (such as
Runtime.CheckWitness) and domain properties (such asBlock.Hash) have been updated where appropriate to be strongly typed asUInt160,UInt256orECPoint.Assorted Notes:
NEOandOracle) have been updated to expose their script hash as a staticHashproperty. To avoid declaring the script hash twice, NEON has been updated to look for a newNativeContractHashAttributeas a marker for the appropriate method to return the contract script hash.ConvertNewObjin NEON has been updated to support the default and byte array constructors ofUInt160andUInt256. Default constructor pushes a byte array of appropriate size onto to stack. Byte array constructors inject VM code to validate the byte array on the evaluation stack is of the expected sizeECPointin SmartContract.Framework has neither default or byte array constructors. I wasn't sure if these types were ever constructed from byte arrays in contracts. It would be straightforward to include these constructors similar toUInt160/UInt256's constructors.UInt160/UInt256each have a static Zero property that pushes a zero array of appropriate length onto the stack viaOpCodeAttributeFuncExport.ConvTyperecognizes the new types and returns the appropriateContractParameterTypevalue as a stringModuleConverter.IsContractCallwas updated to return contract hash out parameter as UInt160 instead of a byte array