Skip to content

Commit 77eee7b

Browse files
committed
Review States
1 parent 4681355 commit 77eee7b

7 files changed

+10
-4
lines changed

src/ApplicationLogs/Store/States/BlockLogState.cs

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public static BlockLogState Create(Guid[] notifyLogIds) =>
3131

3232
public virtual void Deserialize(ref MemoryReader reader)
3333
{
34+
// It should be safe because it filled from a block's notifications.
3435
uint aLen = reader.ReadUInt32();
3536
NotifyLogIds = new Guid[aLen];
3637
for (int i = 0; i < aLen; i++)

src/ApplicationLogs/Store/States/ContractLogState.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ public override void Serialize(BinaryWriter writer)
5656
#region IEquatable
5757

5858
public bool Equals(ContractLogState other) =>
59-
EventName == other.EventName && StackItemIds.SequenceEqual(other.StackItemIds) &&
60-
TransactionHash == other.TransactionHash && Trigger == other.Trigger;
59+
Trigger == other.Trigger && EventName == other.EventName &&
60+
TransactionHash == other.TransactionHash && StackItemIds.SequenceEqual(other.StackItemIds);
6161

6262
public override bool Equals(object obj)
6363
{

src/ApplicationLogs/Store/States/EngineLogState.cs

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public static EngineLogState Create(UInt160 scriptHash, string message) =>
3333
public virtual void Deserialize(ref MemoryReader reader)
3434
{
3535
ScriptHash.Deserialize(ref reader);
36+
// It should be safe because it filled from a transaction's logs.
3637
Message = reader.ReadVarString();
3738
}
3839

src/ApplicationLogs/Store/States/ExecutionLogState.cs

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public void Deserialize(ref MemoryReader reader)
4545
Exception = reader.ReadVarString();
4646
GasConsumed = reader.ReadInt64();
4747

48+
// It should be safe because it filled from a transaction's stack.
4849
uint aLen = reader.ReadUInt32();
4950
StackItemIds = new Guid[aLen];
5051
for (int i = 0; i < aLen; i++)

src/ApplicationLogs/Store/States/NotifyLogState.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public virtual void Deserialize(ref MemoryReader reader)
4040
ScriptHash.Deserialize(ref reader);
4141
EventName = reader.ReadVarString();
4242

43+
// It should be safe because it filled from a transaction's notifications.
4344
uint aLen = reader.ReadUInt32();
4445
StackItemIds = new Guid[aLen];
4546
for (int i = 0; i < aLen; i++)
@@ -61,8 +62,8 @@ public virtual void Serialize(BinaryWriter writer)
6162
#region IEquatable
6263

6364
public bool Equals(NotifyLogState other) =>
64-
EventName == other.EventName && StackItemIds.SequenceEqual(other.StackItemIds) &&
65-
ScriptHash == other.ScriptHash;
65+
EventName == other.EventName && ScriptHash == other.ScriptHash &&
66+
StackItemIds.SequenceEqual(other.StackItemIds);
6667

6768
public override bool Equals(object obj)
6869
{

src/ApplicationLogs/Store/States/TransactionEngineLogState.cs

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public static TransactionEngineLogState Create(Guid[] logIds) =>
3030

3131
public virtual void Deserialize(ref MemoryReader reader)
3232
{
33+
// It should be safe because it filled from a transaction's logs.
3334
uint aLen = reader.ReadUInt32();
3435
LogIds = new Guid[aLen];
3536
for (int i = 0; i < aLen; i++)

src/ApplicationLogs/Store/States/TransactionLogState.cs

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public static TransactionLogState Create(Guid[] notifyLogIds) =>
3131

3232
public virtual void Deserialize(ref MemoryReader reader)
3333
{
34+
// It should be safe because it filled from a transaction's notifications.
3435
uint aLen = reader.ReadUInt32();
3536
NotifyLogIds = new Guid[aLen];
3637
for (int i = 0; i < aLen; i++)

0 commit comments

Comments
 (0)