wormhole-foundation / example-liquidity-layer

Apache License 2.0
13 stars 12 forks source link

solana: type annotations needed #94

Closed a5-pickle closed 6 months ago

a5-pickle commented 6 months ago

Overall looks good.

I'm wondering if the saturating_adds here might be better as checked_add? I'm unclear on the expected behaviour if the written_size exceeds usize here, but it seems like under-reporting the number of bytes might be worse than just panicking especially because we essentially never ever expect this to happen for Wormhole.

What do you think?

I agree. Added it here: https://github.com/wormhole-foundation/example-liquidity-layer/pull/94/commits/7cf200c8d8d70c176068b8cb9fb7fcb5bce62b50.

Fun fact... I'm looking into removing this written size method from the trait. This sort of requirement is better suited for the TypePrefixedPayload trait. So we can remove this once I get around to updating the wormhole_io crate.