crypto: Add a way to go from pubkey to route#2574
Merged
Conversation
This is intended for use in a future PR for #2414
9fd2bf5 to
b49cd16
Compare
Codecov Report
@@ Coverage Diff @@
## develop #2574 +/- ##
==========================================
- Coverage 61.3% 61.3% -0.01%
==========================================
Files 202 202
Lines 16734 16688 -46
==========================================
- Hits 10259 10230 -29
+ Misses 5607 5593 -14
+ Partials 868 865 -3
|
liamsi
reviewed
Oct 9, 2018
| RegisterAmino(cdc) | ||
|
|
||
| // TODO: Have amino provide a way to go from concrete struct to route directly. | ||
| // Its currently a private API |
Contributor
There was a problem hiding this comment.
If not happened already: please open an issue in amino too and link all relevant issues / PRs.
melekes
reviewed
Oct 9, 2018
| ) | ||
|
|
||
| var cdc = amino.NewCodec() | ||
| var routeTable = make(map[reflect.Type]string, 3) |
Contributor
There was a problem hiding this comment.
don't u think this deserve a comment? with an example entry ed25519 -> tendermint/XXX/ed25519
| func PubkeyAminoRoute(cdc *amino.Codec, key crypto.PubKey) (string, error) { | ||
| route, ok := routeTable[reflect.TypeOf(key)] | ||
| if !ok { | ||
| return "", errors.New("Pubkey type not known") |
Contributor
There was a problem hiding this comment.
can we return a bool instead of error? it will simplify the code drastically
return routeTable[reflect.TypeOf(key)]
2 tasks
cboh4
pushed a commit
to scrtlabs/tendermint
that referenced
this pull request
Apr 7, 2025
tendermint#2574) …ks (backport tendermint#2467) (tendermint#2515) Manual backport of cometbft/cometbft#2467 Co-authored-by: Andy Nogueira <me@andynogueira.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is intended for use in a future PR for #2414