-
Notifications
You must be signed in to change notification settings - Fork 100
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
Deployed contract name support in getContractState #441
Deployed contract name support in getContractState #441
Conversation
* fixed-bug-1021 * Update src/RpcServer/RpcServer.SmartContract.cs * 😂 * draft * draft * update * fixed bug with decimal of GAS consumed in invokefunction/invokescript * remove modify of invokescript * Querying contracts by ID/name, server side * update * Enable using native.name for search Enable using native.name for search * Using keyword instead of addressOrScriptHash * revert * _initialize * split * update * Update exception message in ApplicationLog * Update src/ApplicationLogs/LogReader.cs Co-authored-by: Luchuan <luchuan@ngd.neo.org> * update * a * More fix * fix * Fixed UT * Simplify Code * Simplify Code 2 * Update RpcServer * update Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com> Co-authored-by: superboyiii <573504781@qq.com> Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com> Co-authored-by: Luchuan <luchuan@ngd.neo.org>
…ject#413) * Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal * fix
* [RpcServer] Querying contracts by ID/name (neo-project#378) * fixed-bug-1021 * Update src/RpcServer/RpcServer.SmartContract.cs * 😂 * draft * draft * update * fixed bug with decimal of GAS consumed in invokefunction/invokescript * remove modify of invokescript * Querying contracts by ID/name, server side * update * Enable using native.name for search Enable using native.name for search * Using keyword instead of addressOrScriptHash * revert * _initialize * split * update * Update exception message in ApplicationLog * Update src/ApplicationLogs/LogReader.cs Co-authored-by: Luchuan <luchuan@ngd.neo.org> * update * a * More fix * fix * Fixed UT * Simplify Code * Simplify Code 2 * Update RpcServer * update Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com> Co-authored-by: superboyiii <573504781@qq.com> Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com> Co-authored-by: Luchuan <luchuan@ngd.neo.org> * MPT in StateService from core (neo-project#410) * Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (neo-project#413) * Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal * fix * Fixed UT (Neo CI01089) Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com> Co-authored-by: superboyiii <573504781@qq.com> Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com> Co-authored-by: Luchuan <luchuan@ngd.neo.org> Co-authored-by: ZhangTao <ztgoforit@163.com>
* [RpcServer] Querying contracts by ID/name (neo-project#378) * fixed-bug-1021 * Update src/RpcServer/RpcServer.SmartContract.cs * 😂 * draft * draft * update * fixed bug with decimal of GAS consumed in invokefunction/invokescript * remove modify of invokescript * Querying contracts by ID/name, server side * update * Enable using native.name for search Enable using native.name for search * Using keyword instead of addressOrScriptHash * revert * _initialize * split * update * Update exception message in ApplicationLog * Update src/ApplicationLogs/LogReader.cs Co-authored-by: Luchuan <luchuan@ngd.neo.org> * update * a * More fix * fix * Fixed UT * Simplify Code * Simplify Code 2 * Update RpcServer * update Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com> Co-authored-by: superboyiii <573504781@qq.com> Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com> Co-authored-by: Luchuan <luchuan@ngd.neo.org> * String Substitution * Modify filename and name methods * update * update * Update src/RpcClient/Models/RpcNep5TokenInfo.cs Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com> * Update src/RpcClient/Nep17API.cs Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com> * MPT in StateService from core (neo-project#410) * Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (neo-project#413) * Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal * fix * Fixed UT (Neo CI01089) * Update Nep17API.cs * Update README.md Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com> * update filename * Fix UT * Format * fix * update * update UT * Add Unit Tests * update Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com> Co-authored-by: superboyiii <573504781@qq.com> Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com> Co-authored-by: Luchuan <luchuan@ngd.neo.org> Co-authored-by: ZhangTao <ztgoforit@163.com>
* [RpcServer] Querying contracts by ID/name (neo-project#378) * fixed-bug-1021 * Update src/RpcServer/RpcServer.SmartContract.cs * 😂 * draft * draft * update * fixed bug with decimal of GAS consumed in invokefunction/invokescript * remove modify of invokescript * Querying contracts by ID/name, server side * update * Enable using native.name for search Enable using native.name for search * Using keyword instead of addressOrScriptHash * revert * _initialize * split * update * Update exception message in ApplicationLog * Update src/ApplicationLogs/LogReader.cs Co-authored-by: Luchuan <luchuan@ngd.neo.org> * update * a * More fix * fix * Fixed UT * Simplify Code * Simplify Code 2 * Update RpcServer * update Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com> Co-authored-by: superboyiii <573504781@qq.com> Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com> Co-authored-by: Luchuan <luchuan@ngd.neo.org> * MPT in StateService from core (neo-project#410) * Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (neo-project#413) * Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal * fix * Fixed UT (Neo CI01089) (neo-project#416) * [RpcServer] Querying contracts by ID/name (neo-project#378) * fixed-bug-1021 * Update src/RpcServer/RpcServer.SmartContract.cs * 😂 * draft * draft * update * fixed bug with decimal of GAS consumed in invokefunction/invokescript * remove modify of invokescript * Querying contracts by ID/name, server side * update * Enable using native.name for search Enable using native.name for search * Using keyword instead of addressOrScriptHash * revert * _initialize * split * update * Update exception message in ApplicationLog * Update src/ApplicationLogs/LogReader.cs Co-authored-by: Luchuan <luchuan@ngd.neo.org> * update * a * More fix * fix * Fixed UT * Simplify Code * Simplify Code 2 * Update RpcServer * update Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com> Co-authored-by: superboyiii <573504781@qq.com> Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com> Co-authored-by: Luchuan <luchuan@ngd.neo.org> * MPT in StateService from core (neo-project#410) * Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (neo-project#413) * Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal * fix * Fixed UT (Neo CI01089) Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com> Co-authored-by: superboyiii <573504781@qq.com> Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com> Co-authored-by: Luchuan <luchuan@ngd.neo.org> Co-authored-by: ZhangTao <ztgoforit@163.com> * Nep17 (neo-project#412) * [RpcServer] Querying contracts by ID/name (neo-project#378) * fixed-bug-1021 * Update src/RpcServer/RpcServer.SmartContract.cs * 😂 * draft * draft * update * fixed bug with decimal of GAS consumed in invokefunction/invokescript * remove modify of invokescript * Querying contracts by ID/name, server side * update * Enable using native.name for search Enable using native.name for search * Using keyword instead of addressOrScriptHash * revert * _initialize * split * update * Update exception message in ApplicationLog * Update src/ApplicationLogs/LogReader.cs Co-authored-by: Luchuan <luchuan@ngd.neo.org> * update * a * More fix * fix * Fixed UT * Simplify Code * Simplify Code 2 * Update RpcServer * update Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com> Co-authored-by: superboyiii <573504781@qq.com> Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com> Co-authored-by: Luchuan <luchuan@ngd.neo.org> * String Substitution * Modify filename and name methods * update * update * Update src/RpcClient/Models/RpcNep5TokenInfo.cs Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com> * Update src/RpcClient/Nep17API.cs Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com> * MPT in StateService from core (neo-project#410) * Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal (neo-project#413) * Unify GetUnclaimedGas and GetWalletUnclaimedGas with decimal * fix * Fixed UT (Neo CI01089) * Update Nep17API.cs * Update README.md Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com> * update filename * Fix UT * Format * fix * update * update UT * Add Unit Tests * update Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com> Co-authored-by: superboyiii <573504781@qq.com> Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com> Co-authored-by: Luchuan <luchuan@ngd.neo.org> Co-authored-by: ZhangTao <ztgoforit@163.com> * merge * fixed bug * clear * UT * Add a little code coverage Co-authored-by: Shargon <shargon@gmail.com> Co-authored-by: Owen Zhang <38493437+superboyiii@users.noreply.github.com> Co-authored-by: superboyiii <573504781@qq.com> Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com> Co-authored-by: Luchuan <luchuan@ngd.neo.org> Co-authored-by: ZhangTao <ztgoforit@163.com>
* Preview4 * Remove syslog in README.md
|
||
return UInt160.Parse(keyword); | ||
return NativeContract.Contracts.FirstOrDefault(p => keyword.Equals(p.Name, StringComparison.InvariantCultureIgnoreCase) || keyword == p.Id.ToString())?.Hash ?? | ||
NativeContract.ContractManagement.ListContracts(snapshot).FirstOrDefault(p => keyword.Equals(p.Manifest.Name, StringComparison.InvariantCultureIgnoreCase) || keyword == p.Id.ToString())?.Hash ?? |
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.
It will fetch all the smart contracts, we should test it with at least 100k smart contracts. In order to avoid a possible Denial of Service
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.
It will fetch all the smart contracts, we should test it with at least 100k smart contracts. In order to avoid a possible Denial of Service
Maybe we could move getcontractstate
to somewhere like ApplicationLogs, then it could get contract state indenpently from the beginning just with a little adjustment on that plugin?
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.
@devhawk what do you think? if it is possible to cause Denial of Service, we need to reconsider what the API benefits. Otherwise there is no conclusion on this.
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.
I understand the need for a stable contract identifier, but the choice of generating it from a combination of the original deployed contract hash + the original contract deployer address is not very developer friendly. I think there needs to be a mechanism for developers to be able to retrieve information about their deployed contracts w/o having to understand the algorithm that generates the identification hash.
If we don't make this change to getContractState, another option could be to introduce a new contract search RPC method that returns an array of all contacts identification hashes (along with associated metadata) that matches a given name.
I don't think it is possible to map name to contract. Because the name is not unique. |
@erikzhang , Is it okay to do what @devhawk said? request:
response:
or
|
I don't think Does the thing we used to call "script hash" have a new name? I called it "invocation hash" in #426 but I just made that up on the fly. I'd suggest |
For native contract, we supports get contract state by hash, name or id, so I think for the other contracts should also be the same, or support, or don't support name and id. |
Related PR #462 |
Agreed @bettybao1209 |
(sorry, reopened by accident) |
close #426