Skip to content
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
7 changes: 4 additions & 3 deletions .github/workflows/interchaintest-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:
packages: write

env:
GO_VERSION: 1.22.0
GO_VERSION: 1.22.4
TAR_PATH: /tmp/bitsong-docker-image.tar
IMAGE_NAME: bitsong-docker-image

Expand Down Expand Up @@ -58,8 +58,9 @@ jobs:
matrix: 899
# names of `make` commands to run tests
test:
# - "e2e-basic"
# - "e2e-upgrade"
- "e2e-basic"
- "e2e-pfm"
- "e2e-polytone"
fail-fast: false

steps:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/push-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@

name: Push Docker Images

env:
DOCKER_REPOSITORY: bitsongofficial/go-bitsong
RUNNER_BASE_IMAGE_DISTROLESS: gcr.io/distroless/static-debian11
RUNNER_BASE_IMAGE_NONROOT: gcr.io/distroless/static-debian11:nonroot
RUNNER_BASE_IMAGE_ALPINE: alpine:3.17

on:
release:
types: [published, created, edited]
Expand All @@ -26,7 +32,7 @@ on:
- 'v[0-9]+.[0-9]+.[0-9]+' # ignore rc

jobs:
terp-images:
bitsong-images:
runs-on: ubuntu-latest
steps:
-
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# docker build . -t cosmoscontracts/juno:latest
# docker run --rm -it cosmoscontracts/juno:latest /bin/sh
# docker build . -t bitsongofficial/go-bitsong:latest
# docker run --rm -it bitsongofficial/go-bitsong:latest /bin/sh
FROM golang:1.22-alpine AS go-builder

# this comes from standard alpine nightly file
Expand Down Expand Up @@ -29,7 +29,7 @@ RUN set -eux; \
COPY . /code/

# force it to use static lib (from above) not standard libgo_cosmwasm.so file
# then log output of file /code/bin/junod
# then log output of file /code/bin/bitsongd
# then ensure static linking
RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build \
&& file /code/bin/bitsongd \
Expand Down
125 changes: 8 additions & 117 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/usr/bin/make -f

include scripts/makefiles/build.mk
include scripts/makefiles/docker.mk
include scripts/makefiles/e2e.mk
include scripts/makefiles/hl.mk
include scripts/makefiles/proto.mk
include scripts/makefiles/localnet.mk
include contrib/devtools/Makefile

.DEFAULT_GOAL := help
Expand All @@ -13,9 +16,11 @@ help:
@echo " make [command]"
@echo ""
@echo " make build Build Bitsong node binary"
@echo " make install Install Bitsong node binary"
@echo " make hl Show available docker commands (via Strangelove's Heighliner Tooling)"
@echo " make docker Show available docker related commands"
@echo " make e2e Show available e2e commands"
@echo " make hl Show available docker commands (via Strangelove's Heighliner Tooling)"
@echo " make install Install Bitsong node binary"
@echo " make localnet Show available localnet commands"
@echo ""
@echo "Run 'make [subcommand]' to see the available commands for each subcommand."

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

E2E_UPGRADE_VERSION := "v0.18.0"

GO_MODULE := $(shell cat go.mod | grep "module " | cut -d ' ' -f 2)
GO_VERSION := $(shell cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2)
GO_MAJOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1)
Expand Down Expand Up @@ -97,7 +100,6 @@ comma := ,
build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))

# process linker flags

ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=go-bitsong \
-X github.com/cosmos/cosmos-sdk/version.AppName=bitsongd \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
Expand All @@ -115,9 +117,7 @@ endif
ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))

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

all: install tools lint
BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'

build: go.sum
ifeq ($(OS),Windows_NT)
Expand All @@ -126,48 +126,9 @@ else
go build $(BUILD_FLAGS) -o bin/bitsongd ./cmd/bitsongd
endif

build-linux: go.sum
go build $(BUILD_FLAGS)

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

#update-swagger-docs: statik
# $(BINDIR)/statik -src=swagger/swagger-ui -dest=swagger -f -m
# @if [ -n "$(git status --porcelain)" ]; then \
# echo "\033[91mSwagger docs are out of sync!!!\033[0m";\
# exit 1;\
# else \
# echo "\033[92mSwagger docs are in sync\033[0m";\
# fi

###############################################################################
### Localnet ###
###############################################################################

build-docker-go-bitsong:
$(MAKE) -C contrib/localnet

# Run a 4-node testnet locally
localnet-start: build-linux build-docker-bitsongdnode
@if ! [ -f build/node0/bitsongd/config/genesis.json ]; \
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 ; \
fi
docker-compose up -d

# Stop testnet
localnet-stop:
docker-compose down

test-docker:
@docker build -f contrib/Dockerfile.test -t ${TEST_DOCKER_REPO}:$(shell git rev-parse --short HEAD) .
@docker tag ${TEST_DOCKER_REPO}:$(shell git rev-parse --short HEAD) ${TEST_DOCKER_REPO}:$(shell git rev-parse --abbrev-ref HEAD | sed 's#/#_#g')
@docker tag ${TEST_DOCKER_REPO}:$(shell git rev-parse --short HEAD) ${TEST_DOCKER_REPO}:latest

test-docker-push: test-docker
@docker push ${TEST_DOCKER_REPO}:$(shell git rev-parse --short HEAD)
@docker push ${TEST_DOCKER_REPO}:$(shell git rev-parse --abbrev-ref HEAD | sed 's#/#_#g')
@docker push ${TEST_DOCKER_REPO}:latest


########################################
Expand All @@ -192,76 +153,6 @@ clean:
distclean: clean
rm -rf vendor/

###############################################################################
### Protobuf ###
###############################################################################

containerProtoVer=v0.2
containerProtoImage=tendermintdev/sdk-proto-gen:$(containerProtoVer)
containerProtoGen=cosmos-sdk-proto-gen-$(containerProtoVer)
containerProtoGenSwagger=cosmos-sdk-proto-gen-swagger-$(containerProtoVer)
containerProtoFmt=cosmos-sdk-proto-fmt-$(containerProtoVer)

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

proto-gen:
@echo "Generating Protobuf files"
$(DOCKER) run --rm --name $(containerProtoGen) \
-v $(CURDIR):/workspace \
--workdir /workspace \
$(containerProtoImage) sh ./scripts/protocgen.sh

# This generates the SDK's custom wrapper for google.protobuf.Any. It should only be run manually when needed
proto-gen-any:
@echo "Generating Protobuf Any"
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) sh ./scripts/protocgen-any.sh

#proto-swagger-gen:
# @echo "Generating Protobuf Swagger"
# $(DOCKER) run --rm --name $(containerProtoGenSwagger) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) sh ./scripts/protoc-swagger-gen.sh

proto-format:
@echo "Formatting Protobuf files"
$(DOCKER) run --rm --name $(containerProtoFmt) \
--user $(shell id -u):$(shell id -g) \
-v $(CURDIR):/workspace \
--workdir /workspace \
tendermintdev/docker-build-proto find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;

proto-lint:
@$(DOCKER_BUF) lint --error-format=json

proto-check-breaking:
@$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=master

GOGO_PROTO_URL = https://raw.githubusercontent.com/regen-network/protobuf/cosmos
GOOGLE_PROTO_URL = https://raw.githubusercontent.com/googleapis/googleapis/master
REGEN_COSMOS_PROTO_URL = https://raw.githubusercontent.com/regen-network/cosmos-proto/master
COSMOS_PROTO_URL = https://raw.githubusercontent.com/cosmos/cosmos-sdk/v0.45.4/proto/cosmos

GOGO_PROTO_TYPES = third_party/proto/gogoproto
GOOGLE_PROTO_TYPES = third_party/proto/google
REGEN_COSMOS_PROTO_TYPES = third_party/proto/cosmos_proto
COSMOS_PROTO_TYPES = third_party/proto/cosmos

proto-update-deps:
@mkdir -p $(GOGO_PROTO_TYPES)
@curl -sSL $(GOGO_PROTO_URL)/gogoproto/gogo.proto > $(GOGO_PROTO_TYPES)/gogo.proto

@mkdir -p $(GOOGLE_PROTO_TYPES)/api/
@curl -sSL $(GOOGLE_PROTO_URL)/google/api/annotations.proto > $(GOOGLE_PROTO_TYPES)/api/annotations.proto
@curl -sSL $(GOOGLE_PROTO_URL)/google/api/http.proto > $(GOOGLE_PROTO_TYPES)/api/http.proto

@mkdir -p $(REGEN_COSMOS_PROTO_TYPES)
@curl -sSL $(REGEN_COSMOS_PROTO_URL)/cosmos.proto > $(REGEN_COSMOS_PROTO_TYPES)/cosmos.proto

@mkdir -p $(COSMOS_PROTO_TYPES)/base/v1beta1/
@curl -sSL $(COSMOS_PROTO_URL)/base/v1beta1/coin.proto > $(COSMOS_PROTO_TYPES)/base/v1beta1/coin.proto

@mkdir -p $(COSMOS_PROTO_TYPES)/base/query/v1beta1/
@curl -sSL $(COSMOS_PROTO_URL)/base/query/v1beta1/pagination.proto > $(COSMOS_PROTO_TYPES)/base/query/v1beta1/pagination.proto

.PHONY: proto-all proto-gen proto-lint proto-check-breaking proto-update-deps

########################################
### Testing
Expand Down
53 changes: 29 additions & 24 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package app
import (
"fmt"

"github.com/bitsongofficial/go-bitsong/v018/app/keepers"
"github.com/bitsongofficial/go-bitsong/v018/app/upgrades"
v010 "github.com/bitsongofficial/go-bitsong/v018/app/upgrades/v010"
v011 "github.com/bitsongofficial/go-bitsong/v018/app/upgrades/v011"
v013 "github.com/bitsongofficial/go-bitsong/v018/app/upgrades/v013"
v014 "github.com/bitsongofficial/go-bitsong/v018/app/upgrades/v014"
v015 "github.com/bitsongofficial/go-bitsong/v018/app/upgrades/v015"
v016 "github.com/bitsongofficial/go-bitsong/v018/app/upgrades/v016"
v018 "github.com/bitsongofficial/go-bitsong/v018/app/upgrades/v018"
"github.com/bitsongofficial/go-bitsong/app/keepers"
"github.com/bitsongofficial/go-bitsong/app/upgrades"
v010 "github.com/bitsongofficial/go-bitsong/app/upgrades/v010"
v011 "github.com/bitsongofficial/go-bitsong/app/upgrades/v011"
v013 "github.com/bitsongofficial/go-bitsong/app/upgrades/v013"
v014 "github.com/bitsongofficial/go-bitsong/app/upgrades/v014"
v015 "github.com/bitsongofficial/go-bitsong/app/upgrades/v015"
v016 "github.com/bitsongofficial/go-bitsong/app/upgrades/v016"
v018 "github.com/bitsongofficial/go-bitsong/app/upgrades/v018"

errorsmod "cosmossdk.io/errors"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
Expand All @@ -25,7 +25,6 @@ import (
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/store/streaming"
store "github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/cosmos-sdk/x/auth/posthandler"
Expand All @@ -47,7 +46,7 @@ import (

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
fantokenclient "github.com/bitsongofficial/go-bitsong/v018/x/fantoken/client"
fantokenclient "github.com/bitsongofficial/go-bitsong/x/fantoken/client"
"github.com/cosmos/cosmos-sdk/baseapp"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
Expand All @@ -69,9 +68,8 @@ import (
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

tmjson "github.com/cometbft/cometbft/libs/json"

// unnamed import of statik for swagger UI support
_ "github.com/bitsongofficial/go-bitsong/v018/swagger/statik"
// _ "github.com/bitsongofficial/go-bitsong/swagger/statik"
)

const appName = "BitsongApp"
Expand All @@ -86,7 +84,6 @@ var (
ProposalsEnabled = "true"
// If set to non-empty string it must be comma-separated list of values that are all a subset
// of "EnableAllProposals" (takes precedence over ProposalsEnabled)
// https://github.com/terpnetwork/terp-core/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
EnableSpecificProposals = ""

Upgrades = []upgrades.Upgrade{
Expand All @@ -105,7 +102,7 @@ func init() {
}

var (
// DefaultNodeHome default home directories for terpd
// DefaultNodeHome default home directories for Bitsongd
DefaultNodeHome = os.ExpandEnv("$HOME/") + NodeDir

// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
Expand Down Expand Up @@ -486,12 +483,7 @@ func (app *BitsongApp) GetSubspace(moduleName string) paramstypes.Subspace {
return subspace
}

// SimulationManager implements the SimulationApp interface
func (app *BitsongApp) SimulationManager() *module.SimulationManager {
return app.sm
}

// RegisterAPIRoutes registers all application module routes with the provided
// RegisterAPIRoutes registers all app module routes with the provided
// API server.
func (app *BitsongApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
clientCtx := apiSvr.ClientCtx
Expand All @@ -502,12 +494,15 @@ func (app *BitsongApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.AP
// Register new tendermint queries routes from grpc-gateway.
tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)

// Register legacy and grpc-gateway routes for all modules.
ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)

// Register new tendermint queries routes from grpc-gateway.
nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)

// register swagger API from root so that other applications can override easily
if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil {
panic(err)
if apiConfig.Swagger {
RegisterSwaggerAPI(clientCtx, apiSvr.Router)
}

}
Expand All @@ -519,14 +514,24 @@ func (app *BitsongApp) RegisterTxService(clientCtx client.Context) {

// RegisterTendermintService implements the Application.RegisterTendermintService method.
func (app *BitsongApp) RegisterTendermintService(clientCtx client.Context) {
tmservice.RegisterTendermintService(clientCtx, app.BaseApp.GRPCQueryRouter(), app.interfaceRegistry, app.Query)
tmservice.RegisterTendermintService(
clientCtx,
app.BaseApp.GRPCQueryRouter(),
app.interfaceRegistry,
app.Query,
)
}

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

// SimulationManager implements the SimulationApp interface
func (app *BitsongApp) SimulationManager() *module.SimulationManager {
return app.sm
}

func (app *BitsongApp) setupUpgradeStoreLoaders() {
upgradeInfo, err := app.AppKeepers.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/bitsongofficial/go-bitsong/v018/app/params"
"github.com/bitsongofficial/go-bitsong/app/params"
dbm "github.com/cometbft/cometbft-db"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/crypto/hd"
Expand Down
2 changes: 1 addition & 1 deletion app/encoding.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package app

import (
"github.com/bitsongofficial/go-bitsong/v018/app/params"
"github.com/bitsongofficial/go-bitsong/app/params"
"github.com/cosmos/cosmos-sdk/std"
)

Expand Down
6 changes: 3 additions & 3 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/bitsongofficial/go-bitsong/v018/x/fantoken"
fantokenkeeper "github.com/bitsongofficial/go-bitsong/v018/x/fantoken/keeper"
fantokentypes "github.com/bitsongofficial/go-bitsong/v018/x/fantoken/types"
"github.com/bitsongofficial/go-bitsong/x/fantoken"
fantokenkeeper "github.com/bitsongofficial/go-bitsong/x/fantoken/keeper"
fantokentypes "github.com/bitsongofficial/go-bitsong/x/fantoken/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
Expand Down
Loading