Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

key format from ag-chain-cosmos tendermint show-validator not compatible with init cli #17

Closed
dckc opened this issue Aug 17, 2021 · 10 comments
Assignees

Comments

@dckc
Copy link
Member

dckc commented Aug 17, 2021

@michaelfig is this as-designed? If so, I guess we at least need to update the validator guide...

ag-chain-cosmos tendermint show-validator
{"@type":"/cosmos.crypto.ed25519.PubKey","key":"QkK5uJYlRfjgR8vNfW4Srcy0xUz1lfgxpPmoSd2E0/Y="}

context: https://discord.com/channels/585576150827532298/755164695849205942/877268194522452028

@sjors-lemniscap
Copy link

sjors-lemniscap commented Aug 17, 2021

Pulled the genesis file and config from the wiki: https://github.com/Agoric/agoric-sdk/wiki/Validator-Guide-for-Devnet

server_name: ag-cosmos-server
version: 0.26.10
commit: 65cec90b0
build_tags: ',ledger'
go: go version go1.15.7 linux/amd64

The chain syncs up fine to the last block, however when I'm trying to initialize our validator (with either a restored key or new key) it doesn't take the new format.

@dckc
Copy link
Member Author

dckc commented Aug 17, 2021

What specific command fails? What error message comes out?

@sjors-lemniscap
Copy link

Some more info for debugging purposes below:
Fully synced:

# ag-cosmos-helper status 2>&1 | jq .SyncInfo
{
  "latest_block_hash": "115472AC0B80C2BFED8F1123BCB1B2D5394FB20F74633DE2DCC33C4F57A0B0AF",
  "latest_app_hash": "C2F8821461958F908FAE0D34A7E8A19C034CA38C43BE32409210E2CC8570CA36",
  "latest_block_height": "299667",
  "latest_block_time": "2021-08-18T11:38:11.962766312Z",
  "earliest_block_hash": "AE1AF8F81E43BFF07787B4663C12A5770AC583259A06207262930019A2ED4949",
  "earliest_app_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
  "earliest_block_height": "1",
  "earliest_block_time": "2021-07-28T22:57:15.547663041Z",
  "catching_up": false
}

Imported my previous keys:

# ag-cosmos-helper keys list | jq
Enter keyring passphrase:
[
  {
    "name": "lc-agoric-devnet",
    "type": "local",
    "address": "agoric1g2345a296lxzc0ugvkn3fkx3z0zkg6s3ueh603",
    "pubkey": "{\"@type\":\"/cosmos.crypto.secp256k1.PubKey\",\"key\":\"A5GyqfSpjEAP+n50iW+hwgjnKDtq0S73joFHV6o8biQb\"}"
  }
]

Get the public key from the current node
I noticed a different key type and key format here

# ag-chain-cosmos tendermint show-validator | jq
{
  "@type": "/cosmos.crypto.ed25519.PubKey",
  "key": "QkK5uJYlRfjgR8vNfW4Srcy0xUz1lfgxpPmoSd2E0/Y="
}

And last but not least trying to submit the create-validator tx which fails on the pubkey part

# ag-cosmos-helper tx staking create-validator \
   --amount=50000000ubld \
   --broadcast-mode=block \
   --pubkey="QkK5uJYlRfjgR8vNfW4Srcy0xUz1lfgxpPmoSd2E0/Y=" \
   --moniker="$myMoniker" \
   --website="https://lemniscap.com" \
   --details="Lemniscap is an investment firm specialising in investments in emerging cryptoassets and blockchain startups." \
   --identity="1FDB0F8D14C89421" \
   --commission-rate="0.10" \
   --commission-max-rate="0.20" \
   --commission-max-change-rate="0.01" \
   --min-self-delegation="1" \
   --from=lc-agoric-devnet \
   --chain-id=$chainName \
   --gas=auto \
   --gas-adjustment=1.4 | jq
Enter keyring passphrase:
Error: invalid character 'Q' looking for beginning of value

This makes me believe either something is wrong with my binaries or pubkey format. I used the following config files:

@anakin0xc06
Copy link

anakin0xc06 commented Aug 19, 2021

you can use
--pubkey=$(ag-chain-cosmos tendermint show-validator)

total string instead of only pubkey value

@sjors-lemniscap
Copy link

you can use
--pubkey=$(ag-chain-cosmos tendermint show-validator)

total string instead of only pubkey value

Err.. that's the exact same value as I posted under "Get the public key from the current node" of my previous message so that results as expected in the same error:

# ag-cosmos-helper tx staking create-validator \
   --amount=50000000ubld \
   --broadcast-mode=block \
   --pubkey=$(ag-chain-cosmos tendermint show-validator) \
   --moniker="$myMoniker" \
   --website="https://lemniscap.com" \
   --details="Lemniscap is an investment firm specialising in investments in emerging cryptoassets and blockchain startups." \
   --identity="1FDB0F8D14C89421" \
   --commission-rate="0.10" \
   --commission-max-rate="0.20" \
   --commission-max-change-rate="0.01" \
   --min-self-delegation="1" \
   --from=lc-agoric-devnet \
   --chain-id=$chainName \
   --gas=auto \
   --gas-adjustment=1.4
Enter keyring passphrase:
Error: invalid character 'Q' looking for beginning of value

I didn't had any issues updating my node to agorictest-17 and I used the same deployment for devnet. What I will try to do tomorrow is a full redeployment of my devnet node together with running the validator set with a fresh keypair. This way we can be absolutely sure whether there is something wrong with my setup or the agoricdev-3 release.

@dckc
Copy link
Member Author

dckc commented Aug 19, 2021

any chance shell quoting is a problem here?

try --pubkey="$(ag-chain-cosmos tendermint show-validator)"?

@sjors-lemniscap
Copy link

any chance shell quoting is a problem here?

try --pubkey="$(ag-chain-cosmos tendermint show-validator)"?

Same result but ty for the suggestion. I will start with a fresh keypair tomorrow on a freshly synced node to see if it is on my end or not.. Will keep ya'll posted here.

@michaelfig
Copy link
Member

Error: invalid character 'Q' looking for beginning of value

This is really bizarre, as it is a JSON parsing error (it's looking for an object beginning with {, but instead is parsing something that begins with Q). Can you try inlining the total, unaltered output of ag-chain-cosmos tendermint show-validator?

Like this (I needed to escape the output with ', or the shell would butcher it):

...
  --pubkey='{"@type":"/cosmos.crypto.ed25519.PubKey","key":"QkK5uJYlRfjgR8vNfW4Srcy0xUz1lfgxpPmoSd2E0/Y="}'
...

@sjors-lemniscap
Copy link

Error: invalid character 'Q' looking for beginning of value

This is really bizarre, as it is a JSON parsing error (it's looking for an object beginning with {, but instead is parsing something that begins with Q). Can you try inlining the total, unaltered output of ag-chain-cosmos tendermint show-validator?

Like this (I needed to escape the output with ', or the shell would butcher it):

...
  --pubkey='{"@type":"/cosmos.crypto.ed25519.PubKey","key":"QkK5uJYlRfjgR8vNfW4Srcy0xUz1lfgxpPmoSd2E0/Y="}'
...

That did the trick @michaelfig ! Although I'm pretty sure I still had some old traces in the .ag-chain-cosmos directory. After spinning up a new fresh node, with a new fresh deployment of the Agoric Devnet 3 binaries, a new fresh keypair and inlining the total, unaltered output of ag-chain-cosmos tendermint show-validator it worked:

...
  --pubkey='{"@type":"/cosmos.crypto.ed25519.PubKey","key":"hSvi1j/3R0JbfA3lo5fOPwTRxOCcRa671J462rSzXJw="}' 
...

We are back up and running: https://devnet.explorer.agoric.net/validator/agoricvaloper16hlhqxnn5qkp2rwec2s3j3j0lu79sv7xz6whgu

@dckc
Copy link
Member Author

dckc commented Aug 20, 2021

So we just need to update the docs. Oh... in fact, I see the testnet guide was already updated in this regard:

https://github.com/Agoric/agoric-sdk/wiki/Validator-Guide-for-Incentivized-Testnet/_compare/dc4a6b2659765667905093ef8d108b34512396d5...34670f96f8d60bfec1d3778350efdedeb833e6d8

I updated the devnet guide likewise: 5f8dd82

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants