Abstract

Researching request about `no-std` client we found that usage of dynamically sized types such as Strings in our data model will need to work with different allocators on embedded devices or inside WASM runtimes.

After looking on our code we listed the following items as pros of Strings replacement with fixed-size structures:

  • Out of the Box `no-std` support
  • Usage of stack instead of the heap
  • Prevention of memory losses on malicious behavior

As a proposal we can stick to fixed sized arrays of `ASCII` characters for Domain's, Account's and other entities names. 256 or 512 characters should be enough for the start.

  • No labels

5 Comments

  1. "Prevention of memory losses on malicious behavior" explanation:

    ```

    We do not have length restrictions and someone with permissions to add new domain will spawn domains with names 11111111111111111111....1111 it will consume memory even if we will reject such transactions on validation or any other phase

    ```

  2. I think in the first iteration we can have only WASM compatability, it has its own strings

  3. Maybe we should add a custom `FixedSizeString` abstraction over the arrays then?

    1. Sure, as also was proposed by Vladislav Markushinwe will use some types for that. But we should understand requirements (capacity, symbols) first.