manuelmauro/algonaut

`estimate_size` crashes on WASM

ivnsch opened this issue · 2 comments

Caused by using Account / ring when signing the transaction. See #59

Workaround: Instead of signing the transaction, hardcode the additional bytes, like in the Go SDK:

self.to_msg_pack()?.len() as u64 + 75;

The purpose of this function is not entirely clear though - what when it's a multi sig or logic sig?

Could we possibly attach an additional method to a transaction that's something like "signature byte length"? It'd be internal to the library in case we decide to change it.

Essentially like the NumOfAdditionalBytesAfterSigning constant in the Go SDK? But what about multi sig and logic sig? Transaction doesn't have any information yet about how it will be signed. And multi sig and logic sig have variable sizes (for multi sig it depends on how many accounts are participating, and logic sig on the program's size), so we wouldn't be able to estimate those before having the actual signature.