Skip to content

Conversation

@OBorce
Copy link

@OBorce OBorce commented Dec 5, 2025

  • also use the specific version of parity scale codec with the fix for NanoX

- also use the specific version of parrity scale codec with the fix for
  NanoX
pub struct SecondsCount(#[codec(compact)] pub SecondsCountUIntType);

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum CoinType {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put it in a separate file, e.g. coin_type.rs

Comment on lines +216 to +218
pub fn encode_as_compact(num: u32) -> PscVec<u8> {
parity_scale_codec::Compact::<u32>::encode(&num.into())
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function has a generic name, but it's only defined for u32. Either make it generic over the type or at least give it a specific name, e.g. encode_u32_as_compact (though this will also look quite ugly, so plz try making it generic first).

But are all these functions really needed?

Comment on lines +212 to +214
pub fn decode_all<T: Decode>(mut bytes: &[u8]) -> Option<T> {
T::decode_all(&mut bytes).ok()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to return a Result and let the caller decide what to do with it,

Comment on lines +17 to +19
parity-scale-codec = { git = "https://github.com/paritytech/parity-scale-codec.git", rev = "5021525697edc0661591ebc71392c48d950a10b0", default-features = false, features = [
"derive",
] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Successfully merging this pull request may close these issues.

3 participants