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

Improve ApplicationEngine #2796

Merged
merged 2 commits into from
Aug 2, 2022
Merged

Improve ApplicationEngine #2796

merged 2 commits into from
Aug 2, 2022

Conversation

erikzhang
Copy link
Member

@erikzhang erikzhang commented Jul 24, 2022

Some improvements from #2756

  1. Added CallingContext to ExecutionContextState. This fixes a potential issue in CalledByEntryCondition.
  2. Improved the return logic of dynamic calls.
  3. Disallowed notifications in entry script.

{
if (context.EvaluationStack.Count == 0)
Push(StackItem.Null);
else if (context.EvaluationStack.Count > 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this duplicating https://github.com/neo-project/neo-vm/blob/f48de7e595ade7c72be6ccd5cce0ab99708f0afd/src/Neo.VM/ExecutionEngine.cs#L427 (rvcount normally is 0 or 1 in this case:

rvcount: method.ReturnType == ContractParameterType.Void ? 0 : 1,
)? Can this ever happen without #2756?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rvcount: method.ReturnType == ContractParameterType.Void ? 0 : 1,

This is in LoadContract(). For a dynamic script, we have no way of knowing in advance how many values it will return. So set rvcount to -1.

https://github.com/neo-project/neo-vm/blob/master/src/Neo.VM/ExecutionEngine.cs#L1580

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I mean, this change probably can be a part of #2756, it doesn't seem to be useful without it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use it as a double check.

roman-khimov added a commit to nspcc-dev/neo-go that referenced this pull request Jul 27, 2022
@superboyiii
Copy link
Member

Compatibility test pass. No storage difference.

@erikzhang
Copy link
Member Author

Merge?

@superboyiii
Copy link
Member

Tested OK. I think we can merge this.

@erikzhang erikzhang merged commit 718fc9f into master Aug 2, 2022
@erikzhang erikzhang deleted the improve-applicationengine branch August 2, 2022 23:23
This was referenced Oct 2, 2023
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.

None yet

4 participants