-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix Safe Assert #2784
Fix Safe Assert #2784
Conversation
@erikzhang @roman-khimov now Log (Safe Assert) will FAULT, but at least the exception will be saved. What do you think? |
|
||
if (!CurrentContext.GetState<ExecutionContextState>().CallFlags.HasFlag(CallFlags.AllowNotify)) | ||
{ | ||
OnFault(new Exception(message)); |
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.
Why are we faulting on log if AllowNotify is enabled? Why would we assume that a call to Log must be a fault?
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.
Because Log require Notify rights so if we don't have it, it will fault in the previous version, now the same but at least we have the message captured. That's my favorite version for solve the issue
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.
Why are we faulting on log if AllowNotify is enabled? Why would we assume that a call to Log must be a fault?
If NOT
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.
OK, I see the logic. Since this PR changes requiredCallFlags
to None, RuntimeLog will only go down the fault path in cases where we would have thrown in ValidateCallFlags
previously.
Why are we calling OnFault instead of throwing like ValidateCallFlags
does?
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.
Because with OnFault we can set the Log error message, and we don't lose the assert message
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.
NeoExpress, NeoDebugger and NeoTest all provide mechanisms to surface log messages. We can't automatically treat log calls as faults w/o breaking this.
Only faults in cases that would have faulted previously
@roman-khimov @erikzhang Could you review this? I think throw error msg when fault is OK, at least we can make some logs. |
I'd rather go with neo-project/neo-vm#491, as noted in #2782. |
Closed by neo-project/neo-devpack-dotnet#758 |
Alternative to #2783 neo-project/neo-devpack-dotnet#758
Close #2782