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

v3.7.5 #913

Merged
merged 6 commits into from
Jun 12, 2024
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 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());
}
}
}
Loading