Conversation
There was a problem hiding this comment.
You need these or else you have to initialize each one, because they will be null or no instance when you do new(); ISerializable.Serialize or ISerializable.Deserialize will get exception object not set to an instance of an object. Also on some of them Size won't work because of that reason.
Are always initialized, isn't it? |
|
No, you would have to do something like this: var obj = new AClass()
{
AProperty = new(),
} |
| { | ||
| // It should be safe because it filled from a transaction's notifications. | ||
| uint aLen = reader.ReadUInt32(); | ||
| var aLen = reader.ReadUInt32(); |
There was a problem hiding this comment.
No, it's just using dynamic type variable now; instead of being bound to a type specific variable.
It's currently done, otherwise you will have a default unused value, that will be changed in |
|
Yes, But if someone was do Lets have @superboyiii test 1st. before merge. |
Good point, but it call |
| public Guid[] StackItemIds { get; protected set; } = []; | ||
| public UInt160 ScriptHash { get; protected set; } | ||
| public string EventName { get; protected set; } | ||
| public Guid[] StackItemIds { get; protected set; } |
There was a problem hiding this comment.
We should make this required as well.
| public class TransactionEngineLogState : ISerializable, IEquatable<TransactionEngineLogState> | ||
| { | ||
| public Guid[] LogIds { get; private set; } = Array.Empty<Guid>(); | ||
| public Guid[] LogIds { get; private set; } |
There was a problem hiding this comment.
We should make this required as well.
There was a problem hiding this comment.
Then set can't be private
There was a problem hiding this comment.
They have Create method and that should be used. Plus you still run into the same problem with null. So you need to add or remove changes on these files. I marked in review.
| public class TransactionLogState : ISerializable, IEquatable<TransactionLogState> | ||
| { | ||
| public Guid[] NotifyLogIds { get; private set; } = Array.Empty<Guid>(); | ||
| public Guid[] NotifyLogIds { get; private set; } |
There was a problem hiding this comment.
We should make this required as well.
| public VMState VmState { get; private set; } | ||
| public string Exception { get; private set; } | ||
| public long GasConsumed { get; private set; } | ||
| public Guid[] StackItemIds { get; private set; } |
There was a problem hiding this comment.
We should make this required as well.
| public UInt160 ScriptHash { get; private set; } = new(); | ||
| public string Message { get; private set; } = string.Empty; | ||
| public UInt160 ScriptHash { get; private set; } | ||
| public string Message { get; private set; } |
There was a problem hiding this comment.
We should make this required as well.
| public UInt256 TransactionHash { get; private set; } = new(); | ||
| public TriggerType Trigger { get; private set; } = TriggerType.All; | ||
| public UInt256 TransactionHash { get; private set; } | ||
| public TriggerType Trigger { get; private set; } |
There was a problem hiding this comment.
We should make this required as well.
| public class BlockLogState : ISerializable, IEquatable<BlockLogState> | ||
| { | ||
| public Guid[] NotifyLogIds { get; private set; } = []; | ||
| public Guid[] NotifyLogIds { get; private set; } |
There was a problem hiding this comment.
We should make this required as well.
There was a problem hiding this comment.
like this? Kinda ugly:
public virtual void Deserialize(ref MemoryReader reader)
{
// It should be safe because it filled from a block's notifications.
var aLen = reader.ReadUInt32();
var notifyLogIds = new Guid[aLen];
for (var i = 0; i < aLen; i++)
notifyLogIds[i] = new Guid(reader.ReadVarMemory().Span);
// Create a new instance of BlockLogState using the Create factory method
var blockLogState = Create(notifyLogIds);
// Assign the created instance to the current object
NotifyLogIds = blockLogState.NotifyLogIds;
}|
Repository moved to neo, please re-open there |
Related to https://github.com/neo-project/neo-modules/pull/898/files#r1584389953