From bcaf17c33cb0ab32627ede686831ad6a2770902f Mon Sep 17 00:00:00 2001 From: Jonathan Gimeno Date: Wed, 1 Jul 2020 15:27:13 +0200 Subject: [PATCH] Params Spec 80 column md. (#6561) * upgrade params spec to use 80 column convention for better reading * Fix Typo. --- x/params/spec/01_keeper.md | 6 +++++- x/params/spec/02_subspace.md | 24 +++++++++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/x/params/spec/01_keeper.md b/x/params/spec/01_keeper.md index b2256919a4..8cf7e2a53f 100644 --- a/x/params/spec/01_keeper.md +++ b/x/params/spec/01_keeper.md @@ -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: diff --git a/x/params/spec/02_subspace.md b/x/params/spec/02_subspace.md index 98102791fd..5e36eaf498 100644 --- a/x/params/spec/02_subspace.md +++ b/x/params/spec/02_subspace.md @@ -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