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

Update dependency: Neo v3.0.0-CI00044 #98

Merged
merged 3 commits into from
May 19, 2019
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 ApplicationLogs/ApplicationLogs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="2.10.2" />
<PackageReference Include="Neo" Version="3.0.0-CI00044" />
</ItemGroup>

</Project>
40 changes: 17 additions & 23 deletions ApplicationLogs/LogReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,36 +53,30 @@ public void OnPersist(Snapshot snapshot, IReadOnlyList<Blockchain.ApplicationExe
{
JObject json = new JObject();
json["txid"] = appExec.Transaction.Hash.ToString();
json["executions"] = appExec.ExecutionResults.Select(p =>
json["trigger"] = appExec.Trigger;
json["vmstate"] = appExec.VMState;
json["gas_consumed"] = appExec.GasConsumed.ToString();
try
{
JObject execution = new JObject();
execution["trigger"] = p.Trigger;
execution["contract"] = p.ScriptHash.ToString();
execution["vmstate"] = p.VMState;
execution["gas_consumed"] = p.GasConsumed.ToString();
json["stack"] = appExec.Stack.Select(q => q.ToParameter().ToJson()).ToArray();
}
catch (InvalidOperationException)
{
json["stack"] = "error: recursive reference";
}
json["notifications"] = appExec.Notifications.Select(q =>
{
JObject notification = new JObject();
notification["contract"] = q.ScriptHash.ToString();
try
{
execution["stack"] = p.Stack.Select(q => q.ToParameter().ToJson()).ToArray();
notification["state"] = q.State.ToParameter().ToJson();
}
catch (InvalidOperationException)
{
execution["stack"] = "error: recursive reference";
notification["state"] = "error: recursive reference";
}
execution["notifications"] = p.Notifications.Select(q =>
{
JObject notification = new JObject();
notification["contract"] = q.ScriptHash.ToString();
try
{
notification["state"] = q.State.ToParameter().ToJson();
}
catch (InvalidOperationException)
{
notification["state"] = "error: recursive reference";
}
return notification;
}).ToArray();
return execution;
return notification;
}).ToArray();
writeBatch.Put(appExec.Transaction.Hash.ToArray(), json.ToString());
}
Expand Down
3 changes: 1 addition & 2 deletions ApplicationLogs/Settings.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.Extensions.Configuration;
using Neo.Network.P2P;

namespace Neo.Plugins
{
Expand All @@ -11,7 +10,7 @@ internal class Settings

private Settings(IConfigurationSection section)
{
this.Path = string.Format(section.GetSection("Path").Value, Message.Magic.ToString("X8"));
this.Path = string.Format(section.GetSection("Path").Value, ProtocolSettings.Default.Magic.ToString("X8"));
}

public static void Load(IConfigurationSection section)
Expand Down
2 changes: 1 addition & 1 deletion CoreMetrics/CoreMetrics.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="2.10.2" />
<PackageReference Include="Neo" Version="3.0.0-CI00044" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion ImportBlocks/ImportBlocks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="2.10.2" />
<PackageReference Include="Neo" Version="3.0.0-CI00044" />
</ItemGroup>

</Project>
15 changes: 6 additions & 9 deletions RpcNep5Tracker/Nep5Balance.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
using System.IO;
using System.Numerics;
using Neo.IO;
using Neo.Ledger;

namespace Neo.Plugins
{
public class Nep5Balance : StateBase, ICloneable<Nep5Balance>
public class Nep5Balance : ICloneable<Nep5Balance>, ISerializable
{
public BigInteger Balance;
public uint LastUpdatedBlock;

public override int Size => base.Size + Balance.ToByteArray().GetVarSize() + sizeof(uint);
int ISerializable.Size => Balance.ToByteArray().GetVarSize() + sizeof(uint);

public override void Serialize(BinaryWriter writer)
void ISerializable.Serialize(BinaryWriter writer)
{
base.Serialize(writer);
writer.WriteVarBytes(Balance.ToByteArray());
writer.Write(LastUpdatedBlock);
}

public override void Deserialize(BinaryReader reader)
void ISerializable.Deserialize(BinaryReader reader)
{
base.Deserialize(reader);
Balance = new BigInteger(reader.ReadVarBytes(512));
LastUpdatedBlock = reader.ReadUInt32();
}

public Nep5Balance Clone()
Nep5Balance ICloneable<Nep5Balance>.Clone()
{
return new Nep5Balance
{
Expand All @@ -41,4 +38,4 @@ public void FromReplica(Nep5Balance replica)
LastUpdatedBlock = replica.LastUpdatedBlock;
}
}
}
}
15 changes: 6 additions & 9 deletions RpcNep5Tracker/Nep5Transfer.cs
Original file line number Diff line number Diff line change
@@ -1,38 +1,35 @@
using System.IO;
using System.Numerics;
using Neo.IO;
using Neo.Ledger;

namespace Neo.Plugins
{
public class Nep5Transfer : StateBase, ICloneable<Nep5Transfer>
public class Nep5Transfer : ICloneable<Nep5Transfer>, ISerializable
{
public UInt160 UserScriptHash;
public uint BlockIndex;
public UInt256 TxHash;
public BigInteger Amount;

public override int Size => base.Size + 20 + sizeof(uint) + 32 + Amount.ToByteArray().GetVarSize();
int ISerializable.Size => 20 + sizeof(uint) + 32 + Amount.ToByteArray().GetVarSize();

public override void Serialize(BinaryWriter writer)
void ISerializable.Serialize(BinaryWriter writer)
{
base.Serialize(writer);
writer.Write(UserScriptHash);
writer.Write(BlockIndex);
writer.Write(TxHash);
writer.WriteVarBytes(Amount.ToByteArray());
}

public override void Deserialize(BinaryReader reader)
void ISerializable.Deserialize(BinaryReader reader)
{
base.Deserialize(reader);
UserScriptHash = reader.ReadSerializable<UInt160>();
BlockIndex = reader.ReadUInt32();
TxHash = reader.ReadSerializable<UInt256>();
Amount = new BigInteger(reader.ReadVarBytes(512));
}

public Nep5Transfer Clone()
Nep5Transfer ICloneable<Nep5Transfer>.Clone()
{
return new Nep5Transfer
{
Expand All @@ -43,7 +40,7 @@ public Nep5Transfer Clone()
};
}

public void FromReplica(Nep5Transfer replica)
void ICloneable<Nep5Transfer>.FromReplica(Nep5Transfer replica)
{
UserScriptHash = replica.UserScriptHash;
BlockIndex = replica.BlockIndex;
Expand Down
19 changes: 8 additions & 11 deletions RpcNep5Tracker/RpcNep5Tracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,15 @@ public void OnPersist(Snapshot snapshot, IReadOnlyList<Blockchain.ApplicationExe
ushort transferIndex = 0;
foreach (Blockchain.ApplicationExecuted appExecuted in applicationExecutedList)
{
foreach (var executionResults in appExecuted.ExecutionResults)
// Executions that fault won't modify storage, so we can skip them.
if (appExecuted.VMState.HasFlag(VMState.FAULT)) continue;
foreach (var notifyEventArgs in appExecuted.Notifications)
{
// Executions that fault won't modify storage, so we can skip them.
if (executionResults.VMState.HasFlag(VMState.FAULT)) continue;
foreach (var notifyEventArgs in executionResults.Notifications)
{
if (!(notifyEventArgs?.State is VM.Types.Array stateItems) || stateItems.Count == 0
|| !(notifyEventArgs.ScriptContainer is Transaction transaction))
continue;
HandleNotification(snapshot, transaction, notifyEventArgs.ScriptHash, stateItems,
nep5BalancesChanged, ref transferIndex);
}
if (!(notifyEventArgs?.State is VM.Types.Array stateItems) || stateItems.Count == 0
|| !(notifyEventArgs.ScriptContainer is Transaction transaction))
continue;
HandleNotification(snapshot, transaction, notifyEventArgs.ScriptHash, stateItems,
nep5BalancesChanged, ref transferIndex);
}
}

Expand Down
2 changes: 1 addition & 1 deletion RpcNep5Tracker/RpcNep5Tracker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Neo" Version="2.10.2" />
<PackageReference Include="Neo" Version="3.0.0-CI00044" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion RpcSecurity/RpcSecurity.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="2.10.2" />
<PackageReference Include="Neo" Version="3.0.0-CI00044" />
</ItemGroup>

</Project>
17 changes: 0 additions & 17 deletions RpcSystemAssetTracker/RpcSystemAssetTracker.csproj

This file was deleted.

7 changes: 0 additions & 7 deletions RpcSystemAssetTracker/RpcSystemAssetTracker/config.json

This file was deleted.

Loading