Native: store ID->hash map in ContractManagement, add iterator#2807
Merged
shargon merged 7 commits intoneo-project:masterfrom Sep 5, 2022
Merged
Native: store ID->hash map in ContractManagement, add iterator#2807shargon merged 7 commits intoneo-project:masterfrom
shargon merged 7 commits intoneo-project:masterfrom
Conversation
That probably is the lighest design possible, store and retrieve hashes only. But it can be expanded to return full contract state (getContractByID, for example) and probably even iterate over contract states. Fixes neo-project#2803.
4d0f0e6 to
743b8fa
Compare
erikzhang
reviewed
Aug 26, 2022
erikzhang
reviewed
Aug 30, 2022
erikzhang
reviewed
Aug 31, 2022
erikzhang
previously approved these changes
Aug 31, 2022
Closed
superboyiii
reviewed
Sep 5, 2022
| /// <param name="id">Contract ID.</param> | ||
| /// <returns>The deployed contract.</returns> | ||
| [ContractMethod(CpuFee = 1 << 15, RequiredCallFlags = CallFlags.ReadStates)] | ||
| public ContractState GetContractById(DataCache snapshot, int id) |
Member
There was a problem hiding this comment.
Suggested change
| public ContractState GetContractById(DataCache snapshot, int id) | |
| public ContractState GetContractById(DataCache snapshot, uint id) |
Member
There was a problem hiding this comment.
Seems this is only for non-native contracts, uint is better.
Contributor
Author
There was a problem hiding this comment.
I think it's GetContractHashes that is specifically for non-natives, but this one can return native contracts as well, it doesn't hurt. Otherwise we'll have to check for int overflows anyway.
shargon
reviewed
Sep 5, 2022
Co-authored-by: Shargon <shargon@gmail.com>
shargon
approved these changes
Sep 5, 2022
Member
|
Tested OK. Good to Merge. |
superboyiii
approved these changes
Sep 5, 2022
roman-khimov
added a commit
to nspcc-dev/neo-go
that referenced
this pull request
Sep 19, 2022
Follow neo-project/neo#2807. Notice that this data is not cached, our previous implementation wasn't too and it shouldn't be a problem (not on the hot path).
roman-khimov
added a commit
to nspcc-dev/neo-go
that referenced
this pull request
Sep 19, 2022
Follow neo-project/neo#2807. Notice that this data is not cached, our previous implementation wasn't too and it shouldn't be a problem (not on the hot path).
roman-khimov
added a commit
to nspcc-dev/neo-go
that referenced
this pull request
Nov 25, 2022
Follow neo-project/neo#2807. Notice that this data is not cached, our previous implementation wasn't too and it shouldn't be a problem (not on the hot path).
roman-khimov
added a commit
to nspcc-dev/neo-go
that referenced
this pull request
Dec 2, 2022
Follow neo-project/neo#2807. Notice that this data is not cached, our previous implementation wasn't too and it shouldn't be a problem (not on the hot path).
roman-khimov
added a commit
to roman-khimov/neo
that referenced
this pull request
Dec 7, 2022
This is an omission of neo-project#2807, even though native hashes are well-known GetContractById better be symmetric for all contracts. Related to nspcc-dev/neo-go#2837.
roman-khimov
added a commit
to roman-khimov/neo
that referenced
this pull request
Dec 7, 2022
This is an omission of neo-project#2807, even though native hashes are well-known GetContractById better be symmetric for all contracts. Related to nspcc-dev/neo-go#2837.
shargon
added a commit
that referenced
this pull request
Jan 7, 2023
This is an omission of #2807, even though native hashes are well-known GetContractById better be symmetric for all contracts. Related to nspcc-dev/neo-go#2837. Co-authored-by: Shargon <shargon@gmail.com>
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.
That probably is the lighest design possible, store and retrieve hashes
only. But it can be expanded to return full contract state (getContractByID,
for example) and probably even iterate over contract states.
Fixes #2803. Not tested.