Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imp(staking): format ConsensusPubkey into a base64 string #2046

Merged
merged 5 commits into from
Nov 21, 2023

Conversation

luchenqun
Copy link
Contributor

Description

This is the validator information returned through the rest interface http://127.0.0.1:1317/cosmos/staking/v1beta1/validators/evmosvaloper1hajh6rhhkjqkwet6wqld3lgx8ur4y3khljfx82

{
    "validator":{
        "operator_address":"evmosvaloper1hajh6rhhkjqkwet6wqld3lgx8ur4y3khljfx82",
        "consensus_pubkey":{
            "@type":"/cosmos.crypto.ed25519.PubKey",
            "key":"nfJ0axJC9dhta1MAE1EBFaVdxxkYzxYrBaHuJVjG//M="
        },
        .....
}

This is the validator information returned through the precompiled contract Staking interface function validator(string memory validatorAddress) external view returns (Validator calldata validator);

[
    "evmosvaloper1hajh6rhhkjqkwet6wqld3lgx8ur4y3khljfx82",
    "&Any{TypeUrl:/cosmos.crypto.ed25519.PubKey,Value:[10 32 157 242 116 107 18 66 245 216 109 107 83 0 19 81 1 21 165 93 199 25 24 207 22 43 5 161 238 37 88 198 255 243],XXX_unrecognized:[]}",
     .....
]

We see that the validator consensus_pubkey key information returns data formatted by bytes, which is not user friendly.

I formatted it, and after modification, the returned information is as follows, which is consistent with what is returned by the rest interface provided by cosmos.

[
    "evmosvaloper1hajh6rhhkjqkwet6wqld3lgx8ur4y3khljfx82",
    "nfJ0axJC9dhta1MAE1EBFaVdxxkYzxYrBaHuJVjG//M=",
     .....
]

@luchenqun luchenqun requested a review from a team as a code owner November 15, 2023 13:24
@luchenqun luchenqun requested review from Vvaradinov and GAtom22 and removed request for a team November 15, 2023 13:24
@fedekunze
Copy link
Contributor

A test is failing

@luchenqun
Copy link
Contributor Author

A test is failing

done

Copy link

codecov bot commented Nov 19, 2023

Codecov Report

Merging #2046 (d07eb96) into main (8efa1e3) will increase coverage by 0.00%.
The diff coverage is 87.50%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2046   +/-   ##
=======================================
  Coverage   70.17%   70.17%           
=======================================
  Files         340      340           
  Lines       25446    25452    +6     
=======================================
+ Hits        17857    17862    +5     
- Misses       6672     6673    +1     
  Partials      917      917           
Files Coverage Δ
precompiles/staking/types.go 74.88% <87.50%> (+0.11%) ⬆️

@CLAassistant
Copy link

CLAassistant commented Nov 21, 2023

CLA assistant check
All committers have signed the CLA.

@GAtom22 GAtom22 merged commit 6befcc6 into evmos:main Nov 21, 2023
30 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants