[Version-unspecific] Consolidated Mimir-only key string constants #check-lint-warning
[Version-unspecific]
Intended for #1966
'Duplicate string literals for all keys and substrings should reference a single constant'.
This Merge Request is intended to be Mimir-only-key-specific
(terms to be consolidated in
https://gitlab.com/thorchain/thornode/-/blob/develop/constants/mimir_strings.go
which cannot be reflected in
https://thornode-v1.ninerealms.com/thorchain/constants )
without overlapping with ConstantName Merge Request !3578
'ConstantName .String()
for Constants strings #check-lint-warning
'.
Neither MR should be able to close the Issue by itself.
As always, feedback is welcome
(for example preferred format of if I've missed something).
All Mimir-only (/sub-)strings
(full keys, templates, references)
should now be recorded in constants/mimir_strings.go
(except for those in constants/mimir_strings_archive.go
, to be removed on hard fork).
( !3561 (diffs) )
It is gratifying that the regression test block exports show that no block's app_hash
is affected by this #check-lint-warning
refactor!
(That is, no consensus failure expected as a result.)
I note that GetMimir
and SetMimir
both use
( https://gitlab.com/thorchain/thornode/-/blob/v1.132.0/x/thorchain/keeper/v1/keeper_mimir.go#L41-62 )
k.GetKey(ctx, prefixMimir, key)
:
https://gitlab.com/thorchain/thornode/-/blob/v1.132.0/x/thorchain/keeper/v1/keeper.go#L143-145
func (k KVStore) GetKey(ctx cosmos.Context, prefix types.DbPrefix, key string) string {
return fmt.Sprintf("%s/%s", prefix, strings.ToUpper(key))
}
I believe the string.ToUpper
there prevents any consensus issue from string capitalisation differences.
(Similarly, capitalisation differences in THORNode logs should not cause sync failure.)
GetMimirWithRef
(/SetMimirWithRef
) structure is from this format feedback.
(At time of writing my impression is that test-code DeleteMimir
was not called frequently enough to warrant a dedicated DeleteMimirWithRef
function,
but please tell me if preferred.)