Replace the default SVM ABI with SSZ
neysofu opened this issue · comments
For standardization's sake, we'd like to swap out the current ABI with SSZ. See also #493.
The ABI is subject to different concerns compared to svm-codec
. Any chosen ABI implementation must (1) be Fixed-Gas compliant and (2) have the lowest code size possible.
While work can be done to mitigate concerns for (2), Fixed-Gas compliance is extremely hard. The chance of any given Rust SSZ library to compile down to Fixed-Gas compliant WebAssembly (i.e. without any loops) is effectively zero, so we'd have to build our own SSZ library, possibly dealing with some very hard technical challenges to remove any loop logic.
However, by "subsidizing" SSZ encoding and decoding logic using host calls, we can effectively solve both (1) and (2) with excellent performance and low code size footprint. This requires designing an FFI around SSZ decoding and encoding operations, which is perfectly doable.