Fix silent truncation behavior of fixed_string
fixed_string has a weird behavior where it silently truncates when you construct or assign it with a string longer than it's capable of holding. So, say a cut & paste goes wrong:
fixed_string<16> my_account_name = "wallet.hive.blog/my-account-name/transfers"; idump((my_account_name)); // prints: `wallet.hive.blog`
implementation: https://gitlab.syncad.com/hive/hive/-/blob/9cd82767daa4f3494a52d1b95433e0ff68fc14d4/libraries/protocol/include/hive/protocol/fixed_string.hpp#L79-82 possibly originated with fc's fixed_string implementation, though they are now separate. https://gitlab.syncad.com/hive/hive/-/blob/9cd82767daa4f3494a52d1b95433e0ff68fc14d4/libraries/fc/include/fc/fixed_string.hpp#L59-65
account_name_type is a 16-byte
fixed_string, and it's used in lots of operations and in the API, and that sets us up for problems. When we call the condenser_api's
get_accounts(["wallet.hive.blog/my-account-name/transfers"]), we don't get an error that the account doesn't exist; it returns the data for the account named wallet.hive.blog (which someone created, because of course they did). When we use the cli_wallet's
transfer("source_account", "wallet.hive.blog/my-account-name/transfers", "100.000 HIVE", "", true), we don't get an account doesn't exist error, it happily sends the HIVE to the wallet.hive.blog account.
It looks like the author went out of their way to make it behave this way (truncating instead of, say, throwing). Is there anything that depends on this behavior?