contract: tune isolation logic
Wrap when we have outer exception handler and the method is not safe. Otherwise we wrap almost always, since non-readonly methods are very common.
This commit is contained in:
parent
ee82e297fe
commit
3509523baf
1 changed files with 2 additions and 2 deletions
|
@ -118,8 +118,8 @@ func callExFromNative(ic *interop.Context, caller util.Uint160, cs *state.Contra
|
||||||
ic.Invocations[cs.Hash]++
|
ic.Invocations[cs.Hash]++
|
||||||
f = ic.VM.Context().GetCallFlags() & f
|
f = ic.VM.Context().GetCallFlags() & f
|
||||||
|
|
||||||
wrapped := f&(callflag.All^callflag.ReadOnly) != 0 || // If the method is safe, then it's read-only and doesn't perform storage changes or emit notifications.
|
wrapped := ic.VM.Context().HasTryBlock() && // If the method is not wrapped into try-catch block, then changes should be discarded anyway if exception occurs.
|
||||||
ic.VM.Context().HasTryBlock() // If the method is not wrapped into try-catch block, then changes should be discarded anyway if exception occurs.
|
f&(callflag.All^callflag.ReadOnly) != 0 // If the method is safe, then it's read-only and doesn't perform storage changes or emit notifications.
|
||||||
baseNtfCount := len(ic.Notifications)
|
baseNtfCount := len(ic.Notifications)
|
||||||
baseDAO := ic.DAO
|
baseDAO := ic.DAO
|
||||||
if wrapped {
|
if wrapped {
|
||||||
|
|
Loading…
Reference in a new issue