Params Spec 80 column md. (#6561)

* upgrade params spec to use 80 column convention for better reading

* Fix Typo.
This commit is contained in:
Jonathan Gimeno 2020-07-01 15:27:13 +02:00 committed by GitHub
parent 1b4fc78b4f
commit bcaf17c33c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 8 deletions

View File

@ -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:

View File

@ -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