Skip to content

Commit be5ffe8

Browse files
authored
Merge pull request #248 from permissionlessweb/v019
V019
2 parents 2aef6ec + 378d970 commit be5ffe8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+10128
-622
lines changed

.github/workflows/build_docker.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/interchaintest-e2e.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ jobs:
5959
# names of `make` commands to run tests
6060
test:
6161
- "e2e-basic"
62-
# - "e2e-pfm"
63-
# - "e2e-polytone"
62+
- "e2e-pfm"
63+
- "e2e-polytone"
6464
# - "e2e-upgrade"
6565
fail-fast: false
6666

6767
steps:
6868
- name: Set up Go ${{ env.GO_VERSION }}
69-
uses: actions/setup-go@v5
69+
uses: actions/setup-go@v4
7070
with:
7171
go-version: ${{ env.GO_VERSION }}
7272
cache-dependency-path: interchaintest/go.sum

.github/workflows/push-docker-image.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818

1919
name: Push Docker Images
2020

21+
env:
22+
DOCKER_REPOSITORY: bitsongofficial/go-bitsong
23+
RUNNER_BASE_IMAGE_DISTROLESS: gcr.io/distroless/static-debian11
24+
RUNNER_BASE_IMAGE_NONROOT: gcr.io/distroless/static-debian11:nonroot
25+
RUNNER_BASE_IMAGE_ALPINE: alpine:3.17
26+
2127
on:
2228
release:
2329
types: [published, created, edited]
@@ -26,7 +32,7 @@ on:
2632
- 'v[0-9]+.[0-9]+.[0-9]+' # ignore rc
2733

2834
jobs:
29-
terp-images:
35+
bitsong-images:
3036
runs-on: ubuntu-latest
3137
steps:
3238
-

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Create release 📜
3030
uses: goreleaser/goreleaser-action@v3.0.0
3131
with:
32-
args: release --rm-dist
32+
args: release
3333
env:
3434
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3535

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ coverage.txt
2525
profile.out
2626

2727
# heighliner
28-
heighliner
28+
heighliner/
2929

3030
# Vagrant
3131
.vagrant/
@@ -51,4 +51,5 @@ data
5151
state_export.json
5252

5353
github.com*
54-
gogoproto*
54+
gogoproto*
55+
target/

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# docker build . -t cosmoscontracts/juno:latest
2-
# docker run --rm -it cosmoscontracts/juno:latest /bin/sh
1+
# docker build . -t bitsongofficial/go-bitsong:latest
2+
# docker run --rm -it bitsongofficial/go-bitsong:latest /bin/sh
33
FROM golang:1.22-alpine AS go-builder
44

55
# this comes from standard alpine nightly file
@@ -29,17 +29,17 @@ RUN set -eux; \
2929
COPY . /code/
3030

3131
# force it to use static lib (from above) not standard libgo_cosmwasm.so file
32-
# then log output of file /code/bin/junod
32+
# then log output of file /code/build/bitsongd
3333
# then ensure static linking
3434
RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build \
35-
&& file /code/bin/bitsongd \
35+
&& file /code/build/bitsongd \
3636
&& echo "Ensuring binary is statically linked ..." \
37-
&& (file /code/bin/bitsongd | grep "statically linked")
37+
&& (file /code/build/bitsongd | grep "statically linked")
3838

3939
# --------------------------------------------------------
4040
FROM alpine:3.16
4141

42-
COPY --from=go-builder /code/bin/bitsongd /usr/bin/bitsongd
42+
COPY --from=go-builder /code/build/bitsongd /usr/bin/bitsongd
4343

4444
ENV HOME=/bitsongd
4545
WORKDIR $HOME

Makefile

Lines changed: 9 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/usr/bin/make -f
22

33
include scripts/makefiles/build.mk
4+
include scripts/makefiles/docker.mk
45
include scripts/makefiles/e2e.mk
56
include scripts/makefiles/hl.mk
6-
include scripts/makefiles/docker.mk
7+
include scripts/makefiles/proto.mk
8+
include scripts/makefiles/localnet.mk
79
include contrib/devtools/Makefile
810

911
.DEFAULT_GOAL := help
@@ -14,9 +16,11 @@ help:
1416
@echo " make [command]"
1517
@echo ""
1618
@echo " make build Build Bitsong node binary"
17-
@echo " make install Install Bitsong node binary"
18-
@echo " make hl Show available docker commands (via Strangelove's Heighliner Tooling)"
19+
@echo " make docker Show available docker related commands"
1920
@echo " make e2e Show available e2e commands"
21+
@echo " make hl Show available docker commands (via Strangelove's Heighliner Tooling)"
22+
@echo " make install Install Bitsong node binary"
23+
@echo " make localnet Show available localnet commands"
2024
@echo ""
2125
@echo "Run 'make [subcommand]' to see the available commands for each subcommand."
2226

@@ -39,8 +43,6 @@ TENDERMINT_VERSION := $(shell go list -m github.com/cometbft/cometbft | sed 's:.
3943
DOCKER := $(shell which docker)
4044
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf
4145

42-
E2E_UPGRADE_VERSION := "v0.18.0"
43-
4446
GO_MODULE := $(shell cat go.mod | grep "module " | cut -d ' ' -f 2)
4547
GO_VERSION := $(shell cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2)
4648
GO_MAJOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1)
@@ -98,7 +100,6 @@ comma := ,
98100
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))
99101

100102
# process linker flags
101-
102103
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=go-bitsong \
103104
-X github.com/cosmos/cosmos-sdk/version.AppName=bitsongd \
104105
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
@@ -116,59 +117,18 @@ endif
116117
ldflags += $(LDFLAGS)
117118
ldflags := $(strip $(ldflags))
118119

119-
BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)' -trimpath
120-
121-
all: install tools lint
120+
BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
122121

123122
build: go.sum
124123
ifeq ($(OS),Windows_NT)
125124
go build -mod=readonly $(BUILD_FLAGS) -o build/bitsongd.exe ./cmd/bitsongd
126125
else
127-
go build $(BUILD_FLAGS) -o bin/bitsongd ./cmd/bitsongd
126+
go build $(BUILD_FLAGS) -o build/bitsongd ./cmd/bitsongd
128127
endif
129128

130-
build-linux: go.sum
131-
go build $(BUILD_FLAGS)
132-
133129
install: go.sum
134130
go install -mod=readonly $(BUILD_FLAGS) ./cmd/bitsongd
135131

136-
#update-swagger-docs: statik
137-
# $(BINDIR)/statik -src=swagger/swagger-ui -dest=swagger -f -m
138-
# @if [ -n "$(git status --porcelain)" ]; then \
139-
# echo "\033[91mSwagger docs are out of sync!!!\033[0m";\
140-
# exit 1;\
141-
# else \
142-
# echo "\033[92mSwagger docs are in sync\033[0m";\
143-
# fi
144-
145-
###############################################################################
146-
### Localnet ###
147-
###############################################################################
148-
149-
build-docker-go-bitsong:
150-
$(MAKE) -C contrib/localnet
151-
152-
# Run a 4-node testnet locally
153-
localnet-start: build-linux build-docker-bitsongdnode
154-
@if ! [ -f build/node0/bitsongd/config/genesis.json ]; \
155-
then docker run --rm -v $(CURDIR)/build:/bitsongd:Z bitsongofficial/bitsongdnode testnet --v 4 -o . --starting-ip-address 192.168.10.2 --keyring-backend=test ; \
156-
fi
157-
docker-compose up -d
158-
159-
# Stop testnet
160-
localnet-stop:
161-
docker-compose down
162-
163-
test-docker:
164-
@docker build -f contrib/Dockerfile.test -t ${TEST_DOCKER_REPO}:$(shell git rev-parse --short HEAD) .
165-
@docker tag ${TEST_DOCKER_REPO}:$(shell git rev-parse --short HEAD) ${TEST_DOCKER_REPO}:$(shell git rev-parse --abbrev-ref HEAD | sed 's#/#_#g')
166-
@docker tag ${TEST_DOCKER_REPO}:$(shell git rev-parse --short HEAD) ${TEST_DOCKER_REPO}:latest
167-
168-
test-docker-push: test-docker
169-
@docker push ${TEST_DOCKER_REPO}:$(shell git rev-parse --short HEAD)
170-
@docker push ${TEST_DOCKER_REPO}:$(shell git rev-parse --abbrev-ref HEAD | sed 's#/#_#g')
171-
@docker push ${TEST_DOCKER_REPO}:latest
172132

173133

174134
########################################
@@ -193,76 +153,6 @@ clean:
193153
distclean: clean
194154
rm -rf vendor/
195155

196-
###############################################################################
197-
### Protobuf ###
198-
###############################################################################
199-
200-
containerProtoVer=v0.2
201-
containerProtoImage=tendermintdev/sdk-proto-gen:$(containerProtoVer)
202-
containerProtoGen=cosmos-sdk-proto-gen-$(containerProtoVer)
203-
containerProtoGenSwagger=cosmos-sdk-proto-gen-swagger-$(containerProtoVer)
204-
containerProtoFmt=cosmos-sdk-proto-fmt-$(containerProtoVer)
205-
206-
proto-all: proto-format proto-lint proto-gen
207-
208-
proto-gen:
209-
@echo "Generating Protobuf files"
210-
$(DOCKER) run --rm --name $(containerProtoGen) \
211-
-v $(CURDIR):/workspace \
212-
--workdir /workspace \
213-
$(containerProtoImage) sh ./scripts/protocgen.sh
214-
215-
# This generates the SDK's custom wrapper for google.protobuf.Any. It should only be run manually when needed
216-
proto-gen-any:
217-
@echo "Generating Protobuf Any"
218-
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) sh ./scripts/protocgen-any.sh
219-
220-
#proto-swagger-gen:
221-
# @echo "Generating Protobuf Swagger"
222-
# $(DOCKER) run --rm --name $(containerProtoGenSwagger) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) sh ./scripts/protoc-swagger-gen.sh
223-
224-
proto-format:
225-
@echo "Formatting Protobuf files"
226-
$(DOCKER) run --rm --name $(containerProtoFmt) \
227-
--user $(shell id -u):$(shell id -g) \
228-
-v $(CURDIR):/workspace \
229-
--workdir /workspace \
230-
tendermintdev/docker-build-proto find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;
231-
232-
proto-lint:
233-
@$(DOCKER_BUF) lint --error-format=json
234-
235-
proto-check-breaking:
236-
@$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=master
237-
238-
GOGO_PROTO_URL = https://raw.githubusercontent.com/regen-network/protobuf/cosmos
239-
GOOGLE_PROTO_URL = https://raw.githubusercontent.com/googleapis/googleapis/master
240-
REGEN_COSMOS_PROTO_URL = https://raw.githubusercontent.com/regen-network/cosmos-proto/master
241-
COSMOS_PROTO_URL = https://raw.githubusercontent.com/cosmos/cosmos-sdk/v0.45.4/proto/cosmos
242-
243-
GOGO_PROTO_TYPES = third_party/proto/gogoproto
244-
GOOGLE_PROTO_TYPES = third_party/proto/google
245-
REGEN_COSMOS_PROTO_TYPES = third_party/proto/cosmos_proto
246-
COSMOS_PROTO_TYPES = third_party/proto/cosmos
247-
248-
proto-update-deps:
249-
@mkdir -p $(GOGO_PROTO_TYPES)
250-
@curl -sSL $(GOGO_PROTO_URL)/gogoproto/gogo.proto > $(GOGO_PROTO_TYPES)/gogo.proto
251-
252-
@mkdir -p $(GOOGLE_PROTO_TYPES)/api/
253-
@curl -sSL $(GOOGLE_PROTO_URL)/google/api/annotations.proto > $(GOOGLE_PROTO_TYPES)/api/annotations.proto
254-
@curl -sSL $(GOOGLE_PROTO_URL)/google/api/http.proto > $(GOOGLE_PROTO_TYPES)/api/http.proto
255-
256-
@mkdir -p $(REGEN_COSMOS_PROTO_TYPES)
257-
@curl -sSL $(REGEN_COSMOS_PROTO_URL)/cosmos.proto > $(REGEN_COSMOS_PROTO_TYPES)/cosmos.proto
258-
259-
@mkdir -p $(COSMOS_PROTO_TYPES)/base/v1beta1/
260-
@curl -sSL $(COSMOS_PROTO_URL)/base/v1beta1/coin.proto > $(COSMOS_PROTO_TYPES)/base/v1beta1/coin.proto
261-
262-
@mkdir -p $(COSMOS_PROTO_TYPES)/base/query/v1beta1/
263-
@curl -sSL $(COSMOS_PROTO_URL)/base/query/v1beta1/pagination.proto > $(COSMOS_PROTO_TYPES)/base/query/v1beta1/pagination.proto
264-
265-
.PHONY: proto-all proto-gen proto-lint proto-check-breaking proto-update-deps
266156

267157
########################################
268158
### Testing

app/app.go

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
2626
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
2727
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
28-
"github.com/cosmos/cosmos-sdk/server"
2928
"github.com/cosmos/cosmos-sdk/store/streaming"
3029
store "github.com/cosmos/cosmos-sdk/store/types"
3130
"github.com/cosmos/cosmos-sdk/x/auth/posthandler"
@@ -85,7 +84,6 @@ var (
8584
ProposalsEnabled = "true"
8685
// If set to non-empty string it must be comma-separated list of values that are all a subset
8786
// of "EnableAllProposals" (takes precedence over ProposalsEnabled)
88-
// https://github.com/terpnetwork/terp-core/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
8987
EnableSpecificProposals = ""
9088

9189
Upgrades = []upgrades.Upgrade{
@@ -104,7 +102,7 @@ func init() {
104102
}
105103

106104
var (
107-
// DefaultNodeHome default home directories for terpd
105+
// DefaultNodeHome default home directories for Bitsongd
108106
DefaultNodeHome = os.ExpandEnv("$HOME/") + NodeDir
109107

110108
// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
@@ -485,12 +483,7 @@ func (app *BitsongApp) GetSubspace(moduleName string) paramstypes.Subspace {
485483
return subspace
486484
}
487485

488-
// SimulationManager implements the SimulationApp interface
489-
func (app *BitsongApp) SimulationManager() *module.SimulationManager {
490-
return app.sm
491-
}
492-
493-
// RegisterAPIRoutes registers all application module routes with the provided
486+
// RegisterAPIRoutes registers all app module routes with the provided
494487
// API server.
495488
func (app *BitsongApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
496489
clientCtx := apiSvr.ClientCtx
@@ -508,8 +501,8 @@ func (app *BitsongApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.AP
508501
nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
509502

510503
// register swagger API from root so that other applications can override easily
511-
if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil {
512-
panic(err)
504+
if apiConfig.Swagger {
505+
RegisterSwaggerAPI(clientCtx, apiSvr.Router)
513506
}
514507

515508
}
@@ -521,14 +514,24 @@ func (app *BitsongApp) RegisterTxService(clientCtx client.Context) {
521514

522515
// RegisterTendermintService implements the Application.RegisterTendermintService method.
523516
func (app *BitsongApp) RegisterTendermintService(clientCtx client.Context) {
524-
tmservice.RegisterTendermintService(clientCtx, app.BaseApp.GRPCQueryRouter(), app.interfaceRegistry, app.Query)
517+
tmservice.RegisterTendermintService(
518+
clientCtx,
519+
app.BaseApp.GRPCQueryRouter(),
520+
app.interfaceRegistry,
521+
app.Query,
522+
)
525523
}
526524

527525
// RegisterNodeService implements the Application.RegisterNodeService method.
528526
func (app *BitsongApp) RegisterNodeService(clientCtx client.Context) {
529527
nodeservice.RegisterNodeService(clientCtx, app.BaseApp.GRPCQueryRouter())
530528
}
531529

530+
// SimulationManager implements the SimulationApp interface
531+
func (app *BitsongApp) SimulationManager() *module.SimulationManager {
532+
return app.sm
533+
}
534+
532535
func (app *BitsongApp) setupUpgradeStoreLoaders() {
533536
upgradeInfo, err := app.AppKeepers.UpgradeKeeper.ReadUpgradeInfoFromDisk()
534537
if err != nil {

0 commit comments

Comments
 (0)