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

3.4.0 #744

Merged
merged 49 commits into from
Aug 10, 2022
Merged

3.4.0 #744

Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
7488689
update neo
Ashuaidehao Jul 14, 2022
3cfa816
CI-1380
Ashuaidehao Jul 25, 2022
da33c00
Update src/RpcClient/Utility.cs
Ashuaidehao Jul 27, 2022
8503f81
Update src/OracleService/OracleService.csproj
shargon Jul 28, 2022
5e17b24
Merge branch 'master' into sync-neo-1377
superboyiii Aug 1, 2022
0871eb2
3.4.0
erikzhang Aug 4, 2022
24075f7
update neofs api
Aug 9, 2022
4cc2fc0
format
Aug 9, 2022
915e73d
Update LogReader.cs
erikzhang Aug 10, 2022
05e65a0
Update LogReader.cs
erikzhang Aug 10, 2022
18066c7
Update RpcAccount.cs and RpcClient.cs
erikzhang Aug 10, 2022
a4e2238
Update RpcApplicationLog.cs and RpcClient.cs
erikzhang Aug 10, 2022
93d1c14
Update RpcBlock.cs, RpcClient.cs and Utility.cs
erikzhang Aug 10, 2022
5a336ea
Update RpcBlockHeader.cs and RpcClient.cs
erikzhang Aug 10, 2022
bfe0228
Update RpcContractState.cs
erikzhang Aug 10, 2022
cf469ef
Update RpcFoundStates.cs and StateAPI.cs
erikzhang Aug 10, 2022
20d727b
Update RpcInvokeResult.cs and RpcClient.cs
erikzhang Aug 10, 2022
0afbbdf
Update RpcMethodToken.cs and RpcNefFile.cs
erikzhang Aug 10, 2022
27f6bc4
Update RpcNativeContract.cs and RpcClient.cs
erikzhang Aug 10, 2022
a630127
Update RpcContractState.cs, RpcNativeContract.cs, RpcNefFile.cs and R…
erikzhang Aug 10, 2022
14a42d9
Update RpcNep17Balances.cs and RpcClient.cs
erikzhang Aug 10, 2022
c87942d
Update RpcNep17Transfers.cs and RpcClient.cs
erikzhang Aug 10, 2022
ded0cca
Update RpcPeers.cs and RpcClient.cs
erikzhang Aug 10, 2022
338d668
Update RpcPlugin.cs and RpcClient.cs
erikzhang Aug 10, 2022
f1cdb9f
Update RpcRawMemPool.cs and RpcClient.cs
erikzhang Aug 10, 2022
255de6e
Update RpcRequest.cs
erikzhang Aug 10, 2022
ac95c63
Update RpcResponse.cs and RpcClient.cs
erikzhang Aug 10, 2022
f879474
Update RpcStateRoot.cs and StateAPI.cs
erikzhang Aug 10, 2022
4d2e493
Update RpcTransaction.cs, RpcClient.cs and Utility.cs
erikzhang Aug 10, 2022
ba41901
Update RpcTransferOut.cs
erikzhang Aug 10, 2022
40e375c
Update RpcUnclaimedGas.cs and RpcClient.cs
erikzhang Aug 10, 2022
410e0ec
Update RpcValidateAddressResult.cs and RpcClient.cs
erikzhang Aug 10, 2022
26c60d9
Update RpcValidator.cs and RpcClient.cs
erikzhang Aug 10, 2022
2afb5b3
Update RpcVersion.cs and RpcClient.cs
erikzhang Aug 10, 2022
2c17246
Update RpcClient.cs
erikzhang Aug 10, 2022
16d8c34
Update RpcApplicationLog.cs, RpcInvokeResult.cs, RpcStateRoot.cs and …
erikzhang Aug 10, 2022
42b40ec
Update RpcServer.Blockchain.cs and Utility.cs
erikzhang Aug 10, 2022
7a1fb6f
Update RpcServer.Node.cs
erikzhang Aug 10, 2022
f3378e3
Update RpcServer.SmartContract.cs
erikzhang Aug 10, 2022
48c510f
Update RpcServer.Utilities.cs
erikzhang Aug 10, 2022
bc770a5
Update RpcServer.Wallet.cs
erikzhang Aug 10, 2022
009a0bd
Update RpcServer.cs
erikzhang Aug 10, 2022
9378578
Update Utility.cs
erikzhang Aug 10, 2022
838bcf3
Update StateRoot.cs
erikzhang Aug 10, 2022
14fe7fe
Update StatesDumper.cs
erikzhang Aug 10, 2022
200d81f
Update Nep11Tracker.cs and TrackerBase.cs
erikzhang Aug 10, 2022
08d3f18
Update Nep17Tracker.cs
erikzhang Aug 10, 2022
c7d124b
Update TrackerBase.cs
erikzhang Aug 10, 2022
54fac8f
Fix compilation
erikzhang Aug 10, 2022
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
22 changes: 11 additions & 11 deletions src/ApplicationLogs/LogReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

using Neo.IO;
using Neo.IO.Data.LevelDB;
using Neo.IO.Json;
using Neo.Json;
using Neo.Ledger;
using Neo.Network.P2P.Payloads;
using Neo.Persistence;
Expand Down Expand Up @@ -57,14 +57,14 @@ protected override void OnSystemLoaded(NeoSystem system)
}

[RpcMethod]
public JObject GetApplicationLog(JArray _params)
public JToken GetApplicationLog(JArray _params)
{
UInt256 hash = UInt256.Parse(_params[0].AsString());
byte[] value = db.Get(ReadOptions.Default, hash.ToArray());
if (value is null)
throw new RpcException(-100, "Unknown transaction/blockhash");

var raw = JObject.Parse(Neo.Utility.StrictUTF8.GetString(value));
var raw = JToken.Parse(Neo.Utility.StrictUTF8.GetString(value));
//Additional optional "trigger" parameter to getapplicationlog for clients to be able to get just one execution result for a block.
if (_params.Count >= 2 && Enum.TryParse(_params[1].AsString(), true, out TriggerType trigger))
{
Expand All @@ -80,13 +80,13 @@ public JObject GetApplicationLog(JArray _params)
return raw;
}

public static JObject TxLogToJson(Blockchain.ApplicationExecuted appExec)
public static JToken TxLogToJson(Blockchain.ApplicationExecuted appExec)
{
global::System.Diagnostics.Debug.Assert(appExec.Transaction != null);

var txJson = new JObject();
txJson["txid"] = appExec.Transaction.Hash.ToString();
JObject trigger = new JObject();
JToken trigger = new JObject();
trigger["trigger"] = appExec.Trigger;
trigger["vmstate"] = appExec.VMState;
trigger["exception"] = GetExceptionMessage(appExec.Exception);
Expand All @@ -101,7 +101,7 @@ public static JObject TxLogToJson(Blockchain.ApplicationExecuted appExec)
}
trigger["notifications"] = appExec.Notifications.Select(q =>
{
JObject notification = new JObject();
JToken notification = new JObject();
notification["contract"] = q.ScriptHash.ToString();
notification["eventname"] = q.EventName;
try
Expand All @@ -115,22 +115,22 @@ public static JObject TxLogToJson(Blockchain.ApplicationExecuted appExec)
return notification;
}).ToArray();

txJson["executions"] = new List<JObject>() { trigger }.ToArray();
txJson["executions"] = new List<JToken>() { trigger }.ToArray();
return txJson;
}

public static JObject BlockLogToJson(Block block, IReadOnlyList<Blockchain.ApplicationExecuted> applicationExecutedList)
public static JToken BlockLogToJson(Block block, IReadOnlyList<Blockchain.ApplicationExecuted> applicationExecutedList)
{
var blocks = applicationExecutedList.Where(p => p.Transaction is null).ToArray();
if (blocks.Length > 0)
{
var blockJson = new JObject();
var blockHash = block.Hash.ToArray();
blockJson["blockhash"] = block.Hash.ToString();
var triggerList = new List<JObject>();
var triggerList = new List<JToken>();
foreach (var appExec in blocks)
{
JObject trigger = new JObject();
JToken trigger = new JObject();
trigger["trigger"] = appExec.Trigger;
trigger["vmstate"] = appExec.VMState;
trigger["gasconsumed"] = appExec.GasConsumed.ToString();
Expand All @@ -144,7 +144,7 @@ public static JObject BlockLogToJson(Block block, IReadOnlyList<Blockchain.Appli
}
trigger["notifications"] = appExec.Notifications.Select(q =>
{
JObject notification = new JObject();
JToken notification = new JObject();
notification["contract"] = q.ScriptHash.ToString();
notification["eventname"] = q.EventName;
try
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="3.3.1" />
<PackageReference Include="Neo" Version="3.3.1-CI01380" />
</ItemGroup>

</Project>
3 changes: 2 additions & 1 deletion src/OracleService/OracleService.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PackageId>Neo.Plugins.OracleService</PackageId>
Expand All @@ -7,6 +7,7 @@
<ItemGroup>
<PackageReference Include="Neo.ConsoleService" Version="1.2.0" />
<PackageReference Include="NeoFS.API" Version="3.3.1" />
<PackageReference Include="Neo" Version="3.3.1" />
shargon marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/RpcClient/Models/RpcAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.IO.Json;
using Neo.Json;

namespace Neo.Network.RPC.Models
{
Expand All @@ -22,7 +22,7 @@ public class RpcAccount

public bool WatchOnly { get; set; }

public JObject ToJson()
public JToken ToJson()
{
return new JObject
{
Expand All @@ -33,7 +33,7 @@ public JObject ToJson()
};
}

public static RpcAccount FromJson(JObject json)
public static RpcAccount FromJson(JToken json)
{
return new RpcAccount
{
Expand Down
24 changes: 12 additions & 12 deletions src/RpcClient/Models/RpcApplicationLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.IO.Json;
using Neo.Json;
using Neo.SmartContract;
using Neo.VM;
using Neo.VM.Types;
Expand All @@ -25,9 +25,9 @@ public class RpcApplicationLog

public List<Execution> Executions { get; set; }

public JObject ToJson()
public JToken ToJson()
{
JObject json = new JObject();
JToken json = new JObject();
if (TxId != null)
json["txid"] = TxId.ToString();
if (BlockHash != null)
Expand All @@ -36,7 +36,7 @@ public JObject ToJson()
return json;
}

public static RpcApplicationLog FromJson(JObject json, ProtocolSettings protocolSettings)
public static RpcApplicationLog FromJson(JToken json, ProtocolSettings protocolSettings)
{
return new RpcApplicationLog
{
Expand All @@ -61,9 +61,9 @@ public class Execution

public List<RpcNotifyEventArgs> Notifications { get; set; }

public JObject ToJson()
public JToken ToJson()
{
JObject json = new();
var json = new JObject();
json["trigger"] = Trigger;
json["vmstate"] = VMState;
json["gasconsumed"] = GasConsumed.ToString();
Expand All @@ -73,12 +73,12 @@ public JObject ToJson()
return json;
}

public static Execution FromJson(JObject json, ProtocolSettings protocolSettings)
public static Execution FromJson(JToken json, ProtocolSettings protocolSettings)
{
return new Execution
{
Trigger = json["trigger"].TryGetEnum<TriggerType>(),
VMState = json["vmstate"].TryGetEnum<VMState>(),
Trigger = json["trigger"].AsEnum<TriggerType>(),
VMState = json["vmstate"].AsEnum<VMState>(),
GasConsumed = long.Parse(json["gasconsumed"].AsString()),
ExceptionMessage = json["exception"]?.AsString(),
Stack = ((JArray)json["stack"]).Select(p => Utility.StackItemFromJson(p)).ToList(),
Expand All @@ -95,16 +95,16 @@ public class RpcNotifyEventArgs

public StackItem State { get; set; }

public JObject ToJson()
public JToken ToJson()
{
JObject json = new();
var json = new JObject();
json["contract"] = Contract.ToString();
json["eventname"] = EventName;
json["state"] = State.ToJson();
return json;
}

public static RpcNotifyEventArgs FromJson(JObject json, ProtocolSettings protocolSettings)
public static RpcNotifyEventArgs FromJson(JToken json, ProtocolSettings protocolSettings)
{
return new RpcNotifyEventArgs
{
Expand Down
8 changes: 4 additions & 4 deletions src/RpcClient/Models/RpcBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.IO.Json;
using Neo.Json;
using Neo.Network.P2P.Payloads;

namespace Neo.Network.RPC.Models
Expand All @@ -21,15 +21,15 @@ public class RpcBlock

public UInt256 NextBlockHash { get; set; }

public JObject ToJson(ProtocolSettings protocolSettings)
public JToken ToJson(ProtocolSettings protocolSettings)
{
JObject json = Utility.BlockToJson(Block, protocolSettings);
JToken json = Utility.BlockToJson(Block, protocolSettings);
json["confirmations"] = Confirmations;
json["nextblockhash"] = NextBlockHash?.ToString();
return json;
}

public static RpcBlock FromJson(JObject json, ProtocolSettings protocolSettings)
public static RpcBlock FromJson(JToken json, ProtocolSettings protocolSettings)
{
return new RpcBlock
{
Expand Down
8 changes: 4 additions & 4 deletions src/RpcClient/Models/RpcBlockHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.IO.Json;
using Neo.Json;
using Neo.Network.P2P.Payloads;

namespace Neo.Network.RPC.Models
Expand All @@ -21,15 +21,15 @@ public class RpcBlockHeader

public UInt256 NextBlockHash { get; set; }

public JObject ToJson(ProtocolSettings protocolSettings)
public JToken ToJson(ProtocolSettings protocolSettings)
{
JObject json = Header.ToJson(protocolSettings);
JToken json = Header.ToJson(protocolSettings);
json["confirmations"] = Confirmations;
json["nextblockhash"] = NextBlockHash?.ToString();
return json;
}

public static RpcBlockHeader FromJson(JObject json, ProtocolSettings protocolSettings)
public static RpcBlockHeader FromJson(JToken json, ProtocolSettings protocolSettings)
{
return new RpcBlockHeader
{
Expand Down
8 changes: 4 additions & 4 deletions src/RpcClient/Models/RpcContractState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.IO.Json;
using Neo.Json;
using Neo.SmartContract;
using Neo.SmartContract.Manifest;

Expand All @@ -18,12 +18,12 @@ public class RpcContractState
{
public ContractState ContractState { get; set; }

public JObject ToJson()
public JToken ToJson()
{
return ContractState.ToJson();
}

public static RpcContractState FromJson(JObject json)
public static RpcContractState FromJson(JToken json)
{
return new RpcContractState
{
Expand All @@ -33,7 +33,7 @@ public static RpcContractState FromJson(JObject json)
UpdateCounter = (ushort)json["updatecounter"].AsNumber(),
Hash = UInt160.Parse(json["hash"].AsString()),
Nef = RpcNefFile.FromJson(json["nef"]),
Manifest = ContractManifest.FromJson(json["manifest"])
Manifest = ContractManifest.FromJson((JObject)json["manifest"])
}
};
}
Expand Down
6 changes: 3 additions & 3 deletions src/RpcClient/Models/RpcFoundStates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

using System;
using System.Linq;
using Neo.IO.Json;
using Neo.Json;

namespace Neo.Network.RPC.Models
{
Expand All @@ -21,7 +21,7 @@ public class RpcFoundStates
public byte[] FirstProof;
public byte[] LastProof;

public static RpcFoundStates FromJson(JObject json)
public static RpcFoundStates FromJson(JToken json)
{
return new RpcFoundStates
{
Expand All @@ -37,7 +37,7 @@ public static RpcFoundStates FromJson(JObject json)
};
}

static byte[] ProofFromJson(JObject json)
static byte[] ProofFromJson(JToken json)
=> json == null ? null : Convert.FromBase64String(json.AsString());
}
}
16 changes: 8 additions & 8 deletions src/RpcClient/Models/RpcInvokeResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Redistribution and use in source and binary forms with or without
// modifications are permitted.

using Neo.IO.Json;
using Neo.Json;
using Neo.VM;
using Neo.VM.Types;
using System;
Expand All @@ -32,9 +32,9 @@ public class RpcInvokeResult

public string Session { get; set; }

public JObject ToJson()
public JToken ToJson()
{
JObject json = new();
var json = new JObject();
json["script"] = Script;
json["state"] = State;
json["gasconsumed"] = GasConsumed.ToString();
Expand All @@ -53,12 +53,12 @@ public JObject ToJson()
return json;
}

public static RpcInvokeResult FromJson(JObject json)
public static RpcInvokeResult FromJson(JToken json)
{
RpcInvokeResult invokeScriptResult = new()
{
Script = json["script"].AsString(),
State = json["state"].TryGetEnum<VMState>(),
State = json["state"].AsEnum<VMState>(),
GasConsumed = long.Parse(json["gasconsumed"].AsString()),
};
invokeScriptResult.Exception = json["exception"]?.AsString();
Expand All @@ -79,15 +79,15 @@ public class RpcStack

public string Value { get; set; }

public JObject ToJson()
public JToken ToJson()
{
JObject json = new();
var json = new JObject();
json["type"] = Type;
json["value"] = Value;
return json;
}

public static RpcStack FromJson(JObject json)
public static RpcStack FromJson(JToken json)
{
return new RpcStack
{
Expand Down
Loading