Skip to content

Commit

Permalink
Rebrand commands
Browse files Browse the repository at this point in the history
  • Loading branch information
R-Santev committed Mar 6, 2024
1 parent 0951b1a commit 2871fd9
Show file tree
Hide file tree
Showing 27 changed files with 120 additions and 128 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ secretsManagerConfig.json
*-packr.go
config*.json
polygon-edge
hydra

bin/

Expand Down
35 changes: 16 additions & 19 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project_name: polygon-edge
project_name: hydra-client

release:
disable: false
Expand All @@ -8,33 +8,31 @@ release:
builds:
- id: darwin-amd64
main: ./main.go
binary: polygon-edge
binary: hydra
goos:
- darwin
goarch:
- amd64
env:
- CC=o64-clang
- CXX=o64-clang++
ldflags:
-s -w -X 'github.com/0xPolygon/polygon-edge/versioning.Version=v{{ .Version }}'
ldflags: -s -w -X 'github.com/0xPolygon/polygon-edge/versioning.Version=v{{ .Version }}'

- id: darwin-arm64
main: ./main.go
binary: polygon-edge
binary: hydra
goos:
- darwin
goarch:
- arm64
env:
- CC=oa64-clang
- CXX=oa64-clang++
ldflags:
-s -w -X 'github.com/0xPolygon/polygon-edge/versioning.Version=v{{ .Version }}'
ldflags: -s -w -X 'github.com/0xPolygon/polygon-edge/versioning.Version=v{{ .Version }}'

- id: linux-amd64
main: ./main.go
binary: polygon-edge
binary: hydra
goos:
- linux
goarch:
Expand All @@ -51,7 +49,7 @@ builds:

- id: linux-arm64
main: ./main.go
binary: polygon-edge
binary: hydra
goos:
- linux
goarch:
Expand All @@ -67,8 +65,7 @@ builds:
- osusergo

archives:
-
files:
- files:
- LICENSE
- README.md

Expand Down Expand Up @@ -99,7 +96,7 @@ snapshot:

dockers:
- image_templates:
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-amd64
- R-Santev/{{ .ProjectName }}:{{ .Version }}-amd64
dockerfile: Dockerfile.release
use: buildx
goarch: amd64
Expand All @@ -110,7 +107,7 @@ dockers:
skip_push: false

- image_templates:
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-arm64
- R-Santev/{{ .ProjectName }}:{{ .Version }}-arm64
dockerfile: Dockerfile.release
use: buildx
goarch: arm64
Expand All @@ -121,14 +118,14 @@ dockers:
skip_push: false

docker_manifests:
- name_template: 0xpolygon/{{ .ProjectName }}:{{ .Version }}
- name_template: R-Santev/{{ .ProjectName }}:{{ .Version }}
image_templates:
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-amd64
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-arm64
- R-Santev/{{ .ProjectName }}:{{ .Version }}-amd64
- R-Santev/{{ .ProjectName }}:{{ .Version }}-arm64
skip_push: false

- name_template: 0xpolygon/{{ .ProjectName }}:latest
- name_template: R-Santev/{{ .ProjectName }}:latest
image_templates:
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-amd64
- 0xpolygon/{{ .ProjectName }}:{{ .Version }}-arm64
- R-Santev/{{ .ProjectName }}:{{ .Version }}-amd64
- R-Santev/{{ .ProjectName }}:{{ .Version }}-arm64
skip_push: auto
16 changes: 8 additions & 8 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
FROM alpine:3.14

RUN set -x \
&& apk add --update --no-cache \
ca-certificates \
&& rm -rf /var/cache/apk/*
COPY polygon-edge /usr/local/bin/
&& apk add --update --no-cache \
ca-certificates \
&& rm -rf /var/cache/apk/*
COPY hydra /usr/local/bin/

EXPOSE 8545 9632 1478

RUN addgroup -S edge \
&& adduser -S edge -G edge
RUN addgroup -S hydra \
&& adduser -S hydra -G hydra

USER edge
USER hydra

ENTRYPOINT ["polygon-edge"]
ENTRYPOINT ["hydra"]
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To begin your journey as a validator, you'll first need to obtain the software f
- #### Executable

Download the executable for the Hydragon Node directly from [Github Releases](https://github.com/Hydra-Chain/hydragon-node/releases/latest).
After downloading, unzip the file. The extracted folder, named identically to the zip file, contains the polygon-edge executable. To enhance convenience, you may want to move this executable to your system's bin directory to run it from anywhere.
After downloading, unzip the file. The extracted folder, named identically to the zip file, contains the `hydra` executable. To enhance convenience, you may want to move this executable to your system's bin directory to run it from anywhere.

- #### Build from source

Expand All @@ -22,6 +22,7 @@ After downloading, unzip the file. The extracted folder, named identically to th
1. Clone the node source code from our [Github Repository](https://github.com/Hydra-Chain/hydragon-node/tree/prod) or download it from from our [latest release](https://github.com/Hydra-Chain/hydragon-node/releases/latest).

**Note!** Please make sure to check out the `prod` branch if you have opted to clone the repository.

```
git checkout prod
```
Expand All @@ -31,14 +32,14 @@ git checkout prod
4. Build the node

```
CGO_ENABLED=0 go build -o polygon-edge -a -installsuffix cgo main.go
CGO_ENABLED=0 go build -o hydra -a -installsuffix cgo main.go
```

**CGO_ENABLED=0**: This environment variable disables CGO, which is a feature in Go that allows for the creation of Go packages that call C code. Setting CGO_ENABLED=0 makes the build static, meaning it does not depend on C libraries at runtime, enhancing portability across different environments without needing those C libraries installed.

**go build**: This is the Go command to compile packages and dependencies into a binary executable.

**-o polygon-edge**: The -o flag specifies the output file name for the compiled binary. In this case, the binary will be named polygon-edge.
**-o hydra**: The -o flag specifies the output file name for the compiled binary. In this case, the binary will be named `hydra`.

**-a**: This flag forces a rebuild of all packages that are part of the binary. It's useful to ensure you're compiling with the most up-to-date version of the code and dependencies.

Expand All @@ -51,14 +52,14 @@ To build Go applications for different platforms directly from your command line
Example:

```
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o polygon-edge -a -installsuffix cgo main.go
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o hydra -a -installsuffix cgo main.go
```

4. Add the generated binary to your system's PATH environment variable to allow its execution from any directory.

- #### Docker image

Alternatively, pull the Docker image for Hydragon from our repository at [Docker Hub](https://hub.docker.com/repository/docker/rsantev/polygon-edge/general). This method is ideal for users who prefer containerized environments.
Alternatively, pull the Docker image for Hydragon from our repository at [Docker Hub](https://hub.docker.com/repository/docker/rsantev/hydra-client/general). This method is ideal for users who prefer containerized environments.

### Generate secrets

Expand All @@ -71,7 +72,7 @@ The foundation of your validator identity is built upon three distinct private k
There are different options on how and where the secrets to be stored but we recommend storing the keys encrypted on your local file system and maintaining offline backups. To generate these keys, use the following command, which encrypts them locally:

```
polygon-edge polybft-secrets --chain-id 8844 --data-dir node-secrets
hydra secrets init --chain-id 8844 --data-dir node-secrets
```

This command initiates the creation of your node's secrets for a testnet chain with ID 8844, storing them in a directory named node-secrets. During this process, you'll confirm each secret and establish a password for file encryption.
Expand Down Expand Up @@ -108,7 +109,7 @@ Paste the file in your node directory.
Run your node with the following command from its directory:

```
polygon-edge server --data-dir ./node-secrets --chain ./genesis.json --grpc-address :9632 --libp2p 0.0.0.0:1478 --jsonrpc 0.0.0.0:8545 --secrets-config ./secrets-config.json
hydra server --data-dir ./node-secrets --chain ./genesis.json --grpc-address :9632 --libp2p 0.0.0.0:1478 --jsonrpc 0.0.0.0:8545 --secrets-config ./secrets-config.json
```

This process may take some time, as the node needs to fully sync with the blockchain. Once the syncing process is complete, you will need to restart the node by running the same command.
Expand All @@ -126,7 +127,7 @@ Once your node is operational and fully synced, you're ready to become a validat
Check your public secrets data with the following command:

```
polygon-edge polybft-secrets output --data-dir node-secrets
hydra secrets output --data-dir node-secrets
```

You need the following value:
Expand All @@ -143,15 +144,15 @@ Send it to Hydra's team, so they can whitelist your address to be able to partic
After Hydra's team confirms you are whitelisted you have to register your account as a validator and stake a given amount.

```
polygon-edge polybft register-validator --data-dir ./node-secrets --stake 99000000000000000000 --chain-id 8844 --jsonrpc http://localhost:8545
hydra polybft register-validator --data-dir ./node-secrets --stake 99000000000000000000 --chain-id 8844 --jsonrpc http://localhost:8545
```

The above command both register the validator and stakes the specified amount.

Use the following command in case you want to execute the stake operation only:

```
polygon-edge polybft stake --data-dir ./node-secrets --self true --amount 99000000000000000000 --jsonrpc http://localhost:8545
hydra polybft stake --data-dir ./node-secrets --self true --amount 99000000000000000000 --jsonrpc http://localhost:8545
```

**Note:** Amounts are specified in wei.
Expand Down
2 changes: 1 addition & 1 deletion command/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func setFlags(cmd *cobra.Command) {
&params.genesisPath,
dirFlag,
fmt.Sprintf("./%s", command.DefaultGenesisFileName),
"the directory for the Polygon Edge genesis data",
"the directory for the Hydra Chain genesis data",
)

cmd.Flags().Uint64Var(
Expand Down
7 changes: 2 additions & 5 deletions command/genesis/polybft_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (p *genesisParams) generatePolyBftChainConfig(o command.OutputFormatter) er
}

// deploy genesis contracts
allocs, err := p.deployContracts(totalStake, rewardTokenByteCode, polyBftConfig, chainConfig, burnContractAddr)
allocs, err := p.deployContracts(totalStake, rewardTokenByteCode)
if err != nil {
return err
}
Expand Down Expand Up @@ -327,10 +327,7 @@ func (p *genesisParams) generatePolyBftChainConfig(o command.OutputFormatter) er

func (p *genesisParams) deployContracts(
totalStake *big.Int,
rewardTokenByteCode []byte,
polybftConfig *polybft.PolyBFTConfig,
chainConfig *chain.Chain,
burnContractAddr types.Address) (map[types.Address]*chain.GenesisAccount, error) {
rewardTokenByteCode []byte) (map[types.Address]*chain.GenesisAccount, error) {
proxyToImplAddrMap := contracts.GetProxyImplementationMapping()
proxyAddresses := make([]types.Address, 0, len(proxyToImplAddrMap))

Expand Down
2 changes: 1 addition & 1 deletion command/license/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
func GetCommand() *cobra.Command {
return &cobra.Command{
Use: "license",
Short: "Returns Polygon Edge license and dependency attributions",
Short: "Returns Hydra Chain license and dependency attributions",
Args: cobra.NoArgs,
Run: runCommand,
}
Expand Down
4 changes: 2 additions & 2 deletions command/polybft/polybft_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (

func GetCommand() *cobra.Command {
polybftCmd := &cobra.Command{
Use: "polybft",
Short: "Polybft command",
Use: "hydragon",
Short: "Executes HydraChain's Hydragon consensus commands, including staking, unstaking, rewards management, and validator operations.",
}

// Hydra modification: modify sidechain commands and remove rootchain commands
Expand Down
4 changes: 2 additions & 2 deletions command/polybftsecrets/secrets_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ var basicParams = &initParams{}

func GetCommand() *cobra.Command {
secretsInitCmd := &cobra.Command{
Use: "polybft-secrets",
Short: "Initializes private keys for the Polygon Edge (Validator + Networking) " +
Use: "init",
Short: "Initializes private keys for the Hydra Chain (Validator + Networking) " +
"to the specified Secrets Manager",
PreRunE: runPreRun,
Run: runCommand,
Expand Down
2 changes: 1 addition & 1 deletion command/polybftsecrets/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const (
PrivateKeyFlag = "private-key"
ChainIDFlag = "chain-id"

AccountDirFlagDesc = "the directory for the Polygon Edge data if the local FS is used"
AccountDirFlagDesc = "the directory for the Hydra Chain data if the local FS is used"
AccountConfigFlagDesc = "the path to the SecretsManager config file, if omitted, the local FS secrets manager is used"
PrivateKeyFlagDesc = "hex-encoded private key of the account which executes rootchain commands"
ChainIDFlagDesc = "ID of child chain"
Expand Down
7 changes: 2 additions & 5 deletions command/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ import (
"github.com/0xPolygon/polygon-edge/command/bridge"
"github.com/0xPolygon/polygon-edge/command/genesis"
"github.com/0xPolygon/polygon-edge/command/helper"
"github.com/0xPolygon/polygon-edge/command/ibft"
"github.com/0xPolygon/polygon-edge/command/license"
"github.com/0xPolygon/polygon-edge/command/monitor"
"github.com/0xPolygon/polygon-edge/command/peers"
"github.com/0xPolygon/polygon-edge/command/polybft"
"github.com/0xPolygon/polygon-edge/command/polybftsecrets"
"github.com/0xPolygon/polygon-edge/command/regenesis"
"github.com/0xPolygon/polygon-edge/command/secrets"
"github.com/0xPolygon/polygon-edge/command/server"
Expand All @@ -31,7 +29,7 @@ type RootCommand struct {
func NewRootCommand() *RootCommand {
rootCommand := &RootCommand{
baseCmd: &cobra.Command{
Short: "Polygon Edge is a framework for building Ethereum-compatible Blockchain networks",
Short: "Welcome to the HydraChain node CLI",
},
}

Expand All @@ -50,12 +48,11 @@ func (rc *RootCommand) registerSubCommands() {
secrets.GetCommand(),
peers.GetCommand(),
monitor.GetCommand(),
ibft.GetCommand(),
// ibft.GetCommand(),
backup.GetCommand(),
genesis.GetCommand(),
server.GetCommand(),
license.GetCommand(),
polybftsecrets.GetCommand(),
polybft.GetCommand(),
bridge.GetCommand(),
regenesis.GetCommand(),
Expand Down
4 changes: 2 additions & 2 deletions command/secrets/init/secrets_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var (
func GetCommand() *cobra.Command {
secretsInitCmd := &cobra.Command{
Use: "init",
Short: "Initializes private keys for the Polygon Edge (Validator + Networking) " +
Short: "Initializes private keys for the Hydra Chain (Validator + Networking) " +
"to the specified Secrets Manager",
PreRunE: runPreRun,
Run: runCommand,
Expand All @@ -39,7 +39,7 @@ func setFlags(cmd *cobra.Command) {
&basicParams.dataDir,
dataDirFlag,
"",
"the directory for the Polygon Edge data if the local FS is used",
"the directory for the Hydra Chain data if the local FS is used",
)

cmd.Flags().StringVar(
Expand Down
2 changes: 1 addition & 1 deletion command/secrets/output/secrets_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func setFlags(cmd *cobra.Command) {
&params.dataDir,
dataDirFlag,
"",
"the directory for the Polygon Edge data if the local FS is used",
"the directory for the Hydra Chain data if the local FS is used",
)

cmd.Flags().StringVar(
Expand Down
4 changes: 2 additions & 2 deletions command/secrets/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package secrets

import (
"github.com/0xPolygon/polygon-edge/command/helper"
"github.com/0xPolygon/polygon-edge/command/polybftsecrets"
"github.com/0xPolygon/polygon-edge/command/secrets/generate"
initCmd "github.com/0xPolygon/polygon-edge/command/secrets/init"
"github.com/0xPolygon/polygon-edge/command/secrets/output"
"github.com/spf13/cobra"
)
Expand All @@ -24,7 +24,7 @@ func GetCommand() *cobra.Command {
func registerSubcommands(baseCmd *cobra.Command) {
baseCmd.AddCommand(
// secrets init
initCmd.GetCommand(),
polybftsecrets.GetCommand(),
// secrets generate
generate.GetCommand(),
// secrets output public data
Expand Down
Loading

0 comments on commit 2871fd9

Please sign in to comment.