capsule
capsule copied to clipboard
VM Internal Error: MemOutOfBound with Capsule 0.9.0
Executing these tests shows that Capsule 0.9.0
with rustc 1.63.0
suffer from:
-
VM Internal Error: MemOutOfBound
when executing any non trivial script. -
Transaction timeout
when executingalways
success script.
Note: creating and executing tests for these scripts will not manifest these issues without a full CKB VM environment.
The same scripts compiled with Capsule 0.7.3
don't have these issues.
Some research on these issues has been done already by Travis Lee Richardson and Jordan Mack.
Keep up the Great work :muscle: Phroi
the tx built by capsule 0.9.0 should be running with ckb2021 edition ckb-vm, which is incompatible with old version ckb-vm, I think it will pass if you set the value of hash_type
to type
( https://github.com/phroi/capsule-tests/blob/master/lumos-tests/index.js#L124 ) , you may check out rfc https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0032-ckb-vm-version-selection/0032-ckb-vm-version-selection.md for more information.
Is there any way this error could be recognized so a more friendly error message can be provided?
@TravisLeeRichardson @jordanmack and I spent at least three days each thinking about this: we are smart and well informed on Nervos L1, but we couldn't figured it out.
What would do a new developer who is trying out Nervos L1 for the first time? He probably just give up and go away from Nervos.
@quake thanks for helping us, but please improve the error message :pray:
@jordanmack @phroi we'll figure out a way to display more friendly error messages, but before this issue is fixed, I'd also like to know where you saw the document of setting hash_type to data
? Since we recommend using type
(upgradable script) in ckb, I'd like to fix the documentation in this area first.
Great news on more friendly error messages!! :partying_face:
As for me I'm following the Developer Training Course and noting errors as I go. You may want to check out if the current recommended guidelines are followed in the course!
To be honest I believe there are good uses for both:
-
type
for scripts that are intended to be upgradable -
data(1)
for scripts that are immutable by design
data(1)
for scripts that are immutable by design
I see, in your example the always_success
script using data
is a reasonable scenario, let's see if there is a way to figure out how to display a better message of incompatible issue to user.
if you want run a script compiled by capsule v0.8.0+ on vm0 (hash_type: data), you may need to run the ckb-binary-patcher with the compiled binary, which has been removed in this pr, or you may run it on vm1 (hash_type: data1 or type) directly without this patcher.
@jordanmack could you update the https://nervos.gitbook.io/developer-training-course accordingly? I think change the lumos code from data
to data1
is the simplest fix for the time being.
I already tried changing from data
to data1
, but the Lumos version used in the course is too old.. I guess, we'll figure something out, thanks for the help!! :pray:
@quake now basically the issue is displaying a proper error message when CKB VM 2021 binary is run in a old CKB VM, a very common mistake.
Feel free to move and rename this issue to the appropriate repository!
@jordanmack could you update the https://nervos.gitbook.io/developer-training-course accordingly? I think change the lumos code from
data
todata1
is the simplest fix for the time being.
Yes, I am updating all references and will add a new section to explain data, type, and data1.
the issue is displaying a proper error message when CKB VM 2021 binary is run in a old CKB VM, a very common mistake.
Sometimes a binary will run fine in the old CKB-VM, and sometimes it fails with a strange error. This also adds to the confusion.