Skip to content

Commit

Permalink
Problem: Ledger is not enabled and does not work with Crypto.org Chai…
Browse files Browse the repository at this point in the history
…n Ledger app (#149)

* Problem: Ledger is not enabled and does not work with Crypto.org Chain Ledger app

Solution: (Fix #147) (Fix #148) Add build flag with Crypto.org Chain BIP44 coin type

* Fix lint issues

* Reverted changes regarding coin type

* Enable Ledger build by default

* Fix Makefile

* enable ledger in goreleaser

Co-authored-by: HuangYi <huang@crypto.com>
  • Loading branch information
calvinaco and yihuang authored Oct 13, 2021
1 parent 20cc161 commit 52bf447
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 10 deletions.
10 changes: 5 additions & 5 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ builds:
goarch:
- amd64
flags:
- -tags=testnet,cgo
- -tags=testnet,ledger,cgo
ldflags:
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=cronos -X github.com/cosmos/cosmos-sdk/version.AppName=cronosd -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}}
- id: "cronosd-darwin-arm64"
Expand All @@ -30,7 +30,7 @@ builds:
goarch:
- arm64
flags:
- -tags=testnet,cgo
- -tags=testnet,ledger,cgo
ldflags:
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=cronos -X github.com/cosmos/cosmos-sdk/version.AppName=cronosd -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}}
- id: "cronosd-linux"
Expand All @@ -45,7 +45,7 @@ builds:
goarch:
- amd64
flags:
- -tags=testnet,cgo
- -tags=testnet,ledger,cgo
ldflags:
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=cronos -X github.com/cosmos/cosmos-sdk/version.AppName=cronosd -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}}
- id: "cronosd-linux-arm64"
Expand All @@ -60,7 +60,7 @@ builds:
goarch:
- arm64
flags:
- -tags=testnet,cgo
- -tags=testnet,ledger,cgo
ldflags:
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=cronos -X github.com/cosmos/cosmos-sdk/version.AppName=cronosd -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}}
- id: "cronosd-windows"
Expand All @@ -75,7 +75,7 @@ builds:
goarch:
- amd64
flags:
- -tags=testnet,cgo
- -tags=testnet,ledger,cgo
- -buildmode=exe
ldflags:
- -s -w -X github.com/cosmos/cosmos-sdk/version.Name=cronos -X github.com/cosmos/cosmos-sdk/version.AppName=cronosd -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}} -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}}
Expand Down
40 changes: 36 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,45 @@ COVERAGE ?= coverage.txt
GOPATH ?= $(shell $(GO) env GOPATH)
BINDIR ?= ~/go/bin
NETWORK ?= mainnet
LEDGER_ENABLED ?= true

TESTNET_FLAGS ?=

ifeq ($(NETWORK),testnet)
BUILD_TAGS := -tags testnet
BUILD_TAGS := -tags
ifeq ($(NETWORK),mainnet)
BUILD_TAGS := $(BUILD_TAGS) mainnet
else ifeq ($(NETWORK),testnet)
BUILD_TAGS := $(BUILD_TAGS) testnet
endif

ifeq ($(LEDGER_ENABLED),true)
ifeq ($(OS),Windows_NT)
GCCEXE = $(shell where gcc.exe 2> NUL)
ifeq ($(GCCEXE),)
$(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
BUILD_TAGS := $(BUILD_TAGS),ledger
endif
else
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S),OpenBSD)
$(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988))
else
GCC = $(shell command -v gcc 2> /dev/null)
ifeq ($(GCC),)
$(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false)
else
BUILD_TAGS := $(BUILD_TAGS),ledger
endif
endif
endif
endif

all: build
build: check-network go.sum
build: check-network print-ledger go.sum
@go build -mod=readonly $(BUILD_FLAGS) $(BUILD_TAGS) -o $(BUILDDIR)/cronosd ./cmd/cronosd

install: check-network go.sum
install: check-network print-ledger go.sum
@go install -mod=readonly $(BUILD_FLAGS) $(BUILD_TAGS) ./cmd/cronosd

test:
Expand Down Expand Up @@ -194,6 +221,11 @@ else
endif
@echo "building network: ${NETWORK}"

print-ledger:
ifeq ($(LEDGER_ENABLED),true)
@echo "building with ledger support"
endif

###############################################################################
### Protobuf ###
###############################################################################
Expand Down
1 change: 0 additions & 1 deletion app/prefix.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

func SetConfig() {
config := sdk.GetConfig()
// use the configurations from ethermint
cmdcfg.SetBech32Prefixes(config)
ethcfg.SetBip44CoinType(config)
// Make sure address is compatible with ethereum
Expand Down

0 comments on commit 52bf447

Please sign in to comment.