Skip to content

Default size_hint() trait for contract types #1329

@jeffgrunewald

Description

@jeffgrunewald

Sometimes, contract methods will need to pre-allocate funds to cover rent exemption for a given type and there's not currently a method to return the expect size of a given type without first having an instance of that type.

This feature is to extend the account type trait to include a size_hint() method that returns the byte size for the given type, assuming a default value for types that include variable-size fields (32 bytes for a list of pubkeys indicating a vec of a single pubkey as the default).

This should be a static method attached to the trait and for types that are statically sized their existing size() method can just call the size_hint() method.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions