Differences between serialization libs?
stephenhuh opened this issue · comments
Hey there!
Thank you for everything you're doing for the ADA community!
I've noticed that there are some differences between the imported cardano-serialization-library
and the one inside the custom_modules
folder. Do you mind explaining why there were local modifications to the lib? Notably, the set_plutus_data
function on TransactionBuilder
and some of the LanguageViews
functionality are in this repo, but not in emurgos.
Hey thank you!
Sure, I basically advanced the TransactionBuilder to make it easier to work with datums, redeemers and scripts to also calculate the fees correctly. Some of these changes I made were already merged into the official serialization-lib, but it takes some time until they approved and some of the changes I made, I did in my own style which may not apply to the general library. With my own library I could work in my own pace, but I try to get these changes into the official library, since they make things a lot easier.
Thanks for the response! Does that mean that we need these changes in order to submit tx's with set_plutus_data
and have SCs work? I did notice that set_plutus_data
is not available at all on the TransactionBuilder
, only available on TransactionWitnessSet
It depends on what you wanna do. Just serializing a contract tx works anyway. The TransactionBuilder just makes it way more convenient to build transactions. You could also build the whole tx raw and calculate fees on your own etc.
However it's not perfect yet. Calculating the script costs for example I can't determine at this point. Some more work needs to go into this.
hey @alessandrokonrad im curious if you've ever run into an issue with txBuilder.add_change_if_needed
after using the custom set_redeemers
function.
i'm working off a fork of your custom_modules because some of the functions you added do make sense to me - but after I call txBuilder.set_redeemers
, txBuilder.add_change_if_needed
complains and throws a pretty unhelpful error:
index.js:1 RuntimeError: unreachable
at fa76e509f6f8db1dca71.module.wasm:0xb3eec
at fa76e509f6f8db1dca71.module.wasm:0xd49b6
at fa76e509f6f8db1dca71.module.wasm:0xe592c
at fa76e509f6f8db1dca71.module.wasm:0xe4585
at fa76e509f6f8db1dca71.module.wasm:0xe5990
at fa76e509f6f8db1dca71.module.wasm:0xe33c6
at fa76e509f6f8db1dca71.module.wasm:0x3ebee
at fa76e509f6f8db1dca71.module.wasm:0x98f6f
at fa76e509f6f8db1dca71.module.wasm:0xa653e
at fa76e509f6f8db1dca71.module.wasm:0xe471c
at fa76e509f6f8db1dca71.module.wasm:0x106cb
at fa76e509f6f8db1dca71.module.wasm:0xd0353
at TransactionBuilder.add_change_if_needed (VM210 0.chunk.js:13257)
at cancel2 (Activity.js:131)
at async onClick (Activity.js:800)
have you ever faced this issue? i dont think the way i'm setting my redeemers is much different than the way you have and i have pinpointed my issue to some mutated state within txBuilder
from the set_redeemers
call.
creating a new issue for organization purposes!
What exactly is LanguageViews used for ? and how do we use it ?