Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

How to implement an in memory store for extrinsic scope variable? #1949

@xlc

Description

@xlc

I need a place to store some values that are global accessible by multiple modules. The lifetime of this store does not need to exceeds the execution of extrinsic. i.e. it get cleared between each time an extrinsic is applied.

Basically I want to setup a Map<Vec<u8>, Vec<u8>> before this line and make it accessible during the extrinsic execution. May be some helper methods/macros to ensure type safety.

let r = f.dispatch(s.into());

I can't find a way to implement it without some kind of global variables. I am not sure if lazy_static is allowed in the runtime. The only other solution I can think of is add new method in Externalities

Related comments:
#1924 (comment)
#1815 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions