Open autodidaddict opened 5 years ago
On this line .. is there a way to just leave the raw binary sitting in the section and not raise an exception? Then my code can just go through the custom section map later, extract the binary, and do what I need with it.
Yeah this is something we haven't implemented yet. I'll look into implementing this weekend -- could you provide some description of how non-name custom sections are typically parsed by other VMs? Or a link to relevant information would be helpful as well.
On Thu, May 2, 2019, 8:48 AM Kevin Hoffman notifications@github.com wrote:
On this line https://github.com/ElixiumNetwork/AlchemyVM/blob/7a313825ed50720256dda6e61e83356621357963/lib/decoding/custom_section_parser.ex#L20 .. is there a way to just leave the raw binary sitting in the section and not raise an exception? Then my code can just go through the custom section map later, extract the binary, and do what I need with it.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ElixiumNetwork/AlchemyVM/issues/36#issuecomment-488659017, or mute the thread https://github.com/notifications/unsubscribe-auth/ACG5XYQORCWUDCBPNX6UOVDPTLPIPANCNFSM4HJ6AEIA .
According to the spec, the custom sections are designed for debugging or third party use. As such, interpreters typically ignore them (like Rust's wasmer
and Firefox and Chrome... all ignore the custom sections). Libraries that allow for reading of module data, like yours and the one Parity
has for Rust, should expose access to the custom section "as an uninterpreted sequence of bytes for custom use".
So, with parity-wasm
, I can iterate through the custom sections and get a byte array/blob for each one - the main parser doesn't care what the bytes are, it just makes them available to me.
Tangentially related - @alexdovzhanyn are there any benchmarks in terms of execution time and instantiation/load time that I can see? I want to compare them against wasmer
So, with
parity-wasm
, I can iterate through the custom sections and get a byte array/blob for each one - the main parser doesn't care what the bytes are, it just makes them available to me.
This makes sense -- we can implement this way since its considered to be the standard approach.
Tangentially related - @alexdovzhanyn are there any benchmarks in terms of execution time and instantiation/load time that I can see? I want to compare them against
wasmer
We don't have any benchmarks at the moment but I expect that in single threaded execution (i.e. one vm instance at a time) Alchemy will be less performant than something written in a lower level language like Rust or C. The goal with alchemy is to be performant when running multiple VMs in parallel. That being said, it should be quite usable for things that don't require a very high throughput.
Cool thanks for the info!
Did this ever get implemented? I'm curious if this project is still being maintained @alexdovzhanyn
I've got a custom section in my wasm module that has a name
jwt
. When I attempt to load this module, I get an error. It appears from the code that your parser will throw an exception upon encountering any custom section other thanname
. This, I believe, breaks the spec rules allowing anyone to embed any custom section with any name. Can we just get the section added to the module as a binary blob if you don't know how to parse it? Then I can turn it into a string and do the decoding myself later.This is the error I get: