Skip to content

Commit

Permalink
dotnet 5.0 (neo-project#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenzhitong committed Dec 22, 2020
1 parent c5af4ea commit 215a8cc
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 54 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:

env:
DOTNET_VERSION: 3.1.100
DOTNET_VERSION: 5.0.100

jobs:

Expand All @@ -21,8 +21,8 @@ jobs:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Check format
run: |
dotnet tool install --version 3.2.111002 --tool-path ./ dotnet-format --add-source https://dotnet.myget.org/F/format/api/v3/index.json
./dotnet-format --check --dry-run -v diagnostic
dotnet tool install --version 5.0.142902 --tool-path ./ dotnet-format --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json
./dotnet-format . --check -v diagnostic
- name: Test
run: |
sudo apt-get --assume-yes install libleveldb-dev libsnappy-dev libc6-dev
Expand Down
8 changes: 4 additions & 4 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<VersionPrefix>3.0.0</VersionPrefix>
<VersionSuffix>preview4</VersionSuffix>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Neo.Plugins</RootNamespace>
<Authors>The Neo Project</Authors>
<PackageTags>NEO;Blockchain</PackageTags>
Expand All @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="3.0.0-preview4" />
<PackageReference Include="Neo" Version="3.0.0-CI01122" />
</ItemGroup>

</Project>
</Project>
4 changes: 2 additions & 2 deletions src/RpcClient/ContractClient.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System.Threading.Tasks;
using Neo.Network.P2P.Payloads;
using Neo.Network.RPC.Models;
using Neo.SmartContract;
using Neo.SmartContract.Manifest;
using Neo.SmartContract.Native;
using Neo.VM;
using Neo.Wallets;
using System.Threading.Tasks;

namespace Neo.Network.RPC
{
Expand Down Expand Up @@ -57,7 +57,7 @@ public async Task<Transaction> CreateDeployContractTxAsync(byte[] nefFile, Contr
byte[] script;
using (ScriptBuilder sb = new ScriptBuilder())
{
sb.EmitAppCall(NativeContract.Management.Hash, "deploy", nefFile, manifest.ToString());
sb.EmitAppCall(NativeContract.ContractManagement.Hash, "deploy", nefFile, manifest.ToString());
script = sb.ToArray();
}
UInt160 sender = Contract.CreateSignatureRedeemScript(key.PublicKey).ToScriptHash();
Expand Down
3 changes: 1 addition & 2 deletions src/RpcNep17Tracker/RpcNep17Tracker.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Microsoft.AspNetCore.Http;
using Neo.IO;
using Neo.IO.Caching;
using Neo.IO.Data.LevelDB;
Expand Down Expand Up @@ -287,7 +286,7 @@ public JObject GetNep17Balances(JArray _params)
foreach (var (key, value) in dbCache.Find(prefix))
{
JObject balance = new JObject();
if (NativeContract.Management.GetContract(snapshot, key.AssetScriptHash) is null)
if (NativeContract.ContractManagement.GetContract(snapshot, key.AssetScriptHash) is null)
continue;
balance["assethash"] = key.AssetScriptHash.ToString();
balance["amount"] = value.Balance.ToString();
Expand Down
4 changes: 2 additions & 2 deletions src/RpcServer/RpcServer.Blockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected virtual JObject GetContractState(JArray _params)
{
using SnapshotView snapshot = Blockchain.Singleton.GetSnapshot();
UInt160 script_hash = ToScriptHash(_params[0].AsString());
ContractState contract = NativeContract.Management.GetContract(snapshot, script_hash);
ContractState contract = NativeContract.ContractManagement.GetContract(snapshot, script_hash);
return contract?.ToJson() ?? throw new RpcException(-100, "Unknown contract");
}

Expand Down Expand Up @@ -170,7 +170,7 @@ protected virtual JObject GetStorage(JArray _params)
{
using SnapshotView snapshot = Blockchain.Singleton.GetSnapshot();
UInt160 script_hash = UInt160.Parse(_params[0].AsString());
ContractState contract = NativeContract.Management.GetContract(snapshot, script_hash);
ContractState contract = NativeContract.ContractManagement.GetContract(snapshot, script_hash);
if (contract == null) return null;
id = contract.Id;
}
Expand Down
2 changes: 1 addition & 1 deletion src/RpcServer/RpcServer.SmartContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private static Signers SignersFromJson(JArray _params)
private JObject GetVerificationResult(UInt160 scriptHash, ContractParameter[] args, Signers signers = null)
{
var snapshot = Blockchain.Singleton.GetSnapshot();
var contract = NativeContract.Management.GetContract(snapshot, scriptHash);
var contract = NativeContract.ContractManagement.GetContract(snapshot, scriptHash);
if (contract is null)
{
throw new RpcException(-100, "Unknown contract");
Expand Down
15 changes: 15 additions & 0 deletions tests/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.0.0" />
</ItemGroup>

</Project>
5 changes: 0 additions & 5 deletions tests/Neo.Network.RPC.Tests/Neo.Network.RPC.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Neo.Network.RPC.Tests</RootNamespace>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.0.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="coverlet.collector" Version="1.1.0" />
</ItemGroup>
Expand Down
16 changes: 9 additions & 7 deletions tests/Neo.Network.RPC.Tests/RpcTestCases.json
Original file line number Diff line number Diff line change
Expand Up @@ -1112,24 +1112,26 @@
"Name": "invokescriptasync",
"Request": {
"jsonrpc": "2.0",
"id": 1,
"method": "invokescript",
"params": [ "EMMMCGRlY2ltYWxzDBQ7fTcRxvDM+bHcqQPRv6HYlvEjjEFifVtS" ],
"id": 1
"params": [
"HxDDDAhkZWNpbWFscwwU\u002B\u002B3\u002BLtIiZZK2SMTal7nJzV3BpqZB7vQM2w=="
]
},
"Response": {
"jsonrpc": "2.0",
"id": 1,
"result": {
"script": "EMMMCGRlY2ltYWxzDBQ7fTcRxvDM+bHcqQPRv6HYlvEjjEFifVtS",
"script": "HxDDDAhkZWNpbWFscwwU++3+LtIiZZK2SMTal7nJzV3BpqZB7vQM2w==",
"state": "HALT",
"gasconsumed": "0.0506156",
"gasconsumed": "0.0099918",
"exception": null,
"stack": [
{
"type": "Integer",
"value": "8"
}
],
"tx": "00769d16556925aa554712439a9c613ba114efa3fac23ddbca00e1f505000000009e021400000000005620200000009910c30c046e616d650c143b7d3711c6f0ccf9b1dca903d1bfa1d896f1238c41627d5b5210c30c0673796d626f6c0c143b7d3711c6f0ccf9b1dca903d1bfa1d896f1238c41627d5b5210c30c08646563696d616c730c143b7d3711c6f0ccf9b1dca903d1bfa1d896f1238c41627d5b5210c30c0b746f74616c537570706c790c143b7d3711c6f0ccf9b1dca903d1bfa1d896f1238c41627d5b5201420c40c848d0fcbf5e6a820508242ea8b7ccbeed3caefeed5db570537279c2154f7cfd8b0d8f477f37f4e6ca912935b732684d57c455dff7aa525ad4ab000931f22208290c2103aa052fbcb8e5b33a4eefd662536f8684641f04109f1d5e69cdda6f084890286a0b410a906ad4"
]
}
}
},
Expand All @@ -1152,7 +1154,7 @@
"Request": {
"jsonrpc": "2.0",
"method": "getwalletbalance",
"params": [ "0x8c23f196d8a1bfd103a9dcb1f9ccf0c611377d3b" ],
"params": [ "0xa6a6c15dcdc9b997dac448b6926522d22efeedfb" ],
"id": 1
},
"Response": {
Expand Down
4 changes: 2 additions & 2 deletions tests/Neo.Network.RPC.Tests/UT_ContractClient.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Neo.SmartContract;
using Neo.SmartContract.Manifest;
using Neo.SmartContract.Native;
using Neo.VM;
using Neo.Wallets;
using System.Threading.Tasks;

namespace Neo.Network.RPC.Tests
{
Expand Down Expand Up @@ -55,7 +55,7 @@ public async Task TestDeployContract()
};
using (ScriptBuilder sb = new ScriptBuilder())
{
sb.EmitAppCall(NativeContract.Management.Hash, "deploy", new byte[1], manifest.ToString());
sb.EmitAppCall(NativeContract.ContractManagement.Hash, "deploy", new byte[1], manifest.ToString());
script = sb.ToArray();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<RootNamespace>Neo.Plugins.StateService.Tests</RootNamespace>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\StateService\StateService.csproj" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<RootNamespace>Neo.Plugins.StateService.Tests</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\StateService\StateService.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<RootNamespace>Neo.Plugins.Storage.Tests</RootNamespace>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\LevelDBStore\LevelDBStore.csproj" />
<ProjectReference Include="..\..\src\RocksDBStore\RocksDBStore.csproj" />
Expand Down

0 comments on commit 215a8cc

Please sign in to comment.