-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix/localnet-lastblockheight
- Loading branch information
Showing
25 changed files
with
1,237 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
syntax = "proto3"; | ||
package tendermint.spn.profile; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "profile/coordinator.proto"; | ||
import "profile/validator.proto"; | ||
|
||
|
||
option go_package = "github.com/tendermint/spn/x/profile/types"; | ||
|
||
message EventCoordinatorCreated { | ||
Coordinator coordinator = 1 [(gogoproto.nullable) = false]; | ||
} | ||
|
||
message EventCoordinatorUpdated { | ||
Coordinator coordinator = 1 [(gogoproto.nullable) = false]; | ||
} | ||
|
||
message EventValidatorCreated { | ||
Validator validator = 1 [(gogoproto.nullable) = false]; | ||
} | ||
|
||
message EventValidatorUpdated { | ||
Validator validator = 1 [(gogoproto.nullable) = false]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package simulation | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/simapp/helpers" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation" | ||
sdksimulation "github.com/cosmos/cosmos-sdk/x/simulation" | ||
|
||
"github.com/tendermint/spn/testutil/sample" | ||
) | ||
|
||
// GenAndDeliverTxWithRandFees generates a transaction with a random fee and delivers it. | ||
func GenAndDeliverTxWithRandFees(txCtx sdksimulation.OperationInput, gas uint64) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { | ||
account := txCtx.AccountKeeper.GetAccount(txCtx.Context, txCtx.SimAccount.Address) | ||
spendable := txCtx.Bankkeeper.SpendableCoins(txCtx.Context, account.GetAddress()) | ||
|
||
var fees sdk.Coins | ||
var err error | ||
|
||
coins, hasNeg := spendable.SafeSub(txCtx.CoinsSpentInMsg) | ||
if hasNeg { | ||
return simtypes.NoOpMsg(txCtx.ModuleName, txCtx.MsgType, "message doesn't leave room for fees"), nil, err | ||
} | ||
|
||
fees, err = sample.Fees(txCtx.R, coins) | ||
if err != nil { | ||
return simtypes.NoOpMsg(txCtx.ModuleName, txCtx.MsgType, "unable to generate fees"), nil, err | ||
} | ||
return GenAndDeliverTx(txCtx, fees, gas) | ||
} | ||
|
||
// GenAndDeliverTx generates a transactions and delivers it. | ||
func GenAndDeliverTx(txCtx sdksimulation.OperationInput, fees sdk.Coins, gas uint64) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { | ||
account := txCtx.AccountKeeper.GetAccount(txCtx.Context, txCtx.SimAccount.Address) | ||
tx, err := helpers.GenTx( | ||
txCtx.TxGen, | ||
[]sdk.Msg{txCtx.Msg}, | ||
fees, | ||
gas, | ||
txCtx.Context.ChainID(), | ||
[]uint64{account.GetAccountNumber()}, | ||
[]uint64{account.GetSequence()}, | ||
txCtx.SimAccount.PrivKey, | ||
) | ||
|
||
if err != nil { | ||
return simtypes.NoOpMsg(txCtx.ModuleName, txCtx.MsgType, "unable to generate mock tx"), nil, err | ||
} | ||
|
||
_, _, err = txCtx.App.Deliver(txCtx.TxGen.TxEncoder(), tx) | ||
if err != nil { | ||
return simtypes.NoOpMsg(txCtx.ModuleName, txCtx.MsgType, "unable to deliver tx"), nil, err | ||
} | ||
|
||
return simtypes.NewOperationMsg(txCtx.Msg, true, "", txCtx.Cdc), nil, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.