Request for discussion: Optional ELF?

Looking at some of the well-known deployed scripts, I notice that they all are in ELF format. This is really useful for some use cases and to handle the diversity of potential scripts running on CKB.

ELF does not come for free, though, as there is additional metadata that can become a couple hundred bytes. As CKBytes increase in demand on external markets, every byte counts.

What are peoples’ thought (especially @xxuejie) regarding an alternative for certain types of scripts? For example, any script that is not in ELF format the VM will instantiate with a predefined template which fills in certain values prior to evaluation? These alternative scripts could be serialized as tables or dynvecs, I imagine.

I know it’s a pretty weird idea. It might be completely absurd, but I thought I’d put the question to the ckb-vm experts just in case it has any merit.

I actually have thought about this in the very early days. You are definitely correct that ultimately, every single byte counts on chain. However, it’s already possible to strip the majority of metadata from an ELF binary, plus it’s really hard to design a format that provides the needed features, while at the same time provides much space saving than ELF. For any non-trivial scripts running on CKB, the dominant factor will always be code size, not ELF size. And there is always the concern of tooling, it’s already a pretty hard job selling RISC-V in a Solidity-first world, maybe one way a more compact format can be invented and leveraged, but for now, I personally don’t feel the need here.

1 Like

Thanks for the timely response! Those are all great reasons to forego developing an alternative. I am glad, at the very least, that I am not crazy to have followed that line of thinking for a little bit :joy: .