Avoid double memory allocation when encoding/decoding state witness #11064
Labels
A-stateless-validation
Area: stateless validation
C-good-first-issue
Category: issues that are self-contained and easy for newcomers to work on.
Currently we allocate memory for borsh bytes before compressing state witness.
This can be avoided with streaming, see this comment
The implementation would look something like this:
The only missing bit is counting bytes in borsh representation of state witness. This can be implemented with wrapper on top of
Write
to count bytes and then write it downstream. Maybebytes
crate already has something like this.Decoding is similar, see this comment.
The text was updated successfully, but these errors were encountered: