Skip to content
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

Fixed UT (Neo CI01089) #416

Merged
merged 6 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="3.0.0-CI01066" />
<PackageReference Include="Neo" Version="3.0.0-CI01089" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions src/RpcClient/Models/RpcContractState.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Neo;
using Neo.IO.Json;
using Neo.Ledger;
using Neo.SmartContract.Manifest;
Expand All @@ -19,6 +20,7 @@ public static RpcContractState FromJson(JObject json)
ContractState = new ContractState
{
Id = (int)json["id"].AsNumber(),
Hash = UInt160.Parse(json["hash"].AsString()),
Script = Convert.FromBase64String(json["script"].AsString()),
Manifest = ContractManifest.FromJson(json["manifest"])
}
Expand Down
1 change: 1 addition & 0 deletions src/RpcClient/RpcClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ public static ContractState ContractStateFromJson(JObject json)
return new ContractState
{
Id = (int)json["id"].AsNumber(),
Hash = UInt160.Parse(json["hash"].AsString()),
Script = Convert.FromBase64String(json["script"].AsString()),
Manifest = ContractManifest.FromJson(json["manifest"])
};
Expand Down
117 changes: 50 additions & 67 deletions tests/Neo.Network.RPC.Tests/RpcTestCases.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,109 +318,87 @@
"Request": {
"jsonrpc": "2.0",
"method": "getcontractstate",
"params": [ "0x806b7fa0db3b46d6c42e1e1b0a7fd50db9d4a9b0" ],
"params": [ "0x36a019d836d964c438c573f78badf79b9e7eebdd" ],
"id": 1
},
"Response": {
"jsonrpc": "2.0",
"id": 1,
"result": {
"id": 0,
"hash": "0x806b7fa0db3b46d6c42e1e1b0a7fd50db9d4a9b0",
"script": "VgIMFGklqlVHEkOanGE7oRTvo/rCPdvKYAwDKiwKYVcDAiFB6X04oAwBINshmlCaULQlIwAAACEMFGklqlVHEkOanGE7oRTvo/rCPdvKIUH4J+yMQCFB6X04oAwBQNshmlCaULQlKQEAAHgMCWJhbGFuY2VPZpcnDwAAAHkQziE1WgEAAEB4DAhkZWNpbWFsc5cnDAAAACE1sQEAAEB4DAZkZXBsb3mXJwwAAAAhNbQBAABAeAwEbmFtZZcnDAAAACE1OQIAAEB4DAZzeW1ib2yXJwwAAAAhNTsCAABAeAwSc3VwcG9ydGVkU3RhbmRhcmRzlycMAAAAITUfAgAAQHgMC3RvdGFsU3VwcGx5lycMAAAAITUmAgAAQHgMCHRyYW5zZmVylyclAAAAecoTsyUHAAAAEEB5EM55Ec5weRLOcWhpIVM1EgIAAEB4DAdkZXN0cm95lycMAAAAITUzAAAAQHgMB21pZ3JhdGWXJyAAAAB5yhKzJQcAAAAQQHkQznkRznJqIVA1EAAAAEAQQCFBxp8d8BFAVwACIQwUaSWqVUcSQ5qcYTuhFO+j+sI928ohQfgn7IwlBwAAABBAeMonDAAAAHnKJQcAAAAQQHh5IVBBMcYzHRFAVwEBeMoMARTbIbMlPAAAAAwyVGhlIHBhcmFtZXRlciBhY2NvdW50IFNIT1VMRCBiZSAyMC1ieXRlIGFkZHJlc3Nlcy4hRTohQZv2Z854IVBBkl3oMRBwJQcAAABoQCFBm/ZnznghUEGSXegx2yFAGEBXAQF4IUGpxUtBcGgnCQAAAGgSzkARQCFBm/ZnzgwLdG90YWxTdXBwbHkhUEGSXegxRSFBm/ZnziEMFGklqlVHEkOanGE7oRTvo/rCPdvKIQwDKiwKIVNB5j8YhCFBm/ZnzgwLdG90YWxTdXBwbHkhDAMqLAohU0HmPxiEIQshDBRpJapVRxJDmpxhO6EU76P6wj3byiEMAyosCiFTDAhUcmFuc2ZlchTAQZUBb2ERQAwVTmVwNSBOZW8zIFRlbXBsYXRlIDEgQAwDTk5EQBPDShAMBU5FUC010EoRDAVORVAtN9BKEgwGTkVQLTEw0EAhQZv2Z84MC3RvdGFsU3VwcGx5IVBBkl3oMdshQFcCA3oQticHAAAAEEB4IUH4J+yMJQcAAAAQQHnKDAEU2yGzJQcAAAAQQCFBm/ZnznghUEGSXegx2yFwaHq1JwcAAAAQQHh5mlCaULQlBwAAABFAaHqzJxgAAAAhQZv2Z854IVBBL1jF7SMWAAAAIUGb9mfOeGh6nyFTQeY/GIQhQZv2Z855IVBBkl3oMXFpJ0QAAAAMB2lmIHBhc3MhQc/nR5YhQZv2Z855adshep4hU0HmPxiEDBBTdG9yYWdlLnB1dCBwYXNzIUHP50eWIzsAAAAMCWVsc2UgcGFzcyFBz+dHliFBm/Znznl6IVNB5j8YhAwOYW1vdW50IC0+IHBhc3MhQc/nR5YheHl6IVMMCFRyYW5zZmVyFMBBlQFvYRFA",
"id": -2,
"updatecounter": 0,
"hash": "0x36a019d836d964c438c573f78badf79b9e7eebdd",
"script": "DANHQVNBa2d4Cw==",
"manifest": {
"name": "GAS",
"groups": [],
"features": {
"storage": true,
"payable": true
},
"supportedstandards": [
"NEP-5"
"NEP-17"
],
"abi": {
"hash": "0x806b7fa0db3b46d6c42e1e1b0a7fd50db9d4a9b0",
"methods": [
{
"name": "main",
"parameters": [
{
"name": "method",
"type": "String"
},
{
"name": "args",
"type": "Array"
}
],
"name": "onPersist",
"parameters": [],
"offset": 0,
"returntype": "ByteArray"
"returntype": "Void"
},
{
"name": "Destroy",
"name": "totalSupply",
"parameters": [],
"offset": 400,
"returntype": "Boolean"
"offset": 0,
"returntype": "Integer"
},
{
"name": "Migrate",
"name": "balanceOf",
"parameters": [
{
"name": "script",
"name": "account",
"type": "ByteArray"
},
{
"name": "manifest",
"type": "String"
}
],
"offset": 408,
"returntype": "Boolean"
"offset": 0,
"returntype": "Integer"
},
{
"name": "BalanceOf",
"name": "transfer",
"parameters": [
{
"name": "account",
"name": "from",
"type": "ByteArray"
},
{
"name": "to",
"type": "ByteArray"
},
{
"name": "amount",
"type": "Integer"
},
{
"name": "data",
"type": "Any"
}
],
"offset": 474,
"returntype": "Integer"
},
{
"name": "Decimals",
"parameters": [],
"offset": 585,
"returntype": "Integer"
},
{
"name": "Deploy",
"parameters": [],
"offset": 610,
"offset": 0,
"returntype": "Boolean"
},
{
"name": "Name",
"name": "postPersist",
"parameters": [],
"offset": 763,
"returntype": "String"
"offset": 0,
"returntype": "Void"
},
{
"name": "Symbol",
"name": "symbol",
"parameters": [],
"offset": 787,
"offset": 0,
"returntype": "String"
},
{
"name": "SupportedStandards",
"name": "decimals",
"parameters": [],
"offset": 793,
"returntype": "Array"
},
{
"name": "TotalSupply",
"parameters": [],
"offset": 827,
"offset": 0,
"returntype": "Integer"
}
],
Expand All @@ -429,15 +407,15 @@
"name": "Transfer",
"parameters": [
{
"name": "arg1",
"type": "ByteArray"
"name": "from",
"type": "Hash160"
},
{
"name": "arg2",
"type": "ByteArray"
"name": "to",
"type": "Hash160"
},
{
"name": "arg3",
"name": "amount",
"type": "Integer"
}
]
Expand All @@ -451,7 +429,12 @@
}
],
"trusts": [],
"safemethods": [],
"safemethods": [
"totalSupply",
"balanceOf",
"symbol",
"decimals"
],
"extra": null
}
}
Expand Down
2 changes: 0 additions & 2 deletions tests/Neo.Network.RPC.Tests/UT_ContractClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public async Task TestDeployContract()
Permissions = new[] { ContractPermission.DefaultPermission },
Abi = new ContractAbi()
{
Hash = new byte[1].ToScriptHash(),
Events = new ContractEventDescriptor[0],
Methods = new ContractMethodDescriptor[0]
},
Expand All @@ -55,7 +54,6 @@ public async Task TestDeployContract()
SupportedStandards = new string[] { "NEP-10" },
Extra = null,
};
manifest.Features = ContractFeatures.HasStorage | ContractFeatures.Payable;
using (ScriptBuilder sb = new ScriptBuilder())
{
sb.EmitSysCall(ApplicationEngine.System_Contract_Create, new byte[1], manifest.ToString());
Expand Down