Skip to content

Commit

Permalink
v3.7.5 (#913)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
superboyiii authored Jun 12, 2024
1 parent 937cdaa commit 8c6b64b
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VersionPrefix>3.7.4</VersionPrefix>
<VersionPrefix>3.7.5</VersionPrefix>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Neo.Plugins</RootNamespace>
<Authors>The Neo Project</Authors>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# ARCHIVED

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

## What is it

Expand Down
2 changes: 1 addition & 1 deletion src/ApplicationLogs/Store/LogStorageStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public Guid PutStackItemState(StackItem stackItem)
{
_snapshot.Put(key, BinarySerializer.Serialize(stackItem, ExecutionEngineLimits.Default with { MaxItemSize = (uint)Settings.Default.MaxStackSize }));
}
catch (NotSupportedException)
catch
{
_snapshot.Put(key, BinarySerializer.Serialize(StackItem.Null, ExecutionEngineLimits.Default with { MaxItemSize = (uint)Settings.Default.MaxStackSize }));
}
Expand Down
14 changes: 6 additions & 8 deletions src/RpcServer/RpcServer.Blockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,13 @@ protected virtual JToken GetContractState(JArray _params)
{
if (int.TryParse(_params[0].AsString(), out int contractId))
{
var contracts = NativeContract.ContractManagement.GetContractById(system.StoreView, contractId);
return contracts?.ToJson().NotNull_Or(RpcError.UnknownContract);
}
else
{
UInt160 script_hash = ToScriptHash(_params[0].AsString());
ContractState contract = NativeContract.ContractManagement.GetContract(system.StoreView, script_hash);
return contract?.ToJson().NotNull_Or(RpcError.UnknownContract);
var contractState = NativeContract.ContractManagement.GetContractById(system.StoreView, contractId);
return contractState.NotNull_Or(RpcError.UnknownContract).ToJson();
}

var scriptHash = ToScriptHash(_params[0].AsString());
var contract = NativeContract.ContractManagement.GetContract(system.StoreView, scriptHash);
return contract.NotNull_Or(RpcError.UnknownContract).ToJson();
}

private static UInt160 ToScriptHash(string keyword)
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 @@ -246,7 +246,7 @@ protected virtual JToken TraverseIterator(JArray _params)
Guid sid = Result.Ok_Or(() => Guid.Parse(_params[0].GetString()), RpcError.InvalidParams.WithData($"Invalid session id {nameof(sid)}"));
Guid iid = Result.Ok_Or(() => Guid.Parse(_params[1].GetString()), RpcError.InvalidParams.WithData($"Invliad iterator id {nameof(iid)}"));
int count = _params[2].GetInt32();
Result.True_Or(() => count > settings.MaxIteratorResultItems, RpcError.InvalidParams.WithData($"Invalid iterator items count {nameof(count)}"));
Result.True_Or(() => count <= settings.MaxIteratorResultItems, RpcError.InvalidParams.WithData($"Invalid iterator items count {nameof(count)}"));
Session session;
lock (sessions)
{
Expand Down
2 changes: 1 addition & 1 deletion src/RpcServer/RpcServer.Wallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ protected virtual JToken CancelTransaction(JArray _params)

var conflict = new TransactionAttribute[] { new Conflicts() { Hash = txid } };
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>();
(!signers.Any()).True_Or(RpcErrorFactory.BadRequest("No signer."));
signers.Any().True_Or(RpcErrorFactory.BadRequest("No signer."));
Transaction tx = new Transaction
{
Signers = signers,
Expand Down
7 changes: 7 additions & 0 deletions tests/Neo.Plugins.RpcServer.Tests/UT_RpcServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@
// modifications are permitted.

using Microsoft.VisualStudio.TestTools.UnitTesting;
using Neo.SmartContract;

namespace Neo.Plugins.RpcServer.Tests
{
[TestClass]
public class UT_RpcServer
{
[TestMethod]
public void TestNotNull_Or()
{
ContractState? contracts = null;

Check warning on line 23 in tests/Neo.Plugins.RpcServer.Tests/UT_RpcServer.cs

View workflow job for this annotation

GitHub Actions / Test

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
Assert.ThrowsException<RpcException>(() => contracts.NotNull_Or(RpcError.UnknownContract).ToJson());
}
}
}

0 comments on commit 8c6b64b

Please sign in to comment.