Function to modify key codec#4112
Conversation
|
this needs a CHANGELOG_PENDING.md entry |
|
Refs #2358 |
|
Just to document, I did experiment with creating a mapping from string to objects to be able to keep track of the key types added to be able to be used in the |
Codecov Report
@@ Coverage Diff @@
## master #4112 +/- ##
==========================================
+ Coverage 66.67% 66.84% +0.16%
==========================================
Files 247 247
Lines 21220 21225 +5
==========================================
+ Hits 14149 14187 +38
+ Misses 6018 5988 -30
+ Partials 1053 1050 -3
|
|
Sorry that took a little longer than expected, test setup was a little finicky and the print tests required me to make sure the codec was reset after the test. Alternatively I could have changed the expected print output but I didn't want to change any existing tests |
| pubAminoName = "registerTest/Pub" | ||
| ) | ||
|
|
||
| func TestRegisterKeyType(t *testing.T) { |
|
Does this actually work in a real case? I thought the codecs are declared privately on a per package basis so it would be hard to get this effect to thread through ? |
Does for what I needed it for in Ethermint, can't say for other uses. If defined in the main() function of the cli and daemon binary as such: It is able to be overriden for when a public/private key is decoded through the I have noticed other interactions haven't threaded through based on how dependencies of dependencies are compiled in go which made other things more annoying, but this PR allowed the Ethermint key type to be decoded from the Cosmos keybase. Edit: let me be more specific in my testing as I remember it. You can modify the codec but if you reinstantiate it within an application, other references to it outside of the application will still reference the previous version. Hopefully this helps |
Hey, not sure if this is disallowed for any reason specifically, but it would be very beneficial to define additional types to decode tendermint key implementations from bytes, since it uses a static codec. If this is okay, let me know and I will add documentation.
Context: For Ethermint to switch to using Cosmos' keybase, decoding the keys requires this codec to be updated