Merge branch 'develop' into cwgoes/nextvalset
This commit is contained in:
commit
26d43ff94a
|
@ -144,6 +144,7 @@ IMPROVEMENTS
|
|||
* [simulation] Make logs not just pure strings, speeding it up by a large factor at greater block heights \#2282
|
||||
* [simulation] Add a concept of weighting the operations \#2303
|
||||
* [simulation] Logs get written to file if large, and also get printed on panics \#2285
|
||||
* [simulation] Bank simulations now makes testing auth configurable \#2425
|
||||
* [gaiad] \#1992 Add optional flag to `gaiad testnet` to make config directory of daemon (default `gaiad`) and cli (default `gaiacli`) configurable
|
||||
* [x/stake] Add stake `Queriers` for Gaia-lite endpoints. This increases the staking endpoints performance by reusing the staking `keeper` logic for queries. [#2249](https://github.com/cosmos/cosmos-sdk/pull/2149)
|
||||
* [store] [\#2017](https://github.com/cosmos/cosmos-sdk/issues/2017) Refactor
|
||||
|
|
|
@ -187,7 +187,8 @@ func InitializeTestLCD(t *testing.T, nValidators int, initAddrs []sdk.AccAddress
|
|||
// XXX: Need to set this so LCD knows the tendermint node address!
|
||||
viper.Set(client.FlagNode, config.RPC.ListenAddress)
|
||||
viper.Set(client.FlagChainID, genDoc.ChainID)
|
||||
viper.Set(client.FlagTrustNode, false)
|
||||
// TODO Set to false once the upstream Tendermint proof verification issue is fixed.
|
||||
viper.Set(client.FlagTrustNode, true)
|
||||
dir, err := ioutil.TempDir("", "lcd_test")
|
||||
require.NoError(t, err)
|
||||
viper.Set(cli.HomeFlag, dir)
|
||||
|
|
|
@ -90,7 +90,7 @@ func appStateFn(r *rand.Rand, accs []simulation.Account) json.RawMessage {
|
|||
|
||||
func testAndRunTxs(app *GaiaApp) []simulation.WeightedOperation {
|
||||
return []simulation.WeightedOperation{
|
||||
{100, banksim.SimulateSingleInputMsgSend(app.accountMapper)},
|
||||
{100, banksim.SingleInputSendMsg(app.accountMapper, app.bankKeeper)},
|
||||
{5, govsim.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, app.stakeKeeper)},
|
||||
{100, govsim.SimulateMsgDeposit(app.govKeeper, app.stakeKeeper)},
|
||||
{100, stakesim.SimulateMsgCreateValidator(app.accountMapper, app.stakeKeeper)},
|
||||
|
|
|
@ -1,75 +1,44 @@
|
|||
# High priority
|
||||
|
||||
## Fees
|
||||
|
||||
- Collection
|
||||
- Simple flat fee set in-config by validators & full nodes - ref [#1921](https://github.com/cosmos/cosmos-sdk/issues/1921)
|
||||
- @sunnya97 working on implementation
|
||||
- _*BLOCKER:*_ Blocked on [tendermint/tendermint#2275](https://github.com/tendermint/tendermint/issues/2275) @ValarDragon
|
||||
- Distribution
|
||||
- "Piggy bank" fee distribution - ref [#1944](https://github.com/cosmos/cosmos-sdk/pull/1944) (spec)
|
||||
- @rigelrozanski working on implementation
|
||||
- EST TIMELINE:
|
||||
- Work on fees should be completed in the `v0.25.0` release
|
||||
# Post-0.25/GoS Pre-Release
|
||||
|
||||
## Staking/Slashing/Stability
|
||||
|
||||
- Unbonding state for validators (WIP) [#2163](https://github.com/cosmos/cosmos-sdk/pull/2163) @rigelrozanski
|
||||
- Needs :eyes: from @chris
|
||||
- Should be in `v0.25.0` release
|
||||
- Slashing period PR - ref [#2122](https://github.com/cosmos/cosmos-sdk/pull/2122)
|
||||
- Needs :eyes: from @cwgoes and @jaekwon
|
||||
- Should be in `v0.25.0` release
|
||||
- Other slashing issues blocking for launch - [#1256](https://github.com/cosmos/cosmos-sdk/issues/1256)
|
||||
- Update staking/slashing for NextValSet change
|
||||
- @cwgoes to start next
|
||||
- Miscellaneous minor staking issues
|
||||
- [List here](https://github.com/cosmos/cosmos-sdk/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3Astaking+label%3Aprelaunch)
|
||||
- Need to figure out scope of work here to estimate time
|
||||
- @rigelrozanski to start next
|
||||
|
||||
## Vesting
|
||||
|
||||
- Single `VestingAccount` allowing delegation/voting but no withdrawals
|
||||
- Ref [#1875](https://github.com/cosmos/cosmos-sdk/pull/1875) (spec)
|
||||
- @AdityaSripal working on this.
|
||||
- Should be in `v0.25.0` release
|
||||
- Consider "tombstone" / "prison" - double-sign and you can never validate again - https://github.com/cosmos/cosmos-sdk/issues/2363
|
||||
|
||||
## Multisig
|
||||
|
||||
- Already implemented on TM side, need simple CLI interface
|
||||
- @alessio working on the SDK side of things here
|
||||
- Need to schedule some time with @alessio, @ebuchman and @ValarDragon this week to finalize feature set/implementation plan
|
||||
- Need to test changes in https://github.com/cosmos/cosmos-sdk/pull/2165
|
||||
- Spam prevention - https://github.com/cosmos/cosmos-sdk/issues/2019
|
||||
|
||||
## ABCI Changes
|
||||
|
||||
- Need to update for new ABCI changes - error string, tags are list of lists, proposer in header (Tendermint 0.24?)
|
||||
- @cwgoes has done some work here. Should be on `develop` in tendermint w/in next week.
|
||||
- Include in tendermint `v0.24.0` release?
|
||||
- Need to update for new ABCI changes when/if they land - error string, tags are list of lists
|
||||
- Need to verify correct proposer reward semantics
|
||||
- CheckEvidence/DeliverEvidence, CheckTx/DeliverTx ordering semantics
|
||||
|
||||
## Gas
|
||||
|
||||
- Simple transaction benchmarking work by @jlandrews to inform additional work here
|
||||
- Integrate @alessio's simulation work into CLI and LCD
|
||||
- Sanity Checks
|
||||
- Charge for transaction size
|
||||
- Decide what "one gas" corresponds to (standard hardware benchmarks?)
|
||||
- More benchmarking
|
||||
- Consider charging based on maximum depth of IAVL tree iteration
|
||||
- Test out gas estimation in CLI and LCD and ensure the UX works
|
||||
|
||||
## LCD
|
||||
|
||||
- Bianje working on implementation ([#2147](https://github.com/cosmos/cosmos-sdk/pull/2147))
|
||||
- ICS 0,ICS 1, ICS 20 and ICS 21 implemented in this PR :point_up:
|
||||
- @fedekunze, @jackzampolin and @alexanderbez to review
|
||||
- Bianje working on implementation of ICS standards
|
||||
- Additional PR incoming for ICS 22 and ICS 23
|
||||
- Include [#382](https://github.com/cosmos/cosmos-sdk/issues/382)
|
||||
- Decide what ought to be ICS-standardized and what ought not to
|
||||
|
||||
# Lower priority
|
||||
|
||||
## Governance v2
|
||||
|
||||
- Simple software upgrade proposals
|
||||
- Implementation described in [#1079](https://github.com/cosmos/cosmos-sdk/issues/1079)
|
||||
- Agree upon a block height to switch to new version
|
||||
- Another Governance proposal from @jaekwon [#2116](https://github.com/cosmos/cosmos-sdk/pull/2116)
|
||||
- Circuit breaker
|
||||
- Circuit breaker - https://github.com/cosmos/cosmos-sdk/issues/926
|
||||
- Parameter change proposals (roughly the same implementation as circuit breaker)
|
||||
|
||||
## Documentation
|
||||
|
|
|
@ -8,6 +8,12 @@ The first blockchain in the Cosmos Network is the Cosmos Hub, whose native token
|
|||
|
||||
Cosmos can interoperate with multiple other applications and cryptocurrencies. By creating a new zone, you can plug any blockchain system into the Cosmos hub and pass tokens back and forth between those zones, without the need for an intermediary.
|
||||
|
||||
## Quick Start
|
||||
|
||||
- [Getting started with the SDK](./sdk/core/intro.html)
|
||||
- [SDK Examples](../examples)
|
||||
- [Join the testnet](./getting-started/full-node.html#run-a-full-node)
|
||||
|
||||
## Edit the Documentation
|
||||
|
||||
See [this file](./DOCS_README.md) for details of the build process and
|
||||
|
|
|
@ -216,12 +216,12 @@ We have to solve this simple equation to find the reward R for each validator:
|
|||
* For the proposer validator:
|
||||
* The pool obtains `R + R * 5%`: 105 Atoms
|
||||
* Commission: `105 * 80% * 1%` = 0.84 Atoms
|
||||
* Validator's reward: `100 * 20% + Commission` = 21.84 Atoms
|
||||
* Validator's reward: `105 * 20% + Commission` = 21.84 Atoms
|
||||
* Delegators' rewards: `105 * 80% - Commission` = 83.16 Atoms (each delegator will be able to claim its portion of these rewards in proportion to their stake)
|
||||
* For each non-proposer validator:
|
||||
* The pool obtains R: 100 Atoms
|
||||
* Commission: `100 * 80% * 1%` = 0.8 Atoms
|
||||
* Validator's reward: `105 * 20% + Commission` = 20.8 Atoms
|
||||
* Validator's reward: `100 * 20% + Commission` = 20.8 Atoms
|
||||
* Delegators' rewards: `100 * 80% - Commission` = 79.2 Atoms (each delegator will be able to claim its portion of these rewards in proportion to their stake)
|
||||
|
||||
### What are the slashing conditions?
|
||||
|
|
|
@ -15,47 +15,36 @@ import (
|
|||
"github.com/tendermint/tendermint/crypto"
|
||||
)
|
||||
|
||||
// SimulateSingleInputMsgSend tests and runs a single msg send, with one input and one output, where both
|
||||
// SingleInputSendTx tests and runs a single msg send w/ auth, with one input and one output, where both
|
||||
// accounts already exist.
|
||||
func SimulateSingleInputMsgSend(mapper auth.AccountMapper) simulation.Operation {
|
||||
func SingleInputSendTx(mapper auth.AccountMapper) simulation.Operation {
|
||||
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simulation.Account, event func(string)) (action string, fOps []simulation.FutureOperation, err error) {
|
||||
fromAcc := simulation.RandomAcc(r, accs)
|
||||
toAcc := simulation.RandomAcc(r, accs)
|
||||
// Disallow sending money to yourself
|
||||
for {
|
||||
if !fromAcc.PubKey.Equals(toAcc.PubKey) {
|
||||
break
|
||||
}
|
||||
toAcc = simulation.RandomAcc(r, accs)
|
||||
fromAcc, action, msg, abort := createSingleInputSendMsg(r, ctx, accs, mapper)
|
||||
if abort {
|
||||
return action, nil, nil
|
||||
}
|
||||
toAddr := toAcc.Address
|
||||
initFromCoins := mapper.GetAccount(ctx, fromAcc.Address).GetCoins()
|
||||
|
||||
if len(initFromCoins) == 0 {
|
||||
return "skipping, no coins at all", nil, nil
|
||||
err = sendAndVerifyMsgSend(app, mapper, msg, ctx, []crypto.PrivKey{fromAcc.PrivKey}, nil)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
event("bank/sendAndVerifyTxSend/ok")
|
||||
|
||||
denomIndex := r.Intn(len(initFromCoins))
|
||||
amt, goErr := randPositiveInt(r, initFromCoins[denomIndex].Amount)
|
||||
if goErr != nil {
|
||||
return "skipping bank send due to account having no coins of denomination " + initFromCoins[denomIndex].Denom, nil, nil
|
||||
return action, nil, nil
|
||||
}
|
||||
}
|
||||
|
||||
// SingleInputSendMsg tests and runs a single msg send, with one input and one output, where both
|
||||
// accounts already exist.
|
||||
func SingleInputSendMsg(mapper auth.AccountMapper, bk bank.Keeper) simulation.Operation {
|
||||
handler := bank.NewHandler(bk)
|
||||
return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simulation.Account, event func(string)) (action string, fOps []simulation.FutureOperation, err error) {
|
||||
fromAcc, action, msg, abort := createSingleInputSendMsg(r, ctx, accs, mapper)
|
||||
if abort {
|
||||
return action, nil, nil
|
||||
}
|
||||
|
||||
action = fmt.Sprintf("%s is sending %s %s to %s",
|
||||
fromAcc.Address.String(),
|
||||
amt.String(),
|
||||
initFromCoins[denomIndex].Denom,
|
||||
toAddr.String(),
|
||||
)
|
||||
|
||||
coins := sdk.Coins{{initFromCoins[denomIndex].Denom, amt}}
|
||||
var msg = bank.MsgSend{
|
||||
Inputs: []bank.Input{bank.NewInput(fromAcc.Address, coins)},
|
||||
Outputs: []bank.Output{bank.NewOutput(toAddr, coins)},
|
||||
}
|
||||
goErr = sendAndVerifyMsgSend(app, mapper, msg, ctx, []crypto.PrivKey{fromAcc.PrivKey})
|
||||
if goErr != nil {
|
||||
return "", nil, goErr
|
||||
err = sendAndVerifyMsgSend(app, mapper, msg, ctx, []crypto.PrivKey{fromAcc.PrivKey}, handler)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
event("bank/sendAndVerifyMsgSend/ok")
|
||||
|
||||
|
@ -63,8 +52,47 @@ func SimulateSingleInputMsgSend(mapper auth.AccountMapper) simulation.Operation
|
|||
}
|
||||
}
|
||||
|
||||
func createSingleInputSendMsg(r *rand.Rand, ctx sdk.Context, accs []simulation.Account, mapper auth.AccountMapper) (fromAcc simulation.Account, action string, msg bank.MsgSend, abort bool) {
|
||||
fromAcc = simulation.RandomAcc(r, accs)
|
||||
toAcc := simulation.RandomAcc(r, accs)
|
||||
// Disallow sending money to yourself
|
||||
for {
|
||||
if !fromAcc.PubKey.Equals(toAcc.PubKey) {
|
||||
break
|
||||
}
|
||||
toAcc = simulation.RandomAcc(r, accs)
|
||||
}
|
||||
toAddr := toAcc.Address
|
||||
initFromCoins := mapper.GetAccount(ctx, fromAcc.Address).GetCoins()
|
||||
|
||||
if len(initFromCoins) == 0 {
|
||||
return fromAcc, "skipping, no coins at all", msg, true
|
||||
}
|
||||
|
||||
denomIndex := r.Intn(len(initFromCoins))
|
||||
amt, goErr := randPositiveInt(r, initFromCoins[denomIndex].Amount)
|
||||
if goErr != nil {
|
||||
return fromAcc, "skipping bank send due to account having no coins of denomination " + initFromCoins[denomIndex].Denom, msg, true
|
||||
}
|
||||
|
||||
action = fmt.Sprintf("%s is sending %s %s to %s",
|
||||
fromAcc.Address.String(),
|
||||
amt.String(),
|
||||
initFromCoins[denomIndex].Denom,
|
||||
toAddr.String(),
|
||||
)
|
||||
|
||||
coins := sdk.Coins{{initFromCoins[denomIndex].Denom, amt}}
|
||||
msg = bank.MsgSend{
|
||||
Inputs: []bank.Input{bank.NewInput(fromAcc.Address, coins)},
|
||||
Outputs: []bank.Output{bank.NewOutput(toAddr, coins)},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Sends and verifies the transition of a msg send. This fails if there are repeated inputs or outputs
|
||||
func sendAndVerifyMsgSend(app *baseapp.BaseApp, mapper auth.AccountMapper, msg bank.MsgSend, ctx sdk.Context, privkeys []crypto.PrivKey) error {
|
||||
// pass in handler as nil to handle txs, otherwise handle msgs
|
||||
func sendAndVerifyMsgSend(app *baseapp.BaseApp, mapper auth.AccountMapper, msg bank.MsgSend, ctx sdk.Context, privkeys []crypto.PrivKey, handler sdk.Handler) error {
|
||||
initialInputAddrCoins := make([]sdk.Coins, len(msg.Inputs))
|
||||
initialOutputAddrCoins := make([]sdk.Coins, len(msg.Outputs))
|
||||
AccountNumbers := make([]int64, len(msg.Inputs))
|
||||
|
@ -80,14 +108,22 @@ func sendAndVerifyMsgSend(app *baseapp.BaseApp, mapper auth.AccountMapper, msg b
|
|||
acc := mapper.GetAccount(ctx, msg.Outputs[i].Address)
|
||||
initialOutputAddrCoins[i] = acc.GetCoins()
|
||||
}
|
||||
tx := mock.GenTx([]sdk.Msg{msg},
|
||||
AccountNumbers,
|
||||
SequenceNumbers,
|
||||
privkeys...)
|
||||
res := app.Deliver(tx)
|
||||
if !res.IsOK() {
|
||||
// TODO: Do this in a more 'canonical' way
|
||||
return fmt.Errorf("Deliver failed %v", res)
|
||||
if handler != nil {
|
||||
res := handler(ctx, msg)
|
||||
if !res.IsOK() {
|
||||
// TODO: Do this in a more 'canonical' way
|
||||
return fmt.Errorf("handling msg failed %v", res)
|
||||
}
|
||||
} else {
|
||||
tx := mock.GenTx([]sdk.Msg{msg},
|
||||
AccountNumbers,
|
||||
SequenceNumbers,
|
||||
privkeys...)
|
||||
res := app.Deliver(tx)
|
||||
if !res.IsOK() {
|
||||
// TODO: Do this in a more 'canonical' way
|
||||
return fmt.Errorf("Deliver failed %v", res)
|
||||
}
|
||||
}
|
||||
|
||||
for i := 0; i < len(msg.Inputs); i++ {
|
||||
|
|
|
@ -32,14 +32,15 @@ func TestBankWithRandomMessages(t *testing.T) {
|
|||
simulation.Simulate(
|
||||
t, mapp.BaseApp, appStateFn,
|
||||
[]simulation.WeightedOperation{
|
||||
{1, SimulateSingleInputMsgSend(mapper)},
|
||||
{1, SingleInputSendTx(mapper)},
|
||||
{1, SingleInputSendMsg(mapper, bankKeeper)},
|
||||
},
|
||||
[]simulation.RandSetup{},
|
||||
[]simulation.Invariant{
|
||||
NonnegativeBalanceInvariant(mapper),
|
||||
TotalCoinsInvariant(mapper, func() sdk.Coins { return mapp.TotalCoinsSupply }),
|
||||
},
|
||||
30, 30,
|
||||
30, 60,
|
||||
false,
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue