abci/example: use base64 for update validator set#3641
abci/example: use base64 for update validator set#3641melekes merged 4 commits intotendermint:developfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3641 +/- ##
===========================================
- Coverage 64% 63.78% -0.22%
===========================================
Files 241 241
Lines 19940 19996 +56
===========================================
- Hits 12762 12755 -7
- Misses 6128 6187 +59
- Partials 1050 1054 +4
|
|
Would you mind opening a short issue to describe the need for this change? Also need to update the kvstore README where this tx type is documented (is it documented anywhere else that would need changing? ) |
|
Aren't we expecting hex-encoded pubkey? i.e.
It's not documented, but from the looks of it we do. |
We are, but the problem is that we don't expose the pubkey as hex anywhere, so users would have to manually convert it, which is kind of a pain. I think we do want the input format here to match what we use in RPC. Since we probably don't want to change the RPC (large breaking change, inconsistent with previous decisions to use base64 there), we should probably change this app to take base64 input. But since this is technically breaking, we'll save it for v0.32. Thanks! |
Do you have any plan, maybe I can coding it. And this PR has solved it, use another format (pubkey1!power1,pubkey2!power2) |
melekes
left a comment
There was a problem hiding this comment.
LGTM
But as @ebuchman mentioned, https://github.com/tendermint/tendermint/blob/develop/abci/example/kvstore/README.md needs to be updated. Thanks!
|
@needkane do you mind updating https://github.com/tendermint/tendermint/blob/develop/abci/example/kvstore/README.md ? |
done |
|
/cc @melekes |
|
|
||
| // format is "val:pubkey/power" | ||
| // format is "val:pubkey!power" | ||
| // pubkey is raw 32-byte ed25519 key |
There was a problem hiding this comment.
this is not true, right? it should be base64 encoded
There was a problem hiding this comment.
| // pubkey is raw 32-byte ed25519 key | |
| // pubkey is a base64-encoded 32-byte ed25519 key |
abci/example/kvstore/README.md
Outdated
| "val:pubkey1!power1,pubkey2!power2,pubkey3!power3" | ||
| ``` | ||
|
|
||
| where `power1` is the new voting power for the validator with `pubkey1` (possibly a new one). |
There was a problem hiding this comment.
| where `power1` is the new voting power for the validator with `pubkey1` (possibly a new one). | |
| where `pubkeyN` is a base64-encoded 32-byte ed25519 key and `powerN` is a new voting power for the validator with `pubkeyN` (possibly a new one). To remove a validator from the validator set, set power to `0`. |
There was a problem hiding this comment.
"Validators can be removed by setting their power to 0" already exist
|
Can you also add to |
…t#3641) * abci/example: use base64 for update validator set * update kvstore/README.md * update CHANGELOG_PENDING.md and abci/example/kvstore/README.md
Updated all relevant documentation in docs
reference : https://github.com/tendermint/tendermint/blob/master/abci/example/kvstore/README.md
"val:pubkey1/power1,addr2/power2,addr3/power3"
There is a problem, pubkey contains forward slash("/").
Updated all code comments where relevant
Wrote tests
curl -s 'localhost:26657validators'
{
"jsonrpc": "2.0",
"id": "",
"result": {
"block_height": "91",
"validators": [
{
"address": "75F6B901A666ABDB0AB12BDB5D4B1CF8F512997B",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "Vy3mgS0jodu/5zbs0dz99DYTgq/8vOHpFMsjxZSJtqw="
},
"voting_power": "10",
"proposer_priority": "0"
}
]
}
}
if I want update validator voting power,but pubkey contains forward slash so that split result is wrong.
curl -s 'localhost:26657/broadcast_tx_commit?tx="val:Vy3mgS0jodu/5zbs0dz99DYTgq/8vOHpFMsjxZSJtqw=/6"'
My modify:
curl -s 'localhost:26657/broadcast_tx_commit?tx="val:Vy3mgS0jodu/5zbs0dz99DYTgq/8vOHpFMsjxZSJtqw=!6"'
{
"jsonrpc": "2.0",
"id": "",
"result": {
"check_tx": {
"gasWanted": "1"
},
"deliver_tx": {},
"hash": "3463B10BC220888CEA883761B33DE22F3C186C21DC5BBDB1E401F6CC5ACBD6A3",
"height": "11"
}
}
Pubkey default display use base64 encode by rpc(localhost:26657/validators) or read configure file(~/.tendermint/config/priv_validator_key.json), but update validator set function use hex.
#3659