When we build a loader, the Rust SDK only needs the compiled script or predicate binary. Because of this we’re forced to peek inside the binary header to locate the data/configurables section. Since the Sway compiler’s header format isn’t fixed, our code today includes fragile hacks that guess the compiler version and, from there, infer the metadata layout.
After chatting with @green.baneling, it became clear that there’s no realistic scenario where someone has only the binary but not its ABI file and still needs a loader. So, to make the behavior more robust, we should require the ABI file when creating loaders.
When we build a loader, the Rust SDK only needs the compiled script or predicate binary. Because of this we’re forced to peek inside the binary header to locate the data/configurables section. Since the Sway compiler’s header format isn’t fixed, our code today includes fragile hacks that guess the compiler version and, from there, infer the metadata layout.
After chatting with @green.baneling, it became clear that there’s no realistic scenario where someone has only the binary but not its ABI file and still needs a loader. So, to make the behavior more robust, we should require the ABI file when creating loaders.