doc: add infrastructure diagram
encode: fix mistake on encoded data size