-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run benchmarks [run-benchmarks schemas,messages,stateful-storage]
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# On Chain Message Storage | ||
|
||
## Context and Scope | ||
The proposed feature consists of changes that is going to be one (or more) pallet(s) in runtime of a | ||
Substrate based blockchain, and it will be used in all environments including production. | ||
|
||
## Problem Statement | ||
After introduction of **Proof of Validity** or **PoV** in runtime weights, all pallets should be | ||
re-evaluated and refactored if necessary to minimize the usage of **PoV**. This is to ensure all | ||
important operations are scalable. | ||
This document tries to propose some changes on **Schemas** pallet to optimize the **PoV** size. | ||
|
||
## Goals | ||
- Minimizing Weights including **execution times** and **PoV** size. | ||
|
||
## Proposal | ||
Split Schemas into `SchemaInfo` and `payload` would allow lower **PoV** when verifying schema existence | ||
or compatibility. | ||
|
||
### Main Storage types | ||
- **SchemaInfos** | ||
- _Type_: `StorageMap<SchemaId, SchemaInfo>` | ||
- _Purpose_: Main structure To store related properties of any schema | ||
index | ||
- **SchemaPayloads** | ||
- _Type_: `StorageMap<SchemaId, BoundedVec<u8>>` | ||
- _Purpose_: Stores the payload or model for each schema | ||
|
||
|
||
### On Chain Structure | ||
Following is a proposed data structure for storing schema information on chain. | ||
```rust | ||
pub struct SchemaInfo { | ||
/// The type of model (AvroBinary, Parquet, etc.) | ||
pub model_type: ModelType, | ||
/// The payload location | ||
pub payload_location: PayloadLocation, | ||
/// additional control settings for the schema | ||
pub settings: SchemaSettings, | ||
} | ||
``` |