Moves to a newer (unreleased) version of fuels-rs that allows Bytes to be returned. Note this doesn't yet allow Bytes to be passed in as inputs, so as a temporary workaround there's a Vec<u8> version used. Also note that the sway-lib String type doesn't have strong support in fuels-rs -- fuels-rs doesn't allow heap types like Bytes to be composed within other types, which is exactly what the String type is. So instead of using the String type, we just use the Bytes type instead for the interface
Storage types are not yet composable in Sway. A StorageBytes type exists, which would ordinarily be a good candidate for storing the storage locations, but because we need to use a StorageMapVec such that multiple validators can have multiple storage locations stored, we can't compose these two. As a workaround, storage locations are stored as a StorableString, which uses a 128 character str (i.e. str[128]) under the hood, which is composable with storage. When https://github.com/FuelLabs/sway/pull/4297 gets in, we should consider moving away from StorableString. This is tracked in https://github.com/hyperlane-xyz/fuel-contracts/issues/66
There's another workaround to account for fuels-rs not allowing heap types to compose with one another -- for example, you can't have Vec<Bytes> returned yet in fuels-rs. So instead a function get_announced_storage_location is provided to allow the looking up of a storage location for a single validator at a time that returns Bytes. It lets you specify the index of the storage location you want, or to default to the latest one. Unfortunately, we also can't have this function return Option<Bytes> because this isn't yet supported by fuels-rs (as it composes a heap type with another type...)
This borrows the bytes_extended changes from #16 to get access to EvmAddress
This also adds signature_to_compact, which helps convert from the ethers-rs Signature type to the EIP 2098 compatible signature representation that Fuel uses
Vec<u8>
version used. Also note that the sway-lib String type doesn't have strong support in fuels-rs -- fuels-rs doesn't allow heap types likeBytes
to be composed within other types, which is exactly what the String type is. So instead of using the String type, we just use the Bytes type instead for the interfaceStorageBytes
type exists, which would ordinarily be a good candidate for storing the storage locations, but because we need to use aStorageMapVec
such that multiple validators can have multiple storage locations stored, we can't compose these two. As a workaround, storage locations are stored as aStorableString
, which uses a 128 character str (i.e.str[128]
) under the hood, which is composable with storage. When https://github.com/FuelLabs/sway/pull/4297 gets in, we should consider moving away from StorableString. This is tracked in https://github.com/hyperlane-xyz/fuel-contracts/issues/66Vec<Bytes>
returned yet in fuels-rs. So instead a functionget_announced_storage_location
is provided to allow the looking up of a storage location for a single validator at a time that returnsBytes
. It lets you specify the index of the storage location you want, or to default to the latest one. Unfortunately, we also can't have this function returnOption<Bytes>
because this isn't yet supported by fuels-rs (as it composes a heap type with another type...)signature_to_compact
, which helps convert from the ethers-rs Signature type to the EIP 2098 compatible signature representation that Fuel uses