ExocoreNetwork / exocore

Omnichain Restaking
7 stars 9 forks source link

Set-cons-key show Invalid Public Key on WIndows #91

Closed cloud8little closed 3 months ago

cloud8little commented 3 months ago

Summary of Bug

  1. Download the exocore binary for windows.https://github.com/ExocoreNetwork/exocore/releases/download/v1.0.0/exocore_1.0.0_Windows_amd64.zip
  2. Unzip the file and add the binary exocore to a bin folder, and add the folder absolute path to environment variable PATH.
  3. Use the exocore to start a local node.
  4. Register an operator.
  5. Set a public key for the operator.

Version

v1.0.0

Steps to Reproduce

Screenshots

exocored.exe tx operator set-cons-key exocoretestnet_233-2 $(exocored tendermint show-validator --home node2/) --from newoperator1 --home node2/ --keyring-backend test --node http://localhost:19999
Error: invalid public key: invalid character '@' looking for beginning of object key string
Usage:
  exocored tx operator set-cons-key <chain-id> <public-key-in-JSON> [flags]

Flags:
  -h, --help   help for set-cons-key

Global Flags:
  -b, --broadcast-mode string    Transaction broadcasting mode (sync|async) (default "sync")
      --chain-id string          The network chain ID
      --fees string              Fees to pay along with transaction; eg: 10aevmos
      --from string              Name or address of private key with which to sign
      --gas-adjustment float     adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored  (default 1.2)
      --gas-prices string        Gas prices to determine the transaction fee (e.g. 10aevmos)
      --home string              directory for config and data (default "C:\\Users\\ASUS\\.exocored")
      --keyring-backend string   Select keyring's backend (default "os")
      --log_format string        The logging format (json|plain) (default "plain")
      --log_level string         The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
      --node string              <host>:<port> to tendermint rpc interface for this chain (default "tcp://localhost:26657")
      --trace                    print out full stack trace on errors

Additional context


For Admin Use

MaxMustermann2 commented 3 months ago

Please show results for exocored tendermint show-validator --home node2

cloud8little commented 3 months ago

Please show results for exocored tendermint show-validator --home node2

PS D:\ExocorePrivate\.tmp-exocored> exocored tendermint show-validator --home node2/
{"@type":"/cosmos.crypto.ed25519.PubKey","key":"XLtFCK0/nB1xExSXEhH5kaxRte3aIXSGaBfWSeNOtpE="}
MaxMustermann2 commented 3 months ago

Can you escape the results of exocored tendermint show-validator in the exocored tx operator set-cons-key ? The shell you are using does not like the quotes or the braces. I don't have a Windows machine, so the below is untested but in my opinion it will work. If it does not, I can spin up a VM and investigate further.

@echo off
setlocal enabledelayedexpansion

:: Capture the JSON output
for /f "tokens=*" %%i in ('exocored tendermint show-validator --home node2') do set jsonOutput=%%i

:: Escape the JSON string
set "escapedJson=%jsonOutput:"=\"%"

:: Run the command with the escaped JSON string
exocored tx operator set-cons-key exocoretestnet_233-2 %escapedJson% --from newoperator1 --keyring-backend test --home node2

endlocal

Alternatively, here's a powershell script.

# Capture the JSON output
$jsonOutput = exocored tendermint show-validator --home node2

# Escape the JSON string
$escapedJson = $jsonOutput -replace '"', '\"'

# Run the command with the escaped JSON string
exocored tx operator set-cons-key exocoretestnet_233-2 $escapedJson --from newoperator1 --keyring-backend test --home node2
cloud8little commented 3 months ago

Can you escape the results of exocored tendermint show-validator in the exocored tx operator set-cons-key ? The shell you are using does not like the quotes or the braces. I don't have a Windows machine, so the below is untested but in my opinion it will work. If it does not, I can spin up a VM and investigate further.

@echo off
setlocal enabledelayedexpansion

:: Capture the JSON output
for /f "tokens=*" %%i in ('exocored tendermint show-validator --home node2') do set jsonOutput=%%i

:: Escape the JSON string
set "escapedJson=%jsonOutput:"=\"%"

:: Run the command with the escaped JSON string
exocored tx operator set-cons-key exocoretestnet_233-2 %escapedJson% --from newoperator1 --keyring-backend test --home node2

endlocal

Alternatively, here's a powershell script.

# Capture the JSON output
$jsonOutput = exocored tendermint show-validator --home node2

# Escape the JSON string
$escapedJson = $jsonOutput -replace '"', '\"'

# Run the command with the escaped JSON string
exocored tx operator set-cons-key exocoretestnet_233-2 $escapedJson --from newoperator1 --keyring-backend test --home node2

It's good to set public key in this way. or just directly use this command: exocored.exe tx operator set-cons-key exocoretestnet_233-2 exocored.exe tx operator set-cons-key exocoretestnet_233-2 '{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"XLtFCK0/nB1xExSXEhH5kaxRte3aIXSGaBfWSeNOtpE=\"}' --from newoperator1 --keyring-backend test --home node2 --gas-prices 7aexo