Skip to content

split template into 2 opinionated runtimes: AccountId20 + AccountId32 #1056

Open
@bernardoaraujor

Description

@bernardoaraujor

Motivation

Ever since the merge of #1019 , we have the option of using AccountId20 as the native account type. The PR applied this new type into frontier-template-runtime, overwriting all the previous configurations for AccountId32.

Suggested Solution

As discussed in #1053, ideally there should be two template runtimes, so that newcomers can become familiar with the fact that both approaches are viable options (and how to use them correctly).

I thought this was going to be pretty quick to implement, so I started writing a solution.

I soon learned that the implementation wasn't going to be as straightforward as I initially thought. So I'm writing this issue to summarize my findings, so that I (or someone else) can try this again with more available time in the future.

The goal is making the template directory look like:

template
├── ...
└── runtime
    ├── accountid20
    │   ├── Cargo.toml
    │   ├── build.rs
    │   └── src
    │       └── lib.rs
    ├── accountid32
    │   ├── Cargo.toml
    │   ├── build.rs
    │   └── src
    │       └── lib.rs
    └── common
        ├── Cargo.toml
        └── src
            ├── lib.rs
            └── precompiles.rs

Here's a list of crates that would also need to be refactored (additionally to template/runtime):

  • fc-mapping-sync: references to frontier_template_runtime::RuntimeApi inside unit tests.
  • fc-cli: references to frontier_template_runtime::RuntimeApi inside unit tests.
  • template/node: multiple modules with references to frontier_template_runtime::*.

These can be solved with something like:

#[cfg(feature = "accountid20")]
use frontier_template_runtime_accountid20 as frontier_template_runtime;

#[cfg(feature = "accountid32")]
use frontier_template_runtime_accountid32 as frontier_template_runtime;

...

These documentation files should also be modified accordingly:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions