-
Notifications
You must be signed in to change notification settings - Fork 1k
Nullable #4287
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
base: master
Are you sure you want to change the base?
Nullable #4287
Conversation
|
Most of the modifications only replace the original impl with |
|
Give me some days to review it |
| /// The script of the contract. | ||
| /// </summary> | ||
| public byte[] Script; | ||
| public byte[] Script { get => field ??= []; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here the logic it's different, we set in the script
| public byte[] Script { get => field ??= []; set; } | |
| public byte[] Script { get => field ?? []; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If so, it creates a new array every time.
shargon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a test, we need a value
| ValidBlockEnd = StateRoot.Index + validBlockEndThreshold, | ||
| Sender = Contract.CreateSignatureRedeemScript(verifiers[MyIndex]).ToScriptHash(), | ||
| Data = data, | ||
| Witness = null! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Witness = null! | |
| Witness = Witness.Empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, a value isn't needed here because it will be overwritten after the signature. Therefore, simply keeping null is sufficient. The reason for explicitly assigning null! is due to the requirement of the required keyword. My plan is to convert all these classes to immutable types in the future and only use builders to construct these immutable types. This will simplify the caching mechanism considerably.
| public abstract class Peer : UntypedActor, IWithUnboundedStash | ||
| { | ||
| public IStash Stash { get; set; } | ||
| public IStash Stash { get; set; } = null!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is weird, it's because the interface?
| public IStash Stash { get; set; } = null!; | |
| public IStash? Stash { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The system will automatically assign a value to it after the constructor, so we can assume that it is definitely not null.
Co-authored-by: Shargon <[email protected]>
Description
Enable the nullable option for the Neo project.
Type of change
How Has This Been Tested?
Checklist: