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

release/v0.3.56 -> latest #281

Merged
merged 15 commits into from
May 2, 2024
17 changes: 4 additions & 13 deletions bash-utils/bash-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ function bashUtilsVersion() {
# this is default installation script for utils
# ./bash-utils.sh bashUtilsSetup "/var/kiraglob"
function bashUtilsSetup() {
local BASH_UTILS_VERSION="v0.3.54"


local BASH_UTILS_VERSION="v0.3.56"

local COSIGN_VERSION="v2.0.0"
if [ "$1" == "version" ] ; then
echo "$BASH_UTILS_VERSION"
Expand Down Expand Up @@ -2315,15 +2318,3 @@ if declare -f "$1" > /dev/null ; then
fi














4 changes: 3 additions & 1 deletion bip39gen/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import (
"github.com/spf13/cobra"
)

const Bip39GenVersion = "v0.3.54"

const Bip39GenVersion = "v0.3.56"


func cmdVersion(cmd *cobra.Command, args []string) error {
fmt.Println(Bip39GenVersion)
Expand Down
3 changes: 2 additions & 1 deletion build-tools/update_version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import re
import sys

version = "v0.3.54"

version = "v0.3.56"

if len(sys.argv) != 2:
print("Usage: python3 update_version.py <new_release>")
Expand Down
3 changes: 2 additions & 1 deletion ipfs-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ A command-line interface (CLI) for interacting with the IPFS API, providing func
To install the CLI, clone the repository and build the project using Go.= or dowload from existing release

```
TOOLS_VERSION="v0.3.54" && rm -rfv /tmp/ipfs-api && \
TOOLS_VERSION="v0.3.56" && rm -rfv /tmp/ipfs-api && \

safeWget /tmp/ipfs-api.deb "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/ipfs-api-$(getPlatform)-$(getArch).deb" "QmeqFDLGfwoWgCy2ZEFXerVC5XW8c5xgRyhK5bLArBr2ue" && \
dpkg-deb -x /tmp/ipfs-api.deb /tmp/ipfs-api && cp -fv "/tmp/ipfs-api/bin/ipfs-api" /usr/local/bin/ipfs-api && chmod -v 755 /usr/local/bin/ipfs-api && \
ipfs-api version
Expand Down
5 changes: 4 additions & 1 deletion ipfs-api/types/constants.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package types

const (
IpfsApiVersion = "v0.3.54"

IpfsApiVersion = "v0.3.56"



// Pinata v1 constants
BASE_URL = "https://api.pinata.cloud"
Expand Down
4 changes: 3 additions & 1 deletion scripts/version.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env bash

echo "v0.3.54"

echo "v0.3.56"

63 changes: 55 additions & 8 deletions validator-key-gen/MnemonicsGenerator/mnemonicGenerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,28 @@ func MasterKeysGen(masterMnemonic []byte, defaultPrefix, defaultPath, masterkeys

if masterkeys != "" {
// validator_node_key.json validator_node_id.key" files
valkeygen.ValKeyGen(string(mnemonicSet.ValidatorNodeMnemonic), defaultPrefix, defaultPath, "",
fmt.Sprintf("%s/%s", masterkeys, DefaultValidatorNodeKeyFileName),
fmt.Sprintf("%s/%s", masterkeys, DefaultValidatorNodeIdFileName),
false, false, false)

// priv_validator_key.json files
valkeygen.ValKeyGen(string(mnemonicSet.ValidatorValMnemonic), defaultPrefix, defaultPath, fmt.Sprintf("%s/%s", masterkeys, DefaultPrivValidatorKeyFileName), "", "", false, false, false)

// valkeygen.ValKeyGen(string(mnemonicSet.ValidatorNodeMnemonic), defaultPrefix, defaultPath, "",
// fmt.Sprintf("%s/%s", masterkeys, DefaultValidatorNodeKeyFileName),
// fmt.Sprintf("%s/%s", masterkeys, DefaultValidatorNodeIdFileName),
// false, false, false)
// priv_validator_key.json file
// valkeygen.ValKeyGen(string(mnemonicSet.ValidatorValMnemonic), defaultPrefix, defaultPath, fmt.Sprintf("%s/%s", masterkeys, DefaultPrivValidatorKeyFileName), "", "", false, false, false)

// validator_node_key.json file
err = GenerateValidatorNodeKeyJson(mnemonicSet.ValidatorNodeMnemonic, fmt.Sprintf("%s/%s", masterkeys, DefaultValidatorNodeKeyFileName), defaultPrefix, defaultPath)
if err != nil {
return mnemonicSet, err
}
// validator_node_id.key" file
err = GenerateValidatorNodeIdFile(mnemonicSet.ValidatorNodeMnemonic, fmt.Sprintf("%s/%s", masterkeys, DefaultValidatorNodeIdFileName), defaultPrefix, defaultPath)
if err != nil {
return mnemonicSet, err
}
// priv_validator_key.json file
err = GeneratePrivValidatorKeyJson(mnemonicSet.ValidatorValMnemonic, fmt.Sprintf("%s/%s", masterkeys, DefaultPrivValidatorKeyFileName), defaultPrefix, defaultPath)
if err != nil {
return mnemonicSet, err
}
// mnemonics.env file
dataToWrite := []byte(fmt.Sprintf("MASTER_MNEMONIC=%s\nVALIDATOR_ADDR_MNEMONIC=%s\nVALIDATOR_NODE_MNEMONIC=%s\nVALIDATOR_NODE_ID=%s\nVALIDATOR_VAL_MNEMONIC=%s\nSIGNER_ADDR_MNEMONIC=%s\n ", masterMnemonic, mnemonicSet.ValidatorAddrMnemonic, mnemonicSet.ValidatorNodeMnemonic, mnemonicSet.ValidatorNodeId, mnemonicSet.ValidatorValMnemonic, mnemonicSet.SignerAddrMnemonic))

Expand Down Expand Up @@ -192,3 +206,36 @@ func DerivePrivKeyMnemonicFromMasterMnemonic(masterMnemonic []byte) (privKey []b
}
return
}

func GenerateValidatorNodeKeyJson(validatorNodeMnemonic []byte, keyPath, defaultPrefix, defaultPath string) error {
// validator_node_key.json file
err := valkeygen.ValKeyGen(string(validatorNodeMnemonic), defaultPrefix, defaultPath, "",
keyPath,
"",
false, false, false)
if err != nil {
return err
}
return nil
}

func GenerateValidatorNodeIdFile(validatorNodeMnemonic []byte, keyPath, defaultPrefix, defaultPath string) error {
//validator_node_id.key" file
err := valkeygen.ValKeyGen(string(validatorNodeMnemonic), defaultPrefix, defaultPath, "",
"",
keyPath,
false, false, false)
if err != nil {
return err
}
return nil
}

func GeneratePrivValidatorKeyJson(validatorValMnemonic []byte, keyPath, defaultPrefix, defaultPath string) error {
// priv_validator_key.json file
err := valkeygen.ValKeyGen(string(validatorValMnemonic), defaultPrefix, defaultPath, keyPath, "", "", false, false, false)
if err != nil {
return err
}
return nil
}
5 changes: 4 additions & 1 deletion validator-key-gen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ Validator Key Generator is a CLI tool that generates validator keys, node keys,
### Setup from binary file

```bash
TOOLS_VERSION="v0.3.54"

TOOLS_VERSION="v0.3.56"



# Quick-Install bash-utils or see root repository README file for secure download
FILE_NAME="bash-utils.sh" && \
Expand Down
30 changes: 17 additions & 13 deletions validator-key-gen/ValKeyGen/valKeyGen.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import (
"github.com/tendermint/tendermint/privval"
)



type Prefix struct {
fullPath *hd.BIP44Params
bech32MainPrefix string
Expand Down Expand Up @@ -161,32 +159,35 @@ func CheckMnemonic(mnemonic string) error {
}

if isValid := bip39.IsMnemonicValid(mnemonic); !isValid {
return fmt.Errorf("mnemonic is invalid!")
return fmt.Errorf("mnemonic is invalid")
}
return nil
}

var out io.Writer = os.Stdout

func ValKeyGen(mnemonic, defaultPrefix, defaultPath, valkey, nodekey, keyid string, acadr, valadr, consadr bool) {
func ValKeyGen(mnemonic, defaultPrefix, defaultPath, valkey, nodekey, keyid string, acadr, valadr, consadr bool) error {
prefix := Prefix{}

// Setting up prefix with default or provided values
err := prefix.New(defaultPrefix, defaultPath)
if err != nil {
panic(fmt.Errorf("malformed prefix %v", err))
// panic(fmt.Errorf("malformed prefix %v", err))
return fmt.Errorf("malformed prefix %v", err)
}

// Check if mnemonic is provided and valid
if err := CheckMnemonic(mnemonic); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
// fmt.Fprintln(os.Stderr, err)
// os.Exit(1)
return err
}

// Generate HD(Hierarchical Deterministic) path from string
hdPath, err := hd.NewParamsFromPath(defaultPath)
if err != nil {
panic(err)
// panic(err)
return err
}

// Generate tendermint MASTER private key from mnemonic
Expand All @@ -210,8 +211,9 @@ func ValKeyGen(mnemonic, defaultPrefix, defaultPath, valkey, nodekey, keyid stri
config.SetCoinType(prefix.fullPath.CoinType)
// config.Seal()
if ok, err := CheckPath([]string{valkey, nodekey, keyid}); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
// fmt.Fprintln(os.Stderr, err)
// os.Exit(1)
return err
} else {
if ok {
filepvkey := privval.NewFilePV(tmPrivKey, valkey, "").Key
Expand All @@ -226,13 +228,15 @@ func ValKeyGen(mnemonic, defaultPrefix, defaultPath, valkey, nodekey, keyid stri
if len(nodekey) != 0 {
err = filenodekey.SaveAs(nodekey)
if err != nil {
panic(err)
// panic(err)
return err
}
}
if len(keyid) != 0 {
err = ioutil.WriteFile(keyid, []byte(filenodekey.ID()), 0644)
if err != nil {
panic(err)
// panic(err)
return err
}
}

Expand All @@ -249,5 +253,5 @@ func ValKeyGen(mnemonic, defaultPrefix, defaultPath, valkey, nodekey, keyid stri

}
}

return nil
}
10 changes: 8 additions & 2 deletions validator-key-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import (
valkeygen "github.com/KiraCore/tools/validator-key-gen/ValKeyGen"
)

const PrivValidatorKeyGenVersion = "v0.3.54"

const PrivValidatorKeyGenVersion = "v0.3.56"



func main() {

Expand Down Expand Up @@ -79,7 +82,10 @@ func main() {
if master {
mnemonicsgenerator.MasterKeysGen([]byte(mnemonic), defaultPrefix, defaultPath, masterkeys)
} else {
valkeygen.ValKeyGen(mnemonic, defaultPrefix, defaultPath, valkey, nodekey, keyid, acadr, valadr, consadr)
err := valkeygen.ValKeyGen(mnemonic, defaultPrefix, defaultPath, valkey, nodekey, keyid, acadr, valadr, consadr)
if err != nil {
fmt.Println("ERROR: %w", err)
}

}

Expand Down
Loading