Skip to content

Commit

Permalink
Merge PR: change okexchain to exchain (okx#832)
Browse files Browse the repository at this point in the history
* clean okexchain

* clean okexchain

* clean okexchain

* clean okexchain

Co-authored-by: Zhong Qiu <[email protected]>
  • Loading branch information
xiangjianmeng and zhongqiuwood authored Apr 22, 2021
1 parent d96da09 commit 7f2aed3
Show file tree
Hide file tree
Showing 38 changed files with 138 additions and 137 deletions.
16 changes: 8 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
.idea

# Build
okexchaind
okexchaincli
exchaind
exchaincli
vendor
build
tools/
Expand All @@ -25,18 +25,18 @@ doc
# Data - ideally these don't exist
baseapp/data/*
client/lcd/keys/*
cmd/okexchaincli/statik/statik.go
cmd/exchaincli/statik/statik.go
mytestnet
doc/statik/statik.go
dev/cache
cmd/launch/launch
cmd/okexchaincli/okexchaincli
cmd/okexchaind/okexchaind
cmd/okexchaintool/okexchaintool
cmd/exchaincli/exchaincli
cmd/exchaind/exchaind
cmd/exchaintool/exchaintool
cmd/tiger/tiger
cmd/okexchaind/testnet_okchain.go
cmd/exchaind/testnet_okchain.go
dev/testnet/cache
testnet_okexchain.go
testnet_exchain.go
tools


Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- [Release Procedure](#release-procedure)
- [Point Release Procedure](#point-release-procedure)

Thank you for considering making contributions to OKExChain and related
Thank you for considering making contributions to ExChain and related
repositories!

Contributing to this repo can mean many things such as participated in
Expand Down
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Simple usage with a mounted data directory:
# > docker build -t okexchain .
# > docker run -it -p 36657:36657 -p 36656:36656 -v ~/.okexchaind:/root/.okexchaind -v ~/.okexchaincli:/root/.okexchaincli okexchain okexchaind init mynode
# > docker run -it -p 36657:36657 -p 36656:36656 -v ~/.okexchaind:/root/.okexchaind -v ~/.okexchaincli:/root/.okexchaincli okexchain okexchaind start
# > docker build -t exchain .
# > docker run -it -p 36657:36657 -p 36656:36656 -v ~/.exchaind:/root/.exchaind -v ~/.exchaincli:/root/.exchaincli exchain exchaind init mynode
# > docker run -it -p 36657:36657 -p 36656:36656 -v ~/.exchaind:/root/.exchaind -v ~/.exchaincli:/root/.exchaincli exchain exchaind start
FROM golang:alpine AS build-env

# Install minimum necessary dependencies, remove packages
RUN apk add --no-cache curl make git libc-dev bash gcc linux-headers eudev-dev

# Set working directory for the build
WORKDIR /go/src/github.com/okex/okexchain
WORKDIR /go/src/github.com/okex/exchain

# Add source files
COPY . .
Expand All @@ -22,8 +22,8 @@ FROM alpine:edge
WORKDIR /root

# Copy over binaries from the build-env
COPY --from=build-env /go/bin/okexchaind /usr/bin/okexchaind
COPY --from=build-env /go/bin/okexchaincli /usr/bin/okexchaincli
COPY --from=build-env /go/bin/exchaind /usr/bin/exchaind
COPY --from=build-env /go/bin/exchaincli /usr/bin/exchaincli

# Run okexchaind by default, omit entrypoint to ease using container with okexchaincli
CMD ["okexchaind"]
# Run exchaind by default, omit entrypoint to ease using container with exchaincli
CMD ["exchaind"]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OKExChain
ExChain
License: Apache2.0

Apache License
Expand Down
37 changes: 19 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ export GO111MODULE=on

GithubTop=github.com

Version=v0.17.5

Version=v0.18.0
CosmosSDK=v0.39.2
Tendermint=v0.33.9
Iavl=v0.14.3
Name=okexchain
ServerName=okexchaind
ClientName=okexchaincli
Name=exchain
ServerName=exchaind
ClientName=exchaincli
# the height of the 1st block is GenesisHeight+1
GenesisHeight=0
MercuryHeight=2500000
Expand Down Expand Up @@ -52,15 +53,15 @@ BUILD_TESTNET_FLAGS := $(BUILD_FLAGS)

all: install

install: okexchain
install: exchain

okexchain:
go install -v $(BUILD_FLAGS) -tags "$(BUILD_TAGS)" ./cmd/okexchaind
go install -v $(BUILD_FLAGS) -tags "$(BUILD_TAGS)" ./cmd/okexchaincli
exchain:
go install -v $(BUILD_FLAGS) -tags "$(BUILD_TAGS)" ./cmd/exchaind
go install -v $(BUILD_FLAGS) -tags "$(BUILD_TAGS)" ./cmd/exchaincli

testnet:
go install -v $(BUILD_TESTNET_FLAGS) -tags "$(BUILD_TAGS)" ./cmd/okexchaind
go install -v $(BUILD_TESTNET_FLAGS) -tags "$(BUILD_TAGS)" ./cmd/okexchaincli
go install -v $(BUILD_TESTNET_FLAGS) -tags "$(BUILD_TAGS)" ./cmd/exchaind
go install -v $(BUILD_TESTNET_FLAGS) -tags "$(BUILD_TAGS)" ./cmd/exchaincli

test-unit:
@VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock' ./app/...
Expand Down Expand Up @@ -98,32 +99,32 @@ go.sum: go.mod
@go mod tidy

cli:
go install -v $(BUILD_FLAGS) -tags "$(BUILD_TAGS)" ./cmd/okexchaincli
go install -v $(BUILD_FLAGS) -tags "$(BUILD_TAGS)" ./cmd/exchaincli

server:
go install -v $(BUILD_FLAGS) -tags "$(BUILD_TAGS)" ./cmd/okexchaind
go install -v $(BUILD_FLAGS) -tags "$(BUILD_TAGS)" ./cmd/exchaind

format:
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofmt -w -s

build:
ifeq ($(OS),Windows_NT)
go build $(BUILD_FLAGS) -o build/okexchaind.exe ./cmd/okexchaind
go build $(BUILD_FLAGS) -o build/okexchaincli.exe ./cmd/okexchaincli
go build $(BUILD_FLAGS) -o build/exchaind.exe ./cmd/exchaind
go build $(BUILD_FLAGS) -o build/exchaincli.exe ./cmd/exchaincli
else
go build $(BUILD_FLAGS) -o build/okexchaind ./cmd/okexchaind
go build $(BUILD_FLAGS) -o build/okexchaincli ./cmd/okexchaincli
go build $(BUILD_FLAGS) -o build/exchaind ./cmd/exchaind
go build $(BUILD_FLAGS) -o build/exchaincli ./cmd/exchaincli
endif

build-linux:
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build

build-docker-okexchainnode:
build-docker-exchainnode:
$(MAKE) -C networks/local

# Run a 4-node testnet locally
localnet-start: localnet-stop
@if ! [ -f build/node0/okexchaind/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/okexchaind:Z okexchain/node testnet --v 4 -o . --starting-ip-address 192.168.10.2 --keyring-backend=test ; fi
@if ! [ -f build/node0/exchaind/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/exchaind:Z exchain/node testnet --v 4 -o . --starting-ip-address 192.168.10.2 --keyring-backend=test ; fi
docker-compose up -d

# Stop testnet
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OKExChain
# ExChain
The Infrastructure of Decentralized Exchange

![banner](./docs/images/okexchain-image.jpg)
Expand All @@ -11,16 +11,16 @@ The Infrastructure of Decentralized Exchange
[![LoC](https://tokei.rs/b1/github/okex/okexchain)](https://github.com/okex/okexchain)
[![GolangCI](https://golangci.com/badges/github.com/okex/okexchain.svg)](https://golangci.com/r/github.com/okex/okexchain)

This repository hosts `OKExChain`, the implementation of the OKExChain based on the [Cosmos SDK](https://github.com/cosmos/cosmos-sdk).
This repository hosts `ExChain`, the implementation of the ExChain based on the [Cosmos SDK](https://github.com/cosmos/cosmos-sdk).

**Note**: Requires [Go 1.14](https://golang.org/dl/)

## Getting Started
See the [documentation](https://okexchain-docs.readthedocs.io/en/latest/index.html).

## OKExChain Testnet
## ExChain Testnet

To run a full-node for the testnet of the OKExChain, first [install `okexchaind`](https://okexchain-docs.readthedocs.io/en/latest/getting-start/install-okexchain.html), then follow [the guide](https://okexchain-docs.readthedocs.io/en/latest/getting-start/join-okexchain-testnet.html).
To run a full-node for the testnet of the ExChain, first [install `exchaind`](https://okexchain-docs.readthedocs.io/en/latest/getting-start/install-okexchain.html), then follow [the guide](https://okexchain-docs.readthedocs.io/en/latest/getting-start/join-okexchain-testnet.html).

For status updates and genesis file, see the [genesis](https://okexchain-docs.readthedocs.io/en/latest/getting-start/join-okexchain-testnet.html#genesis-seeds).

Expand Down
4 changes: 2 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ const appName = "OKExChain"

var (
// DefaultCLIHome sets the default home directories for the application CLI
DefaultCLIHome = os.ExpandEnv("$HOME/.okexchaincli")
DefaultCLIHome = os.ExpandEnv("$HOME/.exchaincli")

// DefaultNodeHome sets the folder where the applcation data and configuration will be stored
DefaultNodeHome = os.ExpandEnv("$HOME/.okexchaind")
DefaultNodeHome = os.ExpandEnv("$HOME/.exchaind")

// ModuleBasics defines the module BasicManager is in charge of setting up basic,
// non-dependant module elements, such as codec registration
Expand Down
2 changes: 1 addition & 1 deletion app/rpc/namespaces/personal/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (api *PrivateAccountAPI) NewAccount(password string) (common.Address, error

addr := common.BytesToAddress(info.GetPubKey().Address().Bytes())
api.logger.Info("Your new key was generated", "address", addr.String())
api.logger.Info("Please backup your key file!", "path", os.Getenv("HOME")+"/.okexchaind/"+name)
api.logger.Info("Please backup your key file!", "path", os.Getenv("HOME")+"/.exchaind/"+name)
api.logger.Info("Please remember your password!")
return addr, nil
}
Expand Down
46 changes: 23 additions & 23 deletions app/rpc/tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

KEY1="alice"
KEY2="bob"
CHAINID="okexchainevm-65"
CHAINID="exchainevm-65"
MONIKER="okex"
CURDIR=$(dirname $0)
HOME_BASE=$CURDIR/"_cache_evm"
HOME_SERVER=$HOME_BASE/".okexchaind"
HOME_CLI=$HOME_BASE/".okexchaincli"
HOME_SERVER=$HOME_BASE/".exchaind"
HOME_CLI=$HOME_BASE/".exchaincli"

set -e

function killokexchaind() {
ps -ef | grep "okexchaind" | grep -v grep | grep -v run.sh | awk '{print "kill -9 "$2", "$8}'
ps -ef | grep "okexchaind" | grep -v grep | grep -v run.sh | awk '{print "kill -9 "$2}' | sh
echo "All <okexchaind> killed!"
function killexchaind() {
ps -ef | grep "exchaind" | grep -v grep | grep -v run.sh | awk '{print "kill -9 "$2", "$8}'
ps -ef | grep "exchaind" | grep -v grep | grep -v run.sh | awk '{print "kill -9 "$2}' | sh
echo "All <exchaind> killed!"
}

killokexchaind
killexchaind

# remove existing daemon and client
rm -rf $HOME_BASE
Expand All @@ -26,19 +26,19 @@ cd ../../../
make install
cd ./app/rpc/tests

okexchaincli config keyring-backend test --home $HOME_CLI
exchaincli config keyring-backend test --home $HOME_CLI

# Set up config for CLI
okexchaincli config chain-id $CHAINID --home $HOME_CLI
okexchaincli config output json --home $HOME_CLI
okexchaincli config indent true --home $HOME_CLI
okexchaincli config trust-node true --home $HOME_CLI
exchaincli config chain-id $CHAINID --home $HOME_CLI
exchaincli config output json --home $HOME_CLI
exchaincli config indent true --home $HOME_CLI
exchaincli config trust-node true --home $HOME_CLI
# if $KEY exists it should be deleted
okexchaincli keys add $KEY1 --recover -m "plunge silk glide glass curve cycle snack garbage obscure express decade dirt" --home $HOME_CLI
okexchaincli keys add $KEY2 --recover -m "lazy cupboard wealth canoe pumpkin gasp play dash antenna monitor material village" --home $HOME_CLI
exchaincli keys add $KEY1 --recover -m "plunge silk glide glass curve cycle snack garbage obscure express decade dirt" --home $HOME_CLI
exchaincli keys add $KEY2 --recover -m "lazy cupboard wealth canoe pumpkin gasp play dash antenna monitor material village" --home $HOME_CLI

# Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer)
okexchaind init $MONIKER --chain-id $CHAINID --home $HOME_SERVER
exchaind init $MONIKER --chain-id $CHAINID --home $HOME_SERVER

# Change parameter token denominations to okt
cat $HOME_SERVER/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="okt"' >$HOME_SERVER/config/tmp_genesis.json && mv $HOME_SERVER/config/tmp_genesis.json $HOME_SERVER/config/genesis.json
Expand All @@ -51,21 +51,21 @@ sed -i "" 's/"enable_call": false/"enable_call": true/' $HOME_SERVER/config/gene
sed -i "" 's/"enable_create": false/"enable_create": true/' $HOME_SERVER/config/genesis.json

# Allocate genesis accounts (cosmos formatted addresses)
okexchaind add-genesis-account $(okexchaincli keys show $KEY1 -a --home $HOME_CLI) 1000000000okt --home $HOME_SERVER
okexchaind add-genesis-account $(okexchaincli keys show $KEY2 -a --home $HOME_CLI) 1000000000okt --home $HOME_SERVER
exchaind add-genesis-account $(exchaincli keys show $KEY1 -a --home $HOME_CLI) 1000000000okt --home $HOME_SERVER
exchaind add-genesis-account $(exchaincli keys show $KEY2 -a --home $HOME_CLI) 1000000000okt --home $HOME_SERVER
## Sign genesis transaction
okexchaind gentx --name $KEY1 --keyring-backend test --home $HOME_SERVER --home-client $HOME_CLI
exchaind gentx --name $KEY1 --keyring-backend test --home $HOME_SERVER --home-client $HOME_CLI
# Collect genesis tx
okexchaind collect-gentxs --home $HOME_SERVER
exchaind collect-gentxs --home $HOME_SERVER
# Run this to ensure everything worked and that the genesis file is setup correctly
okexchaind validate-genesis --home $HOME_SERVER
exchaind validate-genesis --home $HOME_SERVER

LOG_LEVEL=main:info,state:info,distr:debug,auth:info,mint:debug,farm:debug

# Start the node (remove the --pruning=nothing flag if historical queries are not needed)

# start node with web3 rest
okexchaind start \
exchaind start \
--pruning=nothing \
--rpc.unsafe \
--rest.laddr tcp://0.0.0.0:8545 \
Expand All @@ -81,7 +81,7 @@ okexchaind start \
#go test ./

# cleanup
#killokexchaind
#killexchaind
#rm -rf $HOME_BASE

exit
8 changes: 4 additions & 4 deletions cmd/client/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ necessary files (private validator, genesis, config, etc.).
Note, strict routability for addresses is turned off in the config file.`,

Example: "okexchaind testnet --v 4 --keyring-backend test --output-dir ./output --starting-ip-address 192.168.10.2",
Example: "exchaind testnet --v 4 --keyring-backend test --output-dir ./output --starting-ip-address 192.168.10.2",
RunE: func(cmd *cobra.Command, _ []string) error {
config := ctx.Config

Expand Down Expand Up @@ -96,8 +96,8 @@ Note, strict routability for addresses is turned off in the config file.`,
cmd.Flags().Int(flagNumValidators, 4, "Number of validators to initialize the testnet with")
cmd.Flags().StringP(flagOutputDir, "o", "./build", "Directory to store initialization data for the testnet")
cmd.Flags().String(flagNodeDirPrefix, "node", "Prefix the directory name for each node with (node results in node0, node1, ...)")
cmd.Flags().String(flagNodeDaemonHome, "okexchaind", "Home directory of the node's daemon configuration")
cmd.Flags().String(flagNodeCLIHome, "okexchaincli", "Home directory of the node's cli configuration")
cmd.Flags().String(flagNodeDaemonHome, "exchaind", "Home directory of the node's daemon configuration")
cmd.Flags().String(flagNodeCLIHome, "exchaincli", "Home directory of the node's cli configuration")
cmd.Flags().String(flagStartingIPAddress, "192.168.0.1", "Starting IP address (192.168.0.1 results in persistent peers list [email protected]:46656, [email protected]:46656, ...)")
cmd.Flags().StringSlice(flagIPAddrs, []string{}, "List of IP addresses to use (i.e. `192.168.0.1,172.168.0.1` results in persistent peers list [email protected]:46656, [email protected])")
cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created")
Expand Down Expand Up @@ -133,7 +133,7 @@ func InitTestnet(
) error {

if chainID == "" {
chainID = fmt.Sprintf("okexchain-%d", tmrand.Int63n(9999999999999)+1)
chainID = fmt.Sprintf("exchain-%d", tmrand.Int63n(9999999999999)+1)
}

if !ethermint.IsValidChainID(chainID) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/okexchaincli/main.go → cmd/exchaincli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ func main() {
config.Seal()

rootCmd := &cobra.Command{
Use: "okexchaincli",
Short: "Command line interface for interacting with okexchaind",
Use: "exchaincli",
Short: "Command line interface for interacting with exchaind",
}

// Add --chain-id to persistent flags and mark it required
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions cmd/okexchaind/main.go → cmd/exchaind/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ func main() {
ctx := server.NewDefaultContext()

rootCmd := &cobra.Command{
Use: "okexchaind",
Short: "OKExChain App Daemon (server)",
Use: "exchaind",
Short: "ExChain App Daemon (server)",
PersistentPreRunE: server.PersistentPreRunEFn(ctx),
}
// CLI commands to initialize the chain
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion cmd/okexchaind/replay.go → cmd/exchaind/replay.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func replayCmd(ctx *server.Context) *cobra.Command {
log.Println("--------- replay success ---------")
},
}
cmd.Flags().StringP(dataDirFlag, "d", ".okexchaind/data", "Directory of block data for replaying")
cmd.Flags().StringP(dataDirFlag, "d", ".exchaind/data", "Directory of block data for replaying")
cmd.Flags().BoolVarP(&state.IgnoreSmbCheck, "ignore-smb", "i", false, "ignore state machine broken")
return cmd
}
Expand Down
File renamed without changes.
Loading

0 comments on commit 7f2aed3

Please sign in to comment.