Skip to content

abci/example: use base64 for update validator set#3641

Merged
melekes merged 4 commits intotendermint:developfrom
needkane:pp
Jun 21, 2019
Merged

abci/example: use base64 for update validator set#3641
melekes merged 4 commits intotendermint:developfrom
needkane:pp

Conversation

@needkane
Copy link
Contributor

@needkane needkane commented May 8, 2019

  • 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"
}
}

  • Updated CHANGELOG_PENDING.md

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

@needkane needkane requested review from ebuchman, melekes and xla as code owners May 8, 2019 06:21
@codecov-io
Copy link

codecov-io commented May 8, 2019

Codecov Report

Merging #3641 into develop will decrease coverage by 0.21%.
The diff coverage is 50%.

@@             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
Impacted Files Coverage Δ
abci/example/kvstore/persistent_kvstore.go 63.73% <50%> (-0.31%) ⬇️
privval/signer_validator_endpoint.go 75.55% <0%> (-10%) ⬇️
blockchain/reactor.go 70.56% <0%> (-0.94%) ⬇️
consensus/reactor.go 70.7% <0%> (-0.59%) ⬇️
blockchain/pool.go 79.93% <0%> (-0.33%) ⬇️
state/errors.go 0% <0%> (ø) ⬆️
libs/db/remotedb/grpcdb/server.go 0% <0%> (ø) ⬆️
p2p/pex/pex_reactor.go 82.64% <0%> (+0.58%) ⬆️
privval/signer_remote.go 80% <0%> (+2%) ⬆️
types/tx.go 91.3% <0%> (+4.34%) ⬆️
... and 1 more

@ebuchman
Copy link
Contributor

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? )

@needkane
Copy link
Contributor Author

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? )

#3659

@melekes
Copy link
Contributor

melekes commented May 27, 2019

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"'

Aren't we expecting hex-encoded pubkey? i.e.

Vy3mgS0jodu/5zbs0dz99DYTgq/8vOHpFMsjxZSJtqw= will result in 5679336D6753306A6F64752F357A627330647A393944595467712F38764F4870464D736A785A534A7471773D

It's not documented, but from the looks of it we do.

@ebuchman
Copy link
Contributor

Aren't we expecting hex-encoded pubkey? i.e.

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!

@needkane needkane closed this May 30, 2019
@needkane needkane reopened this May 30, 2019
@needkane
Copy link
Contributor Author

Aren't we expecting hex-encoded pubkey? i.e.

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 melekes changed the base branch from master to develop June 6, 2019 11:33
Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@melekes
Copy link
Contributor

melekes commented Jun 9, 2019

@needkane
Copy link
Contributor Author

@needkane
Copy link
Contributor Author

/cc @melekes


// format is "val:pubkey/power"
// format is "val:pubkey!power"
// pubkey is raw 32-byte ed25519 key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not true, right? it should be base64 encoded

Copy link
Contributor

@melekes melekes Jun 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// pubkey is raw 32-byte ed25519 key
// pubkey is a base64-encoded 32-byte ed25519 key

"val:pubkey1!power1,pubkey2!power2,pubkey3!power3"
```

where `power1` is the new voting power for the validator with `pubkey1` (possibly a new one).
Copy link
Contributor

@melekes melekes Jun 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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`.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Validators can be removed by setting their power to 0" already exist

@melekes
Copy link
Contributor

melekes commented Jun 21, 2019

Can you also add

- [abci/examples] \#3659 Change validator update tx format (incl. expected pubkey format, which is base64 now) (@needkane)

to CHANGELOG_PENDING.md under IMPROVEMENTS section?

Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

@melekes melekes merged commit 2e5b2a9 into tendermint:develop Jun 21, 2019
unclezoro pushed a commit to unclezoro/tendermint that referenced this pull request Sep 6, 2019
…t#3641)

* abci/example: use base64 for update validator set

* update kvstore/README.md

* update CHANGELOG_PENDING.md and abci/example/kvstore/README.md
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.

4 participants