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.

Refactor substrate-test-runtime #9782

@bkchr

Description

@bkchr

The substrate-test-runtime is some special kind of runtime that incorporates some FRAME stuff and some custom logic.
As the name suggests, it is used for testing. The idea here being to rewrite the test runtime into some "pure" FRAME runtime and to remove other cruft. The runtime contains a lot of stuff for testing sp-api behavior in wasm vs native. Most of this stuff can probably be removed as we will gonna deprecate the native runtime in the future. This means that we can remove this huge cfg-if block. Then the runtime contains the custom extrinsic. These are all the calls this test runtime supports. They are being used all over the code base to test different things. These calls need to rewritten as some FRAME pallet. This means we there should be written one pallet as part of this runtime that exposes the same kind of calls, but through the "FRAME abstraction". All the code that is calling these calls need to be changed to use the FRAME Call enum to achieve the same outcome.

The runtime currently also only supports BABE. There should be two features with-babe and with-aura. Depending on which feature is activated, the respective pallets are activated. As we already enable the disable-logging feature while building the wasm binary, it should be changed in the same way to build with once with BABE and once with AURA.

The general idea of this whole issue is that we can continue using the runtime for our unit tests, but we also can write "proper" unit tests for AURA. In a later future we would also like to have zombienet tests based with AURA so that we can test things like warp syncing etc. Currently we use the kitchensink-runtime for the zombienet tests. Maybe it would be a good idea to move the "special testing" pallet just to the kithchensink-runtime and to make this runtime build able with AURA/BABE. Then remove the testing runtime and only use the kitchenshink-runtime for all tests. However, this may adds more complexity and things that can fail in the unit tests. A simple runtime with just the consensus pallets, the testing pallets and some minimal set of required pallets is probably easier to maintain and to use.

Metadata

Metadata

Labels

I5-testsTests need fixing, improving or augmenting.I7-refactorCode needs refactoring.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions