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

[R4R] change file permissions #853

Merged
merged 19 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 88 additions & 88 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM golang:1.11-alpine AS build-env
ENV PACKAGES make git libc-dev bash gcc linux-headers eudev-dev curl ca-certificates ssh

# Set working directory for the build
WORKDIR /go/src/github.com/binance-chain/node
WORKDIR /go/src/github.com/bnb-chain/node

# Add source files
COPY . .
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ export GO111MODULE = on
PACKAGES=$(shell go list ./...)
COMMIT_HASH := $(shell git rev-parse --short HEAD)

COSMOS_RELEASE := $(shell grep 'github.com/binance-chain/bnc-cosmos-sdk' go.mod |awk '{print $$4}')
TENDER_RELEASE := $(shell grep 'github.com/binance-chain/bnc-tendermint' go.mod| grep -v iavl| awk '{print $$4}')
COSMOS_RELEASE := $(shell grep 'github.com/bnb-chain/bnc-cosmos-sdk' go.mod |awk '{print $$4}')
TENDER_RELEASE := $(shell grep 'github.com/bnb-chain/bnc-tendermint' go.mod| grep -v iavl| awk '{print $$4}')

BUILD_TAGS = netgo

BUILD_CLI_TAGS = netgo
BUILD_FLAGS = -mod=readonly -tags "${BUILD_TAGS}" -ldflags "-X github.com/binance-chain/node/version.GitCommit=${COMMIT_HASH} -X github.com/binance-chain/node/version.CosmosRelease=${COSMOS_RELEASE} -X github.com/binance-chain/node/version.TendermintRelease=${TENDER_RELEASE}"
BUILD_CLI_FLAGS = -tags "${BUILD_CLI_TAGS}" -ldflags "-X github.com/binance-chain/node/version.GitCommit=${COMMIT_HASH} -X github.com/binance-chain/node/version.CosmosRelease=${COSMOS_RELEASE} -X github.com/binance-chain/node/version.TendermintRelease=${TENDER_RELEASE}"
BUILD_FLAGS = -mod=readonly -tags "${BUILD_TAGS}" -ldflags "-w -s -X github.com/bnb-chain/node/version.GitCommit=${COMMIT_HASH} -X github.com/bnb-chain/node/version.CosmosRelease=${COSMOS_RELEASE} -X github.com/bnb-chain/node/version.TendermintRelease=${TENDER_RELEASE}" -trimpath
BUILD_CLI_FLAGS = -tags "${BUILD_CLI_TAGS}" -ldflags "-X github.com/bnb-chain/node/version.GitCommit=${COMMIT_HASH} -X github.com/bnb-chain/node/version.CosmosRelease=${COSMOS_RELEASE} -X github.com/bnb-chain/node/version.TendermintRelease=${TENDER_RELEASE}"
# Without -lstdc++ on CentOS we will encounter link error, solution comes from: https://stackoverflow.com/a/29285011/1147187
BUILD_CGOFLAGS = CGO_ENABLED=1 CGO_LDFLAGS="-lleveldb -lsnappy -lstdc++"
BUILD_CFLAGS = ${BUILD_FLAGS} -tags "cleveldb"
BUILD_TESTNET_FLAGS = ${BUILD_CLI_FLAGS} -ldflags "-X github.com/binance-chain/node/app.Bech32PrefixAccAddr=tbnb"
BUILD_TESTNET_FLAGS = ${BUILD_CLI_FLAGS} -ldflags "-X github.com/bnb-chain/node/app.Bech32PrefixAccAddr=tbnb"

UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
BinanceChain
BNB Beacon Chain
------------

BinanceChain is a blockchain with a flexible set of native assets and pluggable modules. It uses [tendermint](https://tendermint.com) for consensus and app logic is written in golang. It targets fast block times, a native dApp layer and multi-token support with no smart contract VM.
BNB Beacon Chain is a blockchain with a flexible set of native assets and pluggable modules. It uses [tendermint](https://tendermint.com) for consensus and app logic is written in golang. It targets fast block times, a native dApp layer and multi-token support with no smart contract VM.

This is a fork of [basecoin](https://github.com/cosmos/cosmos-sdk/tree/master/examples/basecoin) and is already functional as a multi-asset cryptocurrency blockchain and DEX; see below for instructions on how to use it.

Expand Down Expand Up @@ -30,15 +30,15 @@ If you do not have golang yet, please [install it](https://golang.org/dl) or use
```bash
$ export GOPATH=~/go
$ export PATH=~/go/bin:$PATH
$ export BNBCHAINPATH=~/go/src/github.com/binance-chain/node
$ export BNBCHAINPATH=~/go/src/github.com/bnb-chain/node
$ mkdir -p $BNBCHAINPATH
$ git clone [email protected]:binance-chain/node.git $BNBCHAINPATH
$ git clone [email protected]:bnb-chain/node.git $BNBCHAINPATH
$ cd $BNBCHAINPATH
$ make get_vendor_deps
$ make install
```

> If you want run bnbchaind with cleveldb as backend, please ensure leveldb is installed: https://github.com/google/leveldb#building,
> If you want run bnbchaind with cleveldb as backend, please ensure leveldb is installed: https://github.com/google/leveldb#building,
> and change `make install` to `make install_c`
> For mac, `brew install leveldb` would help. For linux, you can build from source

Expand All @@ -50,13 +50,13 @@ You may need add BNBCHAINPATH to the environment variables.

```bat
> md %BNBCHAINPATH%
> git clone [email protected]:binance-chain/node.git %BNBCHAINPATH%
> git clone [email protected]:bnb-chain/node.git %BNBCHAINPATH%
> cd %BNBCHAINPATH%
> make get_vendor_deps
> make install
```

> If you encounter some network issues when downloading the dependencies, make sure you have configured shadowsocks correctly and switch to global mode. Run `set(win)/export(linux/mac) https_proxy=127.0.0.1:1080` if you still have https issues.
> If you encounter some network issues when downloading the dependencies, make sure you have configured shadowsocks correctly and switch to global mode. Run `set(win)/export(linux/mac) https_proxy=127.0.0.1:1080` if you still have https issues.

To test that installation worked, try to run the cli tool:

Expand Down
24 changes: 16 additions & 8 deletions admin/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@ package admin

import (
"fmt"
"math/rand"
"strconv"
"time"
"math/big"

"crypto/rand"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/viper"

"github.com/binance-chain/node/wire"
"github.com/bnb-chain/node/wire"
)

const (
flagPVPath = "pvpath"
errRandF = "failed to generate random int with error: %s"
randMax = 2147483647
)

func AddCommands(cmd *cobra.Command, cdc *wire.Codec) {
Expand Down Expand Up @@ -50,8 +52,11 @@ func setModeCmd(cdc *wire.Codec) *cobra.Command {
mode := args[0]
if mode == "0" || mode == "1" || mode == "2" {
cliCtx := context.NewCLIContext().WithCodec(cdc)
rand.Seed(time.Now().UnixNano())
nonce := strconv.Itoa(rand.Int())
nonceB, err := rand.Int(rand.Reader, big.NewInt(randMax))
if err != nil {
return fmt.Errorf(errRandF, err.Error())
}
nonce := nonceB.Bytes()
sig, err := privKey.Sign([]byte(nonce))
if err != nil {
return err
Expand Down Expand Up @@ -85,8 +90,11 @@ func getModeCmd(cdc *wire.Codec) *cobra.Command {
}

cliCtx := context.NewCLIContext().WithCodec(cdc)
rand.Seed(time.Now().UnixNano())
nonce := strconv.Itoa(rand.Int())
nonceB, err := rand.Int(rand.Reader, big.NewInt(randMax))
if err != nil {
return fmt.Errorf(errRandF, err.Error())
}
nonce := nonceB.Bytes()
sig, err := privKey.Sign([]byte(nonce))
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions admin/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/config"

"github.com/binance-chain/node/common/runtime"
"github.com/binance-chain/node/common/types"
"github.com/bnb-chain/node/common/runtime"
"github.com/bnb-chain/node/common/types"
)

// path:
Expand Down
24 changes: 12 additions & 12 deletions admin/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/bank"

"github.com/binance-chain/node/common/runtime"
"github.com/binance-chain/node/plugins/account"
"github.com/binance-chain/node/plugins/bridge"
"github.com/binance-chain/node/plugins/dex/order"
list "github.com/binance-chain/node/plugins/dex/types"
"github.com/binance-chain/node/plugins/tokens/burn"
"github.com/binance-chain/node/plugins/tokens/freeze"
"github.com/binance-chain/node/plugins/tokens/issue"
"github.com/binance-chain/node/plugins/tokens/ownership"
"github.com/binance-chain/node/plugins/tokens/seturi"
"github.com/binance-chain/node/plugins/tokens/swap"
"github.com/binance-chain/node/plugins/tokens/timelock"
"github.com/bnb-chain/node/common/runtime"
"github.com/bnb-chain/node/plugins/account"
"github.com/bnb-chain/node/plugins/bridge"
"github.com/bnb-chain/node/plugins/dex/order"
list "github.com/bnb-chain/node/plugins/dex/types"
"github.com/bnb-chain/node/plugins/tokens/burn"
"github.com/bnb-chain/node/plugins/tokens/freeze"
"github.com/bnb-chain/node/plugins/tokens/issue"
"github.com/bnb-chain/node/plugins/tokens/ownership"
"github.com/bnb-chain/node/plugins/tokens/seturi"
"github.com/bnb-chain/node/plugins/tokens/swap"
"github.com/bnb-chain/node/plugins/tokens/timelock"
)

var transferOnlyModeBlackList = []string{
Expand Down
2 changes: 1 addition & 1 deletion app/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"

common "github.com/binance-chain/node/common/types"
common "github.com/bnb-chain/node/common/types"
)

func BenchmarkGetAccount(b *testing.B) {
Expand Down
54 changes: 24 additions & 30 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,30 @@ import (
tmstore "github.com/tendermint/tendermint/store"
tmtypes "github.com/tendermint/tendermint/types"

"github.com/binance-chain/node/admin"
"github.com/binance-chain/node/app/config"
"github.com/binance-chain/node/app/pub"
appsub "github.com/binance-chain/node/app/pub/sub"
"github.com/binance-chain/node/common"
"github.com/binance-chain/node/common/runtime"
"github.com/binance-chain/node/common/tx"
"github.com/binance-chain/node/common/types"
"github.com/binance-chain/node/common/upgrade"
"github.com/binance-chain/node/common/utils"
"github.com/binance-chain/node/plugins/account"
"github.com/binance-chain/node/plugins/bridge"
bTypes "github.com/binance-chain/node/plugins/bridge/types"
"github.com/binance-chain/node/plugins/dex"
"github.com/binance-chain/node/plugins/dex/list"
"github.com/binance-chain/node/plugins/dex/order"
dextypes "github.com/binance-chain/node/plugins/dex/types"
"github.com/binance-chain/node/plugins/tokens"
"github.com/binance-chain/node/plugins/tokens/issue"
"github.com/binance-chain/node/plugins/tokens/ownership"
"github.com/binance-chain/node/plugins/tokens/seturi"
"github.com/binance-chain/node/plugins/tokens/swap"
"github.com/binance-chain/node/plugins/tokens/timelock"
"github.com/binance-chain/node/wire"
"github.com/bnb-chain/node/admin"
"github.com/bnb-chain/node/app/config"
"github.com/bnb-chain/node/app/pub"
appsub "github.com/bnb-chain/node/app/pub/sub"
"github.com/bnb-chain/node/common"
"github.com/bnb-chain/node/common/runtime"
"github.com/bnb-chain/node/common/tx"
"github.com/bnb-chain/node/common/types"
"github.com/bnb-chain/node/common/upgrade"
"github.com/bnb-chain/node/common/utils"
"github.com/bnb-chain/node/plugins/account"
"github.com/bnb-chain/node/plugins/bridge"
bTypes "github.com/bnb-chain/node/plugins/bridge/types"
"github.com/bnb-chain/node/plugins/dex"
"github.com/bnb-chain/node/plugins/dex/list"
"github.com/bnb-chain/node/plugins/dex/order"
dextypes "github.com/bnb-chain/node/plugins/dex/types"
"github.com/bnb-chain/node/plugins/tokens"
"github.com/bnb-chain/node/plugins/tokens/issue"
"github.com/bnb-chain/node/plugins/tokens/ownership"
"github.com/bnb-chain/node/plugins/tokens/seturi"
"github.com/bnb-chain/node/plugins/tokens/swap"
"github.com/bnb-chain/node/plugins/tokens/timelock"
"github.com/bnb-chain/node/wire"
)

const (
Expand Down Expand Up @@ -521,7 +521,6 @@ func (app *BinanceChain) initStaking() {
MinDelegationChange: 1e8,
})
app.stakeKeeper.SetPool(newCtx, stake.Pool{
// TODO: optimize these parameters
LooseTokens: sdk.NewDec(5e15),
})
})
Expand Down Expand Up @@ -755,10 +754,6 @@ func (app *BinanceChain) PreDeliverTx(req abci.RequestDeliverTx) (res abci.Respo
if res.IsErr() {
txHash := cmn.HexBytes(tmhash.Sum(req.Tx)).String()
app.Logger.Error("failed to process invalid tx during pre-deliver", "tx", txHash, "res", res.String())
// TODO(#446): comment out temporally for thread safety
//if app.publicationConfig.PublishOrderUpdates {
// app.processErrAbciResponseForPub(txBytes)
//}
}
return res
}
Expand Down Expand Up @@ -855,7 +850,6 @@ func (app *BinanceChain) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) a
pub.Pool.Clean()
//match may end with transaction failure, which is better to save into
//the EndBlock response. However, current cosmos doesn't support this.
//future TODO: add failure info.
return abci.ResponseEndBlock{
ValidatorUpdates: validatorUpdates,
Events: ctx.EventManager().ABCIEvents(),
Expand Down
8 changes: 4 additions & 4 deletions app/app_paramhub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ import (
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/stake"

ctypes "github.com/binance-chain/node/common/types"
"github.com/binance-chain/node/plugins/dex"
"github.com/binance-chain/node/plugins/tokens"
"github.com/binance-chain/node/wire"
ctypes "github.com/bnb-chain/node/common/types"
"github.com/bnb-chain/node/plugins/dex"
"github.com/bnb-chain/node/plugins/tokens"
"github.com/bnb-chain/node/wire"
)

// util objects
Expand Down
14 changes: 7 additions & 7 deletions app/app_pub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import (
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"

"github.com/binance-chain/node/app/config"
"github.com/binance-chain/node/app/pub"
appsub "github.com/binance-chain/node/app/pub/sub"
"github.com/binance-chain/node/common/testutils"
orderPkg "github.com/binance-chain/node/plugins/dex/order"
dextypes "github.com/binance-chain/node/plugins/dex/types"
"github.com/binance-chain/node/wire"
"github.com/bnb-chain/node/app/config"
"github.com/bnb-chain/node/app/pub"
appsub "github.com/bnb-chain/node/app/pub/sub"
"github.com/bnb-chain/node/common/testutils"
orderPkg "github.com/bnb-chain/node/plugins/dex/order"
dextypes "github.com/bnb-chain/node/plugins/dex/types"
"github.com/bnb-chain/node/wire"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"

"github.com/binance-chain/node/common/testutils"
"github.com/bnb-chain/node/common/testutils"
)

func TearDown() {
Expand Down
10 changes: 5 additions & 5 deletions app/apptest/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import (
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"

"github.com/binance-chain/node/app"
common "github.com/binance-chain/node/common/types"
"github.com/binance-chain/node/plugins/dex"
"github.com/binance-chain/node/plugins/tokens"
"github.com/binance-chain/node/wire"
"github.com/bnb-chain/node/app"
common "github.com/bnb-chain/node/common/types"
"github.com/bnb-chain/node/plugins/dex"
"github.com/bnb-chain/node/plugins/tokens"
"github.com/bnb-chain/node/wire"
)

type TestClient struct {
Expand Down
4 changes: 2 additions & 2 deletions app/apptest/match_allocation_cancel_new_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/stretchr/testify/assert"
abci "github.com/tendermint/tendermint/abci/types"

"github.com/binance-chain/node/common/utils"
"github.com/binance-chain/node/plugins/dex/order"
"github.com/bnb-chain/node/common/utils"
"github.com/bnb-chain/node/plugins/dex/order"
)

/*
Expand Down
4 changes: 2 additions & 2 deletions app/apptest/match_allocation_cancel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/stretchr/testify/assert"
abci "github.com/tendermint/tendermint/abci/types"

"github.com/binance-chain/node/common/utils"
"github.com/binance-chain/node/plugins/dex/order"
"github.com/bnb-chain/node/common/utils"
"github.com/bnb-chain/node/plugins/dex/order"
)

/*
Expand Down
6 changes: 3 additions & 3 deletions app/apptest/match_allocation_expire_new_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"github.com/stretchr/testify/assert"
abci "github.com/tendermint/tendermint/abci/types"

"github.com/binance-chain/node/common/utils"
"github.com/binance-chain/node/plugins/dex/matcheng"
"github.com/binance-chain/node/plugins/dex/order"
"github.com/bnb-chain/node/common/utils"
"github.com/bnb-chain/node/plugins/dex/matcheng"
"github.com/bnb-chain/node/plugins/dex/order"
)

/*
Expand Down
4 changes: 2 additions & 2 deletions app/apptest/match_allocation_expire_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/stretchr/testify/assert"
abci "github.com/tendermint/tendermint/abci/types"

"github.com/binance-chain/node/common/utils"
"github.com/binance-chain/node/plugins/dex/order"
"github.com/bnb-chain/node/common/utils"
"github.com/bnb-chain/node/plugins/dex/order"
)

/*
Expand Down
6 changes: 3 additions & 3 deletions app/apptest/match_allocation_fill_new_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"github.com/stretchr/testify/assert"
abci "github.com/tendermint/tendermint/abci/types"

"github.com/binance-chain/node/common/utils"
"github.com/binance-chain/node/plugins/dex/matcheng"
"github.com/binance-chain/node/plugins/dex/order"
"github.com/bnb-chain/node/common/utils"
"github.com/bnb-chain/node/plugins/dex/matcheng"
"github.com/bnb-chain/node/plugins/dex/order"
)

/*
Expand Down
4 changes: 2 additions & 2 deletions app/apptest/match_allocation_fill_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/stretchr/testify/assert"
abci "github.com/tendermint/tendermint/abci/types"

"github.com/binance-chain/node/common/utils"
"github.com/binance-chain/node/plugins/dex/order"
"github.com/bnb-chain/node/common/utils"
"github.com/bnb-chain/node/plugins/dex/order"
)

/*
Expand Down
Loading