Skip to content

Commit

Permalink
Review States
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon committed Jan 10, 2024
1 parent 4681355 commit 77eee7b
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/ApplicationLogs/Store/States/BlockLogState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public static BlockLogState Create(Guid[] notifyLogIds) =>

public virtual void Deserialize(ref MemoryReader reader)
{
// It should be safe because it filled from a block's notifications.
uint aLen = reader.ReadUInt32();
NotifyLogIds = new Guid[aLen];
for (int i = 0; i < aLen; i++)
Expand Down
4 changes: 2 additions & 2 deletions src/ApplicationLogs/Store/States/ContractLogState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public override void Serialize(BinaryWriter writer)
#region IEquatable

public bool Equals(ContractLogState other) =>
EventName == other.EventName && StackItemIds.SequenceEqual(other.StackItemIds) &&
TransactionHash == other.TransactionHash && Trigger == other.Trigger;
Trigger == other.Trigger && EventName == other.EventName &&
TransactionHash == other.TransactionHash && StackItemIds.SequenceEqual(other.StackItemIds);

public override bool Equals(object obj)
{
Expand Down
1 change: 1 addition & 0 deletions src/ApplicationLogs/Store/States/EngineLogState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public static EngineLogState Create(UInt160 scriptHash, string message) =>
public virtual void Deserialize(ref MemoryReader reader)
{
ScriptHash.Deserialize(ref reader);
// It should be safe because it filled from a transaction's logs.
Message = reader.ReadVarString();
}

Expand Down
1 change: 1 addition & 0 deletions src/ApplicationLogs/Store/States/ExecutionLogState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public void Deserialize(ref MemoryReader reader)
Exception = reader.ReadVarString();
GasConsumed = reader.ReadInt64();

// It should be safe because it filled from a transaction's stack.
uint aLen = reader.ReadUInt32();
StackItemIds = new Guid[aLen];
for (int i = 0; i < aLen; i++)
Expand Down
5 changes: 3 additions & 2 deletions src/ApplicationLogs/Store/States/NotifyLogState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public virtual void Deserialize(ref MemoryReader reader)
ScriptHash.Deserialize(ref reader);
EventName = reader.ReadVarString();

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

public bool Equals(NotifyLogState other) =>
EventName == other.EventName && StackItemIds.SequenceEqual(other.StackItemIds) &&
ScriptHash == other.ScriptHash;
EventName == other.EventName && ScriptHash == other.ScriptHash &&
StackItemIds.SequenceEqual(other.StackItemIds);

public override bool Equals(object obj)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static TransactionEngineLogState Create(Guid[] logIds) =>

public virtual void Deserialize(ref MemoryReader reader)
{
// It should be safe because it filled from a transaction's logs.
uint aLen = reader.ReadUInt32();
LogIds = new Guid[aLen];
for (int i = 0; i < aLen; i++)
Expand Down
1 change: 1 addition & 0 deletions src/ApplicationLogs/Store/States/TransactionLogState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public static TransactionLogState Create(Guid[] notifyLogIds) =>

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

0 comments on commit 77eee7b

Please sign in to comment.