Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: deriving serde::{Serialize, Deserialize} on padding: [u8; >32] breaks #56

Open
OliverNChalk opened this issue Feb 10, 2024 · 1 comment

Comments

@OliverNChalk
Copy link

When generating the interface for a contract that has a padding fields >32 bytes serde will complain with:

the trait bound `[u8; 46]: Deserialize<'_>` is not satisfied the following other types implement trait `Deserialize<'de>`:
  [T; 0]
  [T; 1]
  [T; 2]
  [T; 3]
  [T; 4]
  [T; 5]
  [T; 6]
  [T; 7]

Some options are:

@billythedummy
Copy link
Contributor

Haven't had time to work on this in a while, apologies.

In retrospect, the serde feature was kinda half-baked because from our experience, it's being used in a json context most of the time, which would require additional custom de/serialization logic anyway like de/serializing pubkeys as base58-encoded strings instead of byte arrays, serializing u64s as strings instead of javascript numbers to avoid issues with Number.MAX_SAFE_INTEGER.

I would recommend just turning off the serde feature on the generated crate and handling serde on your own. We might even remove the serde feature in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants