merge
This commit is contained in:
commit
93e3d2950d
|
@ -178,7 +178,7 @@ jobs:
|
|||
name: Test multi-seed Gaia simulation
|
||||
command: |
|
||||
export PATH="$GOBIN:$PATH"
|
||||
make test_sim_gaia_multi_seed
|
||||
scripts/multisim.sh 25 TestFullGaiaSimulation
|
||||
|
||||
test_cover:
|
||||
<<: *defaults
|
||||
|
|
55
CHANGELOG.md
55
CHANGELOG.md
|
@ -1,5 +1,60 @@
|
|||
# Changelog
|
||||
|
||||
## 0.28.0
|
||||
|
||||
BREAKING CHANGES
|
||||
|
||||
* Gaia CLI (`gaiacli`)
|
||||
* [cli] [\#2595](https://github.com/cosmos/cosmos-sdk/issues/2595) Remove `keys new` in favor of `keys add` incorporating existing functionality with addition of key recovery functionality.
|
||||
* [cli] [\#2987](https://github.com/cosmos/cosmos-sdk/pull/2987) Add shorthand `-a` to `gaiacli keys show` and update docs
|
||||
* [cli] [\#2971](https://github.com/cosmos/cosmos-sdk/pull/2971) Additional verification when running `gaiad gentx`
|
||||
* [cli] [\#2734](https://github.com/cosmos/cosmos-sdk/issues/2734) Rewrite `gaiacli config`. It is now a non-interactive config utility.
|
||||
|
||||
* Gaia
|
||||
* [#128](https://github.com/tendermint/devops/issues/128) Updated CircleCI job to trigger website build on every push to master/develop.
|
||||
* [\#2994](https://github.com/cosmos/cosmos-sdk/pull/2994) Change wrong-password error message.
|
||||
* [\#3009](https://github.com/cosmos/cosmos-sdk/issues/3009) Added missing Gaia genesis verification
|
||||
* [#128](https://github.com/tendermint/devops/issues/128) Updated CircleCI job to trigger website build on every push to master/develop.
|
||||
* [\#2994](https://github.com/cosmos/cosmos-sdk/pull/2994) Change wrong-password error message.
|
||||
* [\#3009](https://github.com/cosmos/cosmos-sdk/issues/3009) Added missing Gaia genesis verification
|
||||
* [gas] [\#3052](https://github.com/cosmos/cosmos-sdk/issues/3052) Updated gas costs to more reasonable numbers
|
||||
|
||||
* SDK
|
||||
* [auth] [\#2952](https://github.com/cosmos/cosmos-sdk/issues/2952) Signatures are no longer serialized on chain with the account number and sequence number
|
||||
* [auth] [\#2952](https://github.com/cosmos/cosmos-sdk/issues/2952) Signatures are no longer serialized on chain with the account number and sequence number
|
||||
* [stake] [\#3055](https://github.com/cosmos/cosmos-sdk/issues/3055) Use address instead of bond height / intratxcounter for deduplication
|
||||
|
||||
FEATURES
|
||||
|
||||
* Gaia CLI (`gaiacli`)
|
||||
* [\#2961](https://github.com/cosmos/cosmos-sdk/issues/2961) Add --force flag to gaiacli keys delete command to skip passphrase check and force key deletion unconditionally.
|
||||
|
||||
IMPROVEMENTS
|
||||
|
||||
* Gaia CLI (`gaiacli`)
|
||||
* [\#2991](https://github.com/cosmos/cosmos-sdk/issues/2991) Fully validate transaction signatures during `gaiacli tx sign --validate-signatures`
|
||||
|
||||
* SDK
|
||||
* [\#1277](https://github.com/cosmos/cosmos-sdk/issues/1277) Complete bank module specification
|
||||
* [\#2963](https://github.com/cosmos/cosmos-sdk/issues/2963) Complete auth module specification
|
||||
* [\#2914](https://github.com/cosmos/cosmos-sdk/issues/2914) No longer withdraw validator rewards on bond/unbond, but rather move
|
||||
the rewards to the respective validator's pools.
|
||||
|
||||
|
||||
BUG FIXES
|
||||
|
||||
* Gaia CLI (`gaiacli`)
|
||||
* [\#2921](https://github.com/cosmos/cosmos-sdk/issues/2921) Fix `keys delete` inability to delete offline and ledger keys.
|
||||
|
||||
* Gaia
|
||||
* [\#3003](https://github.com/cosmos/cosmos-sdk/issues/3003) CollectStdTxs() must validate DelegatorAddr against genesis accounts.
|
||||
|
||||
* SDK
|
||||
* [\#2967](https://github.com/cosmos/cosmos-sdk/issues/2967) Change ordering of `mint.BeginBlocker` and `distr.BeginBlocker`, recalculate inflation each block
|
||||
* [\#3068](https://github.com/cosmos/cosmos-sdk/issues/3068) check for uint64 gas overflow during `Std#ValidateBasic`.
|
||||
* [\#3071](https://github.com/cosmos/cosmos-sdk/issues/3071) Catch overflow on block gas meter
|
||||
|
||||
|
||||
## 0.27.0
|
||||
|
||||
BREAKING CHANGES
|
||||
|
|
25
PENDING.md
25
PENDING.md
|
@ -3,22 +3,15 @@
|
|||
BREAKING CHANGES
|
||||
|
||||
* Gaia REST API (`gaiacli advanced rest-server`)
|
||||
* [lcd] https://github.com/cosmos/cosmos-sdk/pull/3045 Fix quoted json return on GET /keys (keys list)
|
||||
* [gaia-lite] [\#2191](https://github.com/cosmos/cosmos-sdk/issues/2191) Split `POST /stake/delegators/{delegatorAddr}/delegations` into `POST /stake/delegators/{delegatorAddr}/delegations`, `POST /stake/delegators/{delegatorAddr}/unbonding_delegations` and `POST /stake/delegators/{delegatorAddr}/redelegations`
|
||||
* [gaia-lite] [\#3056](https://github.com/cosmos/cosmos-sdk/pull/3056) `generate_only` and `simulate` have moved from query arguments to POST requests body.
|
||||
|
||||
* Gaia CLI (`gaiacli`)
|
||||
* [cli] [\#2595](https://github.com/cosmos/cosmos-sdk/issues/2595) Remove `keys new` in favor of `keys add` incorporating existing functionality with addition of key recovery functionality.
|
||||
* [cli] [\#2987](https://github.com/cosmos/cosmos-sdk/pull/2987) Add shorthand `-a` to `gaiacli keys show` and update docs
|
||||
* [cli] [\#2971](https://github.com/cosmos/cosmos-sdk/pull/2971) Additional verification when running `gaiad gentx`
|
||||
* [cli] [\#2734](https://github.com/cosmos/cosmos-sdk/issues/2734) Rewrite `gaiacli config`. It is now a non-interactive config utility.
|
||||
|
||||
* Gaia
|
||||
- [#128](https://github.com/tendermint/devops/issues/128) Updated CircleCI job to trigger website build on every push to master/develop.
|
||||
- [\#2994](https://github.com/cosmos/cosmos-sdk/pull/2994) Change wrong-password error message.
|
||||
- \#3009 Added missing Gaia genesis verification
|
||||
- [gas] \#3052 Updated gas costs to more reasonable numbers
|
||||
|
||||
* SDK
|
||||
- [auth] \#2952 Signatures are no longer serialized on chain with the account number and sequence number
|
||||
- [stake] \#3055 Use address instead of bond height / intratxcounter for deduplication
|
||||
|
||||
* Tendermint
|
||||
|
||||
|
@ -28,10 +21,8 @@ FEATURES
|
|||
* Gaia REST API (`gaiacli advanced rest-server`)
|
||||
|
||||
* Gaia CLI (`gaiacli`)
|
||||
- [\#2961](https://github.com/cosmos/cosmos-sdk/issues/2961) Add --force flag to gaiacli keys delete command to skip passphrase check and force key deletion unconditionally.
|
||||
|
||||
* Gaia
|
||||
- [gov] Added minimum quorum needed for vote to pass
|
||||
|
||||
* SDK
|
||||
|
||||
|
@ -43,15 +34,12 @@ IMPROVEMENTS
|
|||
* Gaia REST API (`gaiacli advanced rest-server`)
|
||||
|
||||
* Gaia CLI (`gaiacli`)
|
||||
* \#2991 Fully validate transaction signatures during `gaiacli tx sign --validate-signatures`
|
||||
|
||||
* Gaia
|
||||
* [\#3021](https://github.com/cosmos/cosmos-sdk/pull/3021) Add `--gentx-dir` to `gaiad collect-gentxs` to specify a directory from which collect and load gentxs.
|
||||
Add `--output-document` to `gaiad init` to allow one to redirect output to file.
|
||||
|
||||
* SDK
|
||||
- \#1277 Complete bank module specification
|
||||
- \#2963 Complete auth module specification
|
||||
* \#2914 No longer withdraw validator rewards on bond/unbond, but rather move
|
||||
the rewards to the respective validator's pools.
|
||||
|
||||
* Tendermint
|
||||
|
||||
|
@ -61,12 +49,9 @@ BUG FIXES
|
|||
* Gaia REST API (`gaiacli advanced rest-server`)
|
||||
|
||||
* Gaia CLI (`gaiacli`)
|
||||
* [\#2921](https://github.com/cosmos/cosmos-sdk/issues/2921) Fix `keys delete` inability to delete offline and ledger keys.
|
||||
|
||||
* Gaia
|
||||
* [\#3003](https://github.com/cosmos/cosmos-sdk/issues/3003) CollectStdTxs() must validate DelegatorAddr against genesis accounts.
|
||||
|
||||
* SDK
|
||||
* \#2967 Change ordering of `mint.BeginBlocker` and `distr.BeginBlocker`, recalculate inflation each block
|
||||
|
||||
* Tendermint
|
||||
|
|
|
@ -701,6 +701,11 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte, tx sdk.Tx) (result sdk
|
|||
return
|
||||
}
|
||||
|
||||
var startingGas uint64
|
||||
if mode == runTxModeDeliver {
|
||||
startingGas = ctx.BlockGasMeter().GasConsumed()
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
switch rType := r.(type) {
|
||||
|
@ -726,6 +731,9 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte, tx sdk.Tx) (result sdk
|
|||
if mode == runTxModeDeliver {
|
||||
ctx.BlockGasMeter().ConsumeGas(
|
||||
ctx.GasMeter().GasConsumedToLimit(), "block gas meter")
|
||||
if ctx.BlockGasMeter().GasConsumed() < startingGas {
|
||||
panic(sdk.ErrorGasOverflow{"tx gas summation"})
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package baseapp
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/tendermint/tendermint/abci/server"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// nolint - Mostly for testing
|
||||
|
|
|
@ -4,9 +4,10 @@ package baseapp
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/store"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
)
|
||||
|
||||
// File for storing in-package BaseApp optional functions,
|
||||
|
|
|
@ -4,9 +4,10 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// Test that we can only query from the latest committed state.
|
||||
|
|
|
@ -7,9 +7,10 @@ import (
|
|||
"path"
|
||||
"strconv"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
|
||||
"github.com/pelletier/go-toml"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
|
|
@ -13,14 +13,15 @@ import (
|
|||
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/keys"
|
||||
cskeys "github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
"github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmlite "github.com/tendermint/tendermint/lite"
|
||||
tmliteProxy "github.com/tendermint/tendermint/lite/proxy"
|
||||
rpcclient "github.com/tendermint/tendermint/rpc/client"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/keys"
|
||||
cskeys "github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
"github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
const ctxAccStoreName = "acc"
|
||||
|
@ -46,7 +47,7 @@ type CLIContext struct {
|
|||
JSON bool
|
||||
PrintResponse bool
|
||||
Verifier tmlite.Verifier
|
||||
DryRun bool
|
||||
Simulate bool
|
||||
GenerateOnly bool
|
||||
fromAddress types.AccAddress
|
||||
fromName string
|
||||
|
@ -84,7 +85,7 @@ func NewCLIContext() CLIContext {
|
|||
JSON: viper.GetBool(client.FlagJson),
|
||||
PrintResponse: viper.GetBool(client.FlagPrintResponse),
|
||||
Verifier: verifier,
|
||||
DryRun: viper.GetBool(client.FlagDryRun),
|
||||
Simulate: viper.GetBool(client.FlagDryRun),
|
||||
GenerateOnly: viper.GetBool(client.FlagGenerateOnly),
|
||||
fromAddress: fromAddress,
|
||||
fromName: fromName,
|
||||
|
@ -243,3 +244,15 @@ func (ctx CLIContext) WithVerifier(verifier tmlite.Verifier) CLIContext {
|
|||
ctx.Verifier = verifier
|
||||
return ctx
|
||||
}
|
||||
|
||||
// WithGenerateOnly returns a copy of the context with updated GenerateOnly value
|
||||
func (ctx CLIContext) WithGenerateOnly(generateOnly bool) CLIContext {
|
||||
ctx.GenerateOnly = generateOnly
|
||||
return ctx
|
||||
}
|
||||
|
||||
// WithSimulation returns a copy of the context with updated Simulate value
|
||||
func (ctx CLIContext) WithSimulation(simulate bool) CLIContext {
|
||||
ctx.Simulate = simulate
|
||||
return ctx
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package context
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// ErrInvalidAccount returns a standardized error reflecting that a given
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
|
||||
"strings"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/store"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto/merkle"
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
|
@ -18,6 +17,8 @@ import (
|
|||
tmliteProxy "github.com/tendermint/tendermint/lite/proxy"
|
||||
rpcclient "github.com/tendermint/tendermint/rpc/client"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/store"
|
||||
)
|
||||
|
||||
// GetNode returns an RPC client. If the context's client is not defined, an
|
||||
|
|
|
@ -43,6 +43,7 @@ const (
|
|||
FlagSSLHosts = "ssl-hosts"
|
||||
FlagSSLCertFile = "ssl-certfile"
|
||||
FlagSSLKeyFile = "ssl-keyfile"
|
||||
FlagOutputDocument = "output-document" // inspired by wget -O
|
||||
)
|
||||
|
||||
// LineBreak can be included in a command list to provide a blank line
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package client
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
)
|
||||
|
||||
// GetKeyBase initializes a keybase based on the given db.
|
||||
|
|
|
@ -10,10 +10,11 @@ import (
|
|||
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
keys "github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
keyerror "github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
|
|
@ -50,7 +50,7 @@ func QueryKeysRequestHandler(indent bool) http.HandlerFunc {
|
|||
}
|
||||
// an empty list will be JSONized as null, but we want to keep the empty list
|
||||
if len(infos) == 0 {
|
||||
PostProcessResponse(w, cdc, "[]", indent)
|
||||
PostProcessResponse(w, cdc, []string{}, indent)
|
||||
return
|
||||
}
|
||||
keysOutput, err := Bech32KeysOutput(infos)
|
||||
|
|
|
@ -4,9 +4,10 @@ import (
|
|||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
|
||||
bip39 "github.com/bartekn/go-bip39"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package keys
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
)
|
||||
|
||||
// Commands registers a sub-tree of commands to interact with
|
||||
|
|
|
@ -4,17 +4,19 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/tendermint/tendermint/crypto/multisig"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -5,12 +5,14 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
keys "github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
keys "github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
|
||||
)
|
||||
|
||||
func updateKeyCommand() *cobra.Command {
|
||||
|
|
|
@ -5,14 +5,15 @@ import (
|
|||
"net/http"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/syndtr/goleveldb/leveldb/opt"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// KeyDBName is the directory under root where we store the keys
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package keys
|
||||
|
||||
import (
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
"github.com/stretchr/testify/require"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
)
|
||||
|
||||
func TestGetKeyBaseLocks(t *testing.T) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,12 +7,6 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/keys"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
keybase "github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/rakyll/statik/fs"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -20,6 +14,13 @@ import (
|
|||
"github.com/tendermint/tendermint/libs/log"
|
||||
rpcserver "github.com/tendermint/tendermint/rpc/lib/server"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/keys"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
keybase "github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
|
||||
// Import statik for light client stuff
|
||||
_ "github.com/cosmos/cosmos-sdk/client/lcd/statik"
|
||||
)
|
||||
|
|
|
@ -376,16 +376,6 @@ paths:
|
|||
produces:
|
||||
- application/json
|
||||
parameters:
|
||||
- in: query
|
||||
name: simulate
|
||||
description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it
|
||||
required: false
|
||||
type: boolean
|
||||
- in: query
|
||||
name: generate_only
|
||||
description: if true, build an unsigned transaction and write it back
|
||||
required: false
|
||||
type: boolean
|
||||
- in: path
|
||||
name: address
|
||||
description: Account address in bech32 format
|
||||
|
@ -635,81 +625,6 @@ paths:
|
|||
description: Bech32 AccAddress of Delegator
|
||||
required: true
|
||||
type: string
|
||||
post:
|
||||
summary: Submit delegation
|
||||
parameters:
|
||||
- in: query
|
||||
name: simulate
|
||||
description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it
|
||||
required: false
|
||||
type: boolean
|
||||
- in: query
|
||||
name: generate_only
|
||||
description: if true, build an unsigned transaction and write it back
|
||||
required: false
|
||||
type: boolean
|
||||
- in: body
|
||||
name: delegation
|
||||
description: The password of the account to remove from the KMS
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
"$ref": "#/definitions/BaseReq"
|
||||
delegations:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
delegator_addr:
|
||||
$ref: "#/definitions/Address"
|
||||
validator_addr:
|
||||
$ref: "#/definitions/ValidatorAddress"
|
||||
delegation:
|
||||
$ref: "#/definitions/Coin"
|
||||
begin_unbondings:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
delegator_addr:
|
||||
$ref: "#/definitions/Address"
|
||||
validator_addr:
|
||||
$ref: "#/definitions/ValidatorAddress"
|
||||
shares:
|
||||
type: string
|
||||
example: "100"
|
||||
begin_redelegates:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
delegator_addr:
|
||||
$ref: "#/definitions/Address"
|
||||
validator_src_addr:
|
||||
$ref: "#/definitions/ValidatorAddress"
|
||||
validator_dst_addr:
|
||||
$ref: "#/definitions/ValidatorAddress"
|
||||
shares:
|
||||
type: string
|
||||
example: "100"
|
||||
tags:
|
||||
- ICS21
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid delegator address or delegation body
|
||||
401:
|
||||
description: Key password is wrong
|
||||
500:
|
||||
description: Internal Server Error
|
||||
get:
|
||||
summary: Get all delegations from a delegator
|
||||
tags:
|
||||
|
@ -722,12 +637,72 @@ paths:
|
|||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
"$ref": "#/definitions/Delegation"
|
||||
$ref: "#/definitions/Delegation"
|
||||
400:
|
||||
description: Invalid delegator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
post:
|
||||
summary: Submit delegation
|
||||
parameters:
|
||||
- in: body
|
||||
name: delegation
|
||||
description: The password of the account to remove from the KMS
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
$ref: "#/definitions/BaseReq"
|
||||
delegator_addr:
|
||||
$ref: "#/definitions/Address"
|
||||
validator_addr:
|
||||
$ref: "#/definitions/ValidatorAddress"
|
||||
delegation:
|
||||
$ref: "#/definitions/Coin"
|
||||
tags:
|
||||
- ICS21
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid delegator address or delegation request body
|
||||
401:
|
||||
description: Key password is wrong
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/stake/delegators/{delegatorAddr}/delegations/{validatorAddr}:
|
||||
parameters:
|
||||
- in: path
|
||||
name: delegatorAddr
|
||||
description: Bech32 AccAddress of Delegator
|
||||
required: true
|
||||
type: string
|
||||
- in: path
|
||||
name: validatorAddr
|
||||
description: Bech32 OperatorAddress of validator
|
||||
required: true
|
||||
type: string
|
||||
get:
|
||||
summary: Query the current delegation between a delegator and a validator
|
||||
tags:
|
||||
- ICS21
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/Delegation"
|
||||
400:
|
||||
description: Invalid delegator address or validator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/stake/delegators/{delegatorAddr}/unbonding_delegations:
|
||||
parameters:
|
||||
- in: path
|
||||
|
@ -747,12 +722,85 @@ paths:
|
|||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
"$ref": "#/definitions/UnbondingDelegation"
|
||||
$ref: "#/definitions/UnbondingDelegation"
|
||||
400:
|
||||
description: Invalid delegator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
post:
|
||||
summary: Submit an unbonding delegation
|
||||
parameters:
|
||||
- in: query
|
||||
name: simulate
|
||||
description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it
|
||||
required: false
|
||||
type: boolean
|
||||
- in: query
|
||||
name: generate_only
|
||||
description: if true, build an unsigned transaction and write it back
|
||||
required: false
|
||||
type: boolean
|
||||
- in: body
|
||||
name: delegation
|
||||
description: The password of the account to remove from the KMS
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
$ref: "#/definitions/BaseReq"
|
||||
delegator_addr:
|
||||
$ref: "#/definitions/Address"
|
||||
validator_addr:
|
||||
$ref: "#/definitions/ValidatorAddress"
|
||||
shares:
|
||||
type: string
|
||||
example: "100"
|
||||
tags:
|
||||
- ICS21
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid delegator address or unbonding delegation request body
|
||||
401:
|
||||
description: Key password is wrong
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/stake/delegators/{delegatorAddr}/unbonding_delegations/{validatorAddr}:
|
||||
parameters:
|
||||
- in: path
|
||||
name: delegatorAddr
|
||||
description: Bech32 AccAddress of Delegator
|
||||
required: true
|
||||
type: string
|
||||
- in: path
|
||||
name: validatorAddr
|
||||
description: Bech32 OperatorAddress of validator
|
||||
required: true
|
||||
type: string
|
||||
get:
|
||||
summary: Query all unbonding delegations between a delegator and a validator
|
||||
tags:
|
||||
- ICS21
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/UnbondingDelegation"
|
||||
400:
|
||||
description: Invalid delegator address or validator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/stake/delegators/{delegatorAddr}/redelegations:
|
||||
parameters:
|
||||
- in: path
|
||||
|
@ -772,12 +820,58 @@ paths:
|
|||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
"$ref": "#/definitions/Redelegation"
|
||||
$ref: "#/definitions/Redelegation"
|
||||
400:
|
||||
description: Invalid delegator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
post:
|
||||
summary: Submit a redelegation
|
||||
parameters:
|
||||
- in: query
|
||||
name: simulate
|
||||
description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it
|
||||
required: false
|
||||
type: boolean
|
||||
- in: query
|
||||
name: generate_only
|
||||
description: if true, build an unsigned transaction and write it back
|
||||
required: false
|
||||
type: boolean
|
||||
- in: body
|
||||
name: delegation
|
||||
description: The password of the account to remove from the KMS
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
$ref: "#/definitions/BaseReq"
|
||||
delegator_addr:
|
||||
$ref: "#/definitions/Address"
|
||||
validator_src_addr:
|
||||
$ref: "#/definitions/ValidatorAddress"
|
||||
validator_dst_addr:
|
||||
$ref: "#/definitions/ValidatorAddress"
|
||||
shares:
|
||||
type: string
|
||||
example: "100"
|
||||
tags:
|
||||
- ICS21
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid delegator address or redelegation request body
|
||||
401:
|
||||
description: Key password is wrong
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/stake/delegators/{delegatorAddr}/validators:
|
||||
parameters:
|
||||
- in: path
|
||||
|
@ -855,63 +949,6 @@ paths:
|
|||
description: Invalid delegator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/stake/delegators/{delegatorAddr}/delegations/{validatorAddr}:
|
||||
parameters:
|
||||
- in: path
|
||||
name: delegatorAddr
|
||||
description: Bech32 AccAddress of Delegator
|
||||
required: true
|
||||
type: string
|
||||
- in: path
|
||||
name: validatorAddr
|
||||
description: Bech32 OperatorAddress of validator
|
||||
required: true
|
||||
type: string
|
||||
get:
|
||||
summary: Query the current delegation between a delegator and a validator
|
||||
tags:
|
||||
- ICS21
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/Delegation"
|
||||
400:
|
||||
description: Invalid delegator address or validator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/stake/delegators/{delegatorAddr}/unbonding_delegations/{validatorAddr}:
|
||||
parameters:
|
||||
- in: path
|
||||
name: delegatorAddr
|
||||
description: Bech32 AccAddress of Delegator
|
||||
required: true
|
||||
type: string
|
||||
- in: path
|
||||
name: validatorAddr
|
||||
description: Bech32 OperatorAddress of validator
|
||||
required: true
|
||||
type: string
|
||||
get:
|
||||
summary: Query all unbonding delegations between a delegator and a validator
|
||||
tags:
|
||||
- ICS21
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
"$ref": "#/definitions/UnbondingDelegation"
|
||||
400:
|
||||
description: Invalid delegator address or validator address
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/stake/validators:
|
||||
get:
|
||||
summary: Get all validator candidates
|
||||
|
@ -1123,16 +1160,6 @@ paths:
|
|||
tags:
|
||||
- ICS23
|
||||
parameters:
|
||||
- in: query
|
||||
name: simulate
|
||||
description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it
|
||||
required: false
|
||||
type: boolean
|
||||
- in: query
|
||||
name: generate_only
|
||||
description: if true, build an unsigned transaction and write it back
|
||||
required: false
|
||||
type: boolean
|
||||
- type: string
|
||||
description: Bech32 validator address
|
||||
name: validatorAddr
|
||||
|
@ -1146,7 +1173,7 @@ paths:
|
|||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
"$ref": "#/definitions/BaseReq"
|
||||
$ref: "#/definitions/BaseReq"
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
|
@ -1169,16 +1196,6 @@ paths:
|
|||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- in: query
|
||||
name: simulate
|
||||
description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it
|
||||
required: false
|
||||
type: boolean
|
||||
- in: query
|
||||
name: generate_only
|
||||
description: if true, build an unsigned transaction and write it back
|
||||
required: false
|
||||
type: boolean
|
||||
- description: valid value of `"proposal_type"` can be `"text"`, `"parameter_change"`, `"software_upgrade"`
|
||||
name: post_proposal_body
|
||||
in: body
|
||||
|
@ -1187,7 +1204,7 @@ paths:
|
|||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
"$ref": "#/definitions/BaseReq"
|
||||
$ref: "#/definitions/BaseReq"
|
||||
title:
|
||||
type: string
|
||||
description:
|
||||
|
@ -1196,7 +1213,7 @@ paths:
|
|||
type: string
|
||||
example: "text"
|
||||
proposer:
|
||||
"$ref": "#/definitions/Address"
|
||||
$ref: "#/definitions/Address"
|
||||
initial_deposit:
|
||||
type: array
|
||||
items:
|
||||
|
@ -1205,7 +1222,7 @@ paths:
|
|||
200:
|
||||
description: OK
|
||||
schema:
|
||||
"$ref": "#/definitions/BroadcastTxCommitResult"
|
||||
$ref: "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid proposal body
|
||||
401:
|
||||
|
@ -1241,184 +1258,11 @@ paths:
|
|||
schema:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/definitions/TextProposal"
|
||||
$ref: "#/definitions/TextProposal"
|
||||
400:
|
||||
description: Invalid query parameters
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}/deposits:
|
||||
post:
|
||||
summary: Deposit tokens to a proposal
|
||||
description: Send transaction to deposit tokens to a proposal
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- in: query
|
||||
name: simulate
|
||||
description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it
|
||||
required: false
|
||||
type: boolean
|
||||
- in: query
|
||||
name: generate_only
|
||||
description: if true, build an unsigned transaction and write it back
|
||||
required: false
|
||||
type: boolean
|
||||
- type: string
|
||||
description: proposal id
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
- description: ''
|
||||
name: post_deposit_body
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
"$ref": "#/definitions/BaseReq"
|
||||
depositor:
|
||||
"$ref": "#/definitions/Address"
|
||||
amount:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Coin"
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
"$ref": "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid proposal id or deposit body
|
||||
401:
|
||||
description: Key password is wrong
|
||||
500:
|
||||
description: Internal Server Error
|
||||
get:
|
||||
summary: Query deposits
|
||||
description: Query deposits by proposalId
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- type: string
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/definitions/Deposit"
|
||||
400:
|
||||
description: Invalid proposal id
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}/tally:
|
||||
get:
|
||||
summary: Get a proposal's tally result at the current time
|
||||
description: Gets a proposal's tally result at the current time. If the proposal is pending deposits (i.e status 'DepositPeriod') it returns an empty tally result.
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- type: string
|
||||
description: proposal id
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/TallyResult"
|
||||
400:
|
||||
description: Invalid proposal id
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}/votes:
|
||||
post:
|
||||
summary: Vote a proposal
|
||||
description: Send transaction to vote a proposal
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- in: query
|
||||
name: simulate
|
||||
description: if true, ignore the gas field and perform a simulation of a transaction, but don't broadcast it
|
||||
required: false
|
||||
type: boolean
|
||||
- in: query
|
||||
name: generate_only
|
||||
description: if true, build an unsigned transaction and write it back
|
||||
required: false
|
||||
type: boolean
|
||||
- type: string
|
||||
description: proposal id
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
- description: valid value of `"option"` field can be `"yes"`, `"no"`, `"no_with_veto"` and `"abstain"`
|
||||
name: post_vote_body
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
"$ref": "#/definitions/BaseReq"
|
||||
voter:
|
||||
"$ref": "#/definitions/Address"
|
||||
option:
|
||||
type: string
|
||||
example: "yes"
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
"$ref": "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid proposal id or vote body
|
||||
401:
|
||||
description: Key password is wrong
|
||||
500:
|
||||
description: Internal Server Error
|
||||
get:
|
||||
summary: Query voters
|
||||
description: Query voters information by proposalId
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- type: string
|
||||
description: proposal id
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/definitions/Vote"
|
||||
400:
|
||||
description: Invalid proposal id
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}:
|
||||
get:
|
||||
summary: Query a proposal
|
||||
|
@ -1436,11 +1280,76 @@ paths:
|
|||
200:
|
||||
description: OK
|
||||
schema:
|
||||
"$ref": "#/definitions/TextProposal"
|
||||
$ref: "#/definitions/TextProposal"
|
||||
400:
|
||||
description: Invalid proposal id
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}/deposits:
|
||||
get:
|
||||
summary: Query deposits
|
||||
description: Query deposits by proposalId
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- type: string
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Deposit"
|
||||
400:
|
||||
description: Invalid proposal id
|
||||
500:
|
||||
description: Internal Server Error
|
||||
post:
|
||||
summary: Deposit tokens to a proposal
|
||||
description: Send transaction to deposit tokens to a proposal
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- type: string
|
||||
description: proposal id
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
- description: ''
|
||||
name: post_deposit_body
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
$ref: "#/definitions/BaseReq"
|
||||
depositor:
|
||||
$ref: "#/definitions/Address"
|
||||
amount:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Coin"
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid proposal id or deposit body
|
||||
401:
|
||||
description: Key password is wrong
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}/deposits/{depositor}:
|
||||
get:
|
||||
summary: Query deposit
|
||||
|
@ -1471,6 +1380,71 @@ paths:
|
|||
description: Found no deposit
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}/votes:
|
||||
get:
|
||||
summary: Query voters
|
||||
description: Query voters information by proposalId
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- type: string
|
||||
description: proposal id
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Vote"
|
||||
400:
|
||||
description: Invalid proposal id
|
||||
500:
|
||||
description: Internal Server Error
|
||||
post:
|
||||
summary: Vote a proposal
|
||||
description: Send transaction to vote a proposal
|
||||
consumes:
|
||||
- application/json
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- type: string
|
||||
description: proposal id
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
- description: valid value of `"option"` field can be `"yes"`, `"no"`, `"no_with_veto"` and `"abstain"`
|
||||
name: post_vote_body
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
base_req:
|
||||
$ref: "#/definitions/BaseReq"
|
||||
voter:
|
||||
$ref: "#/definitions/Address"
|
||||
option:
|
||||
type: string
|
||||
example: "yes"
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/BroadcastTxCommitResult"
|
||||
400:
|
||||
description: Invalid proposal id or vote body
|
||||
401:
|
||||
description: Key password is wrong
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}/votes/{voter}:
|
||||
get:
|
||||
summary: Query vote
|
||||
|
@ -1501,6 +1475,29 @@ paths:
|
|||
description: Found no vote
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/proposals/{proposalId}/tally:
|
||||
get:
|
||||
summary: Get a proposal's tally result at the current time
|
||||
description: Gets a proposal's tally result at the current time. If the proposal is pending deposits (i.e status 'DepositPeriod') it returns an empty tally result.
|
||||
produces:
|
||||
- application/json
|
||||
tags:
|
||||
- ICS22
|
||||
parameters:
|
||||
- type: string
|
||||
description: proposal id
|
||||
name: proposalId
|
||||
required: true
|
||||
in: path
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
||||
schema:
|
||||
$ref: "#/definitions/TallyResult"
|
||||
400:
|
||||
description: Invalid proposal id
|
||||
500:
|
||||
description: Internal Server Error
|
||||
/gov/parameters/deposit:
|
||||
get:
|
||||
summary: Query governance deposit parameters
|
||||
|
@ -1598,7 +1595,7 @@ definitions:
|
|||
tags:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/definitions/KVPair"
|
||||
$ref: "#/definitions/KVPair"
|
||||
example:
|
||||
code: 0
|
||||
data: data
|
||||
|
@ -1627,7 +1624,7 @@ definitions:
|
|||
tags:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/definitions/KVPair"
|
||||
$ref: "#/definitions/KVPair"
|
||||
example:
|
||||
code: 5
|
||||
data: data
|
||||
|
@ -1888,6 +1885,12 @@ definitions:
|
|||
gas_adjustment:
|
||||
type: string
|
||||
example: "1.2"
|
||||
generate_only:
|
||||
type: boolean
|
||||
example: false
|
||||
simulate:
|
||||
type: boolean
|
||||
example: true
|
||||
TendermintValidator:
|
||||
type: object
|
||||
properties:
|
||||
|
@ -1922,7 +1925,7 @@ definitions:
|
|||
total_deposit:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/definitions/Coin"
|
||||
$ref: "#/definitions/Coin"
|
||||
voting_start_time:
|
||||
type: string
|
||||
Deposit:
|
||||
|
@ -1931,11 +1934,11 @@ definitions:
|
|||
amount:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/definitions/Coin"
|
||||
$ref: "#/definitions/Coin"
|
||||
proposal_id:
|
||||
type: integer
|
||||
depositor:
|
||||
"$ref": "#/definitions/Address"
|
||||
$ref: "#/definitions/Address"
|
||||
TallyResult:
|
||||
type: object
|
||||
properties:
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -8,11 +8,12 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
tmliteProxy "github.com/tendermint/tendermint/lite/proxy"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||
)
|
||||
|
||||
//BlockCommand returns the verified block data for a given heights
|
||||
|
|
|
@ -5,9 +5,10 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -7,11 +7,12 @@ import (
|
|||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||
"github.com/spf13/viper"
|
||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
)
|
||||
|
||||
// StatusCommand returns the status of the network
|
||||
|
|
|
@ -9,12 +9,13 @@ import (
|
|||
"github.com/gorilla/mux"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/spf13/viper"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
// TODO these next two functions feel kinda hacky based on their placement
|
||||
|
|
|
@ -3,10 +3,11 @@ package tx
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -12,13 +12,14 @@ import (
|
|||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
// QueryTxCmd implements the default command for a tx query.
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
|
@ -17,11 +16,6 @@ import (
|
|||
authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder"
|
||||
)
|
||||
|
||||
const (
|
||||
queryArgDryRun = "simulate"
|
||||
queryArgGenerateOnly = "generate_only"
|
||||
)
|
||||
|
||||
//----------------------------------------
|
||||
// Basic HTTP utilities
|
||||
|
||||
|
@ -39,18 +33,6 @@ func WriteSimulationResponse(w http.ResponseWriter, gas uint64) {
|
|||
w.Write([]byte(fmt.Sprintf(`{"gas_estimate":%v}`, gas)))
|
||||
}
|
||||
|
||||
// HasDryRunArg returns true if the request's URL query contains the dry run
|
||||
// argument and its value is set to "true".
|
||||
func HasDryRunArg(r *http.Request) bool {
|
||||
return urlQueryHasArg(r.URL, queryArgDryRun)
|
||||
}
|
||||
|
||||
// HasGenerateOnlyArg returns whether a URL's query "generate-only" parameter
|
||||
// is set to "true".
|
||||
func HasGenerateOnlyArg(r *http.Request) bool {
|
||||
return urlQueryHasArg(r.URL, queryArgGenerateOnly)
|
||||
}
|
||||
|
||||
// ParseInt64OrReturnBadRequest converts s to a int64 value.
|
||||
func ParseInt64OrReturnBadRequest(w http.ResponseWriter, s string) (n int64, ok bool) {
|
||||
var err error
|
||||
|
@ -113,8 +95,6 @@ func WriteGenerateStdTxResponse(w http.ResponseWriter, txBldr authtxb.TxBuilder,
|
|||
return
|
||||
}
|
||||
|
||||
func urlQueryHasArg(url *url.URL, arg string) bool { return url.Query().Get(arg) == "true" }
|
||||
|
||||
//----------------------------------------
|
||||
// Building / Sending utilities
|
||||
|
||||
|
@ -128,6 +108,8 @@ type BaseReq struct {
|
|||
Sequence uint64 `json:"sequence"`
|
||||
Gas string `json:"gas"`
|
||||
GasAdjustment string `json:"gas_adjustment"`
|
||||
GenerateOnly bool `json:"generate_only"`
|
||||
Simulate bool `json:"simulate"`
|
||||
}
|
||||
|
||||
// Sanitize performs basic sanitization on a BaseReq object.
|
||||
|
@ -140,6 +122,8 @@ func (br BaseReq) Sanitize() BaseReq {
|
|||
GasAdjustment: strings.TrimSpace(br.GasAdjustment),
|
||||
AccountNumber: br.AccountNumber,
|
||||
Sequence: br.Sequence,
|
||||
GenerateOnly: br.GenerateOnly,
|
||||
Simulate: br.Simulate,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,21 +159,21 @@ func ReadRESTReq(w http.ResponseWriter, r *http.Request, cdc *codec.Codec, req i
|
|||
// ValidateBasic performs basic validation of a BaseReq. If custom validation
|
||||
// logic is needed, the implementing request handler should perform those
|
||||
// checks manually.
|
||||
func (br BaseReq) ValidateBasic(w http.ResponseWriter) bool {
|
||||
func (br BaseReq) ValidateBasic(w http.ResponseWriter, cliCtx context.CLIContext) bool {
|
||||
if !cliCtx.GenerateOnly && !cliCtx.Simulate {
|
||||
switch {
|
||||
case len(br.Name) == 0:
|
||||
WriteErrorResponse(w, http.StatusUnauthorized, "name required but not specified")
|
||||
return false
|
||||
|
||||
case len(br.Password) == 0:
|
||||
WriteErrorResponse(w, http.StatusUnauthorized, "password required but not specified")
|
||||
return false
|
||||
|
||||
case len(br.ChainID) == 0:
|
||||
WriteErrorResponse(w, http.StatusUnauthorized, "chainID required but not specified")
|
||||
WriteErrorResponse(w, http.StatusUnauthorized, "chain-id required but not specified")
|
||||
return false
|
||||
}
|
||||
}
|
||||
if len(br.Name) == 0 {
|
||||
WriteErrorResponse(w, http.StatusUnauthorized, "name required but not specified")
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -223,14 +207,14 @@ func CompleteAndBroadcastTxREST(w http.ResponseWriter, r *http.Request, cliCtx c
|
|||
Sequence: baseReq.Sequence,
|
||||
}
|
||||
|
||||
if HasDryRunArg(r) || txBldr.SimulateGas {
|
||||
if baseReq.Simulate || txBldr.SimulateGas {
|
||||
newBldr, err := EnrichCtxWithGas(txBldr, cliCtx, baseReq.Name, msgs)
|
||||
if err != nil {
|
||||
WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
if HasDryRunArg(r) {
|
||||
if baseReq.Simulate {
|
||||
WriteSimulationResponse(w, newBldr.Gas)
|
||||
return
|
||||
}
|
||||
|
@ -238,7 +222,7 @@ func CompleteAndBroadcastTxREST(w http.ResponseWriter, r *http.Request, cliCtx c
|
|||
txBldr = newBldr
|
||||
}
|
||||
|
||||
if HasGenerateOnlyArg(r) {
|
||||
if baseReq.GenerateOnly {
|
||||
WriteGenerateStdTxResponse(w, txBldr, msgs)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -6,13 +6,14 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/tendermint/go-amino"
|
||||
"github.com/tendermint/tendermint/libs/common"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/keys"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder"
|
||||
"github.com/tendermint/go-amino"
|
||||
"github.com/tendermint/tendermint/libs/common"
|
||||
)
|
||||
|
||||
// CompleteAndBroadcastTxCli implements a utility function that facilitates
|
||||
|
@ -33,14 +34,14 @@ func CompleteAndBroadcastTxCli(txBldr authtxb.TxBuilder, cliCtx context.CLIConte
|
|||
return err
|
||||
}
|
||||
|
||||
if txBldr.SimulateGas || cliCtx.DryRun {
|
||||
if txBldr.SimulateGas || cliCtx.Simulate {
|
||||
txBldr, err = EnrichCtxWithGas(txBldr, cliCtx, name, msgs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "estimated gas = %v\n", txBldr.Gas)
|
||||
}
|
||||
if cliCtx.DryRun {
|
||||
if cliCtx.Simulate {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -4,10 +4,11 @@ import (
|
|||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/tendermint/tendermint/libs/common"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func TestParseQueryResponse(t *testing.T) {
|
||||
|
|
|
@ -9,9 +9,10 @@ import (
|
|||
|
||||
"path/filepath"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/version"
|
||||
"github.com/spf13/cobra"
|
||||
tmversion "github.com/tendermint/tendermint/version"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/version"
|
||||
)
|
||||
|
||||
var remoteBasecoinPath = "github.com/cosmos/cosmos-sdk/docs/examples/basecoin"
|
||||
|
|
|
@ -6,6 +6,11 @@ import (
|
|||
"os"
|
||||
"sort"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
bam "github.com/cosmos/cosmos-sdk/baseapp"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
@ -17,10 +22,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/params"
|
||||
"github.com/cosmos/cosmos-sdk/x/slashing"
|
||||
"github.com/cosmos/cosmos-sdk/x/stake"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -4,6 +4,10 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
distr "github.com/cosmos/cosmos-sdk/x/distribution"
|
||||
|
@ -11,9 +15,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/mint"
|
||||
"github.com/cosmos/cosmos-sdk/x/slashing"
|
||||
"github.com/cosmos/cosmos-sdk/x/stake"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
)
|
||||
|
|
|
@ -3,11 +3,12 @@ package app
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank"
|
||||
"github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
)
|
||||
|
||||
// This will fail half the time with the second output being 173
|
||||
|
|
|
@ -4,6 +4,9 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
|
@ -12,8 +15,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/mint"
|
||||
"github.com/cosmos/cosmos-sdk/x/slashing"
|
||||
stake "github.com/cosmos/cosmos-sdk/x/stake"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
// export the state of gaia for a genesis file
|
||||
|
|
|
@ -10,6 +10,8 @@ import (
|
|||
"sort"
|
||||
"strings"
|
||||
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
|
@ -19,7 +21,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/slashing"
|
||||
"github.com/cosmos/cosmos-sdk/x/stake"
|
||||
stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -7,13 +7,14 @@ import (
|
|||
"github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/cosmos/cosmos-sdk/x/stake"
|
||||
stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -4,12 +4,13 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
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"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
)
|
||||
|
||||
func (app *GaiaApp) runtimeInvariants() []simulation.Invariant {
|
||||
|
|
|
@ -76,14 +76,15 @@ func appStateFn(r *rand.Rand, accs []simulation.Account) json.RawMessage {
|
|||
}
|
||||
|
||||
// Random genesis states
|
||||
vp := time.Duration(r.Intn(2*172800)) * time.Second
|
||||
govGenesis := gov.GenesisState{
|
||||
StartingProposalID: uint64(r.Intn(100)),
|
||||
DepositParams: gov.DepositParams{
|
||||
MinDeposit: sdk.Coins{sdk.NewInt64Coin(stakeTypes.DefaultBondDenom, int64(r.Intn(1e3)))},
|
||||
MaxDepositPeriod: time.Duration(r.Intn(2*172800)) * time.Second,
|
||||
MaxDepositPeriod: vp,
|
||||
},
|
||||
VotingParams: gov.VotingParams{
|
||||
VotingPeriod: time.Duration(r.Intn(2*172800)) * time.Second,
|
||||
VotingPeriod: vp,
|
||||
},
|
||||
TallyParams: gov.TallyParams{
|
||||
Threshold: sdk.NewDecWithPrec(5, 1),
|
||||
|
|
|
@ -645,6 +645,37 @@ trust_node = true
|
|||
cleanupDirs(gaiadHome, gaiacliHome)
|
||||
}
|
||||
|
||||
func TestGaiadCollectGentxs(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Initialise temporary directories
|
||||
gaiadHome, gaiacliHome := getTestingHomeDirs(t.Name())
|
||||
gentxDir, err := ioutil.TempDir("", "")
|
||||
gentxDoc := filepath.Join(gentxDir, "gentx.json")
|
||||
require.NoError(t, err)
|
||||
|
||||
tests.ExecuteT(t, fmt.Sprintf("gaiad --home=%s unsafe-reset-all", gaiadHome), "")
|
||||
os.RemoveAll(filepath.Join(gaiadHome, "config", "gentx"))
|
||||
executeWrite(t, fmt.Sprintf("gaiacli keys delete --home=%s foo", gaiacliHome), app.DefaultKeyPass)
|
||||
executeWrite(t, fmt.Sprintf("gaiacli keys delete --home=%s bar", gaiacliHome), app.DefaultKeyPass)
|
||||
executeWriteCheckErr(t, fmt.Sprintf("gaiacli keys add --home=%s foo", gaiacliHome), app.DefaultKeyPass)
|
||||
executeWriteCheckErr(t, fmt.Sprintf("gaiacli keys add --home=%s bar", gaiacliHome), app.DefaultKeyPass)
|
||||
executeWriteCheckErr(t, fmt.Sprintf("gaiacli config --home=%s output json", gaiacliHome))
|
||||
fooAddr, _ := executeGetAddrPK(t, fmt.Sprintf("gaiacli keys show foo --home=%s", gaiacliHome))
|
||||
|
||||
// Run init
|
||||
_ = executeInit(t, fmt.Sprintf("gaiad init -o --moniker=foo --home=%s", gaiadHome))
|
||||
// Add account to genesis.json
|
||||
executeWriteCheckErr(t, fmt.Sprintf(
|
||||
"gaiad add-genesis-account %s 150%s,1000fooToken --home=%s", fooAddr, stakeTypes.DefaultBondDenom, gaiadHome))
|
||||
executeWrite(t, fmt.Sprintf("cat %s%sconfig%sgenesis.json", gaiadHome, string(os.PathSeparator), string(os.PathSeparator)))
|
||||
// Write gentx file
|
||||
executeWriteCheckErr(t, fmt.Sprintf(
|
||||
"gaiad gentx --name=foo --home=%s --home-client=%s --output-document=%s", gaiadHome, gaiacliHome, gentxDoc), app.DefaultKeyPass)
|
||||
// Collect gentxs from a custom directory
|
||||
executeWriteCheckErr(t, fmt.Sprintf("gaiad collect-gentxs --home=%s --gentx-dir=%s", gaiadHome, gentxDir), app.DefaultKeyPass)
|
||||
cleanupDirs(gaiadHome, gaiacliHome, gentxDir)
|
||||
}
|
||||
|
||||
//___________________________________________________________________________________
|
||||
// helper methods
|
||||
|
||||
|
|
|
@ -10,12 +10,13 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
gaia "github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
|
||||
gaia "github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -4,17 +4,22 @@ import (
|
|||
"encoding/json"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
cfg "github.com/tendermint/tendermint/config"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
)
|
||||
|
||||
const (
|
||||
flagGenTxDir = "gentx-dir"
|
||||
)
|
||||
|
||||
type initConfig struct {
|
||||
|
@ -34,7 +39,6 @@ func CollectGenTxsCmd(ctx *server.Context, cdc *codec.Codec) *cobra.Command {
|
|||
config := ctx.Config
|
||||
config.SetRoot(viper.GetString(cli.HomeFlag))
|
||||
name := viper.GetString(client.FlagName)
|
||||
|
||||
nodeID, valPubKey, err := InitializeNodeValidatorFiles(config)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -45,19 +49,13 @@ func CollectGenTxsCmd(ctx *server.Context, cdc *codec.Codec) *cobra.Command {
|
|||
return err
|
||||
}
|
||||
|
||||
toPrint := printInfo{
|
||||
Moniker: config.Moniker,
|
||||
ChainID: genDoc.ChainID,
|
||||
NodeID: nodeID,
|
||||
genTxsDir := viper.GetString(flagGenTxDir)
|
||||
if genTxsDir == "" {
|
||||
genTxsDir = filepath.Join(config.RootDir, "config", "gentx")
|
||||
}
|
||||
|
||||
initCfg := initConfig{
|
||||
ChainID: genDoc.ChainID,
|
||||
GenTxsDir: filepath.Join(config.RootDir, "config", "gentx"),
|
||||
Name: name,
|
||||
NodeID: nodeID,
|
||||
ValPubKey: valPubKey,
|
||||
}
|
||||
toPrint := newPrintInfo(config.Moniker, genDoc.ChainID, nodeID, genTxsDir, json.RawMessage(""))
|
||||
initCfg := newInitConfig(genDoc.ChainID, genTxsDir, name, nodeID, valPubKey)
|
||||
|
||||
appMessage, err := genAppStateFromConfig(cdc, config, initCfg, genDoc)
|
||||
if err != nil {
|
||||
|
@ -72,6 +70,9 @@ func CollectGenTxsCmd(ctx *server.Context, cdc *codec.Codec) *cobra.Command {
|
|||
}
|
||||
|
||||
cmd.Flags().String(cli.HomeFlag, app.DefaultNodeHome, "node's home directory")
|
||||
cmd.Flags().String(flagGenTxDir, "",
|
||||
"override default \"gentx\" directory from which collect and execute "+
|
||||
"genesis transactions; default [--home]/config/gentx/")
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
@ -116,3 +117,27 @@ func genAppStateFromConfig(
|
|||
err = ExportGenesisFile(genFile, initCfg.ChainID, nil, appState)
|
||||
return
|
||||
}
|
||||
|
||||
func newInitConfig(chainID, genTxsDir, name, nodeID string,
|
||||
valPubKey crypto.PubKey) initConfig {
|
||||
|
||||
return initConfig{
|
||||
ChainID: chainID,
|
||||
GenTxsDir: genTxsDir,
|
||||
Name: name,
|
||||
NodeID: nodeID,
|
||||
ValPubKey: valPubKey,
|
||||
}
|
||||
}
|
||||
|
||||
func newPrintInfo(moniker, chainID, nodeID, genTxsDir string,
|
||||
appMessage json.RawMessage) printInfo {
|
||||
|
||||
return printInfo{
|
||||
Moniker: moniker,
|
||||
ChainID: chainID,
|
||||
NodeID: nodeID,
|
||||
GenTxsDir: genTxsDir,
|
||||
AppMessage: appMessage,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,15 +4,16 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
"github.com/tendermint/tendermint/libs/common"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
"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"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
"github.com/tendermint/tendermint/libs/common"
|
||||
)
|
||||
|
||||
// AddGenesisAccountCmd returns add-genesis-account cobra Command
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package init
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
|
|
|
@ -11,6 +11,11 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
cfg "github.com/tendermint/tendermint/config"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
tmcli "github.com/tendermint/tendermint/libs/cli"
|
||||
"github.com/tendermint/tendermint/libs/common"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/keys"
|
||||
|
@ -23,10 +28,6 @@ import (
|
|||
authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder"
|
||||
"github.com/cosmos/cosmos-sdk/x/stake/client/cli"
|
||||
stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types"
|
||||
cfg "github.com/tendermint/tendermint/config"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
tmcli "github.com/tendermint/tendermint/libs/cli"
|
||||
"github.com/tendermint/tendermint/libs/common"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -136,10 +137,13 @@ following delegation and commission default parameters:
|
|||
}
|
||||
|
||||
// Fetch output file name
|
||||
outputDocument, err := makeOutputFilepath(config.RootDir, nodeID)
|
||||
outputDocument := viper.GetString(client.FlagOutputDocument)
|
||||
if outputDocument == "" {
|
||||
outputDocument, err = makeOutputFilepath(config.RootDir, nodeID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err := writeSignedGenTx(cdc, outputDocument, signedTx); err != nil {
|
||||
return err
|
||||
|
@ -153,6 +157,8 @@ following delegation and commission default parameters:
|
|||
cmd.Flags().String(tmcli.HomeFlag, app.DefaultNodeHome, "node's home directory")
|
||||
cmd.Flags().String(flagClientHome, app.DefaultCLIHome, "client's home directory")
|
||||
cmd.Flags().String(client.FlagName, "", "name of private key with which to sign the gentx")
|
||||
cmd.Flags().String(client.FlagOutputDocument, "",
|
||||
"write the genesis transaction JSON document to the given file instead of the default location")
|
||||
cmd.Flags().AddFlagSet(cli.FsCommissionCreate)
|
||||
cmd.Flags().AddFlagSet(cli.FsAmount)
|
||||
cmd.Flags().AddFlagSet(cli.FsPk)
|
||||
|
|
|
@ -6,15 +6,16 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
cfg "github.com/tendermint/tendermint/config"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
"github.com/tendermint/tendermint/libs/common"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -27,6 +28,7 @@ type printInfo struct {
|
|||
Moniker string `json:"moniker"`
|
||||
ChainID string `json:"chain_id"`
|
||||
NodeID string `json:"node_id"`
|
||||
GenTxsDir string `json:"gentxs_dir"`
|
||||
AppMessage json.RawMessage `json:"app_message"`
|
||||
}
|
||||
|
||||
|
@ -76,12 +78,7 @@ func InitCmd(ctx *server.Context, cdc *codec.Codec) *cobra.Command {
|
|||
return err
|
||||
}
|
||||
|
||||
toPrint := printInfo{
|
||||
ChainID: chainID,
|
||||
Moniker: config.Moniker,
|
||||
NodeID: nodeID,
|
||||
AppMessage: appState,
|
||||
}
|
||||
toPrint := newPrintInfo(config.Moniker, chainID, nodeID, "", appState)
|
||||
|
||||
cfg.WriteConfigFile(filepath.Join(config.RootDir, "config", "config.toml"), config)
|
||||
|
||||
|
|
|
@ -8,17 +8,19 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
"github.com/cosmos/cosmos-sdk/server/mock"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
abciServer "github.com/tendermint/tendermint/abci/server"
|
||||
tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
"github.com/cosmos/cosmos-sdk/server/mock"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/stake"
|
||||
stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
cfg "github.com/tendermint/tendermint/config"
|
||||
|
@ -24,6 +23,8 @@ import (
|
|||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
tmtime "github.com/tendermint/tendermint/types/time"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -278,13 +279,7 @@ func collectGenFiles(
|
|||
config.SetRoot(nodeDir)
|
||||
|
||||
nodeID, valPubKey := nodeIDs[i], valPubKeys[i]
|
||||
initCfg := initConfig{
|
||||
ChainID: chainID,
|
||||
GenTxsDir: gentxsDir,
|
||||
Name: moniker,
|
||||
NodeID: nodeID,
|
||||
ValPubKey: valPubKey,
|
||||
}
|
||||
initCfg := newInitConfig(chainID, gentxsDir, moniker, nodeID, valPubKey)
|
||||
|
||||
genDoc, err := loadGenesisDoc(cdc, config.GenesisFile())
|
||||
if err != nil {
|
||||
|
|
|
@ -6,8 +6,6 @@ import (
|
|||
"io/ioutil"
|
||||
"time"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
amino "github.com/tendermint/go-amino"
|
||||
cfg "github.com/tendermint/tendermint/config"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
@ -15,6 +13,9 @@ import (
|
|||
"github.com/tendermint/tendermint/p2p"
|
||||
"github.com/tendermint/tendermint/privval"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
)
|
||||
|
||||
// ExportGenesisFile creates and writes the genesis configuration to disk. An
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package keys
|
||||
|
||||
import (
|
||||
ccrypto "github.com/cosmos/cosmos-sdk/crypto"
|
||||
amino "github.com/tendermint/go-amino"
|
||||
"github.com/tendermint/tendermint/crypto/encoding/amino"
|
||||
|
||||
ccrypto "github.com/cosmos/cosmos-sdk/crypto"
|
||||
)
|
||||
|
||||
var cdc = amino.NewCodec()
|
||||
|
|
|
@ -15,11 +15,12 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/crypto/keys/mintkey"
|
||||
"github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
|
||||
tmcrypto "github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/encoding/amino"
|
||||
"github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
|
||||
)
|
||||
|
||||
var _ Keybase = dbKeybase{}
|
||||
|
|
|
@ -13,8 +13,9 @@ import (
|
|||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/types"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -11,8 +11,9 @@ import (
|
|||
"github.com/tendermint/tendermint/crypto/encoding/amino"
|
||||
"github.com/tendermint/tendermint/crypto/xsalsa20symmetric"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package keys
|
||||
|
||||
import (
|
||||
ccrypto "github.com/cosmos/cosmos-sdk/crypto"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
||||
ccrypto "github.com/cosmos/cosmos-sdk/crypto"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/hd"
|
||||
"github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
This document should contain plain english instructions for testing functionality on `gaiad`. This “Script” is supposed to be run by 2 people who will each spin up a `gaiad` node and run the series of prompts below.
|
||||
|
||||
- [Create a network of 2 nodes](getting-started/create-testnet.md)
|
||||
- [Generate an account](sdk/clients.md)
|
||||
- [Send funds from one account to the other](sdk/clients.md)
|
||||
- [Create a validator](validators/validator-setup.md)
|
||||
- [Edit a validator](validators/validator-setup.md)
|
||||
- [Delegate to validator](sdk/clients.md)
|
||||
- [Unbond from a validator](sdk/clients.md)
|
||||
- [View validators and verify output](validators/validator-setup.md)
|
||||
- [Query network status](getting-started/full-node.md)
|
||||
- [Create a proposal](validators/validator-setup.md)
|
||||
- [Query a proposal](validators/validator-setup.md)
|
||||
- [Vote on a proposal](validators/validator-setup.md)
|
||||
- [Query status of a proposal](validators/validator-setup.md)
|
||||
- [Query the votes on a proposal](validators/validator-setup.md)
|
||||
- [Export state and reload](getting-started/create-testnet.md)
|
||||
- [Create a network of 2 nodes](./gaia/deploy-testnet.md)
|
||||
- [Generate an account](./gaia/gaiacli.md)
|
||||
- [Send funds from one account to the other](./gaia/gaiacli.md)
|
||||
- [Create a validator](./gaia/validators/validator-setup.md)
|
||||
- [Edit a validator](./gaia/alidators/validator-setup.md)
|
||||
- [Delegate to validator](./gaia/gaiacli.md)
|
||||
- [Unbond from a validator](./gaia/gaiacli.md)
|
||||
- [View validators and verify output](./gaia/validators/validator-setup.md)
|
||||
- [Query network status](./gaia/join-testnet.md#run-a-full-node)
|
||||
- [Create a proposal](./gaia/validators/validator-setup.md)
|
||||
- [Query a proposal](./gaia/validators/validator-setup.md)
|
||||
- [Vote on a proposal](./gaia/validators/validator-setup.md)
|
||||
- [Query status of a proposal](./gaia/validators/validator-setup.md)
|
||||
- [Query the votes on a proposal](./gaia/validators/validator-setup.md)
|
||||
- [Export state and reload](./gaia/join-testnet.md)
|
||||
|
|
|
@ -3,9 +3,10 @@ package app
|
|||
import (
|
||||
"testing"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ To start a REST server, we need to specify the following parameters:
|
|||
For example::
|
||||
|
||||
```bash
|
||||
gaiacli advanced rest-server --chain-id=test \
|
||||
gaiacli rest-server --chain-id=test \
|
||||
--laddr=tcp://localhost:1317 \
|
||||
--node tcp://localhost:26657 \
|
||||
--trust-node=false
|
||||
|
@ -22,11 +22,11 @@ gaiacli advanced rest-server --chain-id=test \
|
|||
The server listens on HTTPS by default. You can set the SSL certificate to be used by the server with these additional flags:
|
||||
|
||||
```bash
|
||||
gaiacli advanced rest-server --chain-id=test \
|
||||
gaiacli rest-server --chain-id=test \
|
||||
--laddr=tcp://localhost:1317 \
|
||||
--node tcp://localhost:26657 \
|
||||
--trust-node=false \
|
||||
--certfile=mycert.pem --keyfile=mykey.key
|
||||
--ssl-certfile=mycert.pem --ssl-keyfile=mykey.key
|
||||
```
|
||||
|
||||
If no certificate/keyfile pair is supplied, a self-signed certificate will be generated and its fingerprint printed out.
|
||||
|
|
|
@ -4,6 +4,12 @@ import (
|
|||
"encoding/json"
|
||||
"os"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
bam "github.com/cosmos/cosmos-sdk/baseapp"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/basecoin/types"
|
||||
|
@ -11,11 +17,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -4,15 +4,16 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/basecoin/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/basecoin/types"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
)
|
||||
|
||||
func setGenesis(baseApp *BasecoinApp, accounts ...*types.AppAccount) (types.GenesisState, error) {
|
||||
|
|
|
@ -6,10 +6,11 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
"github.com/cosmos/cosmos-sdk/tests"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -9,6 +9,9 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/basecoin/app"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/version"
|
||||
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
|
||||
|
@ -20,8 +23,6 @@ import (
|
|||
slashing "github.com/cosmos/cosmos-sdk/x/slashing/client/rest"
|
||||
stakecmd "github.com/cosmos/cosmos-sdk/x/stake/client/cli"
|
||||
stake "github.com/cosmos/cosmos-sdk/x/stake/client/rest"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -11,10 +11,6 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
gaiaInit "github.com/cosmos/cosmos-sdk/cmd/gaia/init"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/basecoin/app"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
|
@ -23,6 +19,11 @@ import (
|
|||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/basecoin/app"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -4,16 +4,17 @@ import (
|
|||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/types"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/x/cool"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/types"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/democoin/x/cool"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
)
|
||||
|
||||
func setGenesis(bapp *DemocoinApp, trend string, accs ...auth.BaseAccount) error {
|
||||
|
|
|
@ -8,9 +8,10 @@ import (
|
|||
|
||||
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
"github.com/cosmos/cosmos-sdk/tests"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -6,11 +6,12 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/tendermint/tendermint/libs/common"
|
||||
"github.com/tendermint/tendermint/p2p"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
|
|
|
@ -3,8 +3,9 @@ package mock
|
|||
import (
|
||||
"bytes"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// Validator implements sdk.Validator
|
||||
|
|
|
@ -3,13 +3,14 @@ package cool
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
bank "github.com/cosmos/cosmos-sdk/x/bank"
|
||||
"github.com/cosmos/cosmos-sdk/x/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -5,8 +5,9 @@ import (
|
|||
"math"
|
||||
"strconv"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// generate the mine message
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Join the latest public testnet
|
||||
# Join Public Testnet
|
||||
|
||||
::: tip Current Testnet
|
||||
See the [testnet repo](https://github.com/cosmos/testnets) for
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Ledger // Cosmos
|
||||
# Ledger Nano Support
|
||||
|
||||
### Ledger Support for account keys
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## Overview
|
||||
## Validator Security
|
||||
|
||||
Each validator candidate is encouraged to run its operations independently, as diverse setups increase the resilience of the network. Validator candidates should commence their setup phase now in order to be on time for launch.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Run a validator on the gaia public testnet
|
||||
# Run a Validator on Public Testnet
|
||||
|
||||
::: tip
|
||||
Information on how to join the current testnet (`genesis.json` file and seeds) is held [in our `testnet` repo](https://github.com/cosmos/testnets/tree/master/latest). Please check there if you are looking to join our latest testnet.
|
||||
|
|
Binary file not shown.
|
@ -2,7 +2,7 @@
|
|||
\usepackage{hyperref}
|
||||
|
||||
%opening
|
||||
\title{F1 Fee Distribution Draft-00}
|
||||
\title{F1 Fee Distribution Draft-01}
|
||||
\author{Dev Ojha}
|
||||
|
||||
\begin{document}
|
||||
|
@ -17,49 +17,71 @@
|
|||
|
||||
\section{F1 Fee Distribution}
|
||||
|
||||
In a proof of stake model, each validator has an associated stake, with delegators each contributing some amount to a validator's stake.
|
||||
The validator is rewarded transaction fees every block for the service they are providing the network.
|
||||
In the F1 distribution, each validator is permitted to take a commission from the fees they receive, and the remaining fees should be evenly distributed across the validator's delegators, such that every delegator the percentage of the validator's stake that came from the delegator is the proportion of that validator's remaining tx fees which they are getting.
|
||||
Iterating over all delegators for every validator each block is too expensive for a blockchain environment.
|
||||
Instead there is an explicit withdraw fees action which a delegator can take, which will give the delegator the same total amount of fees as though they were receiving it every block.
|
||||
\subsection{Context}
|
||||
In a proof of stake blockchain, each validator has an associated stake.
|
||||
Transaction fees get rewarded to validators based on the incentive scheme of the underlying proof of stake model.
|
||||
The fee distribution problem occurs in proof of stake blockchains supporting delegation, as there is a need to distribute a validator's fee rewards to its delegators.
|
||||
The trivial solution of just giving the rewards to each delegator every block is too expensive to perform on-chain.
|
||||
So instead fee distribution algorithms have delegators perform an explicit withdraw transaction, which when performed yields the same total amount of fees as if they had received them at every block.
|
||||
|
||||
Suppose a delegator delegates $x$ stake to a validator at block $h$.
|
||||
This details F1, an approximation-free, slash-tolerant fee distribution algorithm which allows validator commission-rates, inflation rates, and fee proportions, which can all efficiently change per validator, every block.
|
||||
The algorithm requires iterating over the validators every block, and withdraws require iterating over all of the corresponding validator's slashes whilst the delegator was bonded.
|
||||
The former iteration is cheap, due to staking logic already requiring iteration over all validators, which causes the expensive state-reads to be cached.
|
||||
The number of slashes is expected to be 0 or 1 for most validators,
|
||||
so the latter term also meets the blockchain's efficiency needs.
|
||||
|
||||
The key point of how F1 works is that it tracks how much rewards a delegator with 1 stake for a given validator would be entitled to if it had bonded at block 0 until the latest block.
|
||||
When a delegator bonds at block $b$, the amount of rewards a delegator with 1 stake would have if bonded at block 0 until block $b$ is also persisted to state.
|
||||
When the delegator withdraws, they receive the difference of these two values.
|
||||
Since rewards are distributed according to stake-weighting, this amount of rewards can be scaled by the amount of stake a delegator had.
|
||||
Section 1.2 describes this in more detail, with an argument for it being approximation free.
|
||||
Section 2 details how to adapt this algorithm to handle commission rates, slashing, and inflation.
|
||||
|
||||
\subsection{Base algorithm}
|
||||
In this section, we show that the F1 base algorithm gives each delegator rewards identical to that which they'd receive in the naive and correct fee distribution algorithm that iterated over all delegators every block.
|
||||
|
||||
Even distribution of a validators rewards amongst its validators weighted by stake means the following:
|
||||
Suppose a delegator delegates $x$ stake to a validator $v$ at block $h$.
|
||||
Let the amount of stake the validator has at block $i$ be $s_i$ and the amount of fees they receive at this height be $f_i$.
|
||||
Then if a delegator contributing $x$ stake decides to withdraw at block $n$, the rewards they receive is
|
||||
Then if a delegator contributing $x$ stake decides to withdraw at block $n$, the rewards they receive are
|
||||
$$\sum_{i = h}^{n} \frac{x}{s_i}f_i = x \sum_{i = h}^{n} \frac{f_i}{s_i}$$
|
||||
|
||||
However $s_i$ will not change every block.
|
||||
It only changes if the validator gets slashed, or if someone new has bonded or unbonded.
|
||||
Handling slashes is relegated to \autoref{ssec:slashing}.
|
||||
Define a period as the set of blocks between two changes in a given validator's total stake.
|
||||
Note that $s_i$ does not change every block,
|
||||
it only changes if the validator gets slashed,
|
||||
or if any delegator alters the amount they have delegated.
|
||||
We'll relegate handling of slashes to \autoref{ssec:slashing},
|
||||
and only consider the case with no slashing here.
|
||||
We can change the iteration from being over every block, to instead being over the set of blocks between two changes in validator $v$'s total stake.
|
||||
Let each of these set of blocks be called a period.
|
||||
A new period begins every time that validator's total stake changes.
|
||||
The above iteration will be converted to iteration over periods.
|
||||
Let the total amount of stake for the validator in period $p$ be $n_p$.
|
||||
Let $T_p$ be the total fees this validator accrued within this period.
|
||||
Let $T_p$ be the total fees that validator $v$ accrued in period $p$.
|
||||
Let $h$ be the start of period $p_{init}$, and height $n$ be the end of $p_{final}$.
|
||||
It follows that
|
||||
$$x \sum_{i = h}^{n} \frac{f_i}{s_i} = x \sum_{p = p_{init}}^{p_{final}} \frac{T_p}{n_p}$$
|
||||
|
||||
Let $p_0$ represent the period from when the validator first bonded until the first change to the validators stake.
|
||||
The central idea to the F1 model is that at the end of the $k$th period, the following is stored at a state location indexable by $k$: $\sum_{i=0}^{k}\frac{T_i}{n_i}$.
|
||||
When a delegator wants to delegate or withdraw their reward, they first create a new entry in state to end the current period. Let the index of the current period be $f$.
|
||||
Then this entry is created using the previous entry as follows: $$\sum_{i=0}^{f}\frac{T_i}{n_i} = \sum_{i=0}^{f-1}\frac{T_i}{n_i} + \frac{T_f}{n_f} = entry_{f-1} + \frac{T_f}{n_f}$$
|
||||
Let $p_0$ represent the period which begins when the validator first bonds.
|
||||
The central idea to the F1 model is that at the end of the $k$th period,
|
||||
the following is stored at a state location indexable by $k$: $\sum_{i=0}^{k}\frac{T_i}{n_i}$.
|
||||
Let the index of the current period be $f$.
|
||||
When a delegator wants to delegate or withdraw their reward, they first create a new entry in state to end the current period.
|
||||
Then this entry is created using the previous entry as follows:
|
||||
$$Entry_f = \sum_{i=0}^{f}\frac{T_i}{n_i} = \sum_{i=0}^{f-1}\frac{T_i}{n_i} + \frac{T_f}{n_f} = Entry_{f-1} + \frac{T_f}{n_f}$$
|
||||
Where $T_f$ is the fees the validator has accrued in period $f$, and $n_f$ is the validators total amount of stake in period $f$.
|
||||
|
||||
The withdrawer's delegation object has the index $k$ for the period which they started accruing fees for.
|
||||
Thus the reward they should receive when withdrawing is:
|
||||
The withdrawer's delegation object has the index $k$ for the period which they ended by bonding. (They start receiving rewards for period $k + 1$)
|
||||
The reward they should receive when withdrawing is:
|
||||
|
||||
$$x\left(entry_f - entry_k\right) = x\left(\left(\sum_{i=0}^{f}\frac{T_i}{n_i}\right) - \left(\sum_{i=0}^{k}\frac{T_i}{n_i}\right)\right) = x \sum_{i = k}^{f} \frac{T_i}{n_i}$$
|
||||
$$x \sum_{i = k + 1}^{f} \frac{T_i}{n_i} = x\left(\left(\sum_{i=0}^{f}\frac{T_i}{n_i}\right) - \left(\sum_{i=0}^{k}\frac{T_i}{n_i}\right)\right) = x\left(Entry_f - Entry_k\right)$$
|
||||
|
||||
The first summation is the state entry for $f$, and the second sum is the state entry at $k$.
|
||||
It is clear from the equations that this payout mechanism maintains correctness, and required no iterations.
|
||||
It is clear from the equations that this payout mechanism maintains correctness, and requires no iterations. It just needed the two state reads for these entries.
|
||||
|
||||
$T_f$ is a separate variable in state for the amount of fees this validator has accrued since the last update to its power.
|
||||
This variable is incremented at every block by however much fees this validator received that block.
|
||||
On the update to the validators power, this variable is used to create the entry in state at $f$.
|
||||
On the update to the validators power, this variable is used to create the entry in state at $f$, and is then reset to 0.
|
||||
|
||||
This fee distribution proposal is agnostic to how all of the blocks fees are divied up between validators.
|
||||
This creates many nice properties, for example only rewarding validators who signed that block.
|
||||
This creates many nice properties, for example it is possible to only rewarding validators who signed that block.
|
||||
|
||||
\section{Additional add-ons}
|
||||
\subsection{Commission Rates}
|
||||
|
@ -68,13 +90,14 @@ This can easily be done as follows:
|
|||
|
||||
In block $h$ a validator receives $f_h$ fees.
|
||||
Instead of incrementing that validators ``total accrued fees this period variable" by $f_h$, it is instead incremented by $(1 - commission\_rate) * f_p$.
|
||||
Then $commission\_rate * f_p$ is deposited directly to the validator.
|
||||
This scheme allow for updates to a validator's commission rate every block if desired.
|
||||
Then $commission\_rate * f_p$ is deposited directly to the validator's account.
|
||||
This allows for efficient updates to a validator's commission rate every block if desired.
|
||||
More generally, each validator could have a function which takes their fees as input, and outputs a set of outputs to pay these fees too. (i.e. x\% going to themselves, y\% to delegators, z\% burnt)
|
||||
|
||||
\subsection{Slashing}
|
||||
\label{ssec:slashing}
|
||||
Slashing is distinct from withdrawals, since not only does it lower the validators total amount of stake, but it also lowers each of its delegator's stake by a fixed percentage.
|
||||
Since noone is charged gas for slashes, a slash cannot iterate over all delegators.
|
||||
Slashing is distinct from withdrawals, since it lowers the stake of all of the delegator's by a fixed percentage.
|
||||
Since no one is charged gas for slashes, a slash cannot iterate over all delegators.
|
||||
Thus we can no longer just multiply by $x$ over the difference in stake.
|
||||
The solution here is to instead store each period created by a slash in the validators state.
|
||||
Then when withdrawing, you must iterate over all slashes between when you started and ended.
|
||||
|
@ -85,24 +108,94 @@ When there are multiple slashes, you just account for the accumulated slash fact
|
|||
|
||||
In practice this will not really be an efficiency hit, as we can expect most validators to have no slashes.
|
||||
Validators that get slashed a lot will naturally lose their delegators.
|
||||
A malicious validator that gets itself slashed many times would increase the gas to withdraw linearly, but the economic loss of funds due to the slashes should far out-weigh the extra overhead the withdrawer must pay for due to the gas.
|
||||
A malicious validator that gets itself slashed many times would increase the gas to withdraw linearly, but the economic loss of funds due to the slashes should far out-weigh the extra overhead the honest withdrawer must pay for due to the gas.
|
||||
|
||||
\subsection{Inflation}
|
||||
Inflation is the idea that we want every staked coin to grow in value as time progresses. Each block, every staked token should each be rewarded $x$ staking tokens as inflation, where $x$ is calculated from function which takes state and the block information as input. This also allows for many seemless upgrade's to $x$'s algorithm. This can be added efficiently into the fee distribution model as follows:
|
||||
Inflation is the idea that we want every staked coin to create more staking tokens as time progresses.
|
||||
The purpose being to drive down the relative worth of unstaked tokens.
|
||||
Each block, every staked token should produce $x$ staking tokens as inflation, where $x$ is calculated from a function $inflation$ which takes state and the block information as input.
|
||||
Let $x_i$ represent the evaluation of $inflation$ in the $i$th block.
|
||||
The goal of this section is to auto-bond inflation in the fee distribution model without iteration.
|
||||
This is done by preserving the invariant that every state entry contains the rewards one would have if they had bonded one stake at genesis until that corresponding block.
|
||||
|
||||
Make each block have an inflation number, by which every staked token should produce $x$ additional staking tokens. In state there is a variable for the sum of all such inflation numbers. Then each period will store this total inflation sum in addition to $\sum_{i=0}^{end}\frac{T_i}{n_i}$. When withdrawing perform a subtraction on the inflation sums at the end and at the start to see how many new staking tokens to produce per staked token.
|
||||
In state a variable should be kept for the number of tokens one would have now due to inflation,
|
||||
given that they bonded one token at genesis.
|
||||
This is $\prod_{0}^{now} (1 + x_i)$.
|
||||
Each period now stores this total inflation product along with what it already stores per-period.
|
||||
|
||||
This works great in the model where the inflation rate should be dynamic each block, but apply the same to each validator. Inflation creation can trivially be epoched as long as inflation isn't required within the epoch, through changes to the $x$ function.
|
||||
Let $R_i$ be the fee rewards in block $i$, and $n_i$ be the total amount bonded to that validator in that block.
|
||||
The correct amount of rewards which 1 token at genesis should have now is:
|
||||
$$Reward(now) = \sum_{i = 0}^{now}\left(\prod_{j = 0}^{i} 1 + x_j \right) * \frac{R_i}{n_i}$$
|
||||
The term in the sum is the amount of stake one stake becomes due to inflation, multiplied by the amount of fees per stake.
|
||||
|
||||
Note that this process is extremely efficient.
|
||||
Now we cast this into the period frame of view.
|
||||
Recall that we build the rewards by creating a state entry for the rewards of the previous period, and keeping track of the rewards within this period.
|
||||
Thus we first define the correct amount of rewards for each successive period, proving correctness of this via induction.
|
||||
We then show that the state entry that gets efficiently built up block by block is equal to this value for the latest period.
|
||||
|
||||
The above can be trivially amended if we want inflation to proceed differently for different validators each block. (e.g. depending on who was offline) It can also be made to be easily adapted in a live chain. It is unclear if either of these two are more desirable settings.
|
||||
Let $start, end$ denote the start/end of a period.
|
||||
|
||||
Suppose that $\forall f > 0$, $Reward(end(f))$ is correctly constructed as
|
||||
$$Reward(end(f)) = Reward(end(f-1)) + \sum_{i = start(f)}^{end(f)}\left(\prod_{j = 0}^{i} 1 + x_j \right) \frac{R_i}{n_i}$$
|
||||
and that for $f = 0$, $Reward(end(0)) = 0$.
|
||||
(With period 1 being defined as the period that has the first bond into it)
|
||||
It must be shown that assuming the supposition $\forall f \leq f_0$, $$Reward(end(f_0 + 1)) = Reward(end(f_0)) + \sum_{i = start(f_0 + 1)}^{end(f_0 + 1)}\left(\prod_{j = 0}^{i} 1 + x_j \right) \frac{R_i}{n_i}$$
|
||||
Using the definition of $Reward$, it follows that:
|
||||
$$\sum_{i = 0}^{end(f_0 + 1)}\left(\prod_{j = 0}^{i} 1 + x_j \right) * \frac{R_i}{n_i} = \sum_{i = 0}^{end(f_0)}\left(\prod_{j = 0}^{i} 1 + x_j \right) * \frac{R_i}{n_i} + \sum_{i = start(f_0 + 1)}^{end(f_0 + 1)}\left(\prod_{j = 0}^{i} 1 + x_j \right) \frac{R_i}{n_i}$$
|
||||
|
||||
Since the first summation on the right hand side is $Reward(end(f_0))$, the supposition is proven true.
|
||||
Consequently, the reward for just period $f$ adjusted for the amount of inflation 1 token at genesis would produce, is:
|
||||
$$\sum_{i = start(f)}^{end(f)}\left(\prod_{j = 0}^{i} 1 + x_j \right) \frac{R_i}{n_i}$$
|
||||
|
||||
TODO: make this proof + pre-amble less verbose, and just wrap up into a lemma.
|
||||
Maybe just leave this proof or the last part to the reader, since it easily follows from summation bounds.
|
||||
|
||||
Now note that
|
||||
$$\sum_{i = start(f)}^{end(f)}\left(\prod_{j = 0}^{i} 1 + x_j \right) \frac{R_i}{n_i} = \left(\prod_{j = 0}^{end(f - 1)} 1 + x_j \right)\sum_{i = start(f)}^{end(f)}\left(\prod_{j = start(f)}^{i} 1 + x_j \right) \frac{R_i}{n_i}$$
|
||||
By definition of period, and inflation being applied every block, \\
|
||||
$n_i = n_{start(f)}\left(\prod_{j = start(f)}^{i} 1 + x_j \right)$. This cancels out the product in the summation, therefore
|
||||
$$\sum_{i = start(f)}^{end(f)}\left(\prod_{j = 0}^{i} 1 + x_j \right) \frac{R_i}{n_i} = \left(\prod_{j = 0}^{end(f - 1)} 1 + x_j \right)\frac{\sum_{i = start(f)}^{end(f)}R_i}{n_{start(f)}}$$
|
||||
|
||||
Thus every block, each validator just has to add the total amount of fees (The $R_i$ term) that goes to delegates to some per-period term.
|
||||
When creating a new period, $n_{start(f)}$ can be cached in state, and the product is already stored in the previous periods state entry.
|
||||
You then get the next period's $n_{start(f)}$ from the current tm-power entry.
|
||||
This is thus extremely efficient per block.
|
||||
|
||||
When withdrawing, you take the difference as before,
|
||||
which yields the amount of rewards you would have obtained with $(\prod_0^{begin\ bonding\ period}1 + x)$ stake from the block you began bonding at until now.
|
||||
$(\prod_0^{begin\ bonding\ period}1 + x)$ is known, since its included in the state entry for when you bonded.
|
||||
You then divide the entitled fees by $(\prod_0^{begin\ bonding\ period}1 + x)$ to normalize it to being the amount of rewards you're entitled to from 1 stake at that block to now.
|
||||
Then as before, you multiply by the amount of stake you had initially bonded.
|
||||
TODO: (Does the difference equating to that make sense, or should it be shown explicitly)
|
||||
|
||||
Note that the inflation function could vary per block,
|
||||
and per validator if ever a need rose.
|
||||
If the inflation rate is the same for everyone then there can be a single global store for the entries corresponding to the product of inflations.
|
||||
Inflation creation can trivially be epoched as long as inflation isn't required within the epoch, through changes to the $inflation$ function.
|
||||
|
||||
Again note that this process is extremely efficient.
|
||||
|
||||
\subsection{Withdrawing with no iteration over slashes}
|
||||
TODO: Fill this out.
|
||||
Core idea: you use the same mechanism as previously, but you just make that blocks $x_j$ term negative.
|
||||
(So a $20\%$ slash would be equivalent to an inflation on that validator of $-20\%$)
|
||||
This foregoes the constant inflation per validator, may or may not be worth it depending on expected number of slashes
|
||||
|
||||
\subsection{Auto bonding fees}
|
||||
TODO: Fill this out.
|
||||
Core idea: you use the same mechanism as previously, but you just don't take that optimization with $n_{i}$ and the $n_{start}$ relation.
|
||||
Fairly simple to do.
|
||||
|
||||
\subsection{Delegation updates}
|
||||
Updating your delegation amount is equivalent to withdrawing earned rewards and a fully independent new delegation occuring in the same block.
|
||||
Updating your delegation amount is equivalent to withdrawing earned rewards and a fully independent new delegation occurring in the same block.
|
||||
The same applies for redelegation.
|
||||
From the view of fee distribution, partial redelegation is the same as a delegation update + a new delegation.
|
||||
|
||||
\subsection{Jailing / being kicked out of the validator set}
|
||||
This basically requires no change. In each block you only iterate over the currently bonded validators. So you simply don't update the "total accrued fees this period" variable for jailed / non-bonded validators. Withdrawing requires \textit{no} special casing here!
|
||||
This basically requires no change.
|
||||
In each block you only iterate over the currently bonded validators.
|
||||
So you simply don't update the "total accrued fees this period" variable for jailed / non-bonded validators.
|
||||
Withdrawing requires \textit{no} special casing here!
|
||||
|
||||
\section{State pruning}
|
||||
You will notice that in the main scheme there was no note for pruning entries from state.
|
||||
|
@ -110,11 +203,20 @@ We can in fact prune quite effectively.
|
|||
Suppose for the sake of exposition that there is at most one delegation / withdrawal to a particular validator in any given block.
|
||||
Then each delegation is responsible for one addition to state.
|
||||
Only the next period, and this delegator's withdrawal could depend on this entry. Thus once this delegator withdraws, this state entry can be pruned.
|
||||
For the entry created by the delegator's withdrawal, that is only required by the creation of the next period. Thus once the next period is created, that withdrawal's period can be deleted.
|
||||
For the entry created by the delegator's withdrawal, that is only required by the creation of the next period.
|
||||
Thus once the next period is created, that withdrawal's period can be deleted.
|
||||
|
||||
This can be easily adapted to the case where there are multiple delegations / withdrawals per block. Keep a counter per state entry for how many delegations need to be cleared. (So 1 for each delegation in that block which created that period, 0 for each withdrawal) When creating a new period, check that the previous period (which had to be read anyway) doesn't have a count of 0. If it does have a count of 0, delete it. When withdrawing, decrement the period which created this delegation's counter by 1. If that counter is now 0, delete that period.
|
||||
This can be easily adapted to the case where there are multiple delegations / withdrawals per block.
|
||||
Keep a counter per state entry for how many delegations need to be cleared.
|
||||
(So 1 for each delegation in that block which created that period, 0 for each withdrawal)
|
||||
When creating a new period, check that the previous period (which had to be read anyway) doesn't have a count of 0.
|
||||
If it does have a count of 0, delete it.
|
||||
When withdrawing, decrement the period which created this delegation's counter by 1.
|
||||
If that counter is now 0, delete that period.
|
||||
|
||||
The slash entries for a validator can only be pruned when all of that validator's delegators have their bonding period starting after the slash. This seems ineffective to keep track of, thus it is not worth it. Each slash should instead remain in state until the validator unbonds and all delegators have their fees withdrawn.
|
||||
The slash entries for a validator can only be pruned when all of that validator's delegators have their bonding period starting after the slash.
|
||||
This seems ineffective to keep track of, thus it is not worth it.
|
||||
Each slash should instead remain in state until the validator unbonds and all delegators have their fees withdrawn.
|
||||
|
||||
\section{Implementers Considerations}
|
||||
|
||||
|
@ -132,4 +234,16 @@ This is an extremely simple scheme with many nice benefits.
|
|||
|
||||
Thus this scheme has efficiency improvements, simplicity improvements, and expressiveness improvements over the currently proposed schemes. With a correct fee distribution amongst the validator set, this solves the existing problem where one could withhold their signature for risk-free gain.
|
||||
|
||||
\section{TO DOs}
|
||||
|
||||
\begin{itemize}
|
||||
\item A global fee pool can be described.
|
||||
\item Determine if auto-bonding fees is compatible with inflation and comission rates in conjunction
|
||||
\item mention storage optimization in the uniform inflation and iteration over slashing case: only have one storage location w/ refcount of the product of inflation results
|
||||
\item Remove iteration over slashes by the same normalization trick used in inflation
|
||||
\item Add equation numbers
|
||||
\item perhaps re-organize so that the no iteration
|
||||
\end{itemize}
|
||||
|
||||
|
||||
\end{document}
|
||||
|
|
|
@ -3,8 +3,9 @@ package config
|
|||
import (
|
||||
"testing"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func TestDefaultConfig(t *testing.T) {
|
||||
|
|
|
@ -7,10 +7,12 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
"io/ioutil"
|
||||
"path"
|
||||
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -4,15 +4,18 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys"
|
||||
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
|
||||
clkeys "github.com/cosmos/cosmos-sdk/client/keys"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
// SimpleGenTx is a simple genesis tx
|
||||
|
|
|
@ -3,9 +3,10 @@ package mock
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/tendermint/tendermint/types"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package mock
|
||||
|
||||
import (
|
||||
"github.com/tendermint/tendermint/types"
|
||||
"testing"
|
||||
|
||||
"github.com/tendermint/tendermint/types"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
|
|
|
@ -2,12 +2,13 @@ package server
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
|
|
|
@ -3,15 +3,17 @@ package server
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
|
||||
tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
|
||||
"github.com/tendermint/tendermint/p2p"
|
||||
pvm "github.com/tendermint/tendermint/privval"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// ShowNodeIDCmd - ported from Tendermint, dump node ID to stdout
|
||||
|
|
|
@ -13,15 +13,16 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/server/config"
|
||||
"github.com/cosmos/cosmos-sdk/version"
|
||||
tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
|
||||
cfg "github.com/tendermint/tendermint/config"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
tmflags "github.com/tendermint/tendermint/libs/cli/flags"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/server/config"
|
||||
"github.com/cosmos/cosmos-sdk/version"
|
||||
)
|
||||
|
||||
// server context
|
||||
|
|
|
@ -4,8 +4,9 @@ import (
|
|||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
)
|
||||
|
||||
func TestInsertKeyJSON(t *testing.T) {
|
||||
|
|
|
@ -3,8 +3,9 @@ package store
|
|||
import (
|
||||
"io"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// Wrapper type for dbm.Db with implementation of KVStore
|
||||
|
|
|
@ -4,8 +4,9 @@ import (
|
|||
"math/rand"
|
||||
"testing"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func TestList(t *testing.T) {
|
||||
|
|
|
@ -3,10 +3,11 @@ package store
|
|||
import (
|
||||
"testing"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func TestVerifyIAVLStoreQueryProof(t *testing.T) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package store
|
||||
|
||||
import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
var _ KVStore = (*transientStore)(nil)
|
||||
|
|
|
@ -8,9 +8,10 @@ import (
|
|||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/store"
|
||||
"github.com/cosmos/cosmos-sdk/types"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
)
|
||||
|
||||
type MockLogger struct {
|
||||
|
|
|
@ -6,8 +6,9 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
)
|
||||
|
||||
// create a decimal from a decimal string (ex. "1234.5678")
|
||||
|
|
|
@ -4,9 +4,10 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
)
|
||||
|
||||
|
@ -43,6 +44,7 @@ const (
|
|||
CodeMemoTooLarge CodeType = 13
|
||||
CodeInsufficientFee CodeType = 14
|
||||
CodeTooManySignatures CodeType = 15
|
||||
CodeGasOverflow CodeType = 16
|
||||
|
||||
// CodespaceRoot is a codespace for error codes in this file only.
|
||||
// Notice that 0 is an "unset" codespace, which can be overridden with
|
||||
|
@ -143,6 +145,9 @@ func ErrInsufficientFee(msg string) Error {
|
|||
func ErrTooManySignatures(msg string) Error {
|
||||
return newErrorWithRootCodespace(CodeTooManySignatures, msg)
|
||||
}
|
||||
func ErrGasOverflow(msg string) Error {
|
||||
return newErrorWithRootCodespace(CodeGasOverflow, msg)
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
// Error & sdkError
|
||||
|
|
|
@ -3,9 +3,10 @@ package auth
|
|||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
)
|
||||
|
||||
// Account is an interface used to store coins at a given address within state.
|
||||
|
|
|
@ -5,10 +5,11 @@ import (
|
|||
"encoding/hex"
|
||||
"fmt"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
"github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -5,8 +5,6 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
codec "github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
@ -14,6 +12,9 @@ import (
|
|||
"github.com/tendermint/tendermint/crypto/multisig"
|
||||
"github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
codec "github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func newTestMsg(addrs ...sdk.AccAddress) *sdk.TestMsg {
|
||||
|
|
|
@ -6,15 +6,16 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/tendermint/go-amino"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
"github.com/cosmos/cosmos-sdk/client/utils"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/tendermint/go-amino"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -6,11 +6,12 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
stakeTypes "github.com/cosmos/cosmos-sdk/x/stake/types"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package auth
|
||||
|
||||
import (
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
|
||||
codec "github.com/cosmos/cosmos-sdk/codec"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue