Merge pull request #447: Initial Application Skeleton Structure
This commit is contained in:
parent
07e7568d62
commit
e5e3d48a6d
26
Gopkg.lock
generated
26
Gopkg.lock
generated
@ -22,9 +22,12 @@
|
|||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/cosmos/cosmos-sdk"
|
name = "github.com/cosmos/cosmos-sdk"
|
||||||
packages = [
|
packages = [
|
||||||
|
"baseapp",
|
||||||
"store",
|
"store",
|
||||||
"types",
|
"types",
|
||||||
"wire"
|
"version",
|
||||||
|
"wire",
|
||||||
|
"x/auth"
|
||||||
]
|
]
|
||||||
revision = "1a1373cc220e402397ad536aee6b8f5b068914c6"
|
revision = "1a1373cc220e402397ad536aee6b8f5b068914c6"
|
||||||
version = "v0.21.0"
|
version = "v0.21.0"
|
||||||
@ -138,6 +141,12 @@
|
|||||||
]
|
]
|
||||||
revision = "0fb14efe8c47ae851c0034ed7a448854d3d34cf3"
|
revision = "0fb14efe8c47ae851c0034ed7a448854d3d34cf3"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/inconshreveable/mousetrap"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
|
||||||
|
version = "v1.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
name = "github.com/jmhodges/levigo"
|
name = "github.com/jmhodges/levigo"
|
||||||
@ -162,6 +171,18 @@
|
|||||||
revision = "ca016a06a5753f8ba03029c0aa5e54afb1bf713f"
|
revision = "ca016a06a5753f8ba03029c0aa5e54afb1bf713f"
|
||||||
version = "v1.4.0"
|
version = "v1.4.0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/spf13/cobra"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "ef82de70bb3f60c65fb8eebacbb2d122ef517385"
|
||||||
|
version = "v0.0.3"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/spf13/pflag"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "583c0c0531f06d5278b7d917446061adc344b5cd"
|
||||||
|
version = "v1.0.1"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
name = "github.com/syndtr/goleveldb"
|
name = "github.com/syndtr/goleveldb"
|
||||||
@ -206,6 +227,7 @@
|
|||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/tendermint/tendermint"
|
name = "github.com/tendermint/tendermint"
|
||||||
packages = [
|
packages = [
|
||||||
|
"abci/server",
|
||||||
"abci/types",
|
"abci/types",
|
||||||
"crypto",
|
"crypto",
|
||||||
"crypto/merkle",
|
"crypto/merkle",
|
||||||
@ -327,6 +349,6 @@
|
|||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
analyzer-version = 1
|
analyzer-version = 1
|
||||||
inputs-digest = "df6cfdfe013b00b662a5b9ebd45319d0c114859e865b3034b0e984f15e698b45"
|
inputs-digest = "6c999da3cbcf5eac93468232147f2d8e372236a297ddd09275edb065f1bc23ae"
|
||||||
solver-name = "gps-cdcl"
|
solver-name = "gps-cdcl"
|
||||||
solver-version = 1
|
solver-version = 1
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/hashicorp/golang-lru"
|
name = "github.com/hashicorp/golang-lru"
|
||||||
|
|
||||||
|
[[constraint]]
|
||||||
|
name = "github.com/spf13/cobra"
|
||||||
|
version = "~0.0.1"
|
||||||
|
|
||||||
[[override]]
|
[[override]]
|
||||||
name = "google.golang.org/genproto"
|
name = "google.golang.org/genproto"
|
||||||
revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200"
|
revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200"
|
||||||
|
57
Makefile
57
Makefile
@ -1,8 +1,24 @@
|
|||||||
|
# Copyright 2018 Tendermint. All rights reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
|
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
|
||||||
COMMIT_HASH := $(shell git rev-parse --short HEAD)
|
COMMIT_HASH := $(shell git rev-parse --short HEAD)
|
||||||
BUILD_FLAGS = -tags netgo -ldflags "-X github.com/cosmos/ethermint/version.GitCommit=${COMMIT_HASH}"
|
BUILD_FLAGS = -tags netgo -ldflags "-X github.com/cosmos/ethermint/version.GitCommit=${COMMIT_HASH}"
|
||||||
DOCKER_TAG = unstable
|
DOCKER_TAG = unstable
|
||||||
DOCKER_IMAGE = tendermint/ethermint
|
DOCKER_IMAGE = tendermint/ethermint
|
||||||
|
ETHERMINT_DAEMON_BINARY = emintd
|
||||||
|
ETHERMINT_CLI_BINARY = emintcli
|
||||||
|
|
||||||
DEP = github.com/golang/dep/cmd/dep
|
DEP = github.com/golang/dep/cmd/dep
|
||||||
GOLINT = github.com/tendermint/lint/golint
|
GOLINT = github.com/tendermint/lint/golint
|
||||||
@ -26,17 +42,22 @@ GOCYCLO_CHECK := $(shell command -v gocyclo 2> /dev/null)
|
|||||||
|
|
||||||
all: tools deps install
|
all: tools deps install
|
||||||
|
|
||||||
ci: tools deps install
|
#######################
|
||||||
|
### Build / Install ###
|
||||||
|
#######################
|
||||||
|
|
||||||
build:
|
build:
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
go build $(BUILD_FLAGS) -o build/ethermint.exe ./*.go
|
go build $(BUILD_FLAGS) -o build/$(ETHERMINT_DAEMON_BINARY).exe ./cmd/ethermintd
|
||||||
|
go build $(BUILD_FLAGS) -o build/$(ETHERMINT_CLI_BINARY).exe ./cmd/ethermintcli
|
||||||
else
|
else
|
||||||
go build $(BUILD_FLAGS) -o build/ethermint ./*.go
|
go build $(BUILD_FLAGS) -o build/$(ETHERMINT_DAEMON_BINARY) ./cmd/ethermintd/
|
||||||
|
go build $(BUILD_FLAGS) -o build/$(ETHERMINT_CLI_BINARY) ./cmd/ethermintcli/
|
||||||
endif
|
endif
|
||||||
|
|
||||||
install:
|
install:
|
||||||
go install $(BUILD_FLAGS) ./*.go
|
go install $(BUILD_FLAGS) ./cmd/ethermintd
|
||||||
|
go install $(BUILD_FLAGS) ./cmd/ethermintcli
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf ./build ./vendor
|
rm -rf ./build ./vendor
|
||||||
@ -45,57 +66,61 @@ update-tools:
|
|||||||
@echo "Updating golang dependencies"
|
@echo "Updating golang dependencies"
|
||||||
go get -u -v $(DEP) $(GOLINT) $(GOMETALINTER) $(UNCONVERT) $(INEFFASSIGN) $(MISSPELL) $(ERRCHECK) $(UNPARAM) $(GOCYCLO)
|
go get -u -v $(DEP) $(GOLINT) $(GOMETALINTER) $(UNCONVERT) $(INEFFASSIGN) $(MISSPELL) $(ERRCHECK) $(UNPARAM) $(GOCYCLO)
|
||||||
|
|
||||||
|
############################
|
||||||
|
### Tools / Dependencies ###
|
||||||
|
############################
|
||||||
|
|
||||||
tools:
|
tools:
|
||||||
ifdef DEP_CHECK
|
ifdef DEP_CHECK
|
||||||
@echo "Dep is already installed. Run 'make update-tools' to update."
|
@echo "Dep is already installed. Run 'make update-tools' to update."
|
||||||
else
|
else
|
||||||
@echo "Installing dep"
|
@echo "Installing dep"
|
||||||
go get -v $(DEP)
|
go get -v $(DEP)
|
||||||
endif
|
endif
|
||||||
ifdef GOLINT_CHECK
|
ifdef GOLINT_CHECK
|
||||||
@echo "Golint is already installed. Run 'make update-tools' to update."
|
@echo "Golint is already installed. Run 'make update-tools' to update."
|
||||||
else
|
else
|
||||||
@echo "Installing golint"
|
@echo "Installing golint"
|
||||||
go get -v $(GOLINT)
|
go get -v $(GOLINT)
|
||||||
endif
|
endif
|
||||||
ifdef GOMETALINTER_CHECK
|
ifdef GOMETALINTER_CHECK
|
||||||
@echo "Gometalinter.v2 is already installed. Run 'make update-tools' to update."
|
@echo "Gometalinter.v2 is already installed. Run 'make update-tools' to update."
|
||||||
else
|
else
|
||||||
@echo "Installing gometalinter.v2"
|
@echo "Installing gometalinter.v2"
|
||||||
go get -v $(GOMETALINTER)
|
go get -v $(GOMETALINTER)
|
||||||
endif
|
endif
|
||||||
ifdef UNCONVERT_CHECK
|
ifdef UNCONVERT_CHECK
|
||||||
@echo "Unconvert is already installed. Run 'make update-tools' to update."
|
@echo "Unconvert is already installed. Run 'make update-tools' to update."
|
||||||
else
|
else
|
||||||
@echo "Installing unconvert"
|
@echo "Installing unconvert"
|
||||||
go get -v $(UNCONVERT)
|
go get -v $(UNCONVERT)
|
||||||
endif
|
endif
|
||||||
ifdef INEFFASSIGN_CHECK
|
ifdef INEFFASSIGN_CHECK
|
||||||
@echo "Ineffassign is already installed. Run 'make update-tools' to update."
|
@echo "Ineffassign is already installed. Run 'make update-tools' to update."
|
||||||
else
|
else
|
||||||
@echo "Installing ineffassign"
|
@echo "Installing ineffassign"
|
||||||
go get -v $(INEFFASSIGN)
|
go get -v $(INEFFASSIGN)
|
||||||
endif
|
endif
|
||||||
ifdef MISSPELL_CHECK
|
ifdef MISSPELL_CHECK
|
||||||
@echo "misspell is already installed. Run 'make update-tools' to update."
|
@echo "misspell is already installed. Run 'make update-tools' to update."
|
||||||
else
|
else
|
||||||
@echo "Installing misspell"
|
@echo "Installing misspell"
|
||||||
go get -v $(MISSPELL)
|
go get -v $(MISSPELL)
|
||||||
endif
|
endif
|
||||||
ifdef ERRCHECK_CHECK
|
ifdef ERRCHECK_CHECK
|
||||||
@echo "errcheck is already installed. Run 'make update-tools' to update."
|
@echo "errcheck is already installed. Run 'make update-tools' to update."
|
||||||
else
|
else
|
||||||
@echo "Installing errcheck"
|
@echo "Installing errcheck"
|
||||||
go get -v $(ERRCHECK)
|
go get -v $(ERRCHECK)
|
||||||
endif
|
endif
|
||||||
ifdef UNPARAM_CHECK
|
ifdef UNPARAM_CHECK
|
||||||
@echo "unparam is already installed. Run 'make update-tools' to update."
|
@echo "unparam is already installed. Run 'make update-tools' to update."
|
||||||
else
|
else
|
||||||
@echo "Installing unparam"
|
@echo "Installing unparam"
|
||||||
go get -v $(UNPARAM)
|
go get -v $(UNPARAM)
|
||||||
endif
|
endif
|
||||||
ifdef GOCYCLO_CHECK
|
ifdef GOCYCLO_CHECK
|
||||||
@echo "goyclo is already installed. Run 'make update-tools' to update."
|
@echo "goyclo is already installed. Run 'make update-tools' to update."
|
||||||
else
|
else
|
||||||
@echo "Installing goyclo"
|
@echo "Installing goyclo"
|
||||||
go get -v $(GOCYCLO)
|
go get -v $(GOCYCLO)
|
||||||
@ -106,6 +131,10 @@ deps:
|
|||||||
@echo "--> Running dep ensure"
|
@echo "--> Running dep ensure"
|
||||||
@dep ensure -v
|
@dep ensure -v
|
||||||
|
|
||||||
|
#######################
|
||||||
|
### Testing / Misc. ###
|
||||||
|
#######################
|
||||||
|
|
||||||
godocs:
|
godocs:
|
||||||
@echo "--> Wait a few seconds and visit http://localhost:6060/pkg/github.com/cosmos/ethermint"
|
@echo "--> Wait a few seconds and visit http://localhost:6060/pkg/github.com/cosmos/ethermint"
|
||||||
godoc -http=:6060
|
godoc -http=:6060
|
||||||
@ -115,4 +144,4 @@ docker:
|
|||||||
docker tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:latest
|
docker tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:latest
|
||||||
docker tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:${COMMIT_HASH}
|
docker tag ${DOCKER_IMAGE}:${DOCKER_TAG} ${DOCKER_IMAGE}:${COMMIT_HASH}
|
||||||
|
|
||||||
.PHONY: build install update-tools tools deps godocs
|
.PHONY: build install update-tools tools deps godocs clean
|
||||||
|
45
app/ethermint.go
Normal file
45
app/ethermint.go
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
bam "github.com/cosmos/cosmos-sdk/baseapp"
|
||||||
|
"github.com/cosmos/cosmos-sdk/wire"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
appName = "Ethermint"
|
||||||
|
)
|
||||||
|
|
||||||
|
// EthermintApp implements an extended ABCI application.
|
||||||
|
type EthermintApp struct {
|
||||||
|
*bam.BaseApp
|
||||||
|
|
||||||
|
codec *wire.Codec
|
||||||
|
sealed bool
|
||||||
|
|
||||||
|
// TODO: stores and keys
|
||||||
|
|
||||||
|
// TODO: keepers
|
||||||
|
|
||||||
|
// TODO: mappers
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewEthermintApp returns a reference to a new initialized Ethermint
|
||||||
|
// application.
|
||||||
|
func NewEthermintApp(opts ...func(*EthermintApp)) *EthermintApp {
|
||||||
|
app := &EthermintApp{}
|
||||||
|
|
||||||
|
// TODO: implement constructor
|
||||||
|
|
||||||
|
for _, opt := range opts {
|
||||||
|
opt(app)
|
||||||
|
}
|
||||||
|
|
||||||
|
app.seal()
|
||||||
|
return app
|
||||||
|
}
|
||||||
|
|
||||||
|
// seal seals the Ethermint application and prohibits any future modifications
|
||||||
|
// that change critical components.
|
||||||
|
func (app *EthermintApp) seal() {
|
||||||
|
app.sealed = true
|
||||||
|
}
|
7
cmd/ethermintcli/main.go
Normal file
7
cmd/ethermintcli/main.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO: Implement CLI commands and logic
|
||||||
|
//
|
||||||
|
// Ref: https://github.com/cosmos/ethermint/issues/432
|
||||||
|
}
|
7
cmd/ethermintd/main.go
Normal file
7
cmd/ethermintd/main.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// TODO: Implement daemon command and logic
|
||||||
|
//
|
||||||
|
// Ref: https://github.com/cosmos/ethermint/issues/433
|
||||||
|
}
|
1
server/start.go
Normal file
1
server/start.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package server
|
8
types/context.go
Normal file
8
types/context.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
// AppContext provides the ability for the application to pass around and
|
||||||
|
// obtain immutable objects easily. More importantly, it allows for the
|
||||||
|
// utilization of the object-capability model in which components gain access
|
||||||
|
// to other components for which they truly need.
|
||||||
|
type AppContext struct {
|
||||||
|
}
|
10
version/version.go
Normal file
10
version/version.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package version
|
||||||
|
|
||||||
|
// Version contains the application semantic version.
|
||||||
|
//
|
||||||
|
// TODO: How do we want to version this being that an initial Ethermint has
|
||||||
|
// been developed?
|
||||||
|
const Version = "0.0.0"
|
||||||
|
|
||||||
|
// GitCommit contains the git SHA1 short hash set by build flags.
|
||||||
|
var GitCommit = ""
|
Loading…
Reference in New Issue
Block a user