Skip to content

Commit

Permalink
Merge pull request #1866 from mesg-foundation/dev
Browse files Browse the repository at this point in the history
Release v0.26.0
  • Loading branch information
Nicolas Mahé authored Jun 9, 2020
2 parents 73a6b0c + 496656c commit 4859595
Show file tree
Hide file tree
Showing 101 changed files with 1,995 additions and 954 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ jobs:
<<: *run_on_docker
steps:
- checkout
- run: make publish version="`echo $CIRCLE_SHA1 | cut -c1-7`" release-type=unstable
- run: make publish-unstable version="`echo $CIRCLE_SHA1 | cut -c1-7`"

"release_cli_prod":
<<: *run_on_docker
steps:
- checkout
- run: make publish version=$CIRCLE_TAG release-type=prod
- run: make publish-prod version=$CIRCLE_TAG

workflows:
version: 2
Expand Down
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ schema1.svg
coverage.txt

# configuration & repo files
Makefile
.circleci
.codacy.yml
.codeclimate.yml
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## [v0.26.0](https://github.com/mesg-foundation/engine/releases/tag/v0.26.0)

#### Breaking Changes

- ([#1842](https://github.com/mesg-foundation/engine/pull/1842)) Execution price based on service task price and new credit module.
- ([#1853](https://github.com/mesg-foundation/engine/pull/1853)) Fix 3 issues with instance.
- ([#1855](https://github.com/mesg-foundation/engine/pull/1855)) Add modules gov, upgrade, evidence and crisis.

#### Added

- ([#1860](https://github.com/mesg-foundation/engine/pull/1860)) Add export and import genesis functions to module credit .
- ([#1861](https://github.com/mesg-foundation/engine/pull/1861)) Add msg to mint credits module credit.

#### Changed

- ([#1849](https://github.com/mesg-foundation/engine/pull/1849)) Add a mechanism to reuse previous build image to speed up build time.
- ([#1850](https://github.com/mesg-foundation/engine/pull/1850)) Move CLI build and publish script to makefile to avoid duplication of code.

#### Fixed

- ([#1862](https://github.com/mesg-foundation/engine/pull/1862)) Improve checks of commands' parameters.

#### Removed

- ([#1863](https://github.com/mesg-foundation/engine/pull/1863)) Remove not used expected keeper.

## [v0.25.1](https://github.com/mesg-foundation/engine/releases/tag/v0.25.1)

#### Changed
Expand Down
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# base Go image version for building the binaries
FROM golang:1.13.10 AS build
ARG from=golang:1.13.10
FROM $from AS build
WORKDIR /app

COPY go.mod go.sum ./
Expand All @@ -8,8 +8,7 @@ RUN go mod download
COPY . .
ARG version

RUN go build -mod=readonly -o ./bin/mesg-cli -ldflags="-s -w -X 'github.com/cosmos/cosmos-sdk/version.Name=mesg' -X 'github.com/cosmos/cosmos-sdk/version.ServerName=mesg-daemon' -X 'github.com/cosmos/cosmos-sdk/version.ClientName=mesg-cli' -X 'github.com/cosmos/cosmos-sdk/version.Version=$version'" ./cmd/mesg-cli/
RUN go build -mod=readonly -o ./bin/mesg-daemon -ldflags="-s -w -X 'github.com/cosmos/cosmos-sdk/version.Name=mesg' -X 'github.com/cosmos/cosmos-sdk/version.ServerName=mesg-daemon' -X 'github.com/cosmos/cosmos-sdk/version.ClientName=mesg-cli' -X 'github.com/cosmos/cosmos-sdk/version.Version=$version'" ./cmd/mesg-daemon/
RUN make build

# ubuntu image with binaries for distribution
FROM ubuntu:18.04
Expand Down
47 changes: 41 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,49 @@
.PHONY: build build-docker publish publish-docker-prod publish-docker-unstable test e2e dep lint build-tools protobuf changelog clean dev dev-mon
.PHONY: build build-multiplatform build-docker publish publish-docker-prod publish-docker-unstable test e2e dev dev-mon dep lint build-tools protobuf changelog clean

version ?= local
MAJOR_VERSION := $(shell echo $(version) | cut -d . -f 1)
MINOR_VERSION := $(shell echo $(version) | cut -d . -f 1-2)

LDFLAGS = "-s -w -X 'github.com/cosmos/cosmos-sdk/version.Name=mesg' -X 'github.com/cosmos/cosmos-sdk/version.ServerName=mesg-daemon' -X 'github.com/cosmos/cosmos-sdk/version.ClientName=mesg-cli' -X 'github.com/cosmos/cosmos-sdk/version.Version=$(version)'"
OSS = linux darwin
ARCHS = amd64 386

# Build

build: dep
./scripts/build-cli.sh "$(version)"
CGO_ENABLED=0 go build -mod=readonly -o "./bin/mesg-daemon" -ldflags=$(LDFLAGS) ./cmd/mesg-daemon/
CGO_ENABLED=0 go build -mod=readonly -o "./bin/mesg-cli" -ldflags=$(LDFLAGS) ./cmd/mesg-cli/

build-multiplatform: dep
for os in $(OSS) ; do \
for arch in $(ARCHS) ; do \
echo "Building $$os $$arch..." ; \
CGO_ENABLED=0 GOOS=$$os GOARCH=$$arch go build -mod=readonly -o "./bin/mesg-daemon-$$os-$$arch" -ldflags=$(LDFLAGS) ./cmd/mesg-daemon/ ; \
CGO_ENABLED=0 GOOS=$$os GOARCH=$$arch go build -mod=readonly -o "./bin/mesg-cli-$$os-$$arch" -ldflags=$(LDFLAGS) ./cmd/mesg-cli/ ; \
done \
done

build-docker-cache:
# building cache image
docker build \
--build-arg version=$(version) \
--target build \
-t mesg/engine:$(version)-build \
.

build-docker-cache-if-needed:
if [ -z "$(shell docker images -q mesg/engine:$(version)-build)" ]; then \
make build-docker-cache ; \
fi

build-docker:
build-docker: build-docker-cache-if-needed
# building image
docker build \
--build-arg version=$(version) \
--build-arg from=mesg/engine:$(version)-build \
-t mesg/engine:$(version) \
.
# building dev image
docker build \
-f ./Dockerfile.dev \
--build-arg from=mesg/engine:$(version) \
Expand All @@ -22,8 +52,13 @@ build-docker:

# Publish

publish: build
./scripts/publish-cli.sh "$(version)" "$(release-type)"
publish-unstable: build-multiplatform
go install github.com/tcnksm/ghr
ghr -u mesg-foundation -r engine -p 1 -delete -prerelease -n "Unstable release" -b "Warning - this is an unstable release, use it only if you know what are doing." unstable ./bin

publish-prod: build-multiplatform
go install github.com/tcnksm/ghr
ghr -u mesg-foundation -r engine -p 1 -replace "$(version)" ./bin

publish-docker-prod: build-docker
docker tag mesg/engine:$(version) mesg/engine:$(MINOR_VERSION)
Expand Down Expand Up @@ -82,7 +117,7 @@ protobuf: build-tools
changelog:
./scripts/changelog.sh $(milestone)

clean:
clean:
- rm -rf bin
- docker volume rm engine
- docker image rm $(shell docker images -q mesg/engine)
Expand Down
92 changes: 84 additions & 8 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/cosmos/cosmos-sdk/x/crisis"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
"github.com/cosmos/cosmos-sdk/x/evidence"
"github.com/cosmos/cosmos-sdk/x/genutil"
"github.com/cosmos/cosmos-sdk/x/gov"
"github.com/cosmos/cosmos-sdk/x/params"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/staking"
"github.com/cosmos/cosmos-sdk/x/supply"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
"github.com/mesg-foundation/engine/protobuf/types"
"github.com/mesg-foundation/engine/x/credit"
"github.com/mesg-foundation/engine/x/execution"
"github.com/mesg-foundation/engine/x/instance"
"github.com/mesg-foundation/engine/x/ownership"
Expand Down Expand Up @@ -54,8 +61,13 @@ var (
params.AppModuleBasic{},
slashing.AppModuleBasic{},
supply.AppModuleBasic{},
gov.NewAppModuleBasic(paramsclient.ProposalHandler, distr.ProposalHandler, upgradeclient.ProposalHandler),
upgrade.AppModuleBasic{},
evidence.AppModuleBasic{},
crisis.AppModuleBasic{},

// Engine's AppModuleBasic
credit.AppModuleBasic{},
ownership.AppModuleBasic{},
instance.AppModuleBasic{},
process.AppModuleBasic{},
Expand All @@ -70,6 +82,7 @@ var (
distr.ModuleName: nil,
staking.BondedPoolName: {supply.Burner, supply.Staking},
staking.NotBondedPoolName: {supply.Burner, supply.Staking},
gov.ModuleName: {supply.Burner},
}
)

Expand Down Expand Up @@ -109,8 +122,13 @@ type NewApp struct {
distrKeeper distr.Keeper
supplyKeeper supply.Keeper
paramsKeeper params.Keeper
govKeeper gov.Keeper
upgradeKeeper upgrade.Keeper
evidenceKeeper evidence.Keeper
crisisKeeper crisis.Keeper

// Engine's keepers
creditKeeper credit.Keeper
ownershipKeeper ownership.Keeper
instanceKeeper instance.Keeper
processKeeper process.Keeper
Expand All @@ -131,7 +149,7 @@ var _ simapp.App = (*NewApp)(nil)
// NewInitApp is a constructor function for engineApp
func NewInitApp(
logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool,
invCheckPeriod uint, baseAppOptions ...func(*bam.BaseApp),
invCheckPeriod uint, skipUpgradeHeights map[int64]bool, baseAppOptions ...func(*bam.BaseApp),
) (*NewApp, error) {
// First define the top level codec that will be shared by the different modules
cdc := MakeCodec()
Expand All @@ -149,8 +167,12 @@ func NewInitApp(
distr.StoreKey,
slashing.StoreKey,
params.StoreKey,
gov.StoreKey,
upgrade.StoreKey,
evidence.StoreKey,

// Engine's module keys
credit.ModuleName,
ownership.ModuleName,
instance.ModuleName,
process.ModuleName,
Expand Down Expand Up @@ -179,7 +201,10 @@ func NewInitApp(
app.subspaces[staking.ModuleName] = app.paramsKeeper.Subspace(staking.DefaultParamspace)
app.subspaces[distr.ModuleName] = app.paramsKeeper.Subspace(distr.DefaultParamspace)
app.subspaces[slashing.ModuleName] = app.paramsKeeper.Subspace(slashing.DefaultParamspace)
app.subspaces[execution.ModuleName] = app.paramsKeeper.Subspace(execution.DefaultParamspace)
app.subspaces[gov.ModuleName] = app.paramsKeeper.Subspace(gov.DefaultParamspace)
app.subspaces[evidence.ModuleName] = app.paramsKeeper.Subspace(evidence.DefaultParamspace)
app.subspaces[crisis.ModuleName] = app.paramsKeeper.Subspace(crisis.DefaultParamspace)
app.subspaces[credit.ModuleName] = app.paramsKeeper.Subspace(credit.DefaultParamspace)

// The AccountKeeper handles address -> account lookups
app.accountKeeper = auth.NewAccountKeeper(
Expand Down Expand Up @@ -230,6 +255,48 @@ func NewInitApp(
app.subspaces[slashing.ModuleName],
)

app.crisisKeeper = crisis.NewKeeper(
app.subspaces[crisis.ModuleName],
invCheckPeriod,
app.supplyKeeper,
auth.FeeCollectorName,
)

app.upgradeKeeper = upgrade.NewKeeper(
skipUpgradeHeights,
keys[upgrade.StoreKey],
app.cdc,
)

// create evidence keeper with evidence router
evidenceKeeper := evidence.NewKeeper(
app.cdc,
keys[evidence.StoreKey],
app.subspaces[evidence.ModuleName],
&stakingKeeper,
app.slashingKeeper,
)
evidenceRouter := evidence.NewRouter()
// register evidence routes
evidenceKeeper.SetRouter(evidenceRouter)
app.evidenceKeeper = *evidenceKeeper

// register the proposal types
govRouter := gov.NewRouter()
govRouter.
AddRoute(gov.RouterKey, gov.ProposalHandler).
AddRoute(params.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)).
AddRoute(distr.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)).
AddRoute(upgrade.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.upgradeKeeper))
app.govKeeper = gov.NewKeeper(
app.cdc,
keys[gov.StoreKey],
app.subspaces[gov.ModuleName].WithKeyTable(gov.ParamKeyTable()),
app.supplyKeeper,
&stakingKeeper,
govRouter,
)

// register the staking hooks
// NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
app.stakingKeeper = *stakingKeeper.SetHooks(
Expand All @@ -239,20 +306,20 @@ func NewInitApp(
)

// Engine's module keepers
app.creditKeeper = credit.NewKeeper(app.cdc, app.accountKeeper, keys[credit.StoreKey], app.subspaces[credit.ModuleName])
app.ownershipKeeper = ownership.NewKeeper(app.cdc, keys[ownership.StoreKey], app.bankKeeper)
app.instanceKeeper = instance.NewKeeper(app.cdc, keys[instance.StoreKey])
app.processKeeper = process.NewKeeper(app.cdc, keys[process.StoreKey], app.instanceKeeper, app.ownershipKeeper, app.bankKeeper)
app.serviceKeeper = service.NewKeeper(app.cdc, keys[service.StoreKey], app.ownershipKeeper)
app.instanceKeeper = instance.NewKeeper(app.cdc, keys[instance.StoreKey], app.serviceKeeper)
app.processKeeper = process.NewKeeper(app.cdc, keys[process.StoreKey], app.instanceKeeper, app.ownershipKeeper)
app.runnerKeeper = runner.NewKeeper(app.cdc, keys[runner.StoreKey], app.instanceKeeper, app.ownershipKeeper)
app.executionKeeper = execution.NewKeeper(
app.cdc,
keys[execution.StoreKey],
app.bankKeeper,
app.serviceKeeper,
app.instanceKeeper,
app.runnerKeeper,
app.processKeeper,
app.subspaces[execution.ModuleName],
app.creditKeeper,
)

// NOTE: Any module instantiated in the module manager that is later modified
Expand All @@ -261,11 +328,14 @@ func NewInitApp(
genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx),
auth.NewAppModule(app.accountKeeper),
bank.NewAppModule(app.bankKeeper, app.accountKeeper),
crisis.NewAppModule(&app.crisisKeeper),
supply.NewAppModule(app.supplyKeeper, app.accountKeeper),
gov.NewAppModule(app.govKeeper, app.accountKeeper, app.supplyKeeper),
distr.NewAppModule(app.distrKeeper, app.accountKeeper, app.supplyKeeper, app.stakingKeeper),
slashing.NewAppModule(app.slashingKeeper, app.accountKeeper, app.stakingKeeper),

// Engine's modules
credit.NewAppModule(app.creditKeeper),
ownership.NewAppModule(app.ownershipKeeper),
instance.NewAppModule(app.instanceKeeper),
process.NewAppModule(app.processKeeper),
Expand All @@ -274,13 +344,15 @@ func NewInitApp(
execution.NewAppModule(app.executionKeeper),

staking.NewAppModule(app.stakingKeeper, app.accountKeeper, app.supplyKeeper),
upgrade.NewAppModule(app.upgradeKeeper),
evidence.NewAppModule(app.evidenceKeeper),
)
// During begin block slashing happens after distr.BeginBlocker so that
// there is nothing left over in the validator fee pool, so as to keep the
// CanWithdrawInvariant invariant.

app.mm.SetOrderBeginBlockers(distr.ModuleName, slashing.ModuleName)
app.mm.SetOrderEndBlockers(staking.ModuleName)
app.mm.SetOrderBeginBlockers(upgrade.ModuleName, distr.ModuleName, slashing.ModuleName)
app.mm.SetOrderEndBlockers(crisis.ModuleName, gov.ModuleName, staking.ModuleName)

// Sets the order of Genesis - Order matters, genutil is to always come last
// NOTE: The genutils module must occur after staking so that pools are
Expand All @@ -291,8 +363,10 @@ func NewInitApp(
auth.ModuleName,
bank.ModuleName,
slashing.ModuleName,
gov.ModuleName,

// Engine's modules
credit.ModuleName,
ownership.ModuleName,
instance.ModuleName,
process.ModuleName,
Expand All @@ -301,7 +375,9 @@ func NewInitApp(
execution.ModuleName,

supply.ModuleName,
crisis.ModuleName,
genutil.ModuleName,
evidence.ModuleName,
)

// register all module routes and module queriers
Expand Down
4 changes: 1 addition & 3 deletions cmd/mesg-cli/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func startOrchestratorCmd(cdc *codec.Codec) *cobra.Command {

// orchestrator
logger.Info("Starting orchestrator")
orch := orchestrator.New(rpc, ep, logger, viper.GetString(flagExecPrice))
orch := orchestrator.New(rpc, ep, logger)
defer func() {
logger.Info("Stopping orchestrator")
orch.Stop()
Expand Down Expand Up @@ -118,7 +118,6 @@ func startOrchestratorCmd(cdc *codec.Codec) *cobra.Command {
cmd.Flags().String(flagAuthorizedPubKeys, "", "The authorized pubkeys to communicate with the gRPC server")
cmd.Flags().String(flagMnemonic, "", "The account's mnemonic that will be used to sign transactions")
cmd.Flags().String(flagGasPrices, "", "The gas price to sign tx")
cmd.Flags().String(flagExecPrice, "10000atto", "The execution price to create execution")
cmd.Flags().String(flagAccNumber, "0", "The account number of the hd path to use to derive the mnemonic")
cmd.Flags().String(flagAccIndex, "0", "The account index of the hd path to use to derive the mnemonic")
return cmd
Expand All @@ -129,7 +128,6 @@ const (
flagAuthorizedPubKeys = "authorized-pubkeys"
flagMnemonic = "mnemonic"
flagGasPrices = "gas-prices"
flagExecPrice = "exec-price"
flagAccNumber = "acc-number"
flagAccIndex = "acc-index"
)
Loading

0 comments on commit 4859595

Please sign in to comment.