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

Mode to disable backward jumps on NeoVM 3 #174

Closed

Conversation

igormcoelho
Copy link
Contributor

@igormcoelho igormcoelho commented Jun 16, 2019

closes #151

First of all, thanks for all the things you guys made me learn in the past months, it has been an amazing opportunity for me, to improve coding skills, testing skills, and learn more about cryptography and all kinds of stuff around a blockchain ecosystem like Neo.

After much thoughts, and many discussions with many different people, I think that we need an execution mode on NeoVM that would allow us to disable backward jumps. This disables loops on practice, although not generating problems to ifs. This also disables recursive calls.

Just a brief back in history, Bitcoin has become famous, and one of its explicit flags has been the capability of not having Turing-complete compution in its verification engine. It also doesn't have this sort of computation on Application Engine either (since it doesn't have one 😂), so I think Neo could benefit of also not having it on Verification trigger, while maintaining a full powerful Turing-complete application engine.

Verification and Application are very different things. Verification needs to be denied as quickly as possible, when necessary, without consuming too much resources from the network, while Application can be much more expensive, since it is paid in advance in Gas. If someone wants to have an infinite loop on Application, it doesn't matter, it will take time, and this time will be well paid on System Fees, no worry (and it will FAULT and be discarded in the future). But we cannot afford having this type of computation on the Verification engine, where nothing is actually paid (yet) to the network.

Disabling Turing-completeness can be done on several manners, one of each is simply removing backward loops, like done here. There even more severe strategies, like removing all sorts of computation from here (thus basically removing the Verification Trigger away). This is an attempt to keep the verification trigger, which is useful for several stuff, while keeping it well contained and fast to process.

Hope having a heated discussion here, but thanks in advance anyway ;)

@codecov-io
Copy link

codecov-io commented Jun 16, 2019

Codecov Report

Merging #174 into master will increase coverage by 0.85%.
The diff coverage is 90.9%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #174      +/-   ##
==========================================
+ Coverage   62.53%   63.39%   +0.85%     
==========================================
  Files          16       16              
  Lines        1412     1426      +14     
==========================================
+ Hits          883      904      +21     
+ Misses        529      522       -7
Impacted Files Coverage Δ
src/neo-vm/Debugger.cs 93.65% <100%> (ø) ⬆️
src/neo-vm/ExecutionEngine.cs 59.04% <88.23%> (+1.76%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b4382aa...a4655d8. Read the comment docs.

@shargon
Copy link
Member

shargon commented Jun 16, 2019

This should be on ApplicationEngine, but i prefer to pay for verification.
You will be able to use your charity wallet with this changes ?

@igormcoelho
Copy link
Contributor Author

igormcoelho commented Jun 16, 2019

That's true @shargon , ApplicationEngine is better... because here is a general computing engine, so the concept of "cost" is not present anywhere. It's more related to Neo blockchain itself.
Regarding the applications, including charity example, all useful loops can be unrolled at some point, automatically by the compiler if necessary, so these changes do not affect any existing practical stuff. Yet, they make everything so much simpler.

@igormcoelho
Copy link
Contributor Author

@shargon just changed operation to PreExecute, it's much simpler and clear. I'll port it to ApplicationEngine.

@igormcoelho
Copy link
Contributor Author

Closing this in favor of neo-project/neo#837

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.

Mode to Disable Jumps and Turing-Completeness
3 participants