-
Notifications
You must be signed in to change notification settings - Fork 81
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
can not run smart contract script, the vm throw FAULT message. #96
Comments
@shelmesky Thanks for your bug report, The old neo-go VM have some issues on new API's I implemented. I'm currently rewriting the VM to be compatible with the new APIS that are in neo-storm. This will not take longer then a week. I will keep you posted on this issue when its completed. The improved VM will also house in the neo-storm repository. Thanks for your understanding. |
Thank you @anthdm . I have check the neo-storm repository, but i can not find a virtual machine in there. Can you tell me where to find a runnable virtual machine and written by golang? thanks a lot! |
@shelmesky I'm currently working on it :) should not take to long. 2 weeks max. |
@anthdm Is this completed? |
@hal0x2328 nope, I test that yesterday |
Reproducible on current master:
|
I think the problem actually is in the codegen, it can be simplified to this one
It tries to get the stack item with index number 2 with |
Or it's not an issue on the compiler side at all, because it can be reduced even further to: package tokensale
func Main(operation int) interface{} {
return true
} And in all these examples |
Current VM implementation doesn't return errors for many operations, so the only way to handle it here is to check for NULL. Refs. #96.
Fixes one more instruction being ran when VM FAULTs: NEO-GO-VM > run NEO-GO-VM > error encountered at instruction 6 (ROLL) NEO-GO-VM > runtime error: invalid memory address or nil pointer dereference FAULT NEO-GO-VM > error encountered at instruction 7 (SETITEM) NEO-GO-VM > interface conversion: interface {} is []vm.StackItem, not []uint8 Refs. #96.
This fixes two minor things observed in #96: running VM twice, which leads to instruction execution attempt for VM in FAULT state panicing with nil dereference (it's better to show some error message) Before this patchset: NEO-GO-VM > run NEO-GO-VM > error encountered at instruction 6 (ROLL) NEO-GO-VM > runtime error: invalid memory address or nil pointer dereference FAULT NEO-GO-VM > error encountered at instruction 7 (SETITEM) NEO-GO-VM > interface conversion: interface {} is []vm.StackItem, not []uint8 After this patchset: NEO-GO-VM > run NEO-GO-VM > error encountered at instruction 6 (ROLL) NEO-GO-VM > bad index FAULT
First i start local neo node by run this command: make run, then i try to run smart contract script token_sale.go:
NEO-GO-VM > loadgo token_sale.go
READY: loaded 2996 instructions
NEO-GO-VM > run
NEO-GO-VM > error encountered at instruction 9 (Oroll)
NEO-GO-VM > runtime error: invalid memory address or nil pointer dereference
FAULT
NEO-GO-VM > error encountered at instruction 10 (Osetitem)
NEO-GO-VM > interface conversion: interface {} is []vm.StackItem, not []uint8
FAULT
NEO-GO-VM 10 >
The text was updated successfully, but these errors were encountered: