-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Store contract ID->hash mapping and allow to iterate over contracts #2803
Comments
One map store active contracts and another for destroyed contracts? |
The hash of a native contract is determined by its name and should not change. |
Well, there could be some deactivation flag stored, although we already block destroyed contracts now. Not sure about that, active ones are the most interesting to me.
This issue is specifically about non-native ones. Consider NeoFS chain, it has NNS contract deployed there as the contract number 1, that's the policy, but it differs from chain to chain. Also, contract iterator is a useful thing to have. |
We need this feature to improve the NeoFS deployment in testing/on-prem environment. We want to pre-generate signed transactions to update settings in Sidechain contracts and use them directly, without the need to have access to Alphabet private keys from the CI environment. Can also be considered a security improvement =) |
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.
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.
I think it makes sense! |
* Native: store ID->hash map in ContractManagement, add iterator 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. * ContractManagement: rework GetContractHash into GetContractById * ContractManagement: fix GetContractById comment * Update ContractManagement.cs * Update ContractManagement.cs * Update src/Neo/SmartContract/Native/ContractManagement.cs Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: Erik Zhang <erik@neo.org> Co-authored-by: Shargon <shargon@gmail.com>
Summary or problem description
Do you have any solution you want to propose?
ContractManagement
contract, it doesn't need a lot of storage space.getContractByID(id integer)
method that will return contract's state corresponding to ID (or just a hash).listContracts
(orlistNonNative
) method that will return an iterator with contract hashes in deployment order (by ID).getcontractstate
RPC with the ability to request contracts by ID.Neo Version
Where in the software does this update applies to?
The text was updated successfully, but these errors were encountered: