Skip to content

Commit

Permalink
feat: continue sdk upgrade with krypton logic
Browse files Browse the repository at this point in the history
  • Loading branch information
johnletey committed May 6, 2024
1 parent d47d46a commit ea47c88
Show file tree
Hide file tree
Showing 56 changed files with 1,872 additions and 8,723 deletions.
14 changes: 3 additions & 11 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ defaults:
- "{{ author }}"

pull_request_rules:
- name: backport patches to v4.0.x branch
conditions:
- base=main
- label=backport/v4.0.x
actions:
backport:
branches:
- release/v4.0.x
- name: backport patches to v4.1.x branch
conditions:
- base=main
Expand All @@ -22,11 +14,11 @@ pull_request_rules:
backport:
branches:
- release/v4.1.x
- name: backport patches to v5.0.x branch
- name: backport patches to v5.x branch
conditions:
- base=main
- label=backport/v5.0.x
- label=backport/v5.x
actions:
backport:
branches:
- release/v5.0.x
- v5.x
4 changes: 2 additions & 2 deletions .github/workflows/e2e-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: strangelove-ventures/[email protected]
with:
registry: "" # empty registry, image only shared for e2e testing
tag: local # emulate local environment for consistency in interchaintest cases
tag: local # emulate local environment for consistency in e2e cases
tar-export-path: ${{ env.TAR_PATH }} # export a tarball that can be uploaded as an artifact for the e2e jobs
platform: linux/amd64 # test runner architecture only
git-ref: ${{ github.head_ref }} # source code ref
Expand Down Expand Up @@ -85,4 +85,4 @@ jobs:
run: docker image load -i ${{ env.TAR_PATH }}

- name: run test
run: cd interchaintest && go test -race -v -timeout 30m -run ^${{ matrix.test }}$ .
run: cd e2e && go test -race -v -timeout 30m -run ^${{ matrix.test }}$ .
12 changes: 3 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
vue/node_modules
vue/dist
release/
.idea/
.vscode/
.DS_Store
play_sh/
/heighliner*
bin/
.duke
.idea
bin
143 changes: 26 additions & 117 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,147 +1,56 @@
#!/usr/bin/make -f

BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
COMMIT := $(shell git log -1 --format='%H')
DOCKER := $(shell which docker)
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf

# don't override user values
ifeq (,$(VERSION))
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
# if VERSION is empty, then populate it with branch's name and raw commit hash
VERSION := $(shell git describe --exact-match 2>/dev/null)
ifeq (,$(VERSION))
VERSION := $(BRANCH)-$(COMMIT)
endif
endif

CHAIN_NAME = noble
DAEMON_NAME = nobled

LEDGER_ENABLED ?= true
TM_VERSION := $(shell go list -m github.com/cometbft/cometbft | sed 's:.* ::')
BUILDDIR ?= $(CURDIR)/build

export GO111MODULE = on

# process build tags

build_tags = netgo
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)
ifeq ($(shell git status --porcelain),)
VERSION := $(BRANCH)
else
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 += ledger
endif
VERSION := $(BRANCH):dirty
endif
endif
endif

build_tags += $(BUILD_TAGS)
build_tags := $(strip $(build_tags))

whitespace :=
whitespace += $(whitespace)
comma := ,
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))

# process linker flags

ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=$(CHAIN_NAME) \
-X github.com/cosmos/cosmos-sdk/version.AppName=$(DAEMON_NAME) \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \
-X github.com/cometbft/cometbft/version.TMCoreSemVer=$(TM_VERSION)

ldflags += $(LDFLAGS)
ldflags := $(LDFLAGS)
ldflags += -X github.com/cosmos/cosmos-sdk/version.Name=noble \
-X github.com/cosmos/cosmos-sdk/version.AppName=nobled \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger
ldflags := $(strip $(ldflags))

BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'

BUILD_FLAGS := -tags 'netgo ledger' -ldflags '$(ldflags)'

###############################################################################
### Building / Install ###
### Build ###
###############################################################################

all: install

install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/nobled

build:
go build $(BUILD_FLAGS) -o bin/nobled ./cmd/nobled

@go build -mod=readonly $(BUILD_FLAGS) -o $(PWD)/bin/ ./cmd/nobled

###############################################################################
### Linting ###
### Formatting & Linting ###
###############################################################################

lint:
@echo "--> Running linter"
@go run github.com/golangci/golangci-lint/cmd/golangci-lint run --timeout=10m



###############################################################################
### INTERCHAINTEST (ictest) ###
###############################################################################

test:
go test -v -race ./...

###############################################################################
### Build Image ###
###############################################################################
get-heighliner:
git clone https://github.com/strangelove-ventures/heighliner.git
cd heighliner && go install
gofumpt_cmd=mvdan.cc/gofumpt
golangci_lint_cmd=github.com/golangci/golangci-lint/cmd/golangci-lint

local-image:
ifeq (,$(shell which heighliner))
echo 'heighliner' binary not found. Consider running `make get-heighliner`
else
heighliner build -c noble --local -f ./chains.yaml
endif
format:
@echo "πŸ€– Running formatter..."
@go run $(gofumpt_cmd) -l -w .
@echo "βœ… Completed formatting!"

.PHONY: all build-linux install lint test \
go-mod-cache build interchaintest get-heighliner local-image \
lint:
@echo "πŸ€– Running linter..."
@go run $(golangci_lint_cmd) run --timeout=10m
@echo "βœ… Completed linting!"

###############################################################################
### Protobuf ###
### Testing ###
###############################################################################

BUF_VERSION=1.30.0
BUILDER_VERSION=0.14.0

proto-all: proto-format proto-lint proto-gen

proto-format:
@echo "πŸ€– Running protobuf formatter..."
@docker run --rm --volume "$(PWD)":/workspace --workdir /workspace \
bufbuild/buf:$(BUF_VERSION) format --diff --write
@echo "βœ… Completed protobuf formatting!"

proto-gen:
@echo "πŸ€– Generating code from protobuf..."
@docker run --rm --volume "$(PWD)":/workspace --workdir /workspace \
ghcr.io/cosmos/proto-builder:$(BUILDER_VERSION) sh ./proto/generate.sh
@echo "βœ… Completed code generation!"

proto-lint:
@echo "πŸ€– Running protobuf linter..."
@docker run --rm --volume "$(PWD)":/workspace --workdir /workspace \
bufbuild/buf:$(BUF_VERSION) lint
@echo "βœ… Completed protobuf linting!"
# TODO(@john): Add "local-image" command!
Loading

0 comments on commit ea47c88

Please sign in to comment.