Skip to content
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

Merged

Conversation

laurci
Copy link
Contributor

@laurci laurci commented Apr 5, 2024

No description provided.

@laurci laurci marked this pull request as draft April 5, 2024 09:31
@laurci laurci marked this pull request as ready for review April 8, 2024 07:12
runtime.AddError(err, runtime.FunctionName())

returnCode := context.resolveReturnCodeFromError(err)
returnMessage := context.resolveReturnMessageFromError(err)

if callType == vm.AsynchronousCallBack {
Copy link
Contributor

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.

@@ -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 {
Copy link
Contributor

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 ?

}

vmOutput := context.outputState // GetVMOutput updates metering
context.PopSetActiveState()
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@laurci laurci requested a review from sasurobert April 11, 2024 15:32
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"
Copy link
Contributor

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.

Copy link
Contributor

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

@sasurobert sasurobert merged commit d5b3efd into refactor-asyncComposability Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants