Skip to content

Commit 8c6b64b

Browse files
authored
v3.7.5 (#913)
* fix patch from: neo-project/neo#3261 and neo-project/neo#3299 * add neo-project/neo#3282 * add neo-project/neo#3263 * v3.7.5 hotfix * readme
1 parent 937cdaa commit 8c6b64b

File tree

8 files changed

+19
-14
lines changed

8 files changed

+19
-14
lines changed

Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4-
<VersionPrefix>3.7.4</VersionPrefix>
4+
<VersionPrefix>3.7.5</VersionPrefix>
55
<TargetFramework>net8.0</TargetFramework>
66
<RootNamespace>Neo.Plugins</RootNamespace>
77
<Authors>The Neo Project</Authors>

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# ARCHIVED
1919

20-
This repository was merged into https://github.com/neo-project/neo, newer (post-3.7.4) modules versions can be obtained from it.
20+
This repository was merged into https://github.com/neo-project/neo, newer (post-3.7.5) modules versions can be obtained from it.
2121

2222
## What is it
2323

src/ApplicationLogs/Store/LogStorageStore.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public Guid PutStackItemState(StackItem stackItem)
162162
{
163163
_snapshot.Put(key, BinarySerializer.Serialize(stackItem, ExecutionEngineLimits.Default with { MaxItemSize = (uint)Settings.Default.MaxStackSize }));
164164
}
165-
catch (NotSupportedException)
165+
catch
166166
{
167167
_snapshot.Put(key, BinarySerializer.Serialize(StackItem.Null, ExecutionEngineLimits.Default with { MaxItemSize = (uint)Settings.Default.MaxStackSize }));
168168
}

src/RpcServer/RpcServer.Blockchain.cs

+6-8
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,13 @@ protected virtual JToken GetContractState(JArray _params)
119119
{
120120
if (int.TryParse(_params[0].AsString(), out int contractId))
121121
{
122-
var contracts = NativeContract.ContractManagement.GetContractById(system.StoreView, contractId);
123-
return contracts?.ToJson().NotNull_Or(RpcError.UnknownContract);
124-
}
125-
else
126-
{
127-
UInt160 script_hash = ToScriptHash(_params[0].AsString());
128-
ContractState contract = NativeContract.ContractManagement.GetContract(system.StoreView, script_hash);
129-
return contract?.ToJson().NotNull_Or(RpcError.UnknownContract);
122+
var contractState = NativeContract.ContractManagement.GetContractById(system.StoreView, contractId);
123+
return contractState.NotNull_Or(RpcError.UnknownContract).ToJson();
130124
}
125+
126+
var scriptHash = ToScriptHash(_params[0].AsString());
127+
var contract = NativeContract.ContractManagement.GetContract(system.StoreView, scriptHash);
128+
return contract.NotNull_Or(RpcError.UnknownContract).ToJson();
131129
}
132130

133131
private static UInt160 ToScriptHash(string keyword)

src/RpcServer/RpcServer.SmartContract.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ protected virtual JToken TraverseIterator(JArray _params)
246246
Guid sid = Result.Ok_Or(() => Guid.Parse(_params[0].GetString()), RpcError.InvalidParams.WithData($"Invalid session id {nameof(sid)}"));
247247
Guid iid = Result.Ok_Or(() => Guid.Parse(_params[1].GetString()), RpcError.InvalidParams.WithData($"Invliad iterator id {nameof(iid)}"));
248248
int count = _params[2].GetInt32();
249-
Result.True_Or(() => count > settings.MaxIteratorResultItems, RpcError.InvalidParams.WithData($"Invalid iterator items count {nameof(count)}"));
249+
Result.True_Or(() => count <= settings.MaxIteratorResultItems, RpcError.InvalidParams.WithData($"Invalid iterator items count {nameof(count)}"));
250250
Session session;
251251
lock (sessions)
252252
{

src/RpcServer/RpcServer.Wallet.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ protected virtual JToken CancelTransaction(JArray _params)
316316

317317
var conflict = new TransactionAttribute[] { new Conflicts() { Hash = txid } };
318318
Signer[] signers = _params.Count >= 2 ? ((JArray)_params[1]).Select(j => new Signer() { Account = AddressToScriptHash(j.AsString(), system.Settings.AddressVersion), Scopes = WitnessScope.None }).ToArray() : Array.Empty<Signer>();
319-
(!signers.Any()).True_Or(RpcErrorFactory.BadRequest("No signer."));
319+
signers.Any().True_Or(RpcErrorFactory.BadRequest("No signer."));
320320
Transaction tx = new Transaction
321321
{
322322
Signers = signers,

tests/Neo.Plugins.RpcServer.Tests/UT_RpcServer.cs

+7
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,18 @@
1010
// modifications are permitted.
1111

1212
using Microsoft.VisualStudio.TestTools.UnitTesting;
13+
using Neo.SmartContract;
1314

1415
namespace Neo.Plugins.RpcServer.Tests
1516
{
1617
[TestClass]
1718
public class UT_RpcServer
1819
{
20+
[TestMethod]
21+
public void TestNotNull_Or()
22+
{
23+
ContractState? contracts = null;
24+
Assert.ThrowsException<RpcException>(() => contracts.NotNull_Or(RpcError.UnknownContract).ToJson());
25+
}
1926
}
2027
}

0 commit comments

Comments
 (0)