diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4a5401c3d..2f9ffe2c5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ on: pull_request: env: - DOTNET_VERSION: 3.1.100 + DOTNET_VERSION: 5.0.100 jobs: @@ -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 diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 28635c471..d2c7dfa9c 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,10 +1,10 @@ - + 3.0.0 preview4 - netstandard2.1 + net5.0 Neo.Plugins The Neo Project NEO;Blockchain @@ -15,7 +15,7 @@ - + - \ No newline at end of file + diff --git a/src/RpcClient/ContractClient.cs b/src/RpcClient/ContractClient.cs index bc664c82f..296c2e12b 100644 --- a/src/RpcClient/ContractClient.cs +++ b/src/RpcClient/ContractClient.cs @@ -1,4 +1,3 @@ -using System.Threading.Tasks; using Neo.Network.P2P.Payloads; using Neo.Network.RPC.Models; using Neo.SmartContract; @@ -6,6 +5,7 @@ using Neo.SmartContract.Native; using Neo.VM; using Neo.Wallets; +using System.Threading.Tasks; namespace Neo.Network.RPC { @@ -57,7 +57,7 @@ public async Task 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(); diff --git a/src/RpcNep17Tracker/RpcNep17Tracker.cs b/src/RpcNep17Tracker/RpcNep17Tracker.cs index 9dcef2318..79fbafa7c 100644 --- a/src/RpcNep17Tracker/RpcNep17Tracker.cs +++ b/src/RpcNep17Tracker/RpcNep17Tracker.cs @@ -1,4 +1,3 @@ -using Microsoft.AspNetCore.Http; using Neo.IO; using Neo.IO.Caching; using Neo.IO.Data.LevelDB; @@ -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(); diff --git a/src/RpcServer/RpcServer.Blockchain.cs b/src/RpcServer/RpcServer.Blockchain.cs index adccfbf38..16eb2a990 100644 --- a/src/RpcServer/RpcServer.Blockchain.cs +++ b/src/RpcServer/RpcServer.Blockchain.cs @@ -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"); } @@ -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; } diff --git a/src/RpcServer/RpcServer.SmartContract.cs b/src/RpcServer/RpcServer.SmartContract.cs index ca635f896..475a12bf6 100644 --- a/src/RpcServer/RpcServer.SmartContract.cs +++ b/src/RpcServer/RpcServer.SmartContract.cs @@ -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"); diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props new file mode 100644 index 000000000..3a7fa1350 --- /dev/null +++ b/tests/Directory.Build.props @@ -0,0 +1,15 @@ + + + + + net5.0 + false + + + + + + + + + diff --git a/tests/Neo.Network.RPC.Tests/Neo.Network.RPC.Tests.csproj b/tests/Neo.Network.RPC.Tests/Neo.Network.RPC.Tests.csproj index af5c7c416..3209d575a 100644 --- a/tests/Neo.Network.RPC.Tests/Neo.Network.RPC.Tests.csproj +++ b/tests/Neo.Network.RPC.Tests/Neo.Network.RPC.Tests.csproj @@ -1,16 +1,11 @@ - netcoreapp3.1 Neo.Network.RPC.Tests - false - - - diff --git a/tests/Neo.Network.RPC.Tests/RpcTestCases.json b/tests/Neo.Network.RPC.Tests/RpcTestCases.json index 1e97c3832..c62c64d5e 100644 --- a/tests/Neo.Network.RPC.Tests/RpcTestCases.json +++ b/tests/Neo.Network.RPC.Tests/RpcTestCases.json @@ -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" + ] } } }, @@ -1152,7 +1154,7 @@ "Request": { "jsonrpc": "2.0", "method": "getwalletbalance", - "params": [ "0x8c23f196d8a1bfd103a9dcb1f9ccf0c611377d3b" ], + "params": [ "0xa6a6c15dcdc9b997dac448b6926522d22efeedfb" ], "id": 1 }, "Response": { diff --git a/tests/Neo.Network.RPC.Tests/UT_ContractClient.cs b/tests/Neo.Network.RPC.Tests/UT_ContractClient.cs index 0de9a0958..06b331595 100644 --- a/tests/Neo.Network.RPC.Tests/UT_ContractClient.cs +++ b/tests/Neo.Network.RPC.Tests/UT_ContractClient.cs @@ -1,4 +1,3 @@ -using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using Neo.SmartContract; @@ -6,6 +5,7 @@ using Neo.SmartContract.Native; using Neo.VM; using Neo.Wallets; +using System.Threading.Tasks; namespace Neo.Network.RPC.Tests { @@ -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(); } diff --git a/tests/Neo.Plugins.StateService.Tests/Neo.Plugins.StateService.Tests.csproj b/tests/Neo.Plugins.StateService.Tests/Neo.Plugins.StateService.Tests.csproj index 4f0dfa232..94b2e2355 100644 --- a/tests/Neo.Plugins.StateService.Tests/Neo.Plugins.StateService.Tests.csproj +++ b/tests/Neo.Plugins.StateService.Tests/Neo.Plugins.StateService.Tests.csproj @@ -1,18 +1,10 @@ - - - - netcoreapp3.0 - Neo.Plugins.StateService.Tests - false - - - - - - - - - - - - + + + + Neo.Plugins.StateService.Tests + + + + + + diff --git a/tests/Neo.Plugins.Storage.Tests/Neo.Plugins.Storage.Tests.csproj b/tests/Neo.Plugins.Storage.Tests/Neo.Plugins.Storage.Tests.csproj index ac7f99449..c6798b71a 100644 --- a/tests/Neo.Plugins.Storage.Tests/Neo.Plugins.Storage.Tests.csproj +++ b/tests/Neo.Plugins.Storage.Tests/Neo.Plugins.Storage.Tests.csproj @@ -1,17 +1,9 @@ - netcoreapp3.0 Neo.Plugins.Storage.Tests - false - - - - - -