solana-labs / solana-program-library

A collection of Solana programs maintained by Solana Labs
https://solanalabs.com
Apache License 2.0
3.5k stars 2.04k forks source link

Token program doing custom deserialization #26

Closed garious closed 3 years ago

garious commented 4 years ago

Problem

Hand-written serializers/deserializers: https://github.com/solana-labs/solana-program-library/blob/master/token/src/state.rs#L524

Proposed Solution

Pick a serialization library and switch to it before we publish the Token program to Mainnet Beta. There's plenty of precedent for Serde/Bincode, but I'm open to something more language agnostic.

garious commented 4 years ago

cc: @jackcmay @mvines @CriesofCarrots

jackcmay commented 4 years ago

@garious Haven't found one yet that doesn't suck. What we have today is essentially Rust's C FFI. Bincode in my book is a non-starter, the overhead for even simple ser/de operations was astronomical. I also tried Near's Borsh but that was also very expensive.