-
Notifications
You must be signed in to change notification settings - Fork 27
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
refactor output in case of error for async callback and empty function name check #840
refactor output in case of error for async callback and empty function name check #840
Conversation
vmhost/contexts/output.go
Outdated
runtime.AddError(err, runtime.FunctionName()) | ||
|
||
returnCode := context.resolveReturnCodeFromError(err) | ||
returnMessage := context.resolveReturnMessageFromError(err) | ||
|
||
if callType == vm.AsynchronousCallBack { |
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 needs a feature flag.
vmhost/contexts/output.go
Outdated
@@ -562,22 +562,60 @@ func (context *outputContext) DeployCode(input vmhost.CodeDeployInput) { | |||
context.codeUpdates[string(input.ContractAddress)] = empty | |||
} | |||
|
|||
// createVMOutputInCaseOfErrorOfAsyncCallback appends the deletion of the async context to the output | |||
func (context *outputContext) createVMOutputInCaseOfErrorOfAsyncCallback(err error, returnCode vmcommon.ReturnCode, returnMessage string) *vmcommon.VMOutput { |
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.
can you add a test whether this works as expected ? like checking that vmOutput has the necessary data ?
vmhost/contexts/output.go
Outdated
} | ||
|
||
vmOutput := context.outputState // GetVMOutput updates metering | ||
context.PopSetActiveState() |
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.
I don't think this is needed. potSetActiveState will happen from finishExecuteOnDestContext.
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.
no need to pop here.
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.
I swapped the order. AsyncV3Flag
is now last.
vmhost/flags.go
Outdated
@@ -3,6 +3,8 @@ package vmhost | |||
import "github.com/multiversx/mx-chain-core-go/core" | |||
|
|||
const ( | |||
// AsyncV3Flag defines the flag that activates async v3 | |||
AsyncV3Flag core.EnableEpochFlag = "AsyncV3Flag" |
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 has to be the last.
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.
also I made a cleanup somewhere of these flags, as they are not needed. Next week we need to make a merge from a new branch to feat/asyncV3
No description provided.