Refactor CelestiaAddress
to fix From<[u8; 32]>
#469
Labels
Small
Use this label for quick cleanup and maintenance tasks
CelestiaAddress
to fix From<[u8; 32]>
#469
Problem
Current implmentation
CelestiaAddress
:We store raw ASCII string of celestia address "as is", with HRP and without any decoding:
Length of this string is 47 bytes, and even without HRP("celesita") it is 39 bytes.
Which means that
impl From<[u8; 32]> for CelestiaAddress {
required byAddressTrait
cannot be done with current representation.Suggested solution 1
Change internal represenation of celestia address to store only decoded
Vec<u5>
asVec<u8>
. Here's example how it might look like:TBD:
Suggested solution 2
Change
AddressTrait
to replace+ for<'a> TryFrom<&'a [u8], Error = anyhow::Error>
withFromStr
Current usage of this trait essentially using it from string. This way we empathis that AddressTrait can be only 32bytes in "raw" format, or it should be possible to convert it from string.
Another improvement would be to replace
From<[u8; 32]>
toTryFrom<[u8; 32]>
so incorrect conversion would not cause panic.Second suggestion does not contradict first and they both can be implemented
The text was updated successfully, but these errors were encountered: