Params Spec 80 column md. (#6561)
* upgrade params spec to use 80 column convention for better reading * Fix Typo.
This commit is contained in:
parent
1b4fc78b4f
commit
bcaf17c33c
|
@ -4,7 +4,11 @@ order: 1
|
|||
|
||||
# Keeper
|
||||
|
||||
In the app initialization stage, `Keeper.Subspace(Paramspace)` is passed to the user modules, and the subspaces are stored in `Keeper.spaces`. Later it can be retrieved with `Keeper.GetSubspace`, so the keepers holding `Keeper` can access to any subspace. For example, Gov module can take `Keeper` as its argument and modify parameter of any subspace when a `ParameterChangeProposal` is accepted.
|
||||
In the app initialization stage, `Keeper.Subspace(Paramspace)` is passed to the
|
||||
user modules, and the subspaces are stored in `Keeper.spaces`. Later it can be
|
||||
retrieved with `Keeper.GetSubspace`, so the keepers holding `Keeper` can access
|
||||
to any subspace. For example, Gov module can take `Keeper` as its argument and
|
||||
modify parameter of any subspace when a `ParameterChangeProposal` is accepted.
|
||||
|
||||
Example:
|
||||
|
||||
|
|
|
@ -4,25 +4,35 @@ order: 2
|
|||
|
||||
# Subspace
|
||||
|
||||
`Subspace` is a prefixed subspace of the parameter store. Each module who use the parameter store will take a `Subspace`, not the `Keeper`, to isolate permission to access.
|
||||
`Subspace` is a prefixed subspace of the parameter store. Each module who use the
|
||||
parameter store will take a `Subspace`, not the `Keeper`, to isolate permission to access.
|
||||
|
||||
## Key
|
||||
|
||||
Parameter keys are human readable alphanumeric strings. A parameter for the key `"ExampleParameter"` is stored under `[]byte("SubspaceName" + "/" + "ExampleParameter")`, where `"SubspaceName"` is the name of the subspace.
|
||||
Parameter keys are human readable alphanumeric strings. A parameter for the key
|
||||
`"ExampleParameter"` is stored under `[]byte("SubspaceName" + "/" + "ExampleParameter")`,
|
||||
where `"SubspaceName"` is the name of the subspace.
|
||||
|
||||
Subkeys are secondary parameter keys those are used along with a primary parameter key. Subkeys can be used for grouping or dynamic parameter key generation during runtime.
|
||||
Subkeys are secondary parameter keys those are used along with a primary parameter key.
|
||||
Subkeys can be used for grouping or dynamic parameter key generation during runtime.
|
||||
|
||||
## KeyTable
|
||||
|
||||
All of the paramter keys that will be used should be registered at the compile time. `KeyTable` is essentially a `map[string]attribute`, where the `string` is a parameter key.
|
||||
All of the parameter keys that will be used should be registered at the compile
|
||||
time. `KeyTable` is essentially a `map[string]attribute`, where the `string` is a parameter key.
|
||||
|
||||
Currently, `attribute` only consists of `reflect.Type`, which indicates the parameter type. It is needed even if the state machine has no error, because the paraeter can be modified externally, for example via the governance.
|
||||
Currently, `attribute` only consists of `reflect.Type`, which indicates the parameter
|
||||
type. It is needed even if the state machine has no error, because the paraeter
|
||||
can be modified externally, for example via the governance.
|
||||
|
||||
Only primary keys have to be registered on the `KeyTable`. Subkeys inherit the attribute of the primary key.
|
||||
Only primary keys have to be registered on the `KeyTable`. Subkeys inherit the
|
||||
attribute of the primary key.
|
||||
|
||||
## ParamSet
|
||||
|
||||
Modules often define a struct of parameters. Instead of calling methods with each of those parameters, when the struct implements `ParamSet`, it can be used with the following methods:
|
||||
Modules often define a struct of parameters. Instead of calling methods with
|
||||
each of those parameters, when the struct implements `ParamSet`, it can be used
|
||||
with the following methods:
|
||||
|
||||
* `KeyTable.RegisterParamSet()`: registers all parameters in the struct
|
||||
* `Subspace.{Get, Set}ParamSet()`: Get to & Set from the struct
|
||||
|
|
Loading…
Reference in New Issue