Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

NeoVM Runtime Versioning #475

Closed
wants to merge 4 commits into from
Closed

NeoVM Runtime Versioning #475

wants to merge 4 commits into from

Conversation

erikzhang
Copy link
Member

Copy link
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

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

For allow versions inside the VM we need to change how the opcodes will be executed in different versions, by a jump table or similar, this pr doesn't close the issue https:/neo-project/neo-vm/issues/142

@erikzhang
Copy link
Member Author

if (RuntimeVersion == xxx)
{
}
else
{
}

Doesn't it work?

@shargon
Copy link
Member

shargon commented May 25, 2022

It will work, but you are adding an extra comparation for each opcode instead of configure the environment and use it. It will be slower.

@erikzhang
Copy link
Member Author

Then we need to create a Runtime class and move the entire runtime environment into it. I don't think it's necessary to do this right now.

@shargon
Copy link
Member

shargon commented May 26, 2022

We can start with this, but in my mind I was thinking in something like this

 protected ExecutionEngine(ReferenceCounter referenceCounter, ExecutionEngineLimits limits, RuntimeVersion version = RuntimeVersion.Latest)
        {
              if (RuntimeVersion == Latest)
              {
ExecuteInstruction = LastestExecuteInstruction;
              }
              else
              {
ExecuteInstruction = PreviousVersionOfExecuteInstruction;
              }
}

shargon
shargon previously approved these changes May 26, 2022
# Conflicts:
# src/Neo.VM/RuntimeVersion.cs
@erikzhang
Copy link
Member Author

Changes to the instruction set also need to be considered. In this way, the verification of Script is different. Needs to be reconsidered.

@erikzhang erikzhang closed this May 26, 2022
@erikzhang erikzhang deleted the runtime-version branch May 26, 2022 11:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vm: Versioning the VM
2 participants