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

Cosmos stargate tracking branch #172 #252

Closed
wants to merge 19 commits into from
Closed
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
57 changes: 40 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ endif
build_tags += $(BUILD_TAGS)
build_tags := $(strip $(build_tags))

empty :=
space := $(empty) $(empty)
whitespace :=
empty = $(whitespace) $(whitespace)
comma := ,
build_tags_comma_sep := $(subst $(space),$(comma),$(build_tags))
build_tags_comma_sep := $(subst $(empty),$(comma),$(build_tags))

# process linker flags

ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=wasm \
-X github.com/cosmos/cosmos-sdk/version.ServerName=wasmd \
-X github.com/cosmos/cosmos-sdk/version.ClientName=wasmcli \
-X github.com/cosmos/cosmos-sdk/version.AppName=wasmd \
-X github.com/CosmWasm/wasmd/cmd/wasmcli/version.ClientName=wasmcli \
-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)"
Expand All @@ -61,8 +61,8 @@ ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))

coral_ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=coral \
-X github.com/cosmos/cosmos-sdk/version.ServerName=corald \
-X github.com/cosmos/cosmos-sdk/version.ClientName=coral \
-X github.com/cosmos/cosmos-sdk/version.AppName=corald \
-X github.com/CosmWasm/wasmd/cmd/wasmcli/version.ClientName=coral \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X github.com/CosmWasm/wasmd/app.CLIDir=.coral \
Expand All @@ -76,8 +76,8 @@ coral_ldflags += $(LDFLAGS)
coral_ldflags := $(strip $(coral_ldflags))

flex_ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=gaiaflex \
-X github.com/cosmos/cosmos-sdk/version.ServerName=gaiaflexd \
-X github.com/cosmos/cosmos-sdk/version.ClientName=gaiaflex \
-X github.com/cosmos/cosmos-sdk/version.AppName=gaiaflexd \
-X github.com/CosmWasm/wasmd/cmd/wasmcli/version.ClientName=gaiaflex \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X github.com/CosmWasm/wasmd/app.ProposalsEnabled=true \
Expand All @@ -89,9 +89,9 @@ flex_ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=gaiaflex \
flex_ldflags += $(LDFLAGS)
flex_ldflags := $(strip $(flex_ldflags))

BUILD_FLAGS := -tags $(build_tags_comma_sep) -ldflags '$(ldflags)' -trimpath
CORAL_BUILD_FLAGS := -tags $(build_tags_comma_sep) -ldflags '$(coral_ldflags)' -trimpath
FLEX_BUILD_FLAGS := -tags $(build_tags_comma_sep) -ldflags '$(flex_ldflags)' -trimpath
BUILD_FLAGS := -tags "$(build_tags_comma_sep)" -ldflags '$(ldflags)' -trimpath
CORAL_BUILD_FLAGS := -tags "$(build_tags_comma_sep)" -ldflags '$(coral_ldflags)' -trimpath
FLEX_BUILD_FLAGS := -tags "$(build_tags_comma_sep)" -ldflags '$(flex_ldflags)' -trimpath

all: install lint test

Expand Down Expand Up @@ -162,7 +162,7 @@ distclean: clean
### Testing


test: test-unit test-build
test: test-unit
test-all: check test-race test-cover

test-unit:
Expand All @@ -174,16 +174,39 @@ test-race:
test-cover:
@go test -mod=readonly -timeout 30m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock' ./...

test-build: build
@go test -mod=readonly -p 4 `go list ./cli_test/...` -tags=cli_test -v

benchmark:
@go test -mod=readonly -bench=. ./...


###############################################################################
### Linting ###
###############################################################################

lint:
golangci-lint run
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s

format:
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs goimports -w -local github.com/CosmWasm/wasmd

benchmark:
@go test -mod=readonly -bench=. ./...

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

proto-all: proto-gen proto-lint proto-check-breaking

proto-gen:
@./scripts/protocgen.sh

proto-lint:
@buf check lint --error-format=json

proto-check-breaking:
@buf check breaking --against-input '.git#branch=master'


.PHONY: all build-linux install install-debug \
Expand Down
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

[![CircleCI](https://circleci.com/gh/cosmwasm/wasmd/tree/master.svg?style=shield)](https://circleci.com/gh/cosmwasm/wasmd/tree/master)
[![codecov](https://codecov.io/gh/cosmwasm/wasmd/branch/master/graph/badge.svg)](https://codecov.io/gh/cosmwasm/wasmd)
[![Go Report Card](https://goreportcard.com/badge/github.com/cosmwasm/wasmd)](https://goreportcard.com/report/github.com/cosmwasm/wasmd)
[![license](https://img.shields.io/github/license/cosmwasm/wasmd.svg)](https://github.com/cosmwasm/wasmd/blob/master/LICENSE)
[![LoC](https://tokei.rs/b1/github/cosmwasm/wasmd)](https://github.com/cosmwasm/wasmd)
<!-- [![GolangCI](https://golangci.com/badges/github.com/cosmwasm/wasmd.svg)](https://golangci.com/r/github.com/cosmwasm/wasmd) -->
[![Go Report Card](https://goreportcard.com/badge/github.com/CosmWasm/wasmd)](https://goreportcard.com/report/github.com/CosmWasm/wasmd)
[![license](https://img.shields.io/github/license/cosmwasm/wasmd.svg)](https://github.com/CosmWasm/wasmd/blob/master/LICENSE)
[![LoC](https://tokei.rs/b1/github/cosmwasm/wasmd)](https://github.com/CosmWasm/wasmd)
<!-- [![GolangCI](https://golangci.com/badges/github.com/CosmWasm/wasmd.svg)](https://golangci.com/r/github.com/CosmWasm/wasmd) -->

This repository hosts `Wasmd`, the first implementation of a cosmos zone with wasm smart contracts enabled.

Expand Down Expand Up @@ -46,6 +46,7 @@ Thank you to all projects who have run this code in your testnets and
given feedback to improve stability.

## Encoding
The used cosmos-sdk version is in transition migrating from amino encoding to protobuf for state. So are we now.

We use standard cosmos-sdk encoding (amino) for all sdk Messages. However, the message body sent to all contracts,
as well as the internal state is encoded using JSON. Cosmwasm allows arbitrary bytes with the contract itself
Expand All @@ -60,12 +61,25 @@ your use case.
make install
make test
```
if you are using a linux without X or headless linux, look at [this article](https://ahelpme.com/linux/dbusexception-could-not-get-owner-of-name-org-freedesktop-secrets-no-such-name) or [#31](https://github.com/cosmwasm/wasmd/issues/31#issuecomment-577058321).
if you are using a linux without X or headless linux, look at [this article](https://ahelpme.com/linux/dbusexception-could-not-get-owner-of-name-org-freedesktop-secrets-no-such-name) or [#31](https://github.com/CosmWasm/wasmd/issues/31#issuecomment-577058321).

To set up a single node testnet, [look at the deployment documentation](./docs/deploy-testnet.md).

If you want to deploy a whole cluster, [look at the network scripts](./networks/README.md).

## Protobuf

1. Install [protoc](https://github.com/protocolbuffers/protobuf#protocol-compiler-installation)

2. Install [cosmos-extension](https://github.com/regen-network/cosmos-proto/) for [gogo-protobuf](https://github.com/gogo/protobuf)
```sh
go install github.com/regen-network/cosmos-proto/protoc-gen-gocosmos
```
3. Run generator
```sh
make proto-gen
```

## Dockerized

We provide a docker image to help with test setups. There are two modes to use it
Expand Down
Loading