Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into rigel/deliver-max-gas
Browse files Browse the repository at this point in the history
  • Loading branch information
rigelrozanski committed Nov 16, 2018
2 parents 2a594fe + cf6b7ef commit 4818e67
Show file tree
Hide file tree
Showing 32 changed files with 311 additions and 166 deletions.
23 changes: 22 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ defaults: &defaults
environment:
GOBIN: /tmp/workspace/bin

docs_update: &docs_deploy
working_directory: ~/repo
docker:
- image: tendermint/docs_deployment
environment:
AWS_REGION: us-east-1

jobs:

setup_dependencies:
Expand Down Expand Up @@ -255,12 +262,26 @@ jobs:
make build-linux
make localnet-start
./scripts/localnet-blocks-test.sh 40 5 10 localhost
deploy_docs:
<<: *docs_deploy
steps:
- checkout
- run:
name: Trigger website build
command: |
export LAST_COMMIT=`git rev-parse HEAD`
export DOCS_COMMIT=`git log -1 --format=format:%H --full-diff docs`
if [[ $DOCS_COMMIT == $LAST_COMMIT ]]; then
chamber exec cosmos-sdk -- start_website_build
else
echo "No changes to docs detected"
fi
workflows:
version: 2
test-suite:
jobs:
- deploy_docs
- setup_dependencies
- lint:
requires:
Expand Down
50 changes: 37 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
# Contributing

Thank you for considering making contributions to Cosmos-SDK and related
repositories!
repositories!

Contributing to this repo can mean many things such as participated in
discussion or proposing code changes. To ensure a smooth workflow for all
contributors, the general procedure for contributing has been established:

1. either [open](https://github.com/cosmos/cosmos-sdk/issues/new/choose) or
[find](https://github.com/cosmos/cosmos-sdk/issues) an issue you'd like to help with,
2. participate in thoughtful discussion on that issue,
[find](https://github.com/cosmos/cosmos-sdk/issues) an issue you'd like to help with,
2. participate in thoughtful discussion on that issue,
3. if you would then like to contribute code:
1. if a the issue is a proposal, ensure that the proposal has been accepted,
1. if a the issue is a proposal, ensure that the proposal has been accepted,
2. ensure that nobody else has already begun working on this issue, if they have
make sure to contact them to collaborate,
make sure to contact them to collaborate,
3. if nobody has been assigned the issue and you would like to work on it
make a comment on the issue to inform the community of your intentions
to begin work,
to begin work,
4. follow standard github best practices: fork the repo, branch from the
tip of `develop`, make some commits, and submit a PR to `develop`,
tip of `develop`, make some commits, and submit a PR to `develop`,
5. include `WIP:` in the PR-title to and submit your PR early, even if it's
incomplete, this indicates to the community you're working on something and
allows them to provide comments early in the development process. When the code
is complete it can be marked as ready-for-review by replacing `WIP:` with
`R4R:` in the PR-title.
`R4R:` in the PR-title.

Note that for very small or blatantly obvious problems (such as typos) it is
Note that for very small or blatantly obvious problems (such as typos) it is
not required to an open issue to submit a PR, but be aware that for more complex
problems/features, if a PR is opened before an adequate design discussion has
taken place in a github issue, that PR runs a high likelihood of being rejected.
taken place in a github issue, that PR runs a high likelihood of being rejected.

Take a peek at our [coding repo](https://github.com/tendermint/coding) for
overall information on repository workflow and standards. Note, we use `make
get_dev_tools` and `make update_dev_tools` for installing the linting tools.

Other notes:
Other notes:
- Looking for a good place to start contributing? How about checking out some
[good first
issues](https://github.com/cosmos/cosmos-sdk/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
Expand All @@ -44,9 +44,33 @@ Other notes:

## Pull Requests

To accommodate review process we suggest that PRs are categorically broken up.
To accommodate review process we suggest that PRs are categorically broken up.
Ideally each PR addresses only a single issue. Additionally, as much as possible
code refactoring and cleanup should be submitted as a separate PRs from bugfixes/feature-additions.
code refactoring and cleanup should be submitted as a separate PRs from bugfixes/feature-additions.

### Process for reviewing PRs

All PRs require two Reviews before merge (except docs changes, or variable name-changes which only require one). When reviewing PRs please use the following review explanations:

- `LGTM` without an explicit approval means that the changes look good, but you haven't pulled down the code, run tests locally and thoroughly reviewed it.
- `Approval` through the GH UI means that you understand the code, documentation/spec is updated in the right places, you have pulled down and tested the code locally. In addition:
- You must also think through anything which ought to be included but is not
- You must think through whether any added code could be partially combined (DRYed) with existing code
- You must think through any potential security issues or incentive-compatibility flaws introduced by the changes
- Naming must be consistent with conventions and the rest of the codebase
- Code must live in a reasonable location, considering dependency structures (e.g. not importing testing modules in production code, or including example code modules in production code).
- if you approve of the PR, you are responsible for fixing any of the issues mentioned here and more
- If you sat down with the PR submitter and did a pairing review please note that in the `Approval`, or your PR comments.
- If you are only making "surface level" reviews, submit any notes as `Comments` without adding a review.

### Updating Documentation

If you open a PR on the Cosmos SDK, it is mandatory to update the relevant documentation in /docs.

* If your change relates to the core SDK (baseapp, store, ...), please update the docs/gaia folder, the docs/examples folder and possibly the docs/spec folder.
* If your changes relate specifically to the gaia application (not including modules), please modify the docs/gaia folder.
* If your changes relate to a module, please update the module's spec in docs/spec. If the module is used by gaia and/or basecoin, you might also need to modify docs/gaia and/or docs/examples.
* If your changes relate to the core of the CLI or Light-client (not specifically to module's CLI/Rest), please modify the docs/clients folder.

## Forking

Expand Down
11 changes: 8 additions & 3 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ BREAKING CHANGES

* SDK
* [\#2752](https://github.com/cosmos/cosmos-sdk/pull/2752) Don't hardcode bondable denom.
* [\#2019](https://github.com/cosmos/cosmos-sdk/issues/2019) Cap total number of signatures. Current per-transaction limit is 7, and if that is exceeded transaction is rejected.
* [\#2801](https://github.com/cosmos/cosmos-sdk/pull/2801) Remove AppInit structure.

* Tendermint

Expand All @@ -27,10 +29,13 @@ FEATURES
* [gov][cli] [\#2479](https://github.com/cosmos/cosmos-sdk/issues/2479) Added governance
parameter query commands.
* [stake][cli] [\#2027] Add CLI query command for getting all delegations to a specific validator.

* Gaia
* [app] \#2791 Support export at a specific height, with `gaiad export --height=HEIGHT`.
* [x/gov] [#2479](https://github.com/cosmos/cosmos-sdk/issues/2479) Implemented querier
for getting governance parameters.
* [app] \#2663 - Runtime-assertable invariants
* [app] \#2791 Support export at a specific height, with `gaiad export --height=HEIGHT`.

* SDK
* [simulator] \#2682 MsgEditValidator now looks at the validator's max rate, thus it now succeeds a significant portion of the time
Expand All @@ -49,7 +54,7 @@ IMPROVEMENTS
* Gaia
- #2773 Require moniker to be provided on `gaiad init`.
- #2672 [Makefile] Updated for better Windows compatibility and ledger support logic, get_tools was rewritten as a cross-compatible Makefile.

- [#110](https://github.com/tendermint/devops/issues/110) Updated CircleCI job to trigger website build when cosmos docs are updated.
* SDK
- [x/mock/simulation] [\#2720] major cleanup, introduction of helper objects, reorganization

Expand All @@ -68,7 +73,7 @@ BUG FIXES
* [\#2742](https://github.com/cosmos/cosmos-sdk/issues/2742) Fix time format of TimeoutCommit override

* SDK

- \#2733 [x/gov, x/mock/simulation] Fix governance simulation, update x/gov import/export

* Tendermint
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Cosmos SDK
![banner](docs/graphics/cosmos-sdk-image.png)
![banner](docs/cosmos-sdk-image.png)

[![version](https://img.shields.io/github/tag/cosmos/cosmos-sdk.svg)](https://github.com/cosmos/cosmos-sdk/releases/latest)
[![CircleCI](https://circleci.com/gh/cosmos/cosmos-sdk/tree/master.svg?style=shield)](https://circleci.com/gh/cosmos/cosmos-sdk/tree/master)
Expand All @@ -12,7 +12,7 @@
[![riot.im](https://img.shields.io/badge/riot.im-JOIN%20CHAT-green.svg)](https://riot.im/app/#/room/#cosmos-sdk:matrix.org)

The Cosmos-SDK is a framework for building blockchain applications in Golang.
It is being used to build `Gaia`, the first implementation of the [Cosmos Hub](https://cosmos.network/docs/),
It is being used to build `Gaia`, the first implementation of the Cosmos Hub.

**WARNING**: The SDK has mostly stabilized, but we are still making some
breaking changes.
Expand Down
7 changes: 7 additions & 0 deletions cmd/gaia/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ func (app *GaiaApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.R
tags := gov.EndBlocker(ctx, app.govKeeper)
validatorUpdates := stake.EndBlocker(ctx, app.stakeKeeper)

app.assertRuntimeInvariants()

return abci.ResponseEndBlock{
ValidatorUpdates: validatorUpdates,
Tags: tags,
Expand Down Expand Up @@ -324,6 +326,11 @@ func (app *GaiaApp) ExportAppStateAndValidators() (appState json.RawMessage, val
return appState, validators, nil
}

// load a particular height
func (app *GaiaApp) LoadHeight(height int64) error {
return app.LoadVersion(height, app.keyMain)
}

//______________________________________________________________________________________________

// Combined Staking Hooks
Expand Down
8 changes: 0 additions & 8 deletions cmd/gaia/app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"strings"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
Expand Down Expand Up @@ -94,13 +93,6 @@ func (ga *GenesisAccount) ToAccount() (acc *auth.BaseAccount) {
}
}

// get app init parameters for server init command
func GaiaAppInit() server.AppInit {

return server.AppInit{
AppGenState: GaiaAppGenStateJSON,
}
}

// Create the core parameters for genesis initialization for gaia
// note that the pubkey input is this machines pubkey
Expand Down
34 changes: 34 additions & 0 deletions cmd/gaia/app/invariants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package app

import (
"fmt"
"time"

banksim "github.com/cosmos/cosmos-sdk/x/bank/simulation"
distrsim "github.com/cosmos/cosmos-sdk/x/distribution/simulation"
"github.com/cosmos/cosmos-sdk/x/mock/simulation"
stakesim "github.com/cosmos/cosmos-sdk/x/stake/simulation"
)

func (app *GaiaApp) runtimeInvariants() []simulation.Invariant {
return []simulation.Invariant{
banksim.NonnegativeBalanceInvariant(app.accountKeeper),
distrsim.ValAccumInvariants(app.distrKeeper, app.stakeKeeper),
stakesim.SupplyInvariants(app.bankKeeper, app.stakeKeeper,
app.feeCollectionKeeper, app.distrKeeper, app.accountKeeper),
stakesim.PositivePowerInvariant(app.stakeKeeper),
}
}

func (app *GaiaApp) assertRuntimeInvariants() {
invariants := app.runtimeInvariants()
start := time.Now()
for _, inv := range invariants {
if err := inv(app.BaseApp); err != nil {
panic(fmt.Errorf("invariant broken: %s", err))
}
}
end := time.Now()
diff := end.Sub(start)
app.BaseApp.Logger.With("module", "invariants").Info("Asserted all invariants", "duration", diff)
}
16 changes: 10 additions & 6 deletions cmd/gaia/cmd/gaiad/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@ func main() {
Short: "Gaia Daemon (server)",
PersistentPreRunE: server.PersistentPreRunEFn(ctx),
}
appInit := app.GaiaAppInit()
rootCmd.AddCommand(gaiaInit.InitCmd(ctx, cdc, appInit))
rootCmd.AddCommand(gaiaInit.InitCmd(ctx, cdc))
rootCmd.AddCommand(gaiaInit.CollectGenTxsCmd(ctx, cdc))
rootCmd.AddCommand(gaiaInit.TestnetFilesCmd(ctx, cdc, server.AppInit{}))
rootCmd.AddCommand(gaiaInit.TestnetFilesCmd(ctx, cdc))
rootCmd.AddCommand(gaiaInit.GenTxCmd(ctx, cdc))
rootCmd.AddCommand(gaiaInit.AddGenesisAccountCmd(ctx, cdc))

server.AddCommands(ctx, cdc, rootCmd, appInit,
newApp, exportAppStateAndTMValidators)
server.AddCommands(ctx, cdc, rootCmd, newApp, exportAppStateAndTMValidators)

// prepare and add flags
executor := cli.PrepareBaseCmd(rootCmd, "GA", app.DefaultNodeHome)
Expand Down Expand Up @@ -75,9 +73,15 @@ func newApp(logger log.Logger, db dbm.DB,
}

func exportAppStateAndTMValidators(
logger log.Logger, db dbm.DB, traceStore io.Writer) (
logger log.Logger, db dbm.DB, traceStore io.Writer, height int64) (
json.RawMessage, []tmtypes.GenesisValidator, error) {

gApp := app.NewGaiaApp(logger, db, traceStore)
if height != -1 {
err := gApp.LoadHeight(height)
if err != nil {
return nil, nil, err
}
}
return gApp.ExportAppStateAndValidators()
}
2 changes: 1 addition & 1 deletion cmd/gaia/init/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func displayInfo(cdc *codec.Codec, info printInfo) error {

// get cmd to initialize all files for tendermint and application
// nolint
func InitCmd(ctx *server.Context, cdc *codec.Codec, appInit server.AppInit) *cobra.Command {
func InitCmd(ctx *server.Context, cdc *codec.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "init",
Short: "Initialize private validator, p2p, genesis, and application configuration files",
Expand Down
16 changes: 3 additions & 13 deletions cmd/gaia/init/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ func TestInitCmd(t *testing.T) {

ctx := server.NewContext(cfg, logger)
cdc := app.MakeCodec()
appInit := server.AppInit{
AppGenState: mock.AppGenState,
}
cmd := InitCmd(ctx, cdc, appInit)
cmd := InitCmd(ctx, cdc)

viper.Set(flagMoniker, "gaianode-test")

Expand Down Expand Up @@ -65,13 +62,9 @@ func TestEmptyState(t *testing.T) {

ctx := server.NewContext(cfg, logger)
cdc := app.MakeCodec()
appInit := server.AppInit{
AppGenState: mock.AppGenStateEmpty,
}

viper.Set(flagMoniker, "gaianode-test")

cmd := InitCmd(ctx, cdc, appInit)
cmd := InitCmd(ctx, cdc)
err = cmd.RunE(nil, nil)
require.NoError(t, err)

Expand Down Expand Up @@ -116,10 +109,7 @@ func TestStartStandAlone(t *testing.T) {
require.Nil(t, err)
ctx := server.NewContext(cfg, logger)
cdc := app.MakeCodec()
appInit := server.AppInit{
AppGenState: mock.AppGenState,
}
initCmd := InitCmd(ctx, cdc, appInit)
initCmd := InitCmd(ctx, cdc)
err = initCmd.RunE(nil, nil)
require.NoError(t, err)

Expand Down
3 changes: 1 addition & 2 deletions cmd/gaia/init/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ var (
const nodeDirPerm = 0755

// get cmd to initialize all files for tendermint testnet and application
func TestnetFilesCmd(ctx *server.Context, cdc *codec.Codec,
appInit server.AppInit) *cobra.Command {
func TestnetFilesCmd(ctx *server.Context, cdc *codec.Codec) *cobra.Command {

cmd := &cobra.Command{
Use: "testnet",
Expand Down
Loading

0 comments on commit 4818e67

Please sign in to comment.