feat: upgrade to Cosmos v0.46 (#1477)

* Update cosmos-sdk to v0.45.10-kava

* Add RegisterNodeService to app

* Update cosmos proto files

* Update cosmos proto files

* Use tagged v0.45.10-kava-v0.19-0.21 cosmos version

* update x/auth/legacy to x/auth/migrations

* Delete rest packages and registration

* Remove rest from proposal handlers

* Remove legacy types referencing removed sdk types

* Remove legacy tx broadcast handler

* Update incentive staking hooks to return error

* Remove grpc replace directive, use new grpc version

* Fix storetypes import

* Update tally_handler with updated gov types

* Delete legacy types

* Use new gov default config

* Update RegisterTendermintService params

Signed-off-by: drklee3 <derrick@dlee.dev>

* Replace sdk.StoreKey with storetypes.StoreKey

* Replace sdk.Int#ToDec with sdk.NewDecFromInt

* Replace sdk.NewUintFromBigInt with sdkmath.NewUintFromBigInt

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update most intances of govtypes to govv1beta1

* Unpack coin slice for Coins#Sub and Coins#SafeSub

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update committee gov codec registration

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update migrate utils period_vesting Coins#Sub

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update Coin#Sub in community proposal handler

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update Coin#Sub, FundModuleAccount/FundAccount in banktestutil

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update community, earn, kavadist proposal gov registration

* Update evm cli client EthSecp256k1Type check

* AccAddressFromHex to AccAddressFromHexUnsafe

* Add mint DefaultInflationCalculationFn to earn test

* Update use of removed staking.NewHandler

* Rename FlagIAVLFastNode -> FlagDisableIAVLFastNode

* cmd: Update new snapshot app option

Signed-off-by: drklee3 <derrick@dlee.dev>

* cmd: Add tendermint default config, use cosmos rpc status command

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update ethermint import path

github.com/tharsis/ethermint -> github.com/evmos/ethermint

* Upgrade ibc-go to v6

* Update proto dependencies

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update Tally handler test with new gov types

* Update helpers.GenTx -> helpers.GenSignedMockTx

* Update evmkeeper.NewKeeper params

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update ante authz, tests

* Add feemarket transient key, pass subspaces to evm/feemarket keepers

* Update new ante decorators

* Add new addModuleInitFlags to server commands

* Pass codec to keyring.New in genaccounts

* Pass codec to client keys add

* Add SendCoins to evmutil bank_keeper

* Use github.com/cosmos/iavl@v0.19.5

* Add ante HandlerOptions

* Add unimplemented SendCoins to evmutil bank keeper

Ethermint x/evm does not use this method

* Update init-new-chain script to disable post-london blocks

* Modify test genesis states to append 1 validator

* Update tally handler test to use string values

* Prevent querying balance for empty sdk.AccAddress in auction bidding test

* Set default bond denom to ukava

* Remove overwritten bank genesis total supply in committee proposal test

Signed-off-by: drklee3 <derrick@dlee.dev>

* Use ukava for testing staked balance

* Disable minting in community proposal handler test

Previously stake denom is used, which resulted in 0 minted coins

* Update hard APYToSPY test expected value

Increased iterations in sdk.ApproxRoot, updated closer to real value

* Fix NewDecCoinsFromCoins bug in incentive collectDerivativeStakingRewards

* Allow bkava earn incentive test values to match within small margin for rounding

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update invalid denom in issuance message coin validation

Colons are now valid in denoms

Signed-off-by: drklee3 <derrick@dlee.dev>

* Remove genesis validator in incentive delegation tests

* Update pricefeed market test for invalid denom

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update incentive delegator rewards test without genesis validator

Signed-off-by: drklee3 <derrick@dlee.dev>

* Add validator to export test

* Clear bank state in minting tests

Signed-off-by: drklee3 <derrick@dlee.dev>

* Remove validator for no stake tally test

Signed-off-by: drklee3 <derrick@dlee.dev>

* Clear incentive state before InitGenesis in incentive genesis export test

* Update swagger

Signed-off-by: drklee3 <derrick@dlee.dev>

* Update ethermint version to match replaced version

* Remove legacy swagger

* Add NewEthEmitEventDecorator

* Remove redundant func for AddModuleInitFlags

* Remove unused addBankBalanceForAddress func

* Add SetIAVLLazyLoading option to app cmd

* Use legacy.RegisterAminoMsg for committee msg concrete registration

* Remove unnecessary Amino field

* Add evm_util bankkeeper SendCoins comment

* Update test method ResetBankState to DeleteGenesisValidatorCoins to be more clear

* Validate incentive params.RewardsPerSecond to be non-zero

* Validate swap pools to disallow colons in token denoms

* Register all legacy amino types on gov modulecdc

* Remove redundant Comittee interface registration

* Pin goleveldb to v1.0.1-0.20210819022825-2ae1ddf74ef7

Causes failed to load state at height errors

* Update ethermint to new pinned version with minGasPrices parse error fix

* Update cosmos fork dependcy commit to include reverted account constructor patch

* Update Cosmos v0.46.11 and cometbft v0.34.27

* Bump minimum go version to 1.19

* Update tendermint proto

* Update internal testnet genesis

* Move NewCanTransferDecorator before NewEthGasConsumeDecorator

* Add hard borrow store tests (#1514)

* add store tests for Borrow type

* refactor Deposit tests to match

* Fix old bep3 tests (#1515)

* Update Ethermint to 1b17445 to fix duplicate proto registration

* Add custom status command to use snake_case and stdout

* Add SetInflation helper

* Reduce ambiguity with evm CanSignEthTx error

* Remove init genesis validator claim in test

* Add disabled evmante.NewMinGasPriceDecorator with x/feemarket note

* chore: use tagged versions for Cosmos and Ethermint forks

* update kvtool & increase wait for ibc transfer test

---------

Signed-off-by: drklee3 <derrick@dlee.dev>
Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com>
Co-authored-by: Robert Pirtle <astropirtle@gmail.com>
This commit is contained in:
drklee3 2023-04-03 17:08:45 -07:00 committed by GitHub
parent 4eab834704
commit f757d7ab15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
372 changed files with 63374 additions and 32336 deletions

View File

@ -9,11 +9,11 @@ import (
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
vesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
ibcante "github.com/cosmos/ibc-go/v3/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"
ibcante "github.com/cosmos/ibc-go/v6/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"
evmante "github.com/evmos/ethermint/app/ante"
evmtypes "github.com/evmos/ethermint/x/evm/types"
tmlog "github.com/tendermint/tendermint/libs/log"
evmante "github.com/tharsis/ethermint/app/ante"
evmtypes "github.com/tharsis/ethermint/x/evm/types"
)
// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
@ -29,6 +29,8 @@ type HandlerOptions struct {
FeeMarketKeeper evmtypes.FeeMarketKeeper
MaxTxGasWanted uint64
AddressFetchers []AddressFetcher
ExtensionOptionChecker authante.ExtensionOptionChecker
TxFeeChecker authante.TxFeeChecker
}
func (options HandlerOptions) Validate() error {
@ -122,7 +124,7 @@ func newCosmosAnteHandler(options cosmosHandlerOptions) sdk.AnteHandler {
)
if !options.isEIP712 {
decorators = append(decorators, authante.NewRejectExtensionOptionsDecorator())
decorators = append(decorators, authante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker))
}
if len(options.AddressFetchers) > 0 {
@ -131,12 +133,11 @@ func newCosmosAnteHandler(options cosmosHandlerOptions) sdk.AnteHandler {
var sigVerification sdk.AnteDecorator = authante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler)
if options.isEIP712 {
sigVerification = evmante.NewEip712SigVerificationDecorator(options.AccountKeeper, options.SignModeHandler, options.EvmKeeper)
sigVerification = evmante.NewLegacyEip712SigVerificationDecorator(options.AccountKeeper, options.SignModeHandler, options.EvmKeeper)
}
decorators = append(decorators,
NewEvmMinGasFilter(options.EvmKeeper), // filter out evm denom from min-gas-prices
authante.NewMempoolFeeDecorator(),
NewVestingAccountDecorator(),
NewAuthzLimiterDecorator(
sdk.MsgTypeURL(&evmtypes.MsgEthereumTx{}),
@ -144,15 +145,17 @@ func newCosmosAnteHandler(options cosmosHandlerOptions) sdk.AnteHandler {
),
authante.NewValidateBasicDecorator(),
authante.NewTxTimeoutHeightDecorator(),
// If ethermint x/feemarket is enabled, align Cosmos min fee with the EVM
// evmante.NewMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper),
authante.NewValidateMemoDecorator(options.AccountKeeper),
authante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
authante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
authante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
authante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
authante.NewValidateSigCountDecorator(options.AccountKeeper),
authante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
sigVerification,
authante.NewIncrementSequenceDecorator(options.AccountKeeper), // innermost AnteDecorator
ibcante.NewAnteDecorator(options.IBCKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
)
return sdk.ChainAnteDecorators(decorators...)
}
@ -163,10 +166,11 @@ func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler {
evmante.NewEthMempoolFeeDecorator(options.EvmKeeper), // Check eth effective gas price against minimal-gas-prices
evmante.NewEthValidateBasicDecorator(options.EvmKeeper),
evmante.NewEthSigVerificationDecorator(options.EvmKeeper),
evmante.NewEthAccountVerificationDecorator(options.AccountKeeper, options.BankKeeper, options.EvmKeeper),
evmante.NewEthGasConsumeDecorator(options.EvmKeeper, options.MaxTxGasWanted),
evmante.NewEthAccountVerificationDecorator(options.AccountKeeper, options.EvmKeeper),
evmante.NewCanTransferDecorator(options.EvmKeeper),
evmante.NewEthGasConsumeDecorator(options.EvmKeeper, options.MaxTxGasWanted),
evmante.NewEthIncrementSenderSequenceDecorator(options.AccountKeeper), // innermost AnteDecorator.
evmante.NewEthEmitEventDecorator(options.EvmKeeper), // emit eth tx hash and index at the very last ante handler.
)
}

View File

@ -1,6 +1,7 @@
package ante_test
import (
"math/rand"
"os"
"testing"
"time"
@ -13,11 +14,11 @@ import (
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
authz "github.com/cosmos/cosmos-sdk/x/authz"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
tmdb "github.com/tendermint/tm-db"
evmtypes "github.com/tharsis/ethermint/x/evm/types"
"github.com/kava-labs/kava/app"
bep3types "github.com/kava-labs/kava/x/bep3/types"
@ -104,7 +105,8 @@ func TestAppAnteHandler_AuthorizedMempool(t *testing.T) {
for _, tc := range testcases {
t.Run(tc.name, func(t *testing.T) {
stdTx, err := helpers.GenTx(
stdTx, err := helpers.GenSignedMockTx(
rand.New(rand.NewSource(time.Now().UnixNano())),
encodingConfig.TxConfig,
[]sdk.Msg{
banktypes.NewMsgSend(
@ -192,11 +194,13 @@ func TestAppAnteHandler_RejectMsgsInAuthz(t *testing.T) {
testPrivKeys, testAddresses := app.GeneratePrivKeyAddressPairs(10)
newMsgGrant := func(msgTypeUrl string) *authz.MsgGrant {
t := time.Date(9000, 1, 1, 0, 0, 0, 0, time.UTC)
msg, err := authz.NewMsgGrant(
testAddresses[0],
testAddresses[1],
authz.NewGenericAuthorization(msgTypeUrl),
time.Date(9000, 1, 1, 0, 0, 0, 0, time.UTC),
&t,
)
if err != nil {
panic(err)
@ -233,7 +237,8 @@ func TestAppAnteHandler_RejectMsgsInAuthz(t *testing.T) {
chainID,
)
stdTx, err := helpers.GenTx(
stdTx, err := helpers.GenSignedMockTx(
rand.New(rand.NewSource(time.Now().UnixNano())),
encodingConfig.TxConfig,
[]sdk.Msg{tc.msg},
sdk.NewCoins(), // no fee

View File

@ -1,7 +1,9 @@
package ante_test
import (
"math/rand"
"testing"
"time"
"github.com/cosmos/cosmos-sdk/simapp/helpers"
sdk "github.com/cosmos/cosmos-sdk/types"
@ -36,7 +38,8 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_NotCheckTx(t *testing.T) {
fetcher := mockAddressFetcher(testAddresses[1:]...)
decorator := ante.NewAuthenticatedMempoolDecorator(fetcher)
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
rand.New(rand.NewSource(time.Now().UnixNano())),
txConfig,
[]sdk.Msg{
banktypes.NewMsgSend(
@ -70,7 +73,8 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_Pass(t *testing.T) {
decorator := ante.NewAuthenticatedMempoolDecorator(fetcher)
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
rand.New(rand.NewSource(time.Now().UnixNano())),
txConfig,
[]sdk.Msg{
banktypes.NewMsgSend(
@ -110,7 +114,8 @@ func TestAuthenticatedMempoolDecorator_AnteHandle_Reject(t *testing.T) {
decorator := ante.NewAuthenticatedMempoolDecorator(fetcher)
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
rand.New(rand.NewSource(time.Now().UnixNano())),
txConfig,
[]sdk.Msg{
banktypes.NewMsgSend(

View File

@ -49,7 +49,11 @@ func (ald AuthzLimiterDecorator) checkForDisabledMsg(msgs []sdk.Msg, searchOnlyI
if !ok {
panic("unexpected msg type")
}
authorization := m.GetAuthorization()
authorization, err := m.GetAuthorization()
if err != nil {
return err
}
if ald.isDisabled(authorization.MsgTypeURL()) {
return fmt.Errorf("found disabled msg type in MsgGrant: %s", authorization.MsgTypeURL())
}

View File

@ -1,6 +1,7 @@
package ante_test
import (
"math/rand"
"testing"
"time"
@ -10,15 +11,15 @@ import (
"github.com/cosmos/cosmos-sdk/x/authz"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
"github.com/stretchr/testify/require"
evmtypes "github.com/tharsis/ethermint/x/evm/types"
"github.com/kava-labs/kava/app"
"github.com/kava-labs/kava/app/ante"
)
func newMsgGrant(granter sdk.AccAddress, grantee sdk.AccAddress, a authz.Authorization, expiration time.Time) *authz.MsgGrant {
msg, err := authz.NewMsgGrant(granter, grantee, a, expiration)
msg, err := authz.NewMsgGrant(granter, grantee, a, &expiration)
if err != nil {
panic(err)
}
@ -211,7 +212,8 @@ func TestAuthzLimiterDecorator(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
rand.New(rand.NewSource(time.Now().UnixNano())),
txConfig,
tc.msgs,
sdk.NewCoins(),

View File

@ -5,13 +5,14 @@ import (
"testing"
"time"
sdkmath "cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/client"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/simapp/helpers"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx"
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
@ -19,18 +20,18 @@ import (
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/evmos/ethermint/crypto/ethsecp256k1"
"github.com/evmos/ethermint/ethereum/eip712"
"github.com/evmos/ethermint/tests"
etherminttypes "github.com/evmos/ethermint/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
feemarkettypes "github.com/evmos/ethermint/x/feemarket/types"
"github.com/stretchr/testify/suite"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto/tmhash"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmversion "github.com/tendermint/tendermint/proto/tendermint/version"
"github.com/tendermint/tendermint/version"
"github.com/tharsis/ethermint/crypto/ethsecp256k1"
"github.com/tharsis/ethermint/ethereum/eip712"
"github.com/tharsis/ethermint/tests"
etherminttypes "github.com/tharsis/ethermint/types"
evmtypes "github.com/tharsis/ethermint/x/evm/types"
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types"
"github.com/kava-labs/kava/app"
cdptypes "github.com/kava-labs/kava/x/cdp/types"
@ -64,8 +65,8 @@ type EIP712TestSuite struct {
usdcEVMAddr evmutiltypes.InternalEVMAddress
}
func (suite *EIP712TestSuite) getEVMAmount(amount int64) sdk.Int {
incr := sdk.RelativePow(sdk.NewUint(10), sdk.NewUint(18), sdk.OneUint())
func (suite *EIP712TestSuite) getEVMAmount(amount int64) sdkmath.Int {
incr := sdkmath.RelativePow(sdkmath.NewUint(10), sdkmath.NewUint(18), sdkmath.OneUint())
return sdk.NewInt(amount).Mul(sdk.NewIntFromUint64(incr.Uint64()))
}
@ -85,7 +86,7 @@ func (suite *EIP712TestSuite) createTestEIP712CosmosTxBuilder(
fee := legacytx.NewStdFee(gas, gasAmount)
accNumber := suite.tApp.GetAccountKeeper().GetAccount(suite.ctx, from).GetAccountNumber()
data := eip712.ConstructUntypedEIP712Data(chainId, accNumber, nonce, 0, fee, msgs, "")
data := eip712.ConstructUntypedEIP712Data(chainId, accNumber, nonce, 0, fee, msgs, "", nil)
typedData, err := eip712.WrapTxToTypedData(ethChainId, msgs, data, &eip712.FeeDelegationOptions{
FeePayer: from,
}, suite.tApp.GetEvmKeeper().GetParams(suite.ctx))
@ -155,7 +156,15 @@ func (suite *EIP712TestSuite) SetupTest() {
// Genesis states
evmGs := evmtypes.NewGenesisState(
evmtypes.NewParams("akava", true, true, evmtypes.DefaultChainConfig()),
evmtypes.NewParams(
"akava", // evmDenom
false, // allowedUnprotectedTxs
true, // enableCreate
true, // enableCall
evmtypes.DefaultChainConfig(), // ChainConfig
nil, // extraEIPs
nil, // eip712AllowedMsgs
),
nil,
)
@ -302,7 +311,7 @@ func (suite *EIP712TestSuite) SetupTest() {
suite.ctx = ctx
// We need to set the validator as calling the EVM looks up the validator address
// https://github.com/tharsis/ethermint/blob/f21592ebfe74da7590eb42ed926dae970b2a9a3f/x/evm/keeper/state_transition.go#L487
// https://github.com/evmos/ethermint/blob/f21592ebfe74da7590eb42ed926dae970b2a9a3f/x/evm/keeper/state_transition.go#L487
// evmkeeper.EVMConfig() will return error "failed to load evm config" if not set
valAcc := &etherminttypes.EthAccount{
BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(consAddress.Bytes()), nil, 0, 0),

View File

@ -2,7 +2,7 @@ package ante
import (
sdk "github.com/cosmos/cosmos-sdk/types"
evmtypes "github.com/tharsis/ethermint/x/evm/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
)
var _ sdk.AnteDecorator = EvmMinGasFilter{}

View File

@ -5,11 +5,11 @@ import (
"testing"
sdk "github.com/cosmos/cosmos-sdk/types"
evmtypes "github.com/evmos/ethermint/x/evm/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"
evmtypes "github.com/tharsis/ethermint/x/evm/types"
"github.com/kava-labs/kava/app"
"github.com/kava-labs/kava/app/ante"

View File

@ -1,6 +1,7 @@
package ante_test
import (
"math/rand"
"testing"
"time"
@ -21,7 +22,8 @@ func TestVestingMempoolDecorator_MsgCreateVestingAccount_Unauthorized(t *testing
decorator := ante.NewVestingAccountDecorator()
tx, err := helpers.GenTx(
tx, err := helpers.GenSignedMockTx(
rand.New(rand.NewSource(time.Now().UnixNano())),
txConfig,
[]sdk.Msg{
vesting.NewMsgCreateVestingAccount(

View File

@ -9,13 +9,14 @@ import (
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
@ -47,8 +48,11 @@ import (
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/cosmos/cosmos-sdk/x/gov"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/cosmos/cosmos-sdk/x/mint"
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
@ -67,29 +71,29 @@ import (
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
transfer "github.com/cosmos/ibc-go/v3/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v3/modules/core"
ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client"
ibcclientclient "github.com/cosmos/ibc-go/v3/modules/core/02-client/client"
ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"
porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"
transfer "github.com/cosmos/ibc-go/v6/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v6/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v6/modules/core"
ibcclient "github.com/cosmos/ibc-go/v6/modules/core/02-client"
ibcclientclient "github.com/cosmos/ibc-go/v6/modules/core/02-client/client"
ibcclienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
porttypes "github.com/cosmos/ibc-go/v6/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v6/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"
evmante "github.com/evmos/ethermint/app/ante"
ethermintconfig "github.com/evmos/ethermint/server/config"
"github.com/evmos/ethermint/x/evm"
evmkeeper "github.com/evmos/ethermint/x/evm/keeper"
evmtypes "github.com/evmos/ethermint/x/evm/types"
"github.com/evmos/ethermint/x/evm/vm/geth"
"github.com/evmos/ethermint/x/feemarket"
feemarketkeeper "github.com/evmos/ethermint/x/feemarket/keeper"
feemarkettypes "github.com/evmos/ethermint/x/feemarket/types"
abci "github.com/tendermint/tendermint/abci/types"
tmjson "github.com/tendermint/tendermint/libs/json"
tmlog "github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"
evmante "github.com/tharsis/ethermint/app/ante"
ethermintconfig "github.com/tharsis/ethermint/server/config"
"github.com/tharsis/ethermint/x/evm"
evmrest "github.com/tharsis/ethermint/x/evm/client/rest"
evmkeeper "github.com/tharsis/ethermint/x/evm/keeper"
evmtypes "github.com/tharsis/ethermint/x/evm/types"
"github.com/tharsis/ethermint/x/feemarket"
feemarketkeeper "github.com/tharsis/ethermint/x/feemarket/keeper"
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types"
"github.com/kava-labs/kava/app/ante"
kavaparams "github.com/kava-labs/kava/app/params"
@ -166,11 +170,11 @@ var (
capability.AppModuleBasic{},
staking.AppModuleBasic{},
distr.AppModuleBasic{},
gov.NewAppModuleBasic(
gov.NewAppModuleBasic([]govclient.ProposalHandler{
paramsclient.ProposalHandler,
distrclient.ProposalHandler,
upgradeclient.ProposalHandler,
upgradeclient.CancelProposalHandler,
upgradeclient.LegacyProposalHandler,
upgradeclient.LegacyCancelProposalHandler,
ibcclientclient.UpdateClientProposalHandler,
ibcclientclient.UpgradeProposalHandler,
kavadistclient.ProposalHandler,
@ -179,7 +183,7 @@ var (
earnclient.WithdrawProposalHandler,
communityclient.LendDepositProposalHandler,
communityclient.LendWithdrawProposalHandler,
),
}),
params.AppModuleBasic{},
crisis.AppModuleBasic{},
slashing.AppModuleBasic{},
@ -242,6 +246,7 @@ var (
// Verify app interface at compile time
var _ servertypes.Application = (*App)(nil)
var _ servertypes.ApplicationQueryService = (*App)(nil)
// Options bundles several configuration params for an App.
type Options struct {
@ -271,9 +276,9 @@ type App struct {
interfaceRegistry types.InterfaceRegistry
// keys to access the substores
keys map[string]*sdk.KVStoreKey
tkeys map[string]*sdk.TransientStoreKey
memKeys map[string]*sdk.MemoryStoreKey
keys map[string]*storetypes.KVStoreKey
tkeys map[string]*storetypes.TransientStoreKey
memKeys map[string]*storetypes.MemoryStoreKey
// keepers from all the modules
accountKeeper authkeeper.AccountKeeper
@ -364,7 +369,7 @@ func NewApp(
committeetypes.StoreKey, incentivetypes.StoreKey, evmutiltypes.StoreKey,
savingstypes.StoreKey, earntypes.StoreKey, minttypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
app := &App{
@ -389,7 +394,7 @@ func NewApp(
stakingSubspace := app.paramsKeeper.Subspace(stakingtypes.ModuleName)
distrSubspace := app.paramsKeeper.Subspace(distrtypes.ModuleName)
slashingSubspace := app.paramsKeeper.Subspace(slashingtypes.ModuleName)
govSubspace := app.paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable())
govSubspace := app.paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable())
crisisSubspace := app.paramsKeeper.Subspace(crisistypes.ModuleName)
kavadistSubspace := app.paramsKeeper.Subspace(kavadisttypes.ModuleName)
auctionSubspace := app.paramsKeeper.Subspace(auctiontypes.ModuleName)
@ -410,7 +415,7 @@ func NewApp(
mintSubspace := app.paramsKeeper.Subspace(minttypes.ModuleName)
bApp.SetParamStore(
app.paramsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable()),
app.paramsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable()),
)
app.capabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey])
scopedIBCKeeper := app.capabilityKeeper.ScopeToModule(ibchost.ModuleName)
@ -424,6 +429,7 @@ func NewApp(
authSubspace,
authtypes.ProtoBaseAccount,
mAccPerms,
sdk.GetConfig().GetBech32AccountAddrPrefix(),
)
app.bankKeeper = bankkeeper.NewBaseKeeper(
appCodec,
@ -443,6 +449,7 @@ func NewApp(
keys[authzkeeper.StoreKey],
appCodec,
app.BaseApp.MsgServiceRouter(),
app.accountKeeper,
)
app.distrKeeper = distrkeeper.NewKeeper(
appCodec,
@ -452,7 +459,6 @@ func NewApp(
app.bankKeeper,
&app.stakingKeeper,
authtypes.FeeCollectorName,
app.ModuleAccountAddrs(),
)
app.slashingKeeper = slashingkeeper.NewKeeper(
appCodec,
@ -472,6 +478,8 @@ func NewApp(
appCodec,
homePath,
app.BaseApp,
// Authority
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
app.evidenceKeeper = *evidencekeeper.NewKeeper(
appCodec,
@ -491,7 +499,12 @@ func NewApp(
// Create Ethermint keepers
app.feeMarketKeeper = feemarketkeeper.NewKeeper(
appCodec, keys[feemarkettypes.StoreKey], feemarketSubspace,
appCodec,
// Authority
authtypes.NewModuleAddress(govtypes.ModuleName),
keys[feemarkettypes.StoreKey],
tkeys[feemarkettypes.TransientKey],
feemarketSubspace,
)
app.evmutilKeeper = evmutilkeeper.NewKeeper(
@ -504,9 +517,14 @@ func NewApp(
evmBankKeeper := evmutilkeeper.NewEvmBankKeeper(app.evmutilKeeper, app.bankKeeper, app.accountKeeper)
app.evmKeeper = evmkeeper.NewKeeper(
appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], evmSubspace,
appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey],
// Authority
authtypes.NewModuleAddress(govtypes.ModuleName),
app.accountKeeper, evmBankKeeper, app.stakingKeeper, app.feeMarketKeeper,
nil, // precompiled contracts
geth.NewEVM,
options.EVMTrace,
evmSubspace,
)
app.evmutilKeeper.SetEvmKeeper(app.evmKeeper)
@ -661,9 +679,9 @@ func NewApp(
)
// create committee keeper with router
committeeGovRouter := govtypes.NewRouter()
committeeGovRouter := govv1beta1.NewRouter()
committeeGovRouter.
AddRoute(govtypes.RouterKey, govtypes.ProposalHandler).
AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler).
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)).
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)).
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.upgradeKeeper))
@ -681,7 +699,11 @@ func NewApp(
// register the staking hooks
// NOTE: These keepers are passed by reference above, so they will contain these hooks.
app.stakingKeeper = *(app.stakingKeeper.SetHooks(
stakingtypes.NewMultiStakingHooks(app.distrKeeper.Hooks(), app.slashingKeeper.Hooks(), app.incentiveKeeper.Hooks())))
stakingtypes.NewMultiStakingHooks(
app.distrKeeper.Hooks(),
app.slashingKeeper.Hooks(),
app.incentiveKeeper.Hooks(),
)))
app.swapKeeper = *swapKeeper.SetHooks(app.incentiveKeeper.Hooks())
app.cdpKeeper = *cdpKeeper.SetHooks(cdptypes.NewMultiCDPHooks(app.incentiveKeeper.Hooks()))
@ -691,9 +713,9 @@ func NewApp(
// create gov keeper with router
// NOTE this must be done after any keepers referenced in the gov router (ie committee) are defined
govRouter := govtypes.NewRouter()
govRouter := govv1beta1.NewRouter()
govRouter.
AddRoute(govtypes.RouterKey, govtypes.ProposalHandler).
AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler).
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)).
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.upgradeKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper)).
@ -702,6 +724,8 @@ func NewApp(
AddRoute(earntypes.RouterKey, earn.NewCommunityPoolProposalHandler(app.earnKeeper)).
AddRoute(communitytypes.RouterKey, community.NewCommunityPoolProposalHandler(app.communityKeeper)).
AddRoute(committeetypes.RouterKey, committee.NewProposalHandler(app.committeeKeeper))
govConfig := govtypes.DefaultConfig()
app.govKeeper = govkeeper.NewKeeper(
appCodec,
keys[govtypes.StoreKey],
@ -710,6 +734,8 @@ func NewApp(
app.bankKeeper,
&app.stakingKeeper,
govRouter,
app.MsgServiceRouter(),
govConfig,
)
// override x/gov tally handler with custom implementation
@ -733,8 +759,8 @@ func NewApp(
crisis.NewAppModule(&app.crisisKeeper, options.SkipGenesisInvariants),
slashing.NewAppModule(appCodec, app.slashingKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper),
ibc.NewAppModule(app.ibcKeeper),
evm.NewAppModule(app.evmKeeper, app.accountKeeper),
feemarket.NewAppModule(app.feeMarketKeeper),
evm.NewAppModule(app.evmKeeper, app.accountKeeper, evmSubspace),
feemarket.NewAppModule(app.feeMarketKeeper, feemarketSubspace),
upgrade.NewAppModule(app.upgradeKeeper),
evidence.NewAppModule(app.evidenceKeeper),
transferModule,
@ -756,7 +782,8 @@ func NewApp(
liquid.NewAppModule(app.liquidKeeper),
earn.NewAppModule(app.earnKeeper, app.accountKeeper, app.bankKeeper),
router.NewAppModule(app.routerKeeper),
mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper),
// nil InflationCalculationFn, use SDK's default inflation function
mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper, nil),
community.NewAppModule(app.communityKeeper, app.accountKeeper),
)
@ -945,6 +972,8 @@ func NewApp(
SigGasConsumer: evmante.DefaultSigVerificationGasConsumer,
MaxTxGasWanted: options.EVMMaxGasWanted,
AddressFetchers: fetchers,
ExtensionOptionChecker: nil,
TxFeeChecker: nil,
}
antehandler, err := ante.NewAnteHandler(anteOptions)
@ -1027,16 +1056,11 @@ func (app *App) SimulationManager() *module.SimulationManager {
func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
clientCtx := apiSvr.ClientCtx
// Register legacy REST routes
rpc.RegisterRoutes(clientCtx, apiSvr.Router)
evmrest.RegisterTxRoutes(clientCtx, apiSvr.Router)
ModuleBasics.RegisterRESTRoutes(clientCtx, apiSvr.Router)
RegisterLegacyTxRoutes(clientCtx, apiSvr.Router)
// Register GRPC Gateway routes
tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
// Swagger API configuration is ignored
}
@ -1050,7 +1074,16 @@ func (app *App) RegisterTxService(clientCtx client.Context) {
// RegisterTendermintService implements the Application.RegisterTendermintService method.
// It registers the standard tendermint grpc endpoints on the app's grpc server.
func (app *App) RegisterTendermintService(clientCtx client.Context) {
tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry)
tmservice.RegisterTendermintService(
clientCtx,
app.BaseApp.GRPCQueryRouter(),
app.interfaceRegistry,
app.Query,
)
}
func (app *App) RegisterNodeService(clientCtx client.Context) {
nodeservice.RegisterNodeService(clientCtx, app.BaseApp.GRPCQueryRouter())
}
// loadBlockedMaccAddrs returns a map indicating the blocked status of each module account address

View File

@ -32,7 +32,9 @@ func TestExport(t *testing.T) {
db := db.NewMemDB()
app := NewApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, DefaultNodeHome, nil, MakeEncodingConfig(), DefaultOptions)
stateBytes, err := json.Marshal(NewDefaultGenesisState())
genesisState := GenesisStateWithSingleValidator(&TestApp{App: *app}, NewDefaultGenesisState())
stateBytes, err := json.Marshal(genesisState)
require.NoError(t, err)
initRequest := abci.RequestInitChain{
@ -58,7 +60,7 @@ func TestExport(t *testing.T) {
assert.Equal(t, initRequest.InitialHeight+1, exportedApp.Height) // app.Commit() increments height
assert.Equal(t, initRequest.ConsensusParams, exportedApp.ConsensusParams)
assert.Equal(t, []tmtypes.GenesisValidator(nil), exportedApp.Validators) // no validators set in default genesis
assert.Len(t, exportedApp.Validators, 1) // no validators set in default genesis
}
// unmarshalJSONKeys extracts keys from the top level of a json blob.

View File

@ -1,7 +1,7 @@
package app
import (
enccodec "github.com/tharsis/ethermint/encoding/codec"
enccodec "github.com/evmos/ethermint/encoding/codec"
"github.com/kava-labs/kava/app/params"
)

View File

@ -1,84 +0,0 @@
package app
import (
"net/http"
"github.com/cosmos/cosmos-sdk/client"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/rest"
"github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx"
"github.com/gorilla/mux"
)
// RegisterLegacyTxRoutes registers a legacy tx routes that use amino encoding json
func RegisterLegacyTxRoutes(clientCtx client.Context, r *mux.Router) {
r.HandleFunc("/txs", legacyTxBroadcast(clientCtx)).Methods("POST")
}
// LegacyTxBroadcastRequest represents a broadcast request with an amino json encoded transaction
type LegacyTxBroadcastRequest struct {
Tx legacytx.StdTx `json:"tx"`
Mode string `json:"mode"`
}
var _ codectypes.UnpackInterfacesMessage = LegacyTxBroadcastRequest{}
// UnpackInterfaces implements the UnpackInterfacesMessage interface
func (m LegacyTxBroadcastRequest) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
return m.Tx.UnpackInterfaces(unpacker)
}
func legacyTxBroadcast(clientCtx client.Context) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req LegacyTxBroadcastRequest
if !rest.ReadRESTReq(w, r, clientCtx.LegacyAmino, &req) {
return
}
tx := req.Tx
builder := clientCtx.TxConfig.NewTxBuilder()
err := builder.SetMsgs(tx.GetMsgs()...)
if rest.CheckBadRequestError(w, err) {
return
}
builder.SetFeeAmount(tx.GetFee())
builder.SetGasLimit(tx.GetGas())
builder.SetMemo(req.Tx.GetMemo())
builder.SetTimeoutHeight(req.Tx.GetTimeoutHeight())
signatures, err := tx.GetSignaturesV2()
if rest.CheckBadRequestError(w, err) {
return
}
for i, sig := range signatures {
addr := sdk.AccAddress(sig.PubKey.Address())
_, seq, err := clientCtx.AccountRetriever.GetAccountNumberSequence(clientCtx, addr)
if rest.CheckBadRequestError(w, err) {
return
}
signatures[i].Sequence = seq
}
err = builder.SetSignatures(signatures...)
if rest.CheckBadRequestError(w, err) {
return
}
txBytes, err := clientCtx.TxConfig.TxEncoder()(builder.GetTx())
if rest.CheckInternalServerError(w, err) {
return
}
clientCtx = clientCtx.WithBroadcastMode(req.Mode)
res, err := clientCtx.BroadcastTx(txBytes)
if rest.CheckInternalServerError(w, err) {
return
}
rest.PostProcessResponseBare(w, clientCtx, res)
}
}

View File

@ -1,194 +0,0 @@
package app_test
import (
"bytes"
"encoding/json"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"github.com/golang/mock/gomock"
"github.com/kava-labs/kava/app"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/tests/mocks"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/gorilla/mux"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
jsonrpctypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
tmtypes "github.com/tendermint/tendermint/types"
)
type LegacyTxBroadcastTestSuite struct {
suite.Suite
clientCtx client.Context
restServer *httptest.Server
rpcServer *httptest.Server
ctrl *gomock.Controller
accountRetriever *mocks.MockAccountRetriever
simulateResponse func(jsonrpctypes.RPCRequest) jsonrpctypes.RPCResponse
}
func (suite *LegacyTxBroadcastTestSuite) SetupTest() {
app.SetSDKConfig()
// setup the mock rpc server
suite.rpcServer = rpcTestServer(suite.T(), func(request jsonrpctypes.RPCRequest) jsonrpctypes.RPCResponse {
suite.Require().Equal("broadcast_tx_sync", request.Method)
return suite.simulateResponse(request)
})
// setup client context with rpc client, account retriever mock, codecs, and tx config
rpcClient, err := rpchttp.New(suite.rpcServer.URL, "/websocket")
suite.Require().NoError(err)
suite.ctrl = gomock.NewController(suite.T())
suite.accountRetriever = mocks.NewMockAccountRetriever(suite.ctrl)
encodingConfig := app.MakeEncodingConfig()
suite.clientCtx = client.Context{}.
WithCodec(encodingConfig.Marshaler).
WithTxConfig(encodingConfig.TxConfig).
WithLegacyAmino(encodingConfig.Amino).
WithNodeURI(suite.rpcServer.URL).
WithClient(rpcClient).
WithAccountRetriever(suite.accountRetriever)
// setup rest server
router := mux.NewRouter()
app.RegisterLegacyTxRoutes(suite.clientCtx, router)
suite.restServer = httptest.NewServer(router)
}
func (suite *LegacyTxBroadcastTestSuite) TearDownTest() {
suite.rpcServer.Close()
suite.restServer.Close()
suite.ctrl.Finish()
}
func (suite *LegacyTxBroadcastTestSuite) TestSimulateRequest() {
_, pk, fromAddr := testdata.KeyTestPubAddr()
toAddr, err := sdk.AccAddressFromBech32("kava1mq9qxlhze029lm0frzw2xr6hem8c3k9ts54w0w")
suite.Require().NoError(err)
// build a legacy transaction
msgs := []sdk.Msg{banktypes.NewMsgSend(fromAddr, toAddr, sdk.NewCoins(sdk.NewCoin("ukava", sdk.NewInt(1e6))))}
fee := legacytx.NewStdFee(1e6, sdk.NewCoins(sdk.NewCoin("ukava", sdk.NewInt(5e4))))
sigs := []legacytx.StdSignature{legacytx.NewStdSignature(pk, []byte("an amino json signed signature"))}
stdTx := legacytx.NewStdTx(msgs, fee, sigs, "legacy broadcast test")
stdTx.TimeoutHeight = 100000
txReq := app.LegacyTxBroadcastRequest{
Tx: stdTx,
Mode: "sync",
}
// setup mock tendermint jsonrpc handler for BroadcastTx
var broadcastedTx authsigning.Tx
var broadcastedTxHash tmbytes.HexBytes
suite.simulateResponse = func(rpcRequest jsonrpctypes.RPCRequest) jsonrpctypes.RPCResponse {
var params struct {
Tx tmtypes.Tx `json:"tx"`
}
err := json.Unmarshal(rpcRequest.Params, &params)
suite.Require().NoError(err)
decodedTx, err := suite.clientCtx.TxConfig.TxDecoder()(params.Tx)
suite.Require().NoError(err)
wrappedTx, err := suite.clientCtx.TxConfig.WrapTxBuilder(decodedTx)
suite.Require().NoError(err)
broadcastedTx = wrappedTx.GetTx()
broadcastedTxHash = params.Tx.Hash()
resp := &ctypes.ResultBroadcastTx{
Log: "[]",
Hash: broadcastedTxHash,
}
result, err := suite.clientCtx.LegacyAmino.MarshalJSON(resp)
suite.Require().NoError(err)
return jsonrpctypes.RPCResponse{
JSONRPC: rpcRequest.JSONRPC,
ID: rpcRequest.ID,
Result: json.RawMessage(result),
}
}
// mock account sequence retrieval
suite.accountRetriever.EXPECT().
GetAccountNumberSequence(suite.clientCtx, fromAddr).
Return(uint64(100), uint64(101), nil)
// amino encode legacy tx
requestBody, err := suite.clientCtx.LegacyAmino.MarshalJSON(txReq)
suite.Require().NoError(err)
// post transaction to POST /txs
req, err := http.NewRequest("POST", suite.restServer.URL+"/txs", bytes.NewBuffer(requestBody))
suite.Require().NoError(err)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
suite.Require().NoError(err)
defer resp.Body.Close()
// assert broadcasted tx has all information
suite.Equal(msgs, broadcastedTx.GetMsgs())
suite.Equal(fee.Amount, broadcastedTx.GetFee())
suite.Equal(fee.Gas, broadcastedTx.GetGas())
suite.Equal(stdTx.TimeoutHeight, broadcastedTx.GetTimeoutHeight())
suite.Equal(stdTx.Memo, broadcastedTx.GetMemo())
// assert broadcasted tx has correct signature
stdSignatures, err := stdTx.GetSignaturesV2()
suite.Require().NoError(err)
stdSignatures[0].Sequence = uint64(101)
broadcastedSigs, err := broadcastedTx.GetSignaturesV2()
suite.Require().NoError(err)
suite.Equal(stdSignatures, broadcastedSigs)
// decode response body
body, err := ioutil.ReadAll(resp.Body)
suite.Require().NoError(err)
var txResponse sdk.TxResponse
err = suite.clientCtx.LegacyAmino.UnmarshalJSON(body, &txResponse)
suite.Require().NoError(err)
// ensure response is correct
suite.Equal("[]", txResponse.RawLog)
suite.Equal(broadcastedTxHash.String(), txResponse.TxHash)
}
func TestLegacyTxBroadcastTestSuite(t *testing.T) {
suite.Run(t, new(LegacyTxBroadcastTestSuite))
}
func rpcTestServer(
t *testing.T,
rpcHandler func(jsonrpctypes.RPCRequest) jsonrpctypes.RPCResponse,
) *httptest.Server {
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
body, err := ioutil.ReadAll(r.Body)
require.NoError(t, err)
var request jsonrpctypes.RPCRequest
err = json.Unmarshal(body, &request)
require.NoError(t, err)
response := rpcHandler(request)
b, err := json.Marshal(&response)
require.NoError(t, err)
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
_, _ = w.Write(b)
}))
}

View File

@ -4,8 +4,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
"github.com/cosmos/cosmos-sdk/x/gov/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
earnkeeper "github.com/kava-labs/kava/x/earn/keeper"
@ -14,7 +13,7 @@ import (
savingskeeper "github.com/kava-labs/kava/x/savings/keeper"
)
var _ govtypes.TallyHandler = TallyHandler{}
var _ govv1.TallyHandler = TallyHandler{}
// TallyHandler is the tally handler for kava
type TallyHandler struct {
@ -41,30 +40,33 @@ func NewTallyHandler(
}
}
func (th TallyHandler) Tally(ctx sdk.Context, proposal types.Proposal) (passes bool, burnDeposits bool, tallyResults types.TallyResult) {
results := make(map[types.VoteOption]sdk.Dec)
results[types.OptionYes] = sdk.ZeroDec()
results[types.OptionAbstain] = sdk.ZeroDec()
results[types.OptionNo] = sdk.ZeroDec()
results[types.OptionNoWithVeto] = sdk.ZeroDec()
func (th TallyHandler) Tally(
ctx sdk.Context,
proposal govv1.Proposal,
) (passes bool, burnDeposits bool, tallyResults govv1.TallyResult) {
results := make(map[govv1.VoteOption]sdk.Dec)
results[govv1.OptionYes] = sdk.ZeroDec()
results[govv1.OptionAbstain] = sdk.ZeroDec()
results[govv1.OptionNo] = sdk.ZeroDec()
results[govv1.OptionNoWithVeto] = sdk.ZeroDec()
totalVotingPower := sdk.ZeroDec()
currValidators := make(map[string]types.ValidatorGovInfo)
currValidators := make(map[string]govv1.ValidatorGovInfo)
// fetch all the bonded validators, insert them into currValidators
th.stk.IterateBondedValidatorsByPower(ctx, func(index int64, validator stakingtypes.ValidatorI) (stop bool) {
currValidators[validator.GetOperator().String()] = types.NewValidatorGovInfo(
currValidators[validator.GetOperator().String()] = govv1.NewValidatorGovInfo(
validator.GetOperator(),
validator.GetBondedTokens(),
validator.GetDelegatorShares(),
sdk.ZeroDec(),
types.WeightedVoteOptions{},
govv1.WeightedVoteOptions{},
)
return false
})
th.gk.IterateVotes(ctx, proposal.ProposalId, func(vote types.Vote) bool {
th.gk.IterateVotes(ctx, proposal.Id, func(vote govv1.Vote) bool {
// if validator, just record it in the map
voter, err := sdk.AccAddressFromBech32(vote.Voter)
@ -92,7 +94,7 @@ func (th TallyHandler) Tally(ctx sdk.Context, proposal types.Proposal) (passes b
votingPower := delegation.GetShares().MulInt(val.BondedTokens).Quo(val.DelegatorShares)
for _, option := range vote.Options {
subPower := votingPower.Mul(option.Weight)
subPower := votingPower.Mul(sdk.MustNewDecFromStr(option.Weight))
results[option.Option] = results[option.Option].Add(subPower)
}
totalVotingPower = totalVotingPower.Add(votingPower)
@ -112,7 +114,7 @@ func (th TallyHandler) Tally(ctx sdk.Context, proposal types.Proposal) (passes b
// reduce delegator shares by the amount of voter bkava for the validator
valAddrStr := valAddr.String()
if val, ok := currValidators[valAddrStr]; ok {
val.DelegatorDeductions = val.DelegatorDeductions.Add(coin.Amount.ToDec())
val.DelegatorDeductions = val.DelegatorDeductions.Add(sdk.NewDecFromInt(coin.Amount))
currValidators[valAddrStr] = val
}
@ -122,10 +124,10 @@ func (th TallyHandler) Tally(ctx sdk.Context, proposal types.Proposal) (passes b
// error is returned only if the bkava denom is incorrect, which should never happen here.
panic(err)
}
votingPower := stakedCoins.Amount.ToDec()
votingPower := sdk.NewDecFromInt(stakedCoins.Amount)
for _, option := range vote.Options {
subPower := votingPower.Mul(option.Weight)
subPower := votingPower.Mul(sdk.MustNewDecFromStr(option.Weight))
results[option.Option] = results[option.Option].Add(subPower)
}
totalVotingPower = totalVotingPower.Add(votingPower)
@ -145,14 +147,14 @@ func (th TallyHandler) Tally(ctx sdk.Context, proposal types.Proposal) (passes b
votingPower := sharesAfterDeductions.MulInt(val.BondedTokens).Quo(val.DelegatorShares)
for _, option := range val.Vote {
subPower := votingPower.Mul(option.Weight)
subPower := votingPower.Mul(sdk.MustNewDecFromStr(option.Weight))
results[option.Option] = results[option.Option].Add(subPower)
}
totalVotingPower = totalVotingPower.Add(votingPower)
}
tallyParams := th.gk.GetTallyParams(ctx)
tallyResults = types.NewTallyResultFromMap(results)
tallyResults = govv1.NewTallyResultFromMap(results)
// TODO: Upgrade the spec to cover all of these cases & remove pseudocode.
// If there is no staked coins, the proposal fails
@ -161,23 +163,23 @@ func (th TallyHandler) Tally(ctx sdk.Context, proposal types.Proposal) (passes b
}
// If there is not enough quorum of votes, the proposal fails
percentVoting := totalVotingPower.Quo(th.stk.TotalBondedTokens(ctx).ToDec())
if percentVoting.LT(tallyParams.Quorum) {
percentVoting := totalVotingPower.Quo(sdk.NewDecFromInt(th.stk.TotalBondedTokens(ctx)))
if percentVoting.LT(sdk.MustNewDecFromStr(tallyParams.Quorum)) {
return false, true, tallyResults
}
// If no one votes (everyone abstains), proposal fails
if totalVotingPower.Sub(results[types.OptionAbstain]).Equal(sdk.ZeroDec()) {
if totalVotingPower.Sub(results[govv1.OptionAbstain]).Equal(sdk.ZeroDec()) {
return false, false, tallyResults
}
// If more than 1/3 of voters veto, proposal fails
if results[types.OptionNoWithVeto].Quo(totalVotingPower).GT(tallyParams.VetoThreshold) {
if results[govv1.OptionNoWithVeto].Quo(totalVotingPower).GT(sdk.MustNewDecFromStr(tallyParams.VetoThreshold)) {
return false, true, tallyResults
}
// If more than 1/2 of non-abstaining voters vote Yes, proposal passes
if results[types.OptionYes].Quo(totalVotingPower.Sub(results[types.OptionAbstain])).GT(tallyParams.Threshold) {
if results[govv1.OptionYes].Quo(totalVotingPower.Sub(results[govv1.OptionAbstain])).GT(sdk.MustNewDecFromStr(tallyParams.Threshold)) {
return true, false, tallyResults
}

View File

@ -8,7 +8,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
@ -69,13 +70,13 @@ func (suite *tallyHandlerSuite) TestVotePower_AllSourcesCounted() {
)
proposal := suite.createProposal()
suite.voteOnProposal(user.GetAddress(), proposal.ProposalId, govtypes.OptionYes)
suite.voteOnProposal(user.GetAddress(), proposal.Id, govv1beta1.OptionYes)
_, _, results := suite.tallier.Tally(suite.ctx, proposal)
suite.Equal(sdk.NewInt(500e6+250e6+250e6), results.Yes)
suite.Equal(sdk.ZeroInt(), results.No)
suite.Equal(sdk.ZeroInt(), results.NoWithVeto)
suite.Equal(sdk.ZeroInt(), results.Abstain)
suite.Equal(sdk.NewInt(500e6+250e6+250e6).String(), results.YesCount)
suite.Equal(sdk.ZeroInt().String(), results.NoCount)
suite.Equal(sdk.ZeroInt().String(), results.NoWithVetoCount)
suite.Equal(sdk.ZeroInt().String(), results.AbstainCount)
}
func (suite *tallyHandlerSuite) TestVotePower_UserOverridesValidator() {
@ -96,28 +97,28 @@ func (suite *tallyHandlerSuite) TestVotePower_UserOverridesValidator() {
proposal := suite.createProposal()
// Validator votes, inheriting user's stake and bkava.
suite.voteOnProposal(validator.GetOperator().Bytes(), proposal.ProposalId, govtypes.OptionYes)
suite.voteOnProposal(validator.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionYes)
// use wrapped context to discard the state changes
readOnlyCtx, _ := suite.ctx.CacheContext()
_, _, results := suite.tallier.Tally(readOnlyCtx, proposal)
userPower := sdk.NewInt(500e6 + 250e6 + 250e6)
suite.Equal(
selfDelegated.Add(userPower),
results.Yes,
selfDelegated.Add(userPower).String(),
results.YesCount,
)
suite.Equal(sdk.ZeroInt(), results.No)
suite.Equal(sdk.ZeroInt(), results.NoWithVeto)
suite.Equal(sdk.ZeroInt(), results.Abstain)
suite.Equal(sdk.ZeroInt().String(), results.NoCount)
suite.Equal(sdk.ZeroInt().String(), results.NoWithVetoCount)
suite.Equal(sdk.ZeroInt().String(), results.AbstainCount)
// User votes, taking power away from validator.
suite.voteOnProposal(user.GetAddress(), proposal.ProposalId, govtypes.OptionNo)
suite.voteOnProposal(user.GetAddress(), proposal.Id, govv1beta1.OptionNo)
_, _, results = suite.tallier.Tally(suite.ctx, proposal)
suite.Equal(selfDelegated, results.Yes)
suite.Equal(userPower, results.No)
suite.Equal(sdk.ZeroInt(), results.NoWithVeto)
suite.Equal(sdk.ZeroInt(), results.Abstain)
suite.Equal(selfDelegated.String(), results.YesCount)
suite.Equal(userPower.String(), results.NoCount)
suite.Equal(sdk.ZeroInt().String(), results.NoWithVetoCount)
suite.Equal(sdk.ZeroInt().String(), results.AbstainCount)
}
func (suite *tallyHandlerSuite) TestTallyOutcomes() {
@ -129,7 +130,7 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() {
v1 := suite.createNewBondedValidator(sdk.NewInt(399_999_999))
suite.createNewBondedValidator(sdk.NewInt(600_000_001))
suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.ProposalId, govtypes.OptionYes)
suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionYes)
passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal)
suite.Falsef(passes, "expected proposal to fail, tally: %v", tally)
@ -143,8 +144,8 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() {
v1 := suite.createNewBondedValidator(sdk.NewInt(334_000_001))
v2 := suite.createNewBondedValidator(sdk.NewInt(665_999_999))
suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.ProposalId, govtypes.OptionNoWithVeto)
suite.voteOnProposal(v2.GetOperator().Bytes(), proposal.ProposalId, govtypes.OptionYes)
suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionNoWithVeto)
suite.voteOnProposal(v2.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionYes)
passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal)
suite.Falsef(passes, "expected proposal to fail, tally: %v", tally)
@ -159,9 +160,9 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() {
v2 := suite.createNewBondedValidator(sdk.NewInt(50_000_001))
v3 := suite.createNewBondedValidator(sdk.NewInt(49_999_999))
suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.ProposalId, govtypes.OptionAbstain)
suite.voteOnProposal(v2.GetOperator().Bytes(), proposal.ProposalId, govtypes.OptionYes)
suite.voteOnProposal(v3.GetOperator().Bytes(), proposal.ProposalId, govtypes.OptionNo)
suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionAbstain)
suite.voteOnProposal(v2.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionYes)
suite.voteOnProposal(v3.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionNo)
passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal)
suite.Truef(passes, "expected proposal to pass, tally: %v", tally)
@ -176,9 +177,9 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() {
v2 := suite.createNewBondedValidator(sdk.NewInt(49_999_999))
v3 := suite.createNewBondedValidator(sdk.NewInt(50_000_001))
suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.ProposalId, govtypes.OptionAbstain)
suite.voteOnProposal(v2.GetOperator().Bytes(), proposal.ProposalId, govtypes.OptionYes)
suite.voteOnProposal(v3.GetOperator().Bytes(), proposal.ProposalId, govtypes.OptionNo)
suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionAbstain)
suite.voteOnProposal(v2.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionYes)
suite.voteOnProposal(v3.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionNo)
passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal)
suite.Falsef(passes, "expected proposal to pass, tally: %v", tally)
@ -190,6 +191,7 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() {
proposal := suite.createProposal()
// no stake
suite.app.DeleteGenesisValidator(suite.T(), suite.ctx)
passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal)
suite.Falsef(passes, "expected proposal to pass, tally: %v", tally)
@ -202,7 +204,7 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() {
v1 := suite.createNewBondedValidator(sdk.NewInt(1e9))
suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.ProposalId, govtypes.OptionAbstain)
suite.voteOnProposal(v1.GetOperator().Bytes(), proposal.Id, govv1beta1.OptionAbstain)
passes, burns, tally := suite.tallier.Tally(suite.ctx, proposal)
suite.Falsef(passes, "expected proposal to pass, tally: %v", tally)
@ -212,37 +214,45 @@ func (suite *tallyHandlerSuite) TestTallyOutcomes() {
}
func (suite *tallyHandlerSuite) setTallyParams(quorum, threshold, veto sdk.Dec) {
suite.app.GetGovKeeper().SetTallyParams(suite.ctx, govtypes.TallyParams{
Quorum: quorum,
Threshold: threshold,
VetoThreshold: veto,
suite.app.GetGovKeeper().SetTallyParams(suite.ctx, govv1.TallyParams{
Quorum: quorum.String(),
Threshold: threshold.String(),
VetoThreshold: veto.String(),
})
}
func (suite *tallyHandlerSuite) voteOnProposal(voter sdk.AccAddress, proposalID uint64, option govtypes.VoteOption) {
func (suite *tallyHandlerSuite) voteOnProposal(
voter sdk.AccAddress,
proposalID uint64,
option govv1beta1.VoteOption,
) {
gk := suite.app.GetGovKeeper()
err := gk.AddVote(suite.ctx,
proposalID,
voter,
govtypes.NewNonSplitVoteOption(option),
govv1.NewNonSplitVoteOption(govv1.VoteOption(option)),
"",
)
suite.Require().NoError(err)
}
func (suite *tallyHandlerSuite) createProposal() govtypes.Proposal {
func (suite *tallyHandlerSuite) createProposal() govv1.Proposal {
gk := suite.app.GetGovKeeper()
deposit := gk.GetDepositParams(suite.ctx).MinDeposit
proposer := suite.createAccount(deposit...)
msg, err := govtypes.NewMsgSubmitProposal(
govtypes.NewTextProposal("a title", "a description"),
msg, err := govv1beta1.NewMsgSubmitProposal(
govv1beta1.NewTextProposal("a title", "a description"),
deposit,
proposer.GetAddress(),
)
suite.Require().NoError(err)
msgServer := govkeeper.NewMsgServerImpl(gk)
msgServerv1 := govkeeper.NewMsgServerImpl(gk)
govAcct := gk.GetGovernanceAccount(suite.ctx).GetAddress()
msgServer := govkeeper.NewLegacyMsgServerImpl(govAcct.String(), msgServerv1)
res, err := msgServer.SubmitProposal(sdk.WrapSDKContext(suite.ctx), msg)
suite.Require().NoError(err)

View File

@ -2,19 +2,24 @@ package app
import (
"encoding/json"
"fmt"
"math/rand"
"testing"
"time"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/testutil/mock"
sdk "github.com/cosmos/cosmos-sdk/types"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
distkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
@ -24,13 +29,14 @@ import (
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
evmkeeper "github.com/evmos/ethermint/x/evm/keeper"
feemarketkeeper "github.com/evmos/ethermint/x/feemarket/keeper"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmtypes "github.com/tendermint/tendermint/types"
tmdb "github.com/tendermint/tm-db"
evmkeeper "github.com/tharsis/ethermint/x/evm/keeper"
feemarketkeeper "github.com/tharsis/ethermint/x/feemarket/keeper"
auctionkeeper "github.com/kava-labs/kava/x/auction/keeper"
bep3keeper "github.com/kava-labs/kava/x/bep3/keeper"
@ -59,8 +65,11 @@ var (
// TestApp is a simple wrapper around an App. It exposes internal keepers for use in integration tests.
// This file also contains test helpers. Ideally they would be in separate package.
// Basic Usage:
//
// Create a test app with NewTestApp, then all keepers and their methods can be accessed for test setup and execution.
//
// Advanced Usage:
//
// Some tests call for an app to be initialized with some state. This can be achieved through keeper method calls (ie keeper.SetParams(...)).
// However this leads to a lot of duplicated logic similar to InitGenesis methods.
// So TestApp.InitializeFromGenesisStates() will call InitGenesis with the default genesis state.
@ -68,6 +77,8 @@ var (
// Creating the genesis states can be combersome, but helper methods can make it easier such as NewAuthGenStateFromAccounts below.
type TestApp struct {
App
GenesisAddrs []sdk.AccAddress
}
// NewTestApp creates a new TestApp
@ -129,6 +140,137 @@ func (app *App) AppCodec() codec.Codec {
return app.appCodec
}
// SetupWithGenesisValSet initializes GenesisState with a single validator and genesis accounts
// that also act as delegators.
func GenesisStateWithSingleValidator(
app *TestApp,
genesisState GenesisState,
) GenesisState {
privVal := mock.NewPV()
pubKey, err := privVal.GetPubKey()
if err != nil {
panic(fmt.Errorf("error getting pubkey: %w", err))
}
// create validator set with single validator
validator := tmtypes.NewValidator(pubKey, 1)
valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator})
// generate genesis account
senderPrivKey := secp256k1.GenPrivKey()
acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0)
app.GenesisAddrs = append(app.GenesisAddrs, acc.GetAddress())
balances := []banktypes.Balance{
{
Address: acc.GetAddress().String(),
Coins: sdk.NewCoins(sdk.NewCoin("ukava", sdk.NewInt(100000000000000))),
},
}
return genesisStateWithValSet(app, genesisState, valSet, []authtypes.GenesisAccount{acc}, balances...)
}
// genesisStateWithValSet applies the provided validator set and genesis accounts
// to the provided genesis state, appending to any existing state without replacement.
func genesisStateWithValSet(
app *TestApp,
genesisState GenesisState,
valSet *tmtypes.ValidatorSet,
genAccs []authtypes.GenesisAccount,
balances ...banktypes.Balance,
) GenesisState {
// set genesis accounts
currentAuthGenesis := authtypes.GetGenesisStateFromAppState(app.appCodec, genesisState)
currentAccs, err := authtypes.UnpackAccounts(currentAuthGenesis.Accounts)
if err != nil {
panic(fmt.Errorf("error unpacking accounts: %w", err))
}
// Add the new accounts to the existing ones
authGenesis := authtypes.NewGenesisState(currentAuthGenesis.Params, append(currentAccs, genAccs...))
validators := make([]stakingtypes.Validator, 0, len(valSet.Validators))
delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators))
bondAmt := sdk.DefaultPowerReduction
for _, val := range valSet.Validators {
pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey)
if err != nil {
panic(fmt.Errorf("error converting validator public key: %w", err))
}
pkAny, err := codectypes.NewAnyWithValue(pk)
if err != nil {
panic(fmt.Errorf("can't pack public key into Any: %w", err))
}
validator := stakingtypes.Validator{
OperatorAddress: sdk.ValAddress(val.Address).String(),
ConsensusPubkey: pkAny,
Jailed: false,
Status: stakingtypes.Bonded,
Tokens: bondAmt,
DelegatorShares: sdk.OneDec(),
Description: stakingtypes.Description{
Moniker: "genesis validator",
},
UnbondingHeight: int64(0),
UnbondingTime: time.Unix(0, 0).UTC(),
Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
MinSelfDelegation: sdk.ZeroInt(),
}
validators = append(validators, validator)
delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), sdk.OneDec()))
}
// set validators and delegations
currentStakingGenesis := stakingtypes.GetGenesisStateFromAppState(app.appCodec, genesisState)
currentStakingGenesis.Params.BondDenom = "ukava"
stakingGenesis := stakingtypes.NewGenesisState(
currentStakingGenesis.Params,
append(currentStakingGenesis.Validators, validators...),
append(currentStakingGenesis.Delegations, delegations...),
)
// Add the new balances to the existing ones
currentBankGenesis := banktypes.GetGenesisStateFromAppState(app.appCodec, genesisState)
balances = append(currentBankGenesis.Balances, balances...)
totalSupply := sdk.NewCoins()
for _, b := range balances {
// add genesis acc tokens to total supply
totalSupply = totalSupply.Add(b.Coins...)
}
for range delegations {
// add delegated tokens to total supply
totalSupply = totalSupply.Add(sdk.NewCoin("ukava", bondAmt))
}
// add bonded amount to bonded pool module account
balances = append(balances, banktypes.Balance{
Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(),
Coins: sdk.Coins{sdk.NewCoin("ukava", bondAmt)},
})
bankGenesis := banktypes.NewGenesisState(
currentBankGenesis.Params,
balances,
totalSupply,
currentBankGenesis.DenomMetadata,
)
// set genesis state
genesisState[authtypes.ModuleName] = app.appCodec.MustMarshalJSON(authGenesis)
genesisState[banktypes.ModuleName] = app.appCodec.MustMarshalJSON(bankGenesis)
genesisState[stakingtypes.ModuleName] = app.appCodec.MustMarshalJSON(stakingGenesis)
return genesisState
}
// InitializeFromGenesisStates calls InitChain on the app using the provided genesis states.
// If any module genesis states are missing, defaults are used.
func (tApp TestApp) InitializeFromGenesisStates(genesisStates ...GenesisState) TestApp {
@ -149,15 +291,37 @@ func (tApp TestApp) InitializeFromGenesisStatesWithTimeAndChainID(genTime time.T
// InitializeFromGenesisStatesWithTimeAndChainIDAndHeight calls InitChain on the app using the provided genesis states and other parameters.
// If any module genesis states are missing, defaults are used.
func (tApp TestApp) InitializeFromGenesisStatesWithTimeAndChainIDAndHeight(genTime time.Time, chainID string, initialHeight int64, genesisStates ...GenesisState) TestApp {
func (tApp TestApp) InitializeFromGenesisStatesWithTimeAndChainIDAndHeight(
genTime time.Time,
chainID string,
initialHeight int64,
genesisStates ...GenesisState,
) TestApp {
// Create a default genesis state and overwrite with provided values
genesisState := NewDefaultGenesisState()
modifiedStates := make(map[string]bool)
for _, state := range genesisStates {
for k, v := range state {
genesisState[k] = v
// Ensure that the same module genesis state is not set more than once.
// Multiple GenesisStates can have the same module genesis state, but
// the same module genesis state will be overwritten.
if previouslyModified := modifiedStates[k]; previouslyModified {
panic(fmt.Sprintf("genesis state for module %s was set more than once, this overrides previous state", k))
}
modifiedStates[k] = true
}
}
// Add default genesis states for at least 1 validator
genesisState = GenesisStateWithSingleValidator(
&tApp,
genesisState,
)
// Initialize the chain
stateBytes, err := json.Marshal(genesisState)
if err != nil {
@ -185,9 +349,57 @@ func (tApp TestApp) InitializeFromGenesisStatesWithTimeAndChainIDAndHeight(genTi
Height: tApp.LastBlockHeight() + 1, Time: genTime, ChainID: chainID,
},
})
return tApp
}
// DeleteGenesisValidator deletes the genesis validator from the staking module.
// This is useful for testing with validators, but only want to consider the
// validators added in the test. InitGenesis requires at least 1 validator, so
// it must be deleted additional validators are created.
func (tApp TestApp) DeleteGenesisValidator(t *testing.T, ctx sdk.Context) {
sk := tApp.GetStakingKeeper()
vals := sk.GetAllValidators(ctx)
var genVal stakingtypes.Validator
found := false
for _, val := range vals {
if val.GetMoniker() == "genesis validator" {
genVal = val
found = true
break
}
}
require.True(t, found, "genesis validator not found")
delegations := sk.GetValidatorDelegations(ctx, genVal.GetOperator())
for _, delegation := range delegations {
_, err := sk.Undelegate(ctx, delegation.GetDelegatorAddr(), genVal.GetOperator(), delegation.Shares)
require.NoError(t, err)
}
}
func (tApp TestApp) DeleteGenesisValidatorCoins(t *testing.T, ctx sdk.Context) {
ak := tApp.GetAccountKeeper()
bk := tApp.GetBankKeeper()
notBondedAcc := ak.GetModuleAccount(ctx, stakingtypes.NotBondedPoolName)
// Burn genesis account balance - use staking module to burn
genAccBal := bk.GetAllBalances(ctx, tApp.GenesisAddrs[0])
err := bk.SendCoinsFromAccountToModule(ctx, tApp.GenesisAddrs[0], stakingtypes.NotBondedPoolName, genAccBal)
require.NoError(t, err)
// Burn coins from the module account
err = bk.BurnCoins(
ctx,
stakingtypes.NotBondedPoolName,
bk.GetAllBalances(ctx, notBondedAcc.GetAddress()),
)
require.NoError(t, err)
}
// CheckBalance requires the account address has the expected amount of coins.
func (tApp TestApp) CheckBalance(t *testing.T, ctx sdk.Context, owner sdk.AccAddress, expectedCoins sdk.Coins) {
coins := tApp.GetBankKeeper().GetAllBalances(ctx, owner)
@ -244,6 +456,20 @@ func (tApp TestApp) CreateNewUnbondedValidator(ctx sdk.Context, valAddress sdk.V
return err
}
func (tApp TestApp) SetInflation(ctx sdk.Context, value sdk.Dec) {
mk := tApp.GetMintKeeper()
mintParams := mk.GetParams(ctx)
mintParams.InflationMax = sdk.ZeroDec()
mintParams.InflationMin = sdk.ZeroDec()
if err := mintParams.Validate(); err != nil {
panic(err)
}
mk.SetParams(ctx, mintParams)
}
// GeneratePrivKeyAddressPairsFromRand generates (deterministically) a total of n private keys and addresses.
func GeneratePrivKeyAddressPairs(n int) (keys []cryptotypes.PrivKey, addrs []sdk.AccAddress) {
r := rand.New(rand.NewSource(12345)) // make the generation deterministic

View File

@ -17,8 +17,8 @@ GOGO_PATH := $(shell go list -m -f '{{.Dir}}' github.com/gogo/protobuf)
TENDERMINT_PATH := $(shell go list -m -f '{{.Dir}}' github.com/tendermint/tendermint)
COSMOS_PROTO_PATH := $(shell go list -m -f '{{.Dir}}' github.com/cosmos/cosmos-proto)
COSMOS_SDK_PATH := $(shell go list -m -f '{{.Dir}}' github.com/cosmos/cosmos-sdk)
IBC_GO_PATH := $(shell go list -m -f '{{.Dir}}' github.com/cosmos/ibc-go/v3)
ETHERMINT_PATH := $(shell go list -m -f '{{.Dir}}' github.com/tharsis/ethermint)
IBC_GO_PATH := $(shell go list -m -f '{{.Dir}}' github.com/cosmos/ibc-go/v6)
ETHERMINT_PATH := $(shell go list -m -f '{{.Dir}}' github.com/evmos/ethermint)
#
# Common target directories

View File

@ -1218,7 +1218,9 @@
"berlin_block": "0",
"london_block": null,
"arrow_glacier_block": null,
"merge_fork_block": null
"merge_netsplit_block": null,
"shanghai_block": null,
"cancun_block": null
},
"eip712_allowed_msgs": [
{
@ -1752,7 +1754,9 @@
"base_fee_change_denominator": 8,
"elasticity_multiplier": 2,
"enable_height": "0",
"base_fee": "1000000000"
"base_fee": "1000000000",
"min_gas_price": "0.000000000000000000",
"min_gas_multiplier": "0.500000000000000000"
},
"block_gas": "0"
},
@ -3212,7 +3216,8 @@
"max_validators": 100,
"max_entries": 7,
"historical_entries": 10000,
"bond_denom": "ukava"
"bond_denom": "ukava",
"min_commission_rate": "0"
},
"last_total_power": "0",
"last_validator_powers": [],

View File

@ -1,7 +1,7 @@
{
"swagger": "2.0",
"info": {
"title": "Kava - Legacy REST and gRPC Gateway docs",
"title": "Kava - gRPC Gateway docs",
"description": "A REST interface for state queries",
"version": "1.0.0"
},
@ -267,12 +267,6 @@
}
]
}
},
{
"url": "./client/docs/legacy-swagger.yml",
"dereference": {
"circular": "ignore"
}
}
]
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -11,9 +11,9 @@ import (
"github.com/tendermint/tendermint/libs/cli"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
ethclient "github.com/tharsis/ethermint/client"
clientkeys "github.com/tharsis/ethermint/client/keys"
"github.com/tharsis/ethermint/crypto/hd"
ethclient "github.com/evmos/ethermint/client"
clientkeys "github.com/evmos/ethermint/client/keys"
"github.com/evmos/ethermint/crypto/hd"
)
var ethFlag = "eth"
@ -88,7 +88,14 @@ func runAddCmd(cmd *cobra.Command, args []string) error {
dryRun, _ := cmd.Flags().GetBool(flags.FlagDryRun)
if dryRun {
kr, err = keyring.New(sdk.KeyringServiceName(), keyring.BackendMemory, clientCtx.KeyringDir, buf, hd.EthSecp256k1Option())
kr, err = keyring.New(
sdk.KeyringServiceName(),
keyring.BackendMemory,
clientCtx.KeyringDir,
buf,
clientCtx.Codec,
hd.EthSecp256k1Option(),
)
clientCtx = clientCtx.WithKeyring(kr)
}
eth, _ := cmd.Flags().GetBool(ethFlag)

View File

@ -12,14 +12,15 @@ import (
"github.com/cosmos/cosmos-sdk/server"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/snapshots"
snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
ethermintflags "github.com/evmos/ethermint/server/flags"
"github.com/spf13/cast"
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/libs/log"
db "github.com/tendermint/tm-db"
ethermintflags "github.com/tharsis/ethermint/server/flags"
"github.com/kava-labs/kava/app"
"github.com/kava-labs/kava/app/params"
@ -77,11 +78,16 @@ func (ac appCreator) newApp(
panic(fmt.Sprintf("could not get authorized address from config: %v", err))
}
iavlDisableFastNode := appOpts.Get(server.FlagIAVLFastNode)
iavlDisableFastNode := appOpts.Get(server.FlagDisableIAVLFastNode)
if iavlDisableFastNode == nil {
iavlDisableFastNode = true
}
snapshotOptions := snapshottypes.NewSnapshotOptions(
cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)),
cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)),
)
return app.NewApp(
logger, db, homeDir, traceStore, ac.encodingConfig,
app.Options{
@ -102,11 +108,10 @@ func (ac appCreator) newApp(
baseapp.SetInterBlockCache(cache),
baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))),
baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))),
baseapp.SetSnapshotStore(snapshotStore),
baseapp.SetSnapshotInterval(cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval))),
baseapp.SetSnapshotKeepRecent(cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent))),
baseapp.SetSnapshot(snapshotStore, snapshotOptions),
baseapp.SetIAVLCacheSize(cast.ToInt(appOpts.Get(server.FlagIAVLCacheSize))),
baseapp.SetIAVLDisableFastNode(cast.ToBool(iavlDisableFastNode)),
baseapp.SetIAVLLazyLoading(cast.ToBool(appOpts.Get(server.FlagIAVLLazyLoading))),
)
}

View File

@ -1,4 +1,4 @@
// Sourced from https://github.com/tharsis/ethermint/blob/main/cmd/ethermintd/genaccounts.go
// Sourced from https://github.com/evmos/ethermint/blob/main/cmd/ethermintd/genaccounts.go
package cmd
import (
@ -20,7 +20,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/tharsis/ethermint/crypto/hd"
"github.com/evmos/ethermint/crypto/hd"
)
const (
@ -61,6 +61,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
keyringBackend,
clientCtx.HomeDir,
inBuf,
clientCtx.Codec,
hd.EthSecp256k1Option(),
)
if err != nil {
@ -75,7 +76,10 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
return fmt.Errorf("failed to get address from Keyring: %w", err)
}
addr = info.GetAddress()
addr, err = info.GetAddress()
if err != nil {
return fmt.Errorf("failed to get address from Keyring: %w", err)
}
}
coins, err := sdk.ParseCoinsNormalized(args[1])

View File

@ -12,12 +12,13 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
ethermintclient "github.com/evmos/ethermint/client"
"github.com/evmos/ethermint/crypto/hd"
ethermintserver "github.com/evmos/ethermint/server"
servercfg "github.com/evmos/ethermint/server/config"
"github.com/spf13/cobra"
tmcfg "github.com/tendermint/tendermint/config"
tmcli "github.com/tendermint/tendermint/libs/cli"
ethermintclient "github.com/tharsis/ethermint/client"
"github.com/tharsis/ethermint/crypto/hd"
ethermintserver "github.com/tharsis/ethermint/server"
servercfg "github.com/tharsis/ethermint/server/config"
"github.com/kava-labs/kava/app"
"github.com/kava-labs/kava/app/params"
@ -69,7 +70,12 @@ func NewRootCmd() *cobra.Command {
customAppTemplate, customAppConfig := servercfg.AppConfig("ukava")
return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig)
return server.InterceptConfigsPreRunHandler(
cmd,
customAppTemplate,
customAppConfig,
tmcfg.DefaultConfig(),
)
},
}
@ -81,6 +87,7 @@ func NewRootCmd() *cobra.Command {
// addSubCmds registers all the sub commands used by kava.
func addSubCmds(rootCmd *cobra.Command, encodingConfig params.EncodingConfig, defaultNodeHome string) {
rootCmd.AddCommand(
StatusCommand(),
ethermintclient.ValidateChainID(
genutilcli.InitCmd(app.ModuleBasics, defaultNodeHome),
),
@ -101,11 +108,18 @@ func addSubCmds(rootCmd *cobra.Command, encodingConfig params.EncodingConfig, de
}
// ethermintserver adds additional flags to start the JSON-RPC server for evm support
ethermintserver.AddCommands(rootCmd, defaultNodeHome, ac.newApp, ac.appExport, ac.addStartCmdFlags)
ethermintserver.AddCommands(
rootCmd,
ethermintserver.NewDefaultStartOptions(
ac.newApp,
app.DefaultNodeHome,
),
ac.appExport,
ac.addStartCmdFlags,
)
// add keybase, auxiliary RPC, query, and tx child commands
rootCmd.AddCommand(
StatusCommand(),
newQueryCmd(),
newTxCmd(),
kavaclient.KeyCommands(app.DefaultNodeHome),

View File

@ -2,20 +2,17 @@ package cmd
import (
"context"
"net/http"
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/libs/bytes"
"github.com/tendermint/tendermint/p2p"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
coretypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/types/rest"
"github.com/cosmos/cosmos-sdk/version"
)
// ValidatorInfo is info about the node's validator, same as Tendermint,
@ -30,7 +27,7 @@ type validatorInfo struct {
// PubKey.
type resultStatus struct {
NodeInfo p2p.DefaultNodeInfo `json:"node_info"`
SyncInfo ctypes.SyncInfo `json:"sync_info"`
SyncInfo coretypes.SyncInfo `json:"sync_info"`
ValidatorInfo validatorInfo `json:"validator_info"`
}
@ -80,53 +77,11 @@ func StatusCommand() *cobra.Command {
return cmd
}
func getNodeStatus(clientCtx client.Context) (*ctypes.ResultStatus, error) {
func getNodeStatus(clientCtx client.Context) (*coretypes.ResultStatus, error) {
node, err := clientCtx.GetNode()
if err != nil {
return &ctypes.ResultStatus{}, err
return &coretypes.ResultStatus{}, err
}
return node.Status(context.Background())
}
// NodeInfoResponse defines a response type that contains node status and version
// information.
type NodeInfoResponse struct {
p2p.DefaultNodeInfo `json:"node_info"`
ApplicationVersion version.Info `json:"application_version"`
}
// REST handler for node info
func NodeInfoRequestHandlerFn(clientCtx client.Context) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
status, err := getNodeStatus(clientCtx)
if rest.CheckInternalServerError(w, err) {
return
}
resp := NodeInfoResponse{
DefaultNodeInfo: status.NodeInfo,
ApplicationVersion: version.NewInfo(),
}
rest.PostProcessResponseBare(w, clientCtx, resp)
}
}
// SyncingResponse defines a response type that contains node syncing information.
type SyncingResponse struct {
Syncing bool `json:"syncing"`
}
// REST handler for node syncing
func NodeSyncingRequestHandlerFn(clientCtx client.Context) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
status, err := getNodeStatus(clientCtx)
if rest.CheckInternalServerError(w, err) {
return
}
rest.PostProcessResponseBare(w, clientCtx, SyncingResponse{Syncing: status.SyncInfo.CatchingUp})
}
}

View File

@ -87,7 +87,10 @@ jq '.app_state.feemarket.params.no_base_fee = true' $DATA/config/genesis.json|sp
# Disable london fork
jq '.app_state.evm.params.chain_config.london_block = null' $DATA/config/genesis.json|sponge $DATA/config/genesis.json
jq '.app_state.evm.params.chain_config.arrow_glacier_block = null' $DATA/config/genesis.json|sponge $DATA/config/genesis.json
jq '.app_state.evm.params.chain_config.merge_fork_block = null' $DATA/config/genesis.json|sponge $DATA/config/genesis.json
jq '.app_state.evm.params.chain_config.gray_glacier_block = null' $DATA/config/genesis.json|sponge $DATA/config/genesis.json
jq '.app_state.evm.params.chain_config.merge_netsplit_block = null' $DATA/config/genesis.json|sponge $DATA/config/genesis.json
jq '.app_state.evm.params.chain_config.shanghai_block = null' $DATA/config/genesis.json|sponge $DATA/config/genesis.json
jq '.app_state.evm.params.chain_config.cancun_block = null' $DATA/config/genesis.json|sponge $DATA/config/genesis.json
# Add earn vault
jq '.app_state.earn.params.allowed_vaults = [

178
go.mod
View File

@ -1,111 +1,145 @@
module github.com/kava-labs/kava
go 1.18
go 1.19
require (
cosmossdk.io/math v1.0.0-beta.6.0.20230216172121-959ce49135e4
github.com/cenkalti/backoff/v4 v4.1.3
github.com/cosmos/cosmos-proto v1.0.0-alpha6
github.com/cosmos/cosmos-sdk v0.45.10
github.com/cosmos/cosmos-proto v1.0.0-beta.1
github.com/cosmos/cosmos-sdk v0.46.11
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/ibc-go/v3 v3.4.0
github.com/ethereum/go-ethereum v1.10.16
github.com/cosmos/ibc-go/v6 v6.1.0
github.com/ethereum/go-ethereum v1.10.26
github.com/evmos/ethermint v0.21.0
github.com/gogo/protobuf v1.3.3
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.2
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/spf13/cast v1.5.0
github.com/spf13/cobra v1.6.0
github.com/stretchr/testify v1.8.0
github.com/spf13/cobra v1.6.1
github.com/stretchr/testify v1.8.1
github.com/subosito/gotenv v1.4.1
github.com/tendermint/tendermint v0.34.24
github.com/tendermint/tendermint v0.34.27
github.com/tendermint/tm-db v0.6.7
github.com/tharsis/ethermint v0.14.0
google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a
google.golang.org/grpc v1.50.1
google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8
google.golang.org/genproto v0.0.0-20230202175211-008b39050e57
google.golang.org/grpc v1.53.0
google.golang.org/protobuf v1.28.2-0.20230208135220-49eaa78c6c9c
sigs.k8s.io/yaml v1.3.0
)
require (
filippo.io/edwards25519 v1.0.0-beta.2 // indirect
github.com/99designs/keyring v1.1.6 // indirect
cloud.google.com/go v0.107.0 // indirect
cloud.google.com/go/compute v1.15.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v0.8.0 // indirect
cloud.google.com/go/storage v1.27.0 // indirect
cosmossdk.io/errors v1.0.0-beta.7 // indirect
filippo.io/edwards25519 v1.0.0-rc.1 // indirect
github.com/99designs/keyring v1.2.1 // indirect
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
github.com/Workiva/go-datastructures v1.0.53 // indirect
github.com/allegro/bigcache v1.2.1 // indirect
github.com/armon/go-metrics v0.4.0 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/aws/aws-sdk-go v1.40.45 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/btcsuite/btcd v0.22.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/coinbase/rosetta-sdk-go v0.7.0 // indirect
github.com/confio/ics23/go v0.7.0 // indirect
github.com/cosmos/btcutil v1.0.4 // indirect
github.com/cosmos/iavl v0.19.4 // indirect
github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect
github.com/cosmos/ledger-go v0.9.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
github.com/cockroachdb/apd/v2 v2.0.2 // indirect
github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect
github.com/cometbft/cometbft-db v0.7.0 // indirect
github.com/confio/ics23/go v0.9.0 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/gogoproto v1.4.6 // indirect
github.com/cosmos/iavl v0.19.5 // indirect
github.com/cosmos/ledger-cosmos-go v0.12.2 // indirect
github.com/creachadair/taskgroup v0.3.2 // indirect
github.com/danieljoos/wincred v1.0.2 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
github.com/dgraph-io/badger/v3 v3.2103.2 // indirect
github.com/dgraph-io/ristretto v0.1.0 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect
github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/edsrzf/mmap-go v1.0.0 // indirect
github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
github.com/gin-gonic/gin v1.8.1 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-playground/validator/v10 v10.11.1 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gogo/gateway v1.1.0 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/glog v1.0.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/flatbuffers v1.12.1 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/gtank/merlin v0.1.1 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter v1.6.1 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 // indirect
github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.2.0 // indirect
github.com/huin/goupnp v1.0.2 // indirect
github.com/holiman/uint256 v1.2.1 // indirect
github.com/huin/goupnp v1.0.3 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect
github.com/klauspost/compress v1.15.11 // indirect
github.com/lib/pq v1.10.6 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/linxGnu/grocksdb v1.7.1 // indirect
github.com/linxGnu/grocksdb v1.7.14 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
@ -113,45 +147,53 @@ require (
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.12.2 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.34.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.40.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/prometheus/tsdb v0.7.1 // indirect
github.com/rakyll/statik v0.1.7 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/regen-network/cosmos-proto v0.3.1 // indirect
github.com/rjeczalik/notify v0.9.1 // indirect
github.com/rs/cors v1.8.2 // indirect
github.com/rs/zerolog v1.27.0 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/rs/cors v1.8.3 // indirect
github.com/rs/zerolog v1.29.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.13.0 // indirect
github.com/spf13/viper v1.14.0 // indirect
github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969 // indirect
github.com/stretchr/objx v0.4.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/tendermint/btcd v0.1.1 // indirect
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tklauser/go-sysconf v0.3.7 // indirect
github.com/tklauser/numcpus v0.2.3 // indirect
github.com/tidwall/btree v1.5.0 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
github.com/zondax/hid v0.9.0 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
github.com/ulikunitz/xz v0.5.8 // indirect
github.com/zondax/hid v0.9.1 // indirect
github.com/zondax/ledger-go v0.14.1 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/net v0.1.0 // indirect
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/term v0.1.0 // indirect
golang.org/x/text v0.4.0 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.6.0 // indirect
golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/oauth2 v0.4.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.103.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
nhooyr.io/websocket v1.8.6 // indirect
@ -163,15 +205,17 @@ replace (
// Required replace for dragonberry security patch
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
// Use cosmos-sdk fork with backported fix for unsafe-reset-all, staking transfer events, and custom tally handler support
github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.45.9-kava.4
github.com/cosmos/cosmos-sdk => github.com/kava-labs/cosmos-sdk v0.46.11-kava.1
// Use ethermint fork that respects min-gas-price with NoBaseFee true and london enabled, and includes eip712 support
github.com/evmos/ethermint => github.com/kava-labs/ethermint v0.21.0-kava-v22
// See https://github.com/cosmos/cosmos-sdk/pull/10401, https://github.com/cosmos/cosmos-sdk/commit/0592ba6158cd0bf49d894be1cef4faeec59e8320
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0
// Use the cosmos modified protobufs
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
// Downgraded to avoid bugs in following commits which causes "version does not exist" errors
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
// Use cometbft fork of tendermint
github.com/tendermint/tendermint => github.com/cometbft/cometbft v0.34.27
// Use rocksdb 7.1.2
github.com/tendermint/tm-db => github.com/kava-labs/tm-db v0.6.7-kava.1
// Use ethermint fork that respects min-gas-price with NoBaseFee true and london enabled, and includes eip712 support
github.com/tharsis/ethermint => github.com/kava-labs/ethermint v0.14.0-kava-v20.1
// Make sure that we use grpc compatible with cosmos
google.golang.org/grpc => google.golang.org/grpc v1.33.2
)

538
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,7 @@ func ResetPeriodicVestingAccount(vacc *v040vesting.PeriodicVestingAccount, start
delegationAdjustment := delegatedVestingCoin.Sub(newDelegatedVestingCoin)
if !delegationAdjustment.IsZero() {
vacc.DelegatedVesting = vacc.DelegatedVesting.Sub(sdk.NewCoins(delegationAdjustment))
vacc.DelegatedVesting = vacc.DelegatedVesting.Sub(delegationAdjustment)
vacc.DelegatedFree = vacc.DelegatedFree.Add(delegationAdjustment)
}
}

View File

@ -12,10 +12,10 @@ import (
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
ibctypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"
ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"
ibctypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"
ibcclienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
ethtypes "github.com/ethereum/go-ethereum/core/types"
emtypes "github.com/tharsis/ethermint/types"
emtypes "github.com/evmos/ethermint/types"
"github.com/kava-labs/kava/app"
"github.com/kava-labs/kava/tests/e2e/testutil"
@ -135,6 +135,7 @@ func (suite *IntegrationTestSuite) TestIbcTransfer() {
ibcAcc.SdkAddress.String(),
ibcclienttypes.NewHeight(0, 0), // timeout height disabled when 0
uint64(time.Now().Add(30*time.Second).UnixNano()),
"",
)
// initial - sent - fee
expectedSrcBalance := funds.Sub(fundsToSend).Sub(fee)

View File

@ -15,9 +15,9 @@ import (
"github.com/ethereum/go-ethereum/common"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/evmos/ethermint/crypto/ethsecp256k1"
emtypes "github.com/evmos/ethermint/types"
"github.com/stretchr/testify/require"
"github.com/tharsis/ethermint/crypto/ethsecp256k1"
emtypes "github.com/tharsis/ethermint/types"
"github.com/kava-labs/kava/app"
"github.com/kava-labs/kava/tests/util"

View File

@ -0,0 +1,13 @@
syntax = "proto3";
package cosmos.app.module.v1alpha1;
import "cosmos/app/v1alpha1/module.proto";
// Module is the module config object for the cosmos.app v1 app module.
message Module {
option (cosmos.app.v1alpha1.module) = {
go_import: "github.com/cosmos/cosmos-sdk/app"
use_package: {name: "cosmos.app.v1alpha1"}
};
}

View File

@ -0,0 +1,36 @@
syntax = "proto3";
package cosmos.app.v1alpha1;
import "google/protobuf/any.proto";
// Config represents the configuration for a Cosmos SDK ABCI app.
// It is intended that all state machine logic including the version of
// baseapp and tx handlers (and possibly even Tendermint) that an app needs
// can be described in a config object. For compatibility, the framework should
// allow a mixture of declarative and imperative app wiring, however, apps
// that strive for the maximum ease of maintainability should be able to describe
// their state machine with a config object alone.
message Config {
// modules are the module configurations for the app.
repeated ModuleConfig modules = 1;
}
// ModuleConfig is a module configuration for an app.
message ModuleConfig {
// name is the unique name of the module within the app. It should be a name
// that persists between different versions of a module so that modules
// can be smoothly upgraded to new versions.
//
// For example, for the module cosmos.bank.module.v1.Module, we may chose
// to simply name the module "bank" in the app. When we upgrade to
// cosmos.bank.module.v2.Module, the app-specific name "bank" stays the same
// and the framework knows that the v2 module should receive all the same state
// that the v1 module had. Note: modules should provide info on which versions
// they can migrate from in the ModuleDescriptor.can_migration_from field.
string name = 1;
// config is the config object for the module. Module config messages should
// define a ModuleDescriptor using the cosmos.app.v1alpha1.is_module extension.
google.protobuf.Any config = 2;
}

View File

@ -0,0 +1,91 @@
syntax = "proto3";
package cosmos.app.v1alpha1;
import "google/protobuf/descriptor.proto";
extend google.protobuf.MessageOptions {
// module indicates that this proto type is a config object for an app module
// and optionally provides other descriptive information about the module.
// It is recommended that a new module config object and go module is versioned
// for every state machine breaking version of a module. The recommended
// pattern for doing this is to put module config objects in a separate proto
// package from the API they expose. Ex: the cosmos.group.v1 API would be
// exposed by module configs cosmos.group.module.v1, cosmos.group.module.v2, etc.
ModuleDescriptor module = 57193479;
}
// ModuleDescriptor describes an app module.
message ModuleDescriptor {
// go_import names the package that should be imported by an app to load the
// module in the runtime module registry. It is required to make debugging
// of configuration errors easier for users.
string go_import = 1;
// use_package refers to a protobuf package that this module
// uses and exposes to the world. In an app, only one module should "use"
// or own a single protobuf package. It is assumed that the module uses
// all of the .proto files in a single package.
repeated PackageReference use_package = 2;
// can_migrate_from defines which module versions this module can migrate
// state from. The framework will check that one module version is able to
// migrate from a previous module version before attempting to update its
// config. It is assumed that modules can transitively migrate from earlier
// versions. For instance if v3 declares it can migrate from v2, and v2
// declares it can migrate from v1, the framework knows how to migrate
// from v1 to v3, assuming all 3 module versions are registered at runtime.
repeated MigrateFromInfo can_migrate_from = 3;
}
// PackageReference is a reference to a protobuf package used by a module.
message PackageReference {
// name is the fully-qualified name of the package.
string name = 1;
// revision is the optional revision of the package that is being used.
// Protobuf packages used in Cosmos should generally have a major version
// as the last part of the package name, ex. foo.bar.baz.v1.
// The revision of a package can be thought of as the minor version of a
// package which has additional backwards compatible definitions that weren't
// present in a previous version.
//
// A package should indicate its revision with a source code comment
// above the package declaration in one of its files containing the
// text "Revision N" where N is an integer revision. All packages start
// at revision 0 the first time they are released in a module.
//
// When a new version of a module is released and items are added to existing
// .proto files, these definitions should contain comments of the form
// "Since Revision N" where N is an integer revision.
//
// When the module runtime starts up, it will check the pinned proto
// image and panic if there are runtime protobuf definitions that are not
// in the pinned descriptor which do not have
// a "Since Revision N" comment or have a "Since Revision N" comment where
// N is <= to the revision specified here. This indicates that the protobuf
// files have been updated, but the pinned file descriptor hasn't.
//
// If there are items in the pinned file descriptor with a revision
// greater than the value indicated here, this will also cause a panic
// as it may mean that the pinned descriptor for a legacy module has been
// improperly updated or that there is some other versioning discrepancy.
// Runtime protobuf definitions will also be checked for compatibility
// with pinned file descriptors to make sure there are no incompatible changes.
//
// This behavior ensures that:
// * pinned proto images are up-to-date
// * protobuf files are carefully annotated with revision comments which
// are important good client UX
// * protobuf files are changed in backwards and forwards compatible ways
uint32 revision = 2;
}
// MigrateFromInfo is information on a module version that a newer module
// can migrate from.
message MigrateFromInfo {
// module is the fully-qualified protobuf name of the module config object
// for the previous module version, ex: "cosmos.group.module.v1.Module".
string module = 1;
}

View File

@ -0,0 +1,22 @@
syntax = "proto3";
package cosmos.app.v1alpha1;
import "cosmos/app/v1alpha1/config.proto";
// Query is the app module query service.
service Query {
// Config returns the current app config.
rpc Config(QueryConfigRequest) returns (QueryConfigResponse) {}
}
// QueryConfigRequest is the Query/Config request type.
message QueryConfigRequest {}
// QueryConfigRequest is the Query/Config response type.
message QueryConfigResponse {
// config is the current app config.
Config config = 1;
}

View File

@ -17,10 +17,9 @@ message BaseAccount {
option (cosmos_proto.implements_interface) = "AccountI";
string address = 1;
google.protobuf.Any pub_key = 2
[(gogoproto.jsontag) = "public_key,omitempty", (gogoproto.moretags) = "yaml:\"public_key\""];
uint64 account_number = 3 [(gogoproto.moretags) = "yaml:\"account_number\""];
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
google.protobuf.Any pub_key = 2 [(gogoproto.jsontag) = "public_key,omitempty"];
uint64 account_number = 3;
uint64 sequence = 4;
}
@ -30,7 +29,7 @@ message ModuleAccount {
option (gogoproto.goproto_stringer) = false;
option (cosmos_proto.implements_interface) = "ModuleAccountI";
BaseAccount base_account = 1 [(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"base_account\""];
BaseAccount base_account = 1 [(gogoproto.embed) = true];
string name = 2;
repeated string permissions = 3;
}
@ -40,11 +39,9 @@ message Params {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = false;
uint64 max_memo_characters = 1 [(gogoproto.moretags) = "yaml:\"max_memo_characters\""];
uint64 tx_sig_limit = 2 [(gogoproto.moretags) = "yaml:\"tx_sig_limit\""];
uint64 tx_size_cost_per_byte = 3 [(gogoproto.moretags) = "yaml:\"tx_size_cost_per_byte\""];
uint64 sig_verify_cost_ed25519 = 4
[(gogoproto.customname) = "SigVerifyCostED25519", (gogoproto.moretags) = "yaml:\"sig_verify_cost_ed25519\""];
uint64 sig_verify_cost_secp256k1 = 5
[(gogoproto.customname) = "SigVerifyCostSecp256k1", (gogoproto.moretags) = "yaml:\"sig_verify_cost_secp256k1\""];
uint64 max_memo_characters = 1;
uint64 tx_sig_limit = 2;
uint64 tx_size_cost_per_byte = 3;
uint64 sig_verify_cost_ed25519 = 4 [(gogoproto.customname) = "SigVerifyCostED25519"];
uint64 sig_verify_cost_secp256k1 = 5 [(gogoproto.customname) = "SigVerifyCostSecp256k1"];
}

View File

@ -24,10 +24,50 @@ service Query {
option (google.api.http).get = "/cosmos/auth/v1beta1/accounts/{address}";
}
// AccountAddressByID returns account address based on account number.
//
// Since: cosmos-sdk 0.46.2
rpc AccountAddressByID(QueryAccountAddressByIDRequest) returns (QueryAccountAddressByIDResponse) {
option (google.api.http).get = "/cosmos/auth/v1beta1/address_by_id/{id}";
}
// Params queries all parameters.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/cosmos/auth/v1beta1/params";
}
// ModuleAccounts returns all the existing module accounts.
//
// Since: cosmos-sdk 0.46
rpc ModuleAccounts(QueryModuleAccountsRequest) returns (QueryModuleAccountsResponse) {
option (google.api.http).get = "/cosmos/auth/v1beta1/module_accounts";
}
// ModuleAccountByName returns the module account info by module name
rpc ModuleAccountByName(QueryModuleAccountByNameRequest) returns (QueryModuleAccountByNameResponse) {
option (google.api.http).get = "/cosmos/auth/v1beta1/module_accounts/{name}";
}
// Bech32Prefix queries bech32Prefix
//
// Since: cosmos-sdk 0.46
rpc Bech32Prefix(Bech32PrefixRequest) returns (Bech32PrefixResponse) {
option (google.api.http).get = "/cosmos/auth/v1beta1/bech32";
}
// AddressBytesToString converts Account Address bytes to string
//
// Since: cosmos-sdk 0.46
rpc AddressBytesToString(AddressBytesToStringRequest) returns (AddressBytesToStringResponse) {
option (google.api.http).get = "/cosmos/auth/v1beta1/bech32/{address_bytes}";
}
// AddressStringToBytes converts Address string to bytes
//
// Since: cosmos-sdk 0.46
rpc AddressStringToBytes(AddressStringToBytesRequest) returns (AddressStringToBytesResponse) {
option (google.api.http).get = "/cosmos/auth/v1beta1/bech32/{address_string}";
}
}
// QueryAccountsRequest is the request type for the Query/Accounts RPC method.
@ -55,7 +95,7 @@ message QueryAccountRequest {
option (gogoproto.goproto_getters) = false;
// address defines the address to query for.
string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// QueryAccountResponse is the response type for the Query/Account RPC method.
@ -72,3 +112,82 @@ message QueryParamsResponse {
// params defines the parameters of the module.
Params params = 1 [(gogoproto.nullable) = false];
}
// QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method.
//
// Since: cosmos-sdk 0.46
message QueryModuleAccountsRequest {}
// QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method.
//
// Since: cosmos-sdk 0.46
message QueryModuleAccountsResponse {
repeated google.protobuf.Any accounts = 1 [(cosmos_proto.accepts_interface) = "ModuleAccountI"];
}
// QueryModuleAccountByNameRequest is the request type for the Query/ModuleAccountByName RPC method.
message QueryModuleAccountByNameRequest {
string name = 1;
}
// QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method.
message QueryModuleAccountByNameResponse {
google.protobuf.Any account = 1 [(cosmos_proto.accepts_interface) = "ModuleAccountI"];
}
// Bech32PrefixRequest is the request type for Bech32Prefix rpc method.
//
// Since: cosmos-sdk 0.46
message Bech32PrefixRequest {}
// Bech32PrefixResponse is the response type for Bech32Prefix rpc method.
//
// Since: cosmos-sdk 0.46
message Bech32PrefixResponse {
string bech32_prefix = 1;
}
// AddressBytesToStringRequest is the request type for AddressString rpc method.
//
// Since: cosmos-sdk 0.46
message AddressBytesToStringRequest {
bytes address_bytes = 1;
}
// AddressBytesToStringResponse is the response type for AddressString rpc method.
//
// Since: cosmos-sdk 0.46
message AddressBytesToStringResponse {
string address_string = 1;
}
// AddressStringToBytesRequest is the request type for AccountBytes rpc method.
//
// Since: cosmos-sdk 0.46
message AddressStringToBytesRequest {
string address_string = 1;
}
// AddressStringToBytesResponse is the response type for AddressBytes rpc method.
//
// Since: cosmos-sdk 0.46
message AddressStringToBytesResponse {
bytes address_bytes = 1;
}
// QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method
//
// Since: cosmos-sdk 0.46.2
message QueryAccountAddressByIDRequest {
// id is the account number of the address to be queried. This field
// should have been an uint64 (like all account numbers), and will be
// updated to uint64 in a future version of the auth query.
int64 id = 1;
}
// QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method
//
// Since: cosmos-sdk 0.46.2
message QueryAccountAddressByIDResponse {
string account_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

View File

@ -23,17 +23,24 @@ message GenericAuthorization {
// the provide method with expiration time.
message Grant {
google.protobuf.Any authorization = 1 [(cosmos_proto.accepts_interface) = "Authorization"];
google.protobuf.Timestamp expiration = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
// time when the grant will expire and will be pruned. If null, then the grant
// doesn't have a time expiration (other conditions in `authorization`
// may apply to invalidate the grant)
google.protobuf.Timestamp expiration = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
}
// GrantAuthorization extends a grant with both the addresses of the grantee and granter.
// It is used in genesis.proto and query.proto
//
// Since: cosmos-sdk 0.45.2
message GrantAuthorization {
string granter = 1;
string grantee = 2;
string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
google.protobuf.Any authorization = 3 [(cosmos_proto.accepts_interface) = "Authorization"];
google.protobuf.Timestamp expiration = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
google.protobuf.Timestamp expiration = 4 [(gogoproto.stdtime) = true];
}
// GrantQueueItem contains the list of TypeURL of a sdk.Msg.
message GrantQueueItem {
// msg_type_urls contains the list of TypeURL of a sdk.Msg.
repeated string msg_type_urls = 1;
}

View File

@ -2,6 +2,8 @@
syntax = "proto3";
package cosmos.authz.v1beta1;
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/authz";
// EventGrant is emitted on Msg/Grant
@ -9,9 +11,9 @@ message EventGrant {
// Msg type URL for which an autorization is granted
string msg_type_url = 2;
// Granter account address
string granter = 3;
string granter = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Grantee account address
string grantee = 4;
string grantee = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// EventRevoke is emitted on Msg/Revoke
@ -19,7 +21,7 @@ message EventRevoke {
// Msg type URL for which an autorization is revoked
string msg_type_url = 2;
// Granter account address
string granter = 3;
string granter = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Grantee account address
string grantee = 4;
string grantee = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

View File

@ -5,6 +5,7 @@ package cosmos.authz.v1beta1;
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "cosmos/authz/v1beta1/authz.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/authz";
@ -17,14 +18,14 @@ service Query {
// GranterGrants returns list of `GrantAuthorization`, granted by granter.
//
// Since: cosmos-sdk 0.45.2
// Since: cosmos-sdk 0.46
rpc GranterGrants(QueryGranterGrantsRequest) returns (QueryGranterGrantsResponse) {
option (google.api.http).get = "/cosmos/authz/v1beta1/grants/granter/{granter}";
}
// GranteeGrants returns a list of `GrantAuthorization` by grantee.
//
// Since: cosmos-sdk 0.45.2
// Since: cosmos-sdk 0.46
rpc GranteeGrants(QueryGranteeGrantsRequest) returns (QueryGranteeGrantsResponse) {
option (google.api.http).get = "/cosmos/authz/v1beta1/grants/grantee/{grantee}";
}
@ -32,8 +33,8 @@ service Query {
// QueryGrantsRequest is the request type for the Query/Grants RPC method.
message QueryGrantsRequest {
string granter = 1;
string grantee = 2;
string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Optional, msg_type_url, when set, will query only grants matching given msg type.
string msg_type_url = 3;
// pagination defines an pagination for the request.
@ -50,7 +51,7 @@ message QueryGrantsResponse {
// QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method.
message QueryGranterGrantsRequest {
string granter = 1;
string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// pagination defines an pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
@ -66,7 +67,7 @@ message QueryGranterGrantsResponse {
// QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method.
message QueryGranteeGrantsRequest {
string grantee = 1;
string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// pagination defines an pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;

View File

@ -4,10 +4,9 @@ package cosmos.authz.v1beta1;
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
import "cosmos/base/abci/v1beta1/abci.proto";
import "cosmos/authz/v1beta1/authz.proto";
import "cosmos/msg/v1/msg.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/authz";
option (gogoproto.goproto_getters_all) = false;
@ -33,8 +32,10 @@ service Msg {
// MsgGrant is a request type for Grant method. It declares authorization to the grantee
// on behalf of the granter with the provided expiration time.
message MsgGrant {
string granter = 1;
string grantee = 2;
option (cosmos.msg.v1.signer) = "granter";
string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
cosmos.authz.v1beta1.Grant grant = 3 [(gogoproto.nullable) = false];
}
@ -48,7 +49,9 @@ message MsgExecResponse {
// authorizations granted to the grantee. Each message should have only
// one signer corresponding to the granter of the authorization.
message MsgExec {
string grantee = 1;
option (cosmos.msg.v1.signer) = "grantee";
string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Authorization Msg requests to execute. Each msg must implement Authorization interface
// The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg))
// triple and validate it.
@ -61,8 +64,10 @@ message MsgGrantResponse {}
// MsgRevoke revokes any authorization with the provided sdk.Msg type on the
// granter's account with that has been granted to the grantee.
message MsgRevoke {
string granter = 1;
string grantee = 2;
option (cosmos.msg.v1.signer) = "granter";
string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string msg_type_url = 3;
}

View File

@ -4,14 +4,15 @@ package cosmos.bank.v1beta1;
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/msg/v1/msg.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types";
// Params defines the parameters for the bank module.
message Params {
option (gogoproto.goproto_stringer) = false;
repeated SendEnabled send_enabled = 1 [(gogoproto.moretags) = "yaml:\"send_enabled,omitempty\""];
bool default_send_enabled = 2 [(gogoproto.moretags) = "yaml:\"default_send_enabled,omitempty\""];
repeated SendEnabled send_enabled = 1;
bool default_send_enabled = 2;
}
// SendEnabled maps coin denom to a send_enabled status (whether a denom is
@ -25,10 +26,12 @@ message SendEnabled {
// Input models transaction input.
message Input {
option (cosmos.msg.v1.signer) = "address";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin coins = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}
@ -38,7 +41,7 @@ message Output {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin coins = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}
@ -52,7 +55,7 @@ message Supply {
option (gogoproto.equal) = true;
option (gogoproto.goproto_getters) = false;
option (cosmos_proto.implements_interface) = "*github.com/cosmos/cosmos-sdk/x/bank/legacy/v040.SupplyI";
option (cosmos_proto.implements_interface) = "*github.com/cosmos/cosmos-sdk/x/bank/migrations/v040.SupplyI";
repeated cosmos.base.v1beta1.Coin total = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
@ -65,7 +68,7 @@ message DenomUnit {
string denom = 1;
// exponent represents power of 10 exponent that one must
// raise the base_denom to in order to equal the given DenomUnit's denom
// 1 denom = 1^exponent base_denom
// 1 denom = 10^exponent base_denom
// (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with
// exponent = 6, thus: 1 atom = 10^6 uatom).
uint32 exponent = 2;
@ -93,4 +96,13 @@ message Metadata {
//
// Since: cosmos-sdk 0.43
string symbol = 6;
// URI to a document (on or off-chain) that contains additional information. Optional.
//
// Since: cosmos-sdk 0.46
string uri = 7 [(gogoproto.customname) = "URI"];
// URIHash is a sha256 hash of a document pointed by URI. It's used to verify that
// the document didn't change. Optional.
//
// Since: cosmos-sdk 0.46
string uri_hash = 8 [(gogoproto.customname) = "URIHash"];
}

View File

@ -4,6 +4,7 @@ package cosmos.bank.v1beta1;
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/bank/v1beta1/bank.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types";
@ -21,7 +22,7 @@ message GenesisState {
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false];
// denom_metadata defines the metadata of the differents coins.
repeated Metadata denom_metadata = 4 [(gogoproto.moretags) = "yaml:\"denom_metadata\"", (gogoproto.nullable) = false];
repeated Metadata denom_metadata = 4 [(gogoproto.nullable) = false];
}
// Balance defines an account address and balance pair used in the bank module's
@ -31,7 +32,7 @@ message Balance {
option (gogoproto.goproto_getters) = false;
// address is the address of the balance holder.
string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// coins defines the different coins this balance holds.
repeated cosmos.base.v1beta1.Coin coins = 2

View File

@ -6,6 +6,7 @@ import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/bank/v1beta1/bank.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types";
@ -23,6 +24,8 @@ service Query {
// SpendableBalances queries the spenable balance of all coins for a single
// account.
//
// Since: cosmos-sdk 0.46
rpc SpendableBalances(QuerySpendableBalancesRequest) returns (QuerySpendableBalancesResponse) {
option (google.api.http).get = "/cosmos/bank/v1beta1/spendable_balances/{address}";
}
@ -34,7 +37,7 @@ service Query {
// SupplyOf queries the supply of a single coin.
rpc SupplyOf(QuerySupplyOfRequest) returns (QuerySupplyOfResponse) {
option (google.api.http).get = "/cosmos/bank/v1beta1/supply/{denom}";
option (google.api.http).get = "/cosmos/bank/v1beta1/supply/by_denom";
}
// Params queries the parameters of x/bank module.
@ -47,10 +50,19 @@ service Query {
option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata/{denom}";
}
// DenomsMetadata queries the client metadata for all registered coin denominations.
// DenomsMetadata queries the client metadata for all registered coin
// denominations.
rpc DenomsMetadata(QueryDenomsMetadataRequest) returns (QueryDenomsMetadataResponse) {
option (google.api.http).get = "/cosmos/bank/v1beta1/denoms_metadata";
}
// DenomOwners queries for all account addresses that own a particular token
// denomination.
//
// Since: cosmos-sdk 0.46
rpc DenomOwners(QueryDenomOwnersRequest) returns (QueryDenomOwnersResponse) {
option (google.api.http).get = "/cosmos/bank/v1beta1/denom_owners/{denom}";
}
}
// QueryBalanceRequest is the request type for the Query/Balance RPC method.
@ -59,7 +71,7 @@ message QueryBalanceRequest {
option (gogoproto.goproto_getters) = false;
// address is the address to query balances for.
string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// denom is the coin denom to query balances for.
string denom = 2;
@ -77,7 +89,7 @@ message QueryAllBalancesRequest {
option (gogoproto.goproto_getters) = false;
// address is the address to query balances for.
string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
@ -96,12 +108,14 @@ message QueryAllBalancesResponse {
// QuerySpendableBalancesRequest defines the gRPC request structure for querying
// an account's spendable balances.
//
// Since: cosmos-sdk 0.46
message QuerySpendableBalancesRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// address is the address to query spendable balances for.
string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
@ -109,6 +123,8 @@ message QuerySpendableBalancesRequest {
// QuerySpendableBalancesResponse defines the gRPC response structure for querying
// an account's spendable balances.
//
// Since: cosmos-sdk 0.46
message QuerySpendableBalancesResponse {
// balances is the spendable balances of all the coins.
repeated cosmos.base.v1beta1.Coin balances = 1
@ -191,3 +207,37 @@ message QueryDenomMetadataResponse {
// metadata describes and provides all the client information for the requested token.
Metadata metadata = 1 [(gogoproto.nullable) = false];
}
// QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query,
// which queries for a paginated set of all account holders of a particular
// denomination.
message QueryDenomOwnersRequest {
// denom defines the coin denomination to query all account holders for.
string denom = 1;
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// DenomOwner defines structure representing an account that owns or holds a
// particular denominated token. It contains the account address and account
// balance of the denominated token.
//
// Since: cosmos-sdk 0.46
message DenomOwner {
// address defines the address that owns a particular denomination.
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// balance is the balance of the denominated coin for an account.
cosmos.base.v1beta1.Coin balance = 2 [(gogoproto.nullable) = false];
}
// QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query.
//
// Since: cosmos-sdk 0.46
message QueryDenomOwnersResponse {
repeated DenomOwner denom_owners = 1;
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

View File

@ -4,6 +4,8 @@ package cosmos.bank.v1beta1;
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/bank/v1beta1/bank.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types";
@ -18,11 +20,13 @@ service Msg {
// MsgSend represents a message to send coins from one account to another.
message MsgSend {
option (cosmos.msg.v1.signer) = "from_address";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string from_address = 1 [(gogoproto.moretags) = "yaml:\"from_address\""];
string to_address = 2 [(gogoproto.moretags) = "yaml:\"to_address\""];
string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string to_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin amount = 3
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}
@ -32,6 +36,8 @@ message MsgSendResponse {}
// MsgMultiSend represents an arbitrary multi-in, multi-out send message.
message MsgMultiSend {
option (cosmos.msg.v1.signer) = "inputs";
option (gogoproto.equal) = false;
repeated Input inputs = 1 [(gogoproto.nullable) = false];

View File

@ -41,7 +41,7 @@ message TxResponse {
string timestamp = 12;
// Events defines all the events emitted by processing a transaction. Note,
// these events include those emitted by processing all the messages and those
// emitted from the ante handler. Whereas Logs contains the events, with
// emitted from the ante. Whereas Logs contains the events, with
// additional metadata, emitted only by processing the messages.
//
// Since: cosmos-sdk 0.42.11, 0.44.5, 0.45
@ -52,7 +52,7 @@ message TxResponse {
message ABCIMessageLog {
option (gogoproto.stringer) = true;
uint32 msg_index = 1;
uint32 msg_index = 1 [(gogoproto.jsontag) = "msg_index"];
string log = 2;
// Events contains a slice of Event objects that were emitted during some
@ -79,10 +79,10 @@ message Attribute {
// GasInfo defines tx execution gas context.
message GasInfo {
// GasWanted is the maximum units of work we allow this tx to perform.
uint64 gas_wanted = 1 [(gogoproto.moretags) = "yaml:\"gas_wanted\""];
uint64 gas_wanted = 1;
// GasUsed is the amount of gas actually consumed.
uint64 gas_used = 2 [(gogoproto.moretags) = "yaml:\"gas_used\""];
uint64 gas_used = 2;
}
// Result is the union of ResponseFormat and ResponseCheckTx.
@ -91,7 +91,9 @@ message Result {
// Data is any data returned from message or handler execution. It MUST be
// length prefixed in order to separate data from multiple message executions.
bytes data = 1;
// Deprecated. This field is still populated, but prefer msg_response instead
// because it also contains the Msg response typeURL.
bytes data = 1 [deprecated = true];
// Log contains the log information from message or handler execution.
string log = 2;
@ -99,6 +101,11 @@ message Result {
// Events contains a slice of Event objects that were emitted during message
// or handler execution.
repeated tendermint.abci.Event events = 3 [(gogoproto.nullable) = false];
// msg_responses contains the Msg handler responses type packed in Anys.
//
// Since: cosmos-sdk 0.46
repeated google.protobuf.Any msg_responses = 4;
}
// SimulationResponse defines the response generated when a transaction is
@ -111,6 +118,7 @@ message SimulationResponse {
// MsgData defines the data returned in a Result object during message
// execution.
message MsgData {
option deprecated = true;
option (gogoproto.stringer) = true;
string msg_type = 1;
@ -122,7 +130,13 @@ message MsgData {
message TxMsgData {
option (gogoproto.stringer) = true;
repeated MsgData data = 1;
// data field is deprecated and not populated.
repeated MsgData data = 1 [deprecated = true];
// msg_responses contains the Msg handler responses packed into Anys.
//
// Since: cosmos-sdk 0.46
repeated google.protobuf.Any msg_responses = 2;
}
// SearchTxsResult defines a structure for querying txs pageable
@ -130,13 +144,13 @@ message SearchTxsResult {
option (gogoproto.stringer) = true;
// Count of all txs
uint64 total_count = 1 [(gogoproto.moretags) = "yaml:\"total_count\"", (gogoproto.jsontag) = "total_count"];
uint64 total_count = 1;
// Count of txs in current page
uint64 count = 2;
// Index of current page, start from 1
uint64 page_number = 3 [(gogoproto.moretags) = "yaml:\"page_number\"", (gogoproto.jsontag) = "page_number"];
uint64 page_number = 3;
// Count of total pages
uint64 page_total = 4 [(gogoproto.moretags) = "yaml:\"page_total\"", (gogoproto.jsontag) = "page_total"];
uint64 page_total = 4;
// Max count txs per page
uint64 limit = 5;
// List of txs in current page

View File

@ -0,0 +1,22 @@
syntax = "proto3";
package cosmos.base.node.v1beta1;
import "google/api/annotations.proto";
option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/node";
// Service defines the gRPC querier service for node related queries.
service Service {
// Config queries for the operator configuration.
rpc Config(ConfigRequest) returns (ConfigResponse) {
option (google.api.http).get = "/cosmos/base/node/v1beta1/config";
}
}
// ConfigRequest defines the request structure for the Config gRPC query.
message ConfigRequest {}
// ConfigResponse defines the response structure for the Config gRPC query.
message ConfigResponse {
string minimum_gas_price = 1;
}

View File

@ -46,7 +46,8 @@ message PageRequest {
// }
message PageResponse {
// next_key is the key to be passed to PageRequest.key to
// query the next page most efficiently
// query the next page most efficiently. It will be empty if
// there are no more results.
bytes next_key = 1;
// total is total number of results available if PageRequest.count_total

View File

@ -20,6 +20,8 @@ message Metadata {
}
// SnapshotItem is an item contained in a rootmulti.Store snapshot.
//
// Since: cosmos-sdk 0.46
message SnapshotItem {
// item is the specific type of snapshot item.
oneof item {
@ -27,15 +29,21 @@ message SnapshotItem {
SnapshotIAVLItem iavl = 2 [(gogoproto.customname) = "IAVL"];
SnapshotExtensionMeta extension = 3;
SnapshotExtensionPayload extension_payload = 4;
SnapshotKVItem kv = 5 [(gogoproto.customname) = "KV"];
SnapshotSchema schema = 6;
}
}
// SnapshotStoreItem contains metadata about a snapshotted store.
//
// Since: cosmos-sdk 0.46
message SnapshotStoreItem {
string name = 1;
}
// SnapshotIAVLItem is an exported IAVL node.
//
// Since: cosmos-sdk 0.46
message SnapshotIAVLItem {
bytes key = 1;
bytes value = 2;
@ -46,12 +54,31 @@ message SnapshotIAVLItem {
}
// SnapshotExtensionMeta contains metadata about an external snapshotter.
//
// Since: cosmos-sdk 0.46
message SnapshotExtensionMeta {
string name = 1;
uint32 format = 2;
}
// SnapshotExtensionPayload contains payloads of an external snapshotter.
//
// Since: cosmos-sdk 0.46
message SnapshotExtensionPayload {
bytes payload = 1;
}
// SnapshotKVItem is an exported Key/Value Pair
//
// Since: cosmos-sdk 0.46
message SnapshotKVItem {
bytes key = 1;
bytes value = 2;
}
// SnapshotSchema is an exported schema of smt store
//
// Since: cosmos-sdk 0.46
message SnapshotSchema {
repeated bytes keys = 1;
}

View File

@ -1,6 +1,8 @@
syntax = "proto3";
package cosmos.base.store.v1beta1;
import "tendermint/abci/types.proto";
option go_package = "github.com/cosmos/cosmos-sdk/store/types";
// StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes)
@ -14,3 +16,19 @@ message StoreKVPair {
bytes key = 3;
bytes value = 4;
}
// BlockMetadata contains all the abci event data of a block
// the file streamer dump them into files together with the state changes.
message BlockMetadata {
// DeliverTx encapulate deliver tx request and response.
message DeliverTx {
tendermint.abci.RequestDeliverTx request = 1;
tendermint.abci.ResponseDeliverTx response = 2;
}
tendermint.abci.RequestBeginBlock request_begin_block = 1;
tendermint.abci.ResponseBeginBlock response_begin_block = 2;
repeated DeliverTx deliver_txs = 3;
tendermint.abci.RequestEndBlock request_end_block = 4;
tendermint.abci.ResponseEndBlock response_end_block = 5;
tendermint.abci.ResponseCommit response_commit = 6;
}

View File

@ -5,9 +5,11 @@ import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "google/api/annotations.proto";
import "tendermint/p2p/types.proto";
import "tendermint/types/block.proto";
import "tendermint/types/types.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "cosmos/base/tendermint/v1beta1/types.proto";
import "cosmos_proto/cosmos.proto";
import "tendermint/types/block.proto";
option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/tmservice";
@ -17,14 +19,17 @@ service Service {
rpc GetNodeInfo(GetNodeInfoRequest) returns (GetNodeInfoResponse) {
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/node_info";
}
// GetSyncing queries node syncing.
rpc GetSyncing(GetSyncingRequest) returns (GetSyncingResponse) {
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/syncing";
}
// GetLatestBlock returns the latest block.
rpc GetLatestBlock(GetLatestBlockRequest) returns (GetLatestBlockResponse) {
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/blocks/latest";
}
// GetBlockByHeight queries block for given height.
rpc GetBlockByHeight(GetBlockByHeightRequest) returns (GetBlockByHeightResponse) {
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/blocks/{height}";
@ -34,20 +39,32 @@ service Service {
rpc GetLatestValidatorSet(GetLatestValidatorSetRequest) returns (GetLatestValidatorSetResponse) {
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/validatorsets/latest";
}
// GetValidatorSetByHeight queries validator-set at a given height.
rpc GetValidatorSetByHeight(GetValidatorSetByHeightRequest) returns (GetValidatorSetByHeightResponse) {
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/validatorsets/{height}";
}
// ABCIQuery defines a query handler that supports ABCI queries directly to
// the application, bypassing Tendermint completely. The ABCI query must
// contain a valid and supported path, including app, custom, p2p, and store.
//
// Since: cosmos-sdk 0.46
rpc ABCIQuery(ABCIQueryRequest) returns (ABCIQueryResponse) {
option (google.api.http).get = "/cosmos/base/tendermint/v1beta1/abci_query";
}
}
// GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method.
// GetValidatorSetByHeightRequest is the request type for the
// Query/GetValidatorSetByHeight RPC method.
message GetValidatorSetByHeightRequest {
int64 height = 1;
// pagination defines an pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight RPC method.
// GetValidatorSetByHeightResponse is the response type for the
// Query/GetValidatorSetByHeight RPC method.
message GetValidatorSetByHeightResponse {
int64 block_height = 1;
repeated Validator validators = 2;
@ -55,13 +72,15 @@ message GetValidatorSetByHeightResponse {
cosmos.base.query.v1beta1.PageResponse pagination = 3;
}
// GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight RPC method.
// GetLatestValidatorSetRequest is the request type for the
// Query/GetValidatorSetByHeight RPC method.
message GetLatestValidatorSetRequest {
// pagination defines an pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}
// GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight RPC method.
// GetLatestValidatorSetResponse is the response type for the
// Query/GetValidatorSetByHeight RPC method.
message GetLatestValidatorSetResponse {
int64 block_height = 1;
repeated Validator validators = 2;
@ -71,30 +90,44 @@ message GetLatestValidatorSetResponse {
// Validator is the type for the validator-set.
message Validator {
string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
google.protobuf.Any pub_key = 2;
int64 voting_power = 3;
int64 proposer_priority = 4;
}
// GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight RPC method.
// GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight
// RPC method.
message GetBlockByHeightRequest {
int64 height = 1;
}
// GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method.
// GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight
// RPC method.
message GetBlockByHeightResponse {
.tendermint.types.BlockID block_id = 1;
// Deprecated: please use `sdk_block` instead
.tendermint.types.Block block = 2;
// Since: cosmos-sdk 0.47
Block sdk_block = 3;
}
// GetLatestBlockRequest is the request type for the Query/GetLatestBlock RPC method.
// GetLatestBlockRequest is the request type for the Query/GetLatestBlock RPC
// method.
message GetLatestBlockRequest {}
// GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC method.
// GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC
// method.
message GetLatestBlockResponse {
.tendermint.types.BlockID block_id = 1;
// Deprecated: please use `sdk_block` instead
.tendermint.types.Block block = 2;
// Since: cosmos-sdk 0.47
Block sdk_block = 3;
}
// GetSyncingRequest is the request type for the Query/GetSyncing RPC method.
@ -108,7 +141,8 @@ message GetSyncingResponse {
// GetNodeInfoRequest is the request type for the Query/GetNodeInfo RPC method.
message GetNodeInfoRequest {}
// GetNodeInfoResponse is the request type for the Query/GetNodeInfo RPC method.
// GetNodeInfoResponse is the response type for the Query/GetNodeInfo RPC
// method.
message GetNodeInfoResponse {
.tendermint.p2p.DefaultNodeInfo default_node_info = 1;
VersionInfo application_version = 2;
@ -136,3 +170,50 @@ message Module {
// checksum
string sum = 3;
}
// ABCIQueryRequest defines the request structure for the ABCIQuery gRPC query.
message ABCIQueryRequest {
bytes data = 1;
string path = 2;
int64 height = 3;
bool prove = 4;
}
// ABCIQueryResponse defines the response structure for the ABCIQuery gRPC
// query.
//
// Note: This type is a duplicate of the ResponseQuery proto type defined in
// Tendermint.
message ABCIQueryResponse {
uint32 code = 1;
// DEPRECATED: use "value" instead
reserved 2;
string log = 3; // nondeterministic
string info = 4; // nondeterministic
int64 index = 5;
bytes key = 6;
bytes value = 7;
ProofOps proof_ops = 8;
int64 height = 9;
string codespace = 10;
}
// ProofOp defines an operation used for calculating Merkle root. The data could
// be arbitrary format, providing nessecary data for example neighbouring node
// hash.
//
// Note: This type is a duplicate of the ProofOp proto type defined in
// Tendermint.
message ProofOp {
string type = 1;
bytes key = 2;
bytes data = 3;
}
// ProofOps is Merkle proof defined by the list of ProofOps.
//
// Note: This type is a duplicate of the ProofOps proto type defined in
// Tendermint.
message ProofOps {
repeated ProofOp ops = 1 [(gogoproto.nullable) = false];
}

View File

@ -0,0 +1,50 @@
syntax = "proto3";
package cosmos.base.tendermint.v1beta1;
import "gogoproto/gogo.proto";
import "tendermint/types/types.proto";
import "tendermint/types/evidence.proto";
import "tendermint/version/types.proto";
import "google/protobuf/timestamp.proto";
option go_package = "github.com/cosmos/cosmos-sdk/client/grpc/tmservice";
// Block is tendermint type Block, with the Header proposer address
// field converted to bech32 string.
message Block {
Header header = 1 [(gogoproto.nullable) = false];
.tendermint.types.Data data = 2 [(gogoproto.nullable) = false];
.tendermint.types.EvidenceList evidence = 3 [(gogoproto.nullable) = false];
.tendermint.types.Commit last_commit = 4;
}
// Header defines the structure of a Tendermint block header.
message Header {
// basic block info
.tendermint.version.Consensus version = 1 [(gogoproto.nullable) = false];
string chain_id = 2 [(gogoproto.customname) = "ChainID"];
int64 height = 3;
google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
// prev block info
.tendermint.types.BlockID last_block_id = 5 [(gogoproto.nullable) = false];
// hashes of block data
bytes last_commit_hash = 6; // commit from validators from the last block
bytes data_hash = 7; // transactions
// hashes from the app output from the prev block
bytes validators_hash = 8; // validators for the current block
bytes next_validators_hash = 9; // validators for the next block
bytes consensus_hash = 10; // consensus params for current block
bytes app_hash = 11; // state after txs from the previous block
bytes last_results_hash = 12; // root hash of all results from the txs from the previous block
// consensus info
bytes evidence_hash = 13; // evidence included in the block
// proposer_address is the original block proposer address, formatted as a Bech32 string.
// In Tendermint, this type is `bytes`, but in the SDK, we convert it to a Bech32 string
// for better UX.
string proposer_address = 14; // original proposer of the block
}

View File

@ -2,6 +2,7 @@ syntax = "proto3";
package cosmos.base.v1beta1;
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/cosmos/cosmos-sdk/types";
option (gogoproto.goproto_stringer_all) = false;
@ -15,7 +16,8 @@ message Coin {
option (gogoproto.equal) = true;
string denom = 1;
string amount = 2 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false];
string amount = 2
[(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "Int", (gogoproto.nullable) = false];
}
// DecCoin defines a token with a denomination and a decimal amount.
@ -26,15 +28,16 @@ message DecCoin {
option (gogoproto.equal) = true;
string denom = 1;
string amount = 2 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false];
string amount = 2
[(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false];
}
// IntProto defines a Protobuf wrapper around an Int object.
message IntProto {
string int = 1 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false];
string int = 1 [(cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "Int", (gogoproto.nullable) = false];
}
// DecProto defines a Protobuf wrapper around a Dec object.
message DecProto {
string dec = 1 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false];
string dec = 1 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false];
}

View File

@ -10,7 +10,7 @@ import "gogoproto/gogo.proto";
message Capability {
option (gogoproto.goproto_stringer) = false;
uint64 index = 1 [(gogoproto.moretags) = "yaml:\"index\""];
uint64 index = 1;
}
// Owner defines a single capability owner. An owner is defined by the name of
@ -19,8 +19,8 @@ message Owner {
option (gogoproto.goproto_stringer) = false;
option (gogoproto.goproto_getters) = false;
string module = 1 [(gogoproto.moretags) = "yaml:\"module\""];
string name = 2 [(gogoproto.moretags) = "yaml:\"name\""];
string module = 1;
string name = 2;
}
// CapabilityOwners defines a set of owners of a single Capability. The set of

View File

@ -12,7 +12,7 @@ message GenesisOwners {
uint64 index = 1;
// index_owners are the owners at the given index.
CapabilityOwners index_owners = 2 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"index_owners\""];
CapabilityOwners index_owners = 2 [(gogoproto.nullable) = false];
}
// GenesisState defines the capability module's genesis state.

View File

@ -10,6 +10,5 @@ import "cosmos/base/v1beta1/coin.proto";
message GenesisState {
// constant_fee is the fee used to verify the invariant in the crisis
// module.
cosmos.base.v1beta1.Coin constant_fee = 3
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"constant_fee\""];
cosmos.base.v1beta1.Coin constant_fee = 3 [(gogoproto.nullable) = false];
}

View File

@ -4,6 +4,8 @@ package cosmos.crisis.v1beta1;
option go_package = "github.com/cosmos/cosmos-sdk/x/crisis/types";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
// Msg defines the bank Msg service.
service Msg {
@ -13,12 +15,14 @@ service Msg {
// MsgVerifyInvariant represents a message to verify a particular invariance.
message MsgVerifyInvariant {
option (cosmos.msg.v1.signer) = "sender";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string sender = 1;
string invariant_module_name = 2 [(gogoproto.moretags) = "yaml:\"invariant_module_name\""];
string invariant_route = 3 [(gogoproto.moretags) = "yaml:\"invariant_route\""];
string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string invariant_module_name = 2;
string invariant_route = 3;
}
// MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response type.

View File

@ -0,0 +1,24 @@
// Since: cosmos-sdk 0.46
syntax = "proto3";
package cosmos.crypto.hd.v1;
import "gogoproto/gogo.proto";
option go_package = "github.com/cosmos/cosmos-sdk/crypto/hd";
option (gogoproto.goproto_getters_all) = false;
// BIP44Params is used as path field in ledger item in Record.
message BIP44Params {
option (gogoproto.goproto_stringer) = false;
// purpose is a constant set to 44' (or 0x8000002C) following the BIP43 recommendation
uint32 purpose = 1;
// coin_type is a constant that improves privacy
uint32 coin_type = 2;
// account splits the key space into independent user identities
uint32 account = 3;
// change is a constant used for public derivation. Constant 0 is used for external chain and constant 1 for internal
// chain.
bool change = 4;
// address_index is used as child index in BIP32 derivation
uint32 address_index = 5;
}

View File

@ -0,0 +1,47 @@
// Since: cosmos-sdk 0.46
syntax = "proto3";
package cosmos.crypto.keyring.v1;
import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "cosmos/crypto/hd/v1/hd.proto";
option go_package = "github.com/cosmos/cosmos-sdk/crypto/keyring";
option (gogoproto.goproto_getters_all) = false;
// Record is used for representing a key in the keyring.
message Record {
// name represents a name of Record
string name = 1;
// pub_key represents a public key in any format
google.protobuf.Any pub_key = 2;
// Record contains one of the following items
oneof item {
// local stores the private key locally.
Local local = 3;
// ledger stores the information about a Ledger key.
Ledger ledger = 4;
// Multi does not store any other information.
Multi multi = 5;
// Offline does not store any other information.
Offline offline = 6;
}
// Item is a keyring item stored in a keyring backend.
// Local item
message Local {
google.protobuf.Any priv_key = 1;
}
// Ledger item
message Ledger {
hd.v1.BIP44Params path = 1;
}
// Multi item
message Multi {}
// Offline item
message Offline {}
}

View File

@ -12,7 +12,6 @@ option go_package = "github.com/cosmos/cosmos-sdk/crypto/keys/multisig";
message LegacyAminoPubKey {
option (gogoproto.goproto_getters) = false;
uint32 threshold = 1 [(gogoproto.moretags) = "yaml:\"threshold\""];
repeated google.protobuf.Any public_keys = 2
[(gogoproto.customname) = "PubKeys", (gogoproto.moretags) = "yaml:\"pubkeys\""];
uint32 threshold = 1;
repeated google.protobuf.Any public_keys = 2 [(gogoproto.customname) = "PubKeys"];
}

View File

@ -6,26 +6,27 @@ option (gogoproto.equal_all) = true;
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
// Params defines the set of params for the distribution module.
message Params {
option (gogoproto.goproto_stringer) = false;
string community_tax = 1 [
(gogoproto.moretags) = "yaml:\"community_tax\"",
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
string base_proposer_reward = 2 [
(gogoproto.moretags) = "yaml:\"base_proposer_reward\"",
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
string bonus_proposer_reward = 3 [
(gogoproto.moretags) = "yaml:\"bonus_proposer_reward\"",
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
bool withdraw_addr_enabled = 4 [(gogoproto.moretags) = "yaml:\"withdraw_addr_enabled\""];
bool withdraw_addr_enabled = 4;
}
// ValidatorHistoricalRewards represents historical rewards for a validator.
@ -41,12 +42,9 @@ message Params {
// read that record)
// + one per validator for the zeroeth period, set on initialization
message ValidatorHistoricalRewards {
repeated cosmos.base.v1beta1.DecCoin cumulative_reward_ratio = 1 [
(gogoproto.moretags) = "yaml:\"cumulative_reward_ratio\"",
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins",
(gogoproto.nullable) = false
];
uint32 reference_count = 2 [(gogoproto.moretags) = "yaml:\"reference_count\""];
repeated cosmos.base.v1beta1.DecCoin cumulative_reward_ratio = 1
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
uint32 reference_count = 2;
}
// ValidatorCurrentRewards represents current rewards and current
@ -68,11 +66,8 @@ message ValidatorAccumulatedCommission {
// ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards
// for a validator inexpensive to track, allows simple sanity checks.
message ValidatorOutstandingRewards {
repeated cosmos.base.v1beta1.DecCoin rewards = 1 [
(gogoproto.moretags) = "yaml:\"rewards\"",
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins",
(gogoproto.nullable) = false
];
repeated cosmos.base.v1beta1.DecCoin rewards = 1
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
}
// ValidatorSlashEvent represents a validator slash event.
@ -80,24 +75,24 @@ message ValidatorOutstandingRewards {
// This is needed to calculate appropriate amount of staking tokens
// for delegations which are withdrawn after a slash has occurred.
message ValidatorSlashEvent {
uint64 validator_period = 1 [(gogoproto.moretags) = "yaml:\"validator_period\""];
string fraction = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
uint64 validator_period = 1;
string fraction = 2 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
}
// ValidatorSlashEvents is a collection of ValidatorSlashEvent messages.
message ValidatorSlashEvents {
option (gogoproto.goproto_stringer) = false;
repeated ValidatorSlashEvent validator_slash_events = 1
[(gogoproto.moretags) = "yaml:\"validator_slash_events\"", (gogoproto.nullable) = false];
repeated ValidatorSlashEvent validator_slash_events = 1 [(gogoproto.nullable) = false];
}
// FeePool is the global fee pool for distribution.
message FeePool {
repeated cosmos.base.v1beta1.DecCoin community_pool = 1 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins",
(gogoproto.moretags) = "yaml:\"community_pool\""
];
repeated cosmos.base.v1beta1.DecCoin community_pool = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"];
}
// CommunityPoolSpendProposal details a proposal for use of community funds,
@ -107,6 +102,7 @@ message CommunityPoolSpendProposal {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";
string title = 1;
string description = 2;
@ -122,13 +118,13 @@ message CommunityPoolSpendProposal {
// the delegators within the validator may be left with less than a full token,
// thus sdk.Dec is used.
message DelegatorStartingInfo {
uint64 previous_period = 1 [(gogoproto.moretags) = "yaml:\"previous_period\""];
uint64 previous_period = 1;
string stake = 2 [
(gogoproto.moretags) = "yaml:\"stake\"",
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
uint64 height = 3 [(gogoproto.moretags) = "yaml:\"creation_height\"", (gogoproto.jsontag) = "creation_height"];
uint64 height = 3 [(gogoproto.jsontag) = "creation_height"];
}
// DelegationDelegatorReward represents the properties
@ -137,7 +133,7 @@ message DelegationDelegatorReward {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = true;
string validator_address = 1 [(gogoproto.moretags) = "yaml:\"validator_address\""];
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.DecCoin reward = 2
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
@ -148,10 +144,11 @@ message DelegationDelegatorReward {
message CommunityPoolSpendProposalWithDeposit {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = true;
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";
string title = 1 [(gogoproto.moretags) = "yaml:\"title\""];
string description = 2 [(gogoproto.moretags) = "yaml:\"description\""];
string recipient = 3 [(gogoproto.moretags) = "yaml:\"recipient\""];
string amount = 4 [(gogoproto.moretags) = "yaml:\"amount\""];
string deposit = 5 [(gogoproto.moretags) = "yaml:\"deposit\""];
string title = 1;
string description = 2;
string recipient = 3;
string amount = 4;
string deposit = 5;
}

View File

@ -7,6 +7,7 @@ option (gogoproto.equal_all) = true;
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/distribution/v1beta1/distribution.proto";
import "cosmos_proto/cosmos.proto";
// DelegatorWithdrawInfo is the address for where distributions rewards are
// withdrawn to by default this struct is only used at genesis to feed in
@ -16,10 +17,10 @@ message DelegatorWithdrawInfo {
option (gogoproto.goproto_getters) = false;
// delegator_address is the address of the delegator.
string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""];
string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// withdraw_address is the address to withdraw the delegation rewards to.
string withdraw_address = 2 [(gogoproto.moretags) = "yaml:\"withdraw_address\""];
string withdraw_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// ValidatorOutstandingRewardsRecord is used for import/export via genesis json.
@ -28,14 +29,11 @@ message ValidatorOutstandingRewardsRecord {
option (gogoproto.goproto_getters) = false;
// validator_address is the address of the validator.
string validator_address = 1 [(gogoproto.moretags) = "yaml:\"validator_address\""];
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// outstanding_rewards represents the oustanding rewards of a validator.
repeated cosmos.base.v1beta1.DecCoin outstanding_rewards = 2 [
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"outstanding_rewards\""
];
repeated cosmos.base.v1beta1.DecCoin outstanding_rewards = 2
[(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false];
}
// ValidatorAccumulatedCommissionRecord is used for import / export via genesis
@ -45,11 +43,10 @@ message ValidatorAccumulatedCommissionRecord {
option (gogoproto.goproto_getters) = false;
// validator_address is the address of the validator.
string validator_address = 1 [(gogoproto.moretags) = "yaml:\"validator_address\""];
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// accumulated is the accumulated commission of a validator.
ValidatorAccumulatedCommission accumulated = 2
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"accumulated\""];
ValidatorAccumulatedCommission accumulated = 2 [(gogoproto.nullable) = false];
}
// ValidatorHistoricalRewardsRecord is used for import / export via genesis
@ -59,13 +56,13 @@ message ValidatorHistoricalRewardsRecord {
option (gogoproto.goproto_getters) = false;
// validator_address is the address of the validator.
string validator_address = 1 [(gogoproto.moretags) = "yaml:\"validator_address\""];
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// period defines the period the historical rewards apply to.
uint64 period = 2;
// rewards defines the historical rewards of a validator.
ValidatorHistoricalRewards rewards = 3 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"rewards\""];
ValidatorHistoricalRewards rewards = 3 [(gogoproto.nullable) = false];
}
// ValidatorCurrentRewardsRecord is used for import / export via genesis json.
@ -74,10 +71,10 @@ message ValidatorCurrentRewardsRecord {
option (gogoproto.goproto_getters) = false;
// validator_address is the address of the validator.
string validator_address = 1 [(gogoproto.moretags) = "yaml:\"validator_address\""];
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// rewards defines the current rewards of a validator.
ValidatorCurrentRewards rewards = 2 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"rewards\""];
ValidatorCurrentRewards rewards = 2 [(gogoproto.nullable) = false];
}
// DelegatorStartingInfoRecord used for import / export via genesis json.
@ -86,14 +83,13 @@ message DelegatorStartingInfoRecord {
option (gogoproto.goproto_getters) = false;
// delegator_address is the address of the delegator.
string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""];
string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// validator_address is the address of the validator.
string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""];
string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// starting_info defines the starting info of a delegator.
DelegatorStartingInfo starting_info = 3
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"starting_info\""];
DelegatorStartingInfo starting_info = 3 [(gogoproto.nullable) = false];
}
// ValidatorSlashEventRecord is used for import / export via genesis json.
@ -102,13 +98,13 @@ message ValidatorSlashEventRecord {
option (gogoproto.goproto_getters) = false;
// validator_address is the address of the validator.
string validator_address = 1 [(gogoproto.moretags) = "yaml:\"validator_address\""];
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// height defines the block height at which the slash event occured.
uint64 height = 2;
// period is the period of the slash event.
uint64 period = 3;
// validator_slash_event describes the slash event.
ValidatorSlashEvent validator_slash_event = 4 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"event\""];
ValidatorSlashEvent validator_slash_event = 4 [(gogoproto.nullable) = false];
}
// GenesisState defines the distribution module's genesis state.
@ -117,39 +113,32 @@ message GenesisState {
option (gogoproto.goproto_getters) = false;
// params defines all the paramaters of the module.
Params params = 1 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"params\""];
Params params = 1 [(gogoproto.nullable) = false];
// fee_pool defines the fee pool at genesis.
FeePool fee_pool = 2 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"fee_pool\""];
FeePool fee_pool = 2 [(gogoproto.nullable) = false];
// fee_pool defines the delegator withdraw infos at genesis.
repeated DelegatorWithdrawInfo delegator_withdraw_infos = 3
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"delegator_withdraw_infos\""];
repeated DelegatorWithdrawInfo delegator_withdraw_infos = 3 [(gogoproto.nullable) = false];
// fee_pool defines the previous proposer at genesis.
string previous_proposer = 4 [(gogoproto.moretags) = "yaml:\"previous_proposer\""];
string previous_proposer = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// fee_pool defines the outstanding rewards of all validators at genesis.
repeated ValidatorOutstandingRewardsRecord outstanding_rewards = 5
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"outstanding_rewards\""];
repeated ValidatorOutstandingRewardsRecord outstanding_rewards = 5 [(gogoproto.nullable) = false];
// fee_pool defines the accumulated commisions of all validators at genesis.
repeated ValidatorAccumulatedCommissionRecord validator_accumulated_commissions = 6
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"validator_accumulated_commissions\""];
repeated ValidatorAccumulatedCommissionRecord validator_accumulated_commissions = 6 [(gogoproto.nullable) = false];
// fee_pool defines the historical rewards of all validators at genesis.
repeated ValidatorHistoricalRewardsRecord validator_historical_rewards = 7
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"validator_historical_rewards\""];
repeated ValidatorHistoricalRewardsRecord validator_historical_rewards = 7 [(gogoproto.nullable) = false];
// fee_pool defines the current rewards of all validators at genesis.
repeated ValidatorCurrentRewardsRecord validator_current_rewards = 8
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"validator_current_rewards\""];
repeated ValidatorCurrentRewardsRecord validator_current_rewards = 8 [(gogoproto.nullable) = false];
// fee_pool defines the delegator starting infos at genesis.
repeated DelegatorStartingInfoRecord delegator_starting_infos = 9
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"delegator_starting_infos\""];
repeated DelegatorStartingInfoRecord delegator_starting_infos = 9 [(gogoproto.nullable) = false];
// fee_pool defines the validator slash events at genesis.
repeated ValidatorSlashEventRecord validator_slash_events = 10
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"validator_slash_events\""];
repeated ValidatorSlashEventRecord validator_slash_events = 10 [(gogoproto.nullable) = false];
}

View File

@ -6,6 +6,7 @@ import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/distribution/v1beta1/distribution.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/distribution/types";
@ -77,7 +78,7 @@ message QueryParamsResponse {
// Query/ValidatorOutstandingRewards RPC method.
message QueryValidatorOutstandingRewardsRequest {
// validator_address defines the validator address to query for.
string validator_address = 1;
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// QueryValidatorOutstandingRewardsResponse is the response type for the
@ -90,7 +91,7 @@ message QueryValidatorOutstandingRewardsResponse {
// Query/ValidatorCommission RPC method
message QueryValidatorCommissionRequest {
// validator_address defines the validator address to query for.
string validator_address = 1;
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// QueryValidatorCommissionResponse is the response type for the
@ -107,7 +108,7 @@ message QueryValidatorSlashesRequest {
option (gogoproto.goproto_stringer) = true;
// validator_address defines the validator address to query for.
string validator_address = 1;
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// starting_height defines the optional starting height to query the slashes.
uint64 starting_height = 2;
// starting_height defines the optional ending height to query the slashes.
@ -133,9 +134,9 @@ message QueryDelegationRewardsRequest {
option (gogoproto.goproto_getters) = false;
// delegator_address defines the delegator address to query for.
string delegator_address = 1;
string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// validator_address defines the validator address to query for.
string validator_address = 2;
string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// QueryDelegationRewardsResponse is the response type for the
@ -152,7 +153,7 @@ message QueryDelegationTotalRewardsRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
// delegator_address defines the delegator address to query for.
string delegator_address = 1;
string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// QueryDelegationTotalRewardsResponse is the response type for the
@ -172,7 +173,7 @@ message QueryDelegatorValidatorsRequest {
option (gogoproto.goproto_getters) = false;
// delegator_address defines the delegator address to query for.
string delegator_address = 1;
string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// QueryDelegatorValidatorsResponse is the response type for the
@ -192,7 +193,7 @@ message QueryDelegatorWithdrawAddressRequest {
option (gogoproto.goproto_getters) = false;
// delegator_address defines the delegator address to query for.
string delegator_address = 1;
string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// QueryDelegatorWithdrawAddressResponse is the response type for the
@ -202,7 +203,7 @@ message QueryDelegatorWithdrawAddressResponse {
option (gogoproto.goproto_getters) = false;
// withdraw_address defines the delegator address to query for.
string withdraw_address = 1;
string withdraw_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC

View File

@ -6,6 +6,8 @@ option (gogoproto.equal_all) = true;
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
// Msg defines the distribution Msg service.
service Msg {
@ -29,11 +31,13 @@ service Msg {
// MsgSetWithdrawAddress sets the withdraw address for
// a delegator (or validator self-delegation).
message MsgSetWithdrawAddress {
option (cosmos.msg.v1.signer) = "delegator_address";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""];
string withdraw_address = 2 [(gogoproto.moretags) = "yaml:\"withdraw_address\""];
string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string withdraw_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response type.
@ -42,37 +46,51 @@ message MsgSetWithdrawAddressResponse {}
// MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator
// from a single validator.
message MsgWithdrawDelegatorReward {
option (cosmos.msg.v1.signer) = "delegator_address";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string delegator_address = 1 [(gogoproto.moretags) = "yaml:\"delegator_address\""];
string validator_address = 2 [(gogoproto.moretags) = "yaml:\"validator_address\""];
string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string validator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward response type.
message MsgWithdrawDelegatorRewardResponse {}
message MsgWithdrawDelegatorRewardResponse {
// Since: cosmos-sdk 0.46
repeated cosmos.base.v1beta1.Coin amount = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}
// MsgWithdrawValidatorCommission withdraws the full commission to the validator
// address.
message MsgWithdrawValidatorCommission {
option (cosmos.msg.v1.signer) = "validator_address";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string validator_address = 1 [(gogoproto.moretags) = "yaml:\"validator_address\""];
string validator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// MsgWithdrawValidatorCommissionResponse defines the Msg/WithdrawValidatorCommission response type.
message MsgWithdrawValidatorCommissionResponse {}
message MsgWithdrawValidatorCommissionResponse {
// Since: cosmos-sdk 0.46
repeated cosmos.base.v1beta1.Coin amount = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}
// MsgFundCommunityPool allows an account to directly
// fund the community pool.
message MsgFundCommunityPool {
option (cosmos.msg.v1.signer) = "depositor";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
repeated cosmos.base.v1beta1.Coin amount = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
string depositor = 2;
string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type.

View File

@ -6,6 +6,7 @@ option (gogoproto.equal_all) = true;
import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "cosmos_proto/cosmos.proto";
// Equivocation implements the Evidence interface and defines evidence of double
// signing misbehavior.
@ -17,5 +18,5 @@ message Equivocation {
int64 height = 1;
google.protobuf.Timestamp time = 2 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
int64 power = 3;
string consensus_address = 4 [(gogoproto.moretags) = "yaml:\"consensus_address\""];
string consensus_address = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

View File

@ -7,6 +7,7 @@ option (gogoproto.equal_all) = true;
import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
// Msg defines the evidence Msg service.
service Msg {
@ -18,10 +19,12 @@ service Msg {
// MsgSubmitEvidence represents a message that supports submitting arbitrary
// Evidence of misbehavior such as equivocation or counterfactual signing.
message MsgSubmitEvidence {
option (cosmos.msg.v1.signer) = "submitter";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string submitter = 1;
string submitter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
google.protobuf.Any evidence = 2 [(cosmos_proto.accepts_interface) = "Evidence"];
}

View File

@ -11,13 +11,13 @@ import "google/protobuf/duration.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant";
// BasicAllowance implements Allowance with a one-time grant of tokens
// BasicAllowance implements Allowance with a one-time grant of coins
// that optionally expires. The grantee can use up to SpendLimit to cover fees.
message BasicAllowance {
option (cosmos_proto.implements_interface) = "FeeAllowanceI";
// spend_limit specifies the maximum amount of tokens that can be spent
// by this allowance and will be updated as tokens are spent. If it is
// spend_limit specifies the maximum amount of coins that can be spent
// by this allowance and will be updated as coins are spent. If it is
// empty, there is no spend limit and any amount of coins can be spent.
repeated cosmos.base.v1beta1.Coin spend_limit = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
@ -58,7 +58,7 @@ message AllowedMsgAllowance {
option (gogoproto.goproto_getters) = false;
option (cosmos_proto.implements_interface) = "FeeAllowanceI";
// allowance can be any of basic and filtered fee allowance.
// allowance can be any of basic and periodic fee allowance.
google.protobuf.Any allowance = 1 [(cosmos_proto.accepts_interface) = "FeeAllowanceI"];
// allowed_messages are the messages for which the grantee has the access.
@ -68,11 +68,11 @@ message AllowedMsgAllowance {
// Grant is stored in the KVStore to record a grant with full context
message Grant {
// granter is the address of the user granting an allowance of their funds.
string granter = 1;
string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// grantee is the address of the user being granted an allowance of another user's funds.
string grantee = 2;
string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// allowance can be any of basic and filtered fee allowance.
// allowance can be any of basic, periodic, allowed fee allowance.
google.protobuf.Any allowance = 3 [(cosmos_proto.accepts_interface) = "FeeAllowanceI"];
}

View File

@ -5,6 +5,7 @@ package cosmos.feegrant.v1beta1;
import "cosmos/feegrant/v1beta1/feegrant.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "google/api/annotations.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant";
@ -22,7 +23,8 @@ service Query {
}
// AllowancesByGranter returns all the grants given by an address
// Since v0.46
//
// Since: cosmos-sdk 0.46
rpc AllowancesByGranter(QueryAllowancesByGranterRequest) returns (QueryAllowancesByGranterResponse) {
option (google.api.http).get = "/cosmos/feegrant/v1beta1/issued/{granter}";
}
@ -31,10 +33,10 @@ service Query {
// QueryAllowanceRequest is the request type for the Query/Allowance RPC method.
message QueryAllowanceRequest {
// granter is the address of the user granting an allowance of their funds.
string granter = 1;
string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// grantee is the address of the user being granted an allowance of another user's funds.
string grantee = 2;
string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// QueryAllowanceResponse is the response type for the Query/Allowance RPC method.
@ -45,7 +47,7 @@ message QueryAllowanceResponse {
// QueryAllowancesRequest is the request type for the Query/Allowances RPC method.
message QueryAllowancesRequest {
string grantee = 1;
string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// pagination defines an pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
@ -61,14 +63,18 @@ message QueryAllowancesResponse {
}
// QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method.
//
// Since: cosmos-sdk 0.46
message QueryAllowancesByGranterRequest {
string granter = 1;
string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// pagination defines an pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method.
//
// Since: cosmos-sdk 0.46
message QueryAllowancesByGranterResponse {
// allowances that have been issued by the granter.
repeated cosmos.feegrant.v1beta1.Grant allowances = 1;

View File

@ -2,9 +2,9 @@
syntax = "proto3";
package cosmos.feegrant.v1beta1;
import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/feegrant";
@ -23,13 +23,15 @@ service Msg {
// MsgGrantAllowance adds permission for Grantee to spend up to Allowance
// of fees from the account of Granter.
message MsgGrantAllowance {
option (cosmos.msg.v1.signer) = "granter";
// granter is the address of the user granting an allowance of their funds.
string granter = 1;
string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// grantee is the address of the user being granted an allowance of another user's funds.
string grantee = 2;
string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// allowance can be any of basic and filtered fee allowance.
// allowance can be any of basic, periodic, allowed fee allowance.
google.protobuf.Any allowance = 3 [(cosmos_proto.accepts_interface) = "FeeAllowanceI"];
}
@ -38,11 +40,13 @@ message MsgGrantAllowanceResponse {}
// MsgRevokeAllowance removes any existing Allowance from Granter to Grantee.
message MsgRevokeAllowance {
option (cosmos.msg.v1.signer) = "granter";
// granter is the address of the user granting an allowance of their funds.
string granter = 1;
string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// grantee is the address of the user being granted an allowance of another user's funds.
string grantee = 2;
string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type.

View File

@ -8,9 +8,5 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/genutil/types";
// GenesisState defines the raw genesis transaction in JSON.
message GenesisState {
// gen_txs defines the genesis transactions.
repeated bytes gen_txs = 1 [
(gogoproto.casttype) = "encoding/json.RawMessage",
(gogoproto.jsontag) = "gentxs",
(gogoproto.moretags) = "yaml:\"gentxs\""
];
repeated bytes gen_txs = 1 [(gogoproto.casttype) = "encoding/json.RawMessage", (gogoproto.jsontag) = "gentxs"];
}

View File

@ -0,0 +1,26 @@
// Since: cosmos-sdk 0.46
syntax = "proto3";
package cosmos.gov.v1;
import "cosmos/gov/v1/gov.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1";
// GenesisState defines the gov module's genesis state.
message GenesisState {
// starting_proposal_id is the ID of the starting proposal.
uint64 starting_proposal_id = 1;
// deposits defines all the deposits present at genesis.
repeated Deposit deposits = 2;
// votes defines all the votes present at genesis.
repeated Vote votes = 3;
// proposals defines all the proposals present at genesis.
repeated Proposal proposals = 4;
// params defines all the paramaters of related to deposit.
DepositParams deposit_params = 5;
// params defines all the paramaters of related to voting.
VotingParams voting_params = 6;
// params defines all the paramaters of related to tally.
TallyParams tally_params = 7;
}

View File

@ -0,0 +1,132 @@
// Since: cosmos-sdk 0.46
syntax = "proto3";
package cosmos.gov.v1;
import "cosmos/base/v1beta1/coin.proto";
import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
import "google/protobuf/duration.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1";
// VoteOption enumerates the valid vote options for a given governance proposal.
enum VoteOption {
// VOTE_OPTION_UNSPECIFIED defines a no-op vote option.
VOTE_OPTION_UNSPECIFIED = 0;
// VOTE_OPTION_YES defines a yes vote option.
VOTE_OPTION_YES = 1;
// VOTE_OPTION_ABSTAIN defines an abstain vote option.
VOTE_OPTION_ABSTAIN = 2;
// VOTE_OPTION_NO defines a no vote option.
VOTE_OPTION_NO = 3;
// VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option.
VOTE_OPTION_NO_WITH_VETO = 4;
}
// WeightedVoteOption defines a unit of vote for vote split.
message WeightedVoteOption {
VoteOption option = 1;
string weight = 2 [(cosmos_proto.scalar) = "cosmos.Dec"];
}
// Deposit defines an amount deposited by an account address to an active
// proposal.
message Deposit {
uint64 proposal_id = 1;
string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false];
}
// Proposal defines the core field members of a governance proposal.
message Proposal {
uint64 id = 1;
repeated google.protobuf.Any messages = 2;
ProposalStatus status = 3;
// final_tally_result is the final tally result of the proposal. When
// querying a proposal via gRPC, this field is not populated until the
// proposal's voting period has ended.
TallyResult final_tally_result = 4;
google.protobuf.Timestamp submit_time = 5 [(gogoproto.stdtime) = true];
google.protobuf.Timestamp deposit_end_time = 6 [(gogoproto.stdtime) = true];
repeated cosmos.base.v1beta1.Coin total_deposit = 7 [(gogoproto.nullable) = false];
google.protobuf.Timestamp voting_start_time = 8 [(gogoproto.stdtime) = true];
google.protobuf.Timestamp voting_end_time = 9 [(gogoproto.stdtime) = true];
// metadata is any arbitrary metadata attached to the proposal.
string metadata = 10;
}
// ProposalStatus enumerates the valid statuses of a proposal.
enum ProposalStatus {
// PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status.
PROPOSAL_STATUS_UNSPECIFIED = 0;
// PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit
// period.
PROPOSAL_STATUS_DEPOSIT_PERIOD = 1;
// PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting
// period.
PROPOSAL_STATUS_VOTING_PERIOD = 2;
// PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has
// passed.
PROPOSAL_STATUS_PASSED = 3;
// PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has
// been rejected.
PROPOSAL_STATUS_REJECTED = 4;
// PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has
// failed.
PROPOSAL_STATUS_FAILED = 5;
}
// TallyResult defines a standard tally for a governance proposal.
message TallyResult {
string yes_count = 1 [(cosmos_proto.scalar) = "cosmos.Int"];
string abstain_count = 2 [(cosmos_proto.scalar) = "cosmos.Int"];
string no_count = 3 [(cosmos_proto.scalar) = "cosmos.Int"];
string no_with_veto_count = 4 [(cosmos_proto.scalar) = "cosmos.Int"];
}
// Vote defines a vote on a governance proposal.
// A Vote consists of a proposal ID, the voter, and the vote option.
message Vote {
uint64 proposal_id = 1;
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
reserved 3;
repeated WeightedVoteOption options = 4;
// metadata is any arbitrary metadata to attached to the vote.
string metadata = 5;
}
// DepositParams defines the params for deposits on governance proposals.
message DepositParams {
// Minimum deposit for a proposal to enter voting period.
repeated cosmos.base.v1beta1.Coin min_deposit = 1
[(gogoproto.nullable) = false, (gogoproto.jsontag) = "min_deposit,omitempty"];
// Maximum period for Atom holders to deposit on a proposal. Initial value: 2
// months.
google.protobuf.Duration max_deposit_period = 2
[(gogoproto.stdduration) = true, (gogoproto.jsontag) = "max_deposit_period,omitempty"];
}
// VotingParams defines the params for voting on governance proposals.
message VotingParams {
// Length of the voting period.
google.protobuf.Duration voting_period = 1 [(gogoproto.stdduration) = true];
}
// TallyParams defines the params for tallying votes on governance proposals.
message TallyParams {
// Minimum percentage of total stake needed to vote for a result to be
// considered valid.
string quorum = 1 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.jsontag) = "quorum,omitempty"];
// Minimum proportion of Yes votes for proposal to pass. Default value: 0.5.
string threshold = 2 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.jsontag) = "threshold,omitempty"];
// Minimum value of Veto votes to Total votes ratio for proposal to be
// vetoed. Default value: 1/3.
string veto_threshold = 3 [(cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.jsontag) = "veto_threshold,omitempty"];
}

View File

@ -0,0 +1,183 @@
// Since: cosmos-sdk 0.46
syntax = "proto3";
package cosmos.gov.v1;
import "cosmos/base/query/v1beta1/pagination.proto";
import "google/api/annotations.proto";
import "cosmos/gov/v1/gov.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1";
// Query defines the gRPC querier service for gov module
service Query {
// Proposal queries proposal details based on ProposalID.
rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse) {
option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}";
}
// Proposals queries all proposals based on given status.
rpc Proposals(QueryProposalsRequest) returns (QueryProposalsResponse) {
option (google.api.http).get = "/cosmos/gov/v1/proposals";
}
// Vote queries voted information based on proposalID, voterAddr.
rpc Vote(QueryVoteRequest) returns (QueryVoteResponse) {
option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/votes/{voter}";
}
// Votes queries votes of a given proposal.
rpc Votes(QueryVotesRequest) returns (QueryVotesResponse) {
option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/votes";
}
// Params queries all parameters of the gov module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/cosmos/gov/v1/params/{params_type}";
}
// Deposit queries single deposit information based proposalID, depositAddr.
rpc Deposit(QueryDepositRequest) returns (QueryDepositResponse) {
option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/deposits/{depositor}";
}
// Deposits queries all deposits of a single proposal.
rpc Deposits(QueryDepositsRequest) returns (QueryDepositsResponse) {
option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/deposits";
}
// TallyResult queries the tally of a proposal vote.
rpc TallyResult(QueryTallyResultRequest) returns (QueryTallyResultResponse) {
option (google.api.http).get = "/cosmos/gov/v1/proposals/{proposal_id}/tally";
}
}
// QueryProposalRequest is the request type for the Query/Proposal RPC method.
message QueryProposalRequest {
// proposal_id defines the unique id of the proposal.
uint64 proposal_id = 1;
}
// QueryProposalResponse is the response type for the Query/Proposal RPC method.
message QueryProposalResponse {
Proposal proposal = 1;
}
// QueryProposalsRequest is the request type for the Query/Proposals RPC method.
message QueryProposalsRequest {
// proposal_status defines the status of the proposals.
ProposalStatus proposal_status = 1;
// voter defines the voter address for the proposals.
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// depositor defines the deposit addresses from the proposals.
string depositor = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 4;
}
// QueryProposalsResponse is the response type for the Query/Proposals RPC
// method.
message QueryProposalsResponse {
repeated Proposal proposals = 1;
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryVoteRequest is the request type for the Query/Vote RPC method.
message QueryVoteRequest {
// proposal_id defines the unique id of the proposal.
uint64 proposal_id = 1;
// voter defines the voter address for the proposals.
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// QueryVoteResponse is the response type for the Query/Vote RPC method.
message QueryVoteResponse {
// vote defined the queried vote.
Vote vote = 1;
}
// QueryVotesRequest is the request type for the Query/Votes RPC method.
message QueryVotesRequest {
// proposal_id defines the unique id of the proposal.
uint64 proposal_id = 1;
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryVotesResponse is the response type for the Query/Votes RPC method.
message QueryVotesResponse {
// votes defined the queried votes.
repeated Vote votes = 1;
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryParamsRequest is the request type for the Query/Params RPC method.
message QueryParamsRequest {
// params_type defines which parameters to query for, can be one of "voting",
// "tallying" or "deposit".
string params_type = 1;
}
// QueryParamsResponse is the response type for the Query/Params RPC method.
message QueryParamsResponse {
// voting_params defines the parameters related to voting.
VotingParams voting_params = 1;
// deposit_params defines the parameters related to deposit.
DepositParams deposit_params = 2;
// tally_params defines the parameters related to tally.
TallyParams tally_params = 3;
}
// QueryDepositRequest is the request type for the Query/Deposit RPC method.
message QueryDepositRequest {
// proposal_id defines the unique id of the proposal.
uint64 proposal_id = 1;
// depositor defines the deposit addresses from the proposals.
string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// QueryDepositResponse is the response type for the Query/Deposit RPC method.
message QueryDepositResponse {
// deposit defines the requested deposit.
Deposit deposit = 1;
}
// QueryDepositsRequest is the request type for the Query/Deposits RPC method.
message QueryDepositsRequest {
// proposal_id defines the unique id of the proposal.
uint64 proposal_id = 1;
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryDepositsResponse is the response type for the Query/Deposits RPC method.
message QueryDepositsResponse {
repeated Deposit deposits = 1;
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryTallyResultRequest is the request type for the Query/Tally RPC method.
message QueryTallyResultRequest {
// proposal_id defines the unique id of the proposal.
uint64 proposal_id = 1;
}
// QueryTallyResultResponse is the response type for the Query/Tally RPC method.
message QueryTallyResultResponse {
// tally defines the requested tally.
TallyResult tally = 1;
}

100
third_party/proto/cosmos/gov/v1/tx.proto vendored Normal file
View File

@ -0,0 +1,100 @@
// Since: cosmos-sdk 0.46
syntax = "proto3";
package cosmos.gov.v1;
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/gov/v1/gov.proto";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "google/protobuf/any.proto";
import "cosmos/msg/v1/msg.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1";
// Msg defines the gov Msg service.
service Msg {
// SubmitProposal defines a method to create new proposal given a content.
rpc SubmitProposal(MsgSubmitProposal) returns (MsgSubmitProposalResponse);
// ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal
// to execute a legacy content-based proposal.
rpc ExecLegacyContent(MsgExecLegacyContent) returns (MsgExecLegacyContentResponse);
// Vote defines a method to add a vote on a specific proposal.
rpc Vote(MsgVote) returns (MsgVoteResponse);
// VoteWeighted defines a method to add a weighted vote on a specific proposal.
rpc VoteWeighted(MsgVoteWeighted) returns (MsgVoteWeightedResponse);
// Deposit defines a method to add deposit on a specific proposal.
rpc Deposit(MsgDeposit) returns (MsgDepositResponse);
}
// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary
// proposal Content.
message MsgSubmitProposal {
option (cosmos.msg.v1.signer) = "proposer";
repeated google.protobuf.Any messages = 1;
repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [(gogoproto.nullable) = false];
string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// metadata is any arbitrary metadata attached to the proposal.
string metadata = 4;
}
// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type.
message MsgSubmitProposalResponse {
uint64 proposal_id = 1;
}
// MsgExecLegacyContent is used to wrap the legacy content field into a message.
// This ensures backwards compatibility with v1beta1.MsgSubmitProposal.
message MsgExecLegacyContent {
option (cosmos.msg.v1.signer) = "authority";
// content is the proposal's content.
google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "Content"];
// authority must be the gov module address.
string authority = 2;
}
// MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type.
message MsgExecLegacyContentResponse {}
// MsgVote defines a message to cast a vote.
message MsgVote {
option (cosmos.msg.v1.signer) = "voter";
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
VoteOption option = 3;
string metadata = 4;
}
// MsgVoteResponse defines the Msg/Vote response type.
message MsgVoteResponse {}
// MsgVoteWeighted defines a message to cast a vote.
message MsgVoteWeighted {
option (cosmos.msg.v1.signer) = "voter";
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated WeightedVoteOption options = 3;
string metadata = 4;
}
// MsgVoteWeightedResponse defines the Msg/VoteWeighted response type.
message MsgVoteWeightedResponse {}
// MsgDeposit defines a message to submit a deposit to an existing proposal.
message MsgDeposit {
option (cosmos.msg.v1.signer) = "depositor";
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false];
}
// MsgDepositResponse defines the Msg/Deposit response type.
message MsgDepositResponse {}

View File

@ -5,12 +5,12 @@ package cosmos.gov.v1beta1;
import "gogoproto/gogo.proto";
import "cosmos/gov/v1beta1/gov.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types";
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1";
// GenesisState defines the gov module's genesis state.
message GenesisState {
// starting_proposal_id is the ID of the starting proposal.
uint64 starting_proposal_id = 1 [(gogoproto.moretags) = "yaml:\"starting_proposal_id\""];
uint64 starting_proposal_id = 1;
// deposits defines all the deposits present at genesis.
repeated Deposit deposits = 2 [(gogoproto.castrepeated) = "Deposits", (gogoproto.nullable) = false];
// votes defines all the votes present at genesis.
@ -18,9 +18,9 @@ message GenesisState {
// proposals defines all the proposals present at genesis.
repeated Proposal proposals = 4 [(gogoproto.castrepeated) = "Proposals", (gogoproto.nullable) = false];
// params defines all the paramaters of related to deposit.
DepositParams deposit_params = 5 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"deposit_params\""];
DepositParams deposit_params = 5 [(gogoproto.nullable) = false];
// params defines all the paramaters of related to voting.
VotingParams voting_params = 6 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_params\""];
VotingParams voting_params = 6 [(gogoproto.nullable) = false];
// params defines all the paramaters of related to tally.
TallyParams tally_params = 7 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"tally_params\""];
TallyParams tally_params = 7 [(gogoproto.nullable) = false];
}

View File

@ -3,12 +3,13 @@ package cosmos.gov.v1beta1;
import "cosmos/base/v1beta1/coin.proto";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
import "google/protobuf/duration.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1";
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types";
option (gogoproto.goproto_stringer_all) = false;
option (gogoproto.stringer_all) = false;
option (gogoproto.goproto_getters_all) = false;
@ -35,9 +36,9 @@ enum VoteOption {
message WeightedVoteOption {
VoteOption option = 1;
string weight = 2 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"weight\""
(gogoproto.nullable) = false
];
}
@ -58,8 +59,8 @@ message Deposit {
option (gogoproto.goproto_getters) = false;
option (gogoproto.equal) = false;
uint64 proposal_id = 1 [(gogoproto.moretags) = "yaml:\"proposal_id\""];
string depositor = 2;
uint64 proposal_id = 1;
string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin amount = 3
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}
@ -68,31 +69,26 @@ message Deposit {
message Proposal {
option (gogoproto.equal) = true;
uint64 proposal_id = 1 [(gogoproto.jsontag) = "id", (gogoproto.moretags) = "yaml:\"id\""];
uint64 proposal_id = 1;
google.protobuf.Any content = 2 [(cosmos_proto.accepts_interface) = "Content"];
ProposalStatus status = 3 [(gogoproto.moretags) = "yaml:\"proposal_status\""];
TallyResult final_tally_result = 4
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"final_tally_result\""];
google.protobuf.Timestamp submit_time = 5
[(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"submit_time\""];
google.protobuf.Timestamp deposit_end_time = 6
[(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"deposit_end_time\""];
repeated cosmos.base.v1beta1.Coin total_deposit = 7 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.moretags) = "yaml:\"total_deposit\""
];
google.protobuf.Timestamp voting_start_time = 8
[(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_start_time\""];
google.protobuf.Timestamp voting_end_time = 9
[(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"voting_end_time\""];
ProposalStatus status = 3;
// final_tally_result is the final tally result of the proposal. When
// querying a proposal via gRPC, this field is not populated until the
// proposal's voting period has ended.
TallyResult final_tally_result = 4 [(gogoproto.nullable) = false];
google.protobuf.Timestamp submit_time = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
google.protobuf.Timestamp deposit_end_time = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
repeated cosmos.base.v1beta1.Coin total_deposit = 7
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
google.protobuf.Timestamp voting_start_time = 8 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
google.protobuf.Timestamp voting_end_time = 9 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
}
// ProposalStatus enumerates the valid statuses of a proposal.
enum ProposalStatus {
option (gogoproto.goproto_enum_prefix) = false;
// PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status.
// PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status.
PROPOSAL_STATUS_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "StatusNil"];
// PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit
// period.
@ -115,13 +111,25 @@ enum ProposalStatus {
message TallyResult {
option (gogoproto.equal) = true;
string yes = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false];
string abstain = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false];
string no = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false];
string no_with_veto = 4 [
string yes = 1 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"no_with_veto\""
(gogoproto.nullable) = false
];
string abstain = 2 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
string no = 3 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
string no_with_veto = 4 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}
@ -131,8 +139,8 @@ message Vote {
option (gogoproto.goproto_stringer) = false;
option (gogoproto.equal) = false;
uint64 proposal_id = 1 [(gogoproto.moretags) = "yaml:\"proposal_id\""];
string voter = 2;
uint64 proposal_id = 1 [(gogoproto.jsontag) = "id"];
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Deprecated: Prefer to use `options` instead. This field is set in queries
// if and only if `len(options) == 1` and that option has weight 1. In all
// other cases, this field will default to VOTE_OPTION_UNSPECIFIED.
@ -147,7 +155,6 @@ message DepositParams {
repeated cosmos.base.v1beta1.Coin min_deposit = 1 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.moretags) = "yaml:\"min_deposit\"",
(gogoproto.jsontag) = "min_deposit,omitempty"
];
@ -156,20 +163,15 @@ message DepositParams {
google.protobuf.Duration max_deposit_period = 2 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.jsontag) = "max_deposit_period,omitempty",
(gogoproto.moretags) = "yaml:\"max_deposit_period\""
(gogoproto.jsontag) = "max_deposit_period,omitempty"
];
}
// VotingParams defines the params for voting on governance proposals.
message VotingParams {
// Length of the voting period.
google.protobuf.Duration voting_period = 1 [
(gogoproto.nullable) = false,
(gogoproto.stdduration) = true,
(gogoproto.jsontag) = "voting_period,omitempty",
(gogoproto.moretags) = "yaml:\"voting_period\""
];
google.protobuf.Duration voting_period = 1
[(gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.jsontag) = "voting_period,omitempty"];
}
// TallyParams defines the params for tallying votes on governance proposals.
@ -194,7 +196,6 @@ message TallyParams {
bytes veto_threshold = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "veto_threshold,omitempty",
(gogoproto.moretags) = "yaml:\"veto_threshold\""
(gogoproto.jsontag) = "veto_threshold,omitempty"
];
}

View File

@ -5,8 +5,9 @@ import "cosmos/base/query/v1beta1/pagination.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/gov/v1beta1/gov.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types";
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1";
// Query defines the gRPC querier service for gov module
service Query {
@ -71,10 +72,10 @@ message QueryProposalsRequest {
ProposalStatus proposal_status = 1;
// voter defines the voter address for the proposals.
string voter = 2;
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// depositor defines the deposit addresses from the proposals.
string depositor = 3;
string depositor = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 4;
@ -97,8 +98,8 @@ message QueryVoteRequest {
// proposal_id defines the unique id of the proposal.
uint64 proposal_id = 1;
// voter defines the oter address for the proposals.
string voter = 2;
// voter defines the voter address for the proposals.
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// QueryVoteResponse is the response type for the Query/Vote RPC method.
@ -151,7 +152,7 @@ message QueryDepositRequest {
uint64 proposal_id = 1;
// depositor defines the deposit addresses from the proposals.
string depositor = 2;
string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// QueryDepositResponse is the response type for the Query/Deposit RPC method.

View File

@ -7,7 +7,9 @@ import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types";
import "cosmos/msg/v1/msg.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1";
// Msg defines the bank Msg service.
service Msg {
@ -29,34 +31,35 @@ service Msg {
// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary
// proposal Content.
message MsgSubmitProposal {
option (cosmos.msg.v1.signer) = "proposer";
option (gogoproto.equal) = false;
option (gogoproto.goproto_stringer) = false;
option (gogoproto.stringer) = false;
option (gogoproto.goproto_getters) = false;
google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "Content"];
repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [
(gogoproto.nullable) = false,
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
(gogoproto.moretags) = "yaml:\"initial_deposit\""
];
string proposer = 3;
repeated cosmos.base.v1beta1.Coin initial_deposit = 2
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type.
message MsgSubmitProposalResponse {
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (gogoproto.moretags) = "yaml:\"proposal_id\""];
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
}
// MsgVote defines a message to cast a vote.
message MsgVote {
option (cosmos.msg.v1.signer) = "voter";
option (gogoproto.equal) = false;
option (gogoproto.goproto_stringer) = false;
option (gogoproto.stringer) = false;
option (gogoproto.goproto_getters) = false;
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (gogoproto.moretags) = "yaml:\"proposal_id\""];
string voter = 2;
uint64 proposal_id = 1;
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
VoteOption option = 3;
}
@ -67,13 +70,15 @@ message MsgVoteResponse {}
//
// Since: cosmos-sdk 0.43
message MsgVoteWeighted {
option (cosmos.msg.v1.signer) = "voter";
option (gogoproto.equal) = false;
option (gogoproto.goproto_stringer) = false;
option (gogoproto.stringer) = false;
option (gogoproto.goproto_getters) = false;
uint64 proposal_id = 1 [(gogoproto.moretags) = "yaml:\"proposal_id\""];
string voter = 2;
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated WeightedVoteOption options = 3 [(gogoproto.nullable) = false];
}
@ -84,13 +89,15 @@ message MsgVoteWeightedResponse {}
// MsgDeposit defines a message to submit a deposit to an existing proposal.
message MsgDeposit {
option (cosmos.msg.v1.signer) = "depositor";
option (gogoproto.equal) = false;
option (gogoproto.goproto_stringer) = false;
option (gogoproto.stringer) = false;
option (gogoproto.goproto_getters) = false;
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (gogoproto.moretags) = "yaml:\"proposal_id\""];
string depositor = 2;
uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id"];
string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin amount = 3
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}

View File

@ -0,0 +1,81 @@
// Since: cosmos-sdk 0.46
syntax = "proto3";
package cosmos.group.v1;
import "cosmos_proto/cosmos.proto";
import "cosmos/group/v1/types.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/group";
// EventCreateGroup is an event emitted when a group is created.
message EventCreateGroup {
// group_id is the unique ID of the group.
uint64 group_id = 1;
}
// EventUpdateGroup is an event emitted when a group is updated.
message EventUpdateGroup {
// group_id is the unique ID of the group.
uint64 group_id = 1;
}
// EventCreateGroupPolicy is an event emitted when a group policy is created.
message EventCreateGroupPolicy {
// address is the account address of the group policy.
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// EventUpdateGroupPolicy is an event emitted when a group policy is updated.
message EventUpdateGroupPolicy {
// address is the account address of the group policy.
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// EventSubmitProposal is an event emitted when a proposal is created.
message EventSubmitProposal {
// proposal_id is the unique ID of the proposal.
uint64 proposal_id = 1;
}
// EventWithdrawProposal is an event emitted when a proposal is withdrawn.
message EventWithdrawProposal {
// proposal_id is the unique ID of the proposal.
uint64 proposal_id = 1;
}
// EventVote is an event emitted when a voter votes on a proposal.
message EventVote {
// proposal_id is the unique ID of the proposal.
uint64 proposal_id = 1;
}
// EventExec is an event emitted when a proposal is executed.
message EventExec {
// proposal_id is the unique ID of the proposal.
uint64 proposal_id = 1;
// result is the proposal execution result.
ProposalExecutorResult result = 2;
// logs contains error logs in case the execution result is FAILURE.
string logs = 3;
}
// EventLeaveGroup is an event emitted when group member leaves the group.
message EventLeaveGroup {
// group_id is the unique ID of the group.
uint64 group_id = 1;
// address is the account address of the group member.
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

View File

@ -0,0 +1,39 @@
// Since: cosmos-sdk 0.46
syntax = "proto3";
package cosmos.group.v1;
option go_package = "github.com/cosmos/cosmos-sdk/x/group";
import "cosmos/group/v1/types.proto";
// GenesisState defines the group module's genesis state.
message GenesisState {
// group_seq is the group table orm.Sequence,
// it is used to get the next group ID.
uint64 group_seq = 1;
// groups is the list of groups info.
repeated GroupInfo groups = 2;
// group_members is the list of groups members.
repeated GroupMember group_members = 3;
// group_policy_seq is the group policy table orm.Sequence,
// it is used to generate the next group policy account address.
uint64 group_policy_seq = 4;
// group_policies is the list of group policies info.
repeated GroupPolicyInfo group_policies = 5;
// proposal_seq is the proposal table orm.Sequence,
// it is used to get the next proposal ID.
uint64 proposal_seq = 6;
// proposals is the list of proposals.
repeated Proposal proposals = 7;
// votes is the list of votes.
repeated Vote votes = 8;
}

View File

@ -0,0 +1,313 @@
// Since: cosmos-sdk 0.46
syntax = "proto3";
package cosmos.group.v1;
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/group/v1/types.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/group";
// Query is the cosmos.group.v1 Query service.
service Query {
// GroupInfo queries group info based on group id.
rpc GroupInfo(QueryGroupInfoRequest) returns (QueryGroupInfoResponse) {
option (google.api.http).get = "/cosmos/group/v1/group_info/{group_id}";
};
// GroupPolicyInfo queries group policy info based on account address of group policy.
rpc GroupPolicyInfo(QueryGroupPolicyInfoRequest) returns (QueryGroupPolicyInfoResponse) {
option (google.api.http).get = "/cosmos/group/v1/group_policy_info/{address}";
};
// GroupMembers queries members of a group
rpc GroupMembers(QueryGroupMembersRequest) returns (QueryGroupMembersResponse) {
option (google.api.http).get = "/cosmos/group/v1/group_members/{group_id}";
};
// GroupsByAdmin queries groups by admin address.
rpc GroupsByAdmin(QueryGroupsByAdminRequest) returns (QueryGroupsByAdminResponse) {
option (google.api.http).get = "/cosmos/group/v1/groups_by_admin/{admin}";
};
// GroupPoliciesByGroup queries group policies by group id.
rpc GroupPoliciesByGroup(QueryGroupPoliciesByGroupRequest) returns (QueryGroupPoliciesByGroupResponse) {
option (google.api.http).get = "/cosmos/group/v1/group_policies_by_group/{group_id}";
};
// GroupsByAdmin queries group policies by admin address.
rpc GroupPoliciesByAdmin(QueryGroupPoliciesByAdminRequest) returns (QueryGroupPoliciesByAdminResponse) {
option (google.api.http).get = "/cosmos/group/v1/group_policies_by_admin/{admin}";
};
// Proposal queries a proposal based on proposal id.
rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse) {
option (google.api.http).get = "/cosmos/group/v1/proposal/{proposal_id}";
};
// ProposalsByGroupPolicy queries proposals based on account address of group policy.
rpc ProposalsByGroupPolicy(QueryProposalsByGroupPolicyRequest) returns (QueryProposalsByGroupPolicyResponse) {
option (google.api.http).get = "/cosmos/group/v1/proposals_by_group_policy/{address}";
};
// VoteByProposalVoter queries a vote by proposal id and voter.
rpc VoteByProposalVoter(QueryVoteByProposalVoterRequest) returns (QueryVoteByProposalVoterResponse) {
option (google.api.http).get = "/cosmos/group/v1/vote_by_proposal_voter/{proposal_id}/{voter}";
};
// VotesByProposal queries a vote by proposal.
rpc VotesByProposal(QueryVotesByProposalRequest) returns (QueryVotesByProposalResponse) {
option (google.api.http).get = "/cosmos/group/v1/votes_by_proposal/{proposal_id}";
};
// VotesByVoter queries a vote by voter.
rpc VotesByVoter(QueryVotesByVoterRequest) returns (QueryVotesByVoterResponse) {
option (google.api.http).get = "/cosmos/group/v1/votes_by_voter/{voter}";
};
// GroupsByMember queries groups by member address.
rpc GroupsByMember(QueryGroupsByMemberRequest) returns (QueryGroupsByMemberResponse) {
option (google.api.http).get = "/cosmos/group/v1/groups_by_member/{address}";
};
// TallyResult returns the tally result of a proposal. If the proposal is
// still in voting period, then this query computes the current tally state,
// which might not be final. On the other hand, if the proposal is final,
// then it simply returns the `final_tally_result` state stored in the
// proposal itself.
rpc TallyResult(QueryTallyResultRequest) returns (QueryTallyResultResponse) {
option (google.api.http).get = "/cosmos/group/v1/proposals/{proposal_id}/tally";
};
}
// QueryGroupInfoRequest is the Query/GroupInfo request type.
message QueryGroupInfoRequest {
// group_id is the unique ID of the group.
uint64 group_id = 1;
}
// QueryGroupInfoResponse is the Query/GroupInfo response type.
message QueryGroupInfoResponse {
// info is the GroupInfo for the group.
GroupInfo info = 1;
}
// QueryGroupPolicyInfoRequest is the Query/GroupPolicyInfo request type.
message QueryGroupPolicyInfoRequest {
// address is the account address of the group policy.
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response type.
message QueryGroupPolicyInfoResponse {
// info is the GroupPolicyInfo for the group policy.
GroupPolicyInfo info = 1;
}
// QueryGroupMembersRequest is the Query/GroupMembers request type.
message QueryGroupMembersRequest {
// group_id is the unique ID of the group.
uint64 group_id = 1;
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryGroupMembersResponse is the Query/GroupMembersResponse response type.
message QueryGroupMembersResponse {
// members are the members of the group with given group_id.
repeated GroupMember members = 1;
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryGroupsByAdminRequest is the Query/GroupsByAdmin request type.
message QueryGroupsByAdminRequest {
// admin is the account address of a group's admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response type.
message QueryGroupsByAdminResponse {
// groups are the groups info with the provided admin.
repeated GroupInfo groups = 1;
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup request type.
message QueryGroupPoliciesByGroupRequest {
// group_id is the unique ID of the group policy's group.
uint64 group_id = 1;
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response type.
message QueryGroupPoliciesByGroupResponse {
// group_policies are the group policies info associated with the provided group.
repeated GroupPolicyInfo group_policies = 1;
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryGroupPoliciesByAdminRequest is the Query/GroupPoliciesByAdmin request type.
message QueryGroupPoliciesByAdminRequest {
// admin is the admin address of the group policy.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response type.
message QueryGroupPoliciesByAdminResponse {
// group_policies are the group policies info with provided admin.
repeated GroupPolicyInfo group_policies = 1;
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryProposalRequest is the Query/Proposal request type.
message QueryProposalRequest {
// proposal_id is the unique ID of a proposal.
uint64 proposal_id = 1;
}
// QueryProposalResponse is the Query/Proposal response type.
message QueryProposalResponse {
// proposal is the proposal info.
Proposal proposal = 1;
}
// QueryProposalsByGroupPolicyRequest is the Query/ProposalByGroupPolicy request type.
message QueryProposalsByGroupPolicyRequest {
// address is the account address of the group policy related to proposals.
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryProposalsByGroupPolicyResponse is the Query/ProposalByGroupPolicy response type.
message QueryProposalsByGroupPolicyResponse {
// proposals are the proposals with given group policy.
repeated Proposal proposals = 1;
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter request type.
message QueryVoteByProposalVoterRequest {
// proposal_id is the unique ID of a proposal.
uint64 proposal_id = 1;
// voter is a proposal voter account address.
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response type.
message QueryVoteByProposalVoterResponse {
// vote is the vote with given proposal_id and voter.
Vote vote = 1;
}
// QueryVotesByProposalRequest is the Query/VotesByProposal request type.
message QueryVotesByProposalRequest {
// proposal_id is the unique ID of a proposal.
uint64 proposal_id = 1;
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryVotesByProposalResponse is the Query/VotesByProposal response type.
message QueryVotesByProposalResponse {
// votes are the list of votes for given proposal_id.
repeated Vote votes = 1;
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryVotesByVoterRequest is the Query/VotesByVoter request type.
message QueryVotesByVoterRequest {
// voter is a proposal voter account address.
string voter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryVotesByVoterResponse is the Query/VotesByVoter response type.
message QueryVotesByVoterResponse {
// votes are the list of votes by given voter.
repeated Vote votes = 1;
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryGroupsByMemberRequest is the Query/GroupsByMember request type.
message QueryGroupsByMemberRequest {
// address is the group member address.
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}
// QueryGroupsByMemberResponse is the Query/GroupsByMember response type.
message QueryGroupsByMemberResponse {
// groups are the groups info with the provided group member.
repeated GroupInfo groups = 1;
// pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryTallyResultRequest is the Query/TallyResult request type.
message QueryTallyResultRequest {
// proposal_id is the unique id of a proposal.
uint64 proposal_id = 1;
}
// QueryTallyResultResponse is the Query/TallyResult response type.
message QueryTallyResultResponse {
// tally defines the requested tally.
TallyResult tally = 1 [(gogoproto.nullable) = false];
}

View File

@ -0,0 +1,373 @@
// Since: cosmos-sdk 0.46
syntax = "proto3";
package cosmos.group.v1;
option go_package = "github.com/cosmos/cosmos-sdk/x/group";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "google/protobuf/any.proto";
import "cosmos/group/v1/types.proto";
import "cosmos/msg/v1/msg.proto";
// Msg is the cosmos.group.v1 Msg service.
service Msg {
// CreateGroup creates a new group with an admin account address, a list of members and some optional metadata.
rpc CreateGroup(MsgCreateGroup) returns (MsgCreateGroupResponse);
// UpdateGroupMembers updates the group members with given group id and admin address.
rpc UpdateGroupMembers(MsgUpdateGroupMembers) returns (MsgUpdateGroupMembersResponse);
// UpdateGroupAdmin updates the group admin with given group id and previous admin address.
rpc UpdateGroupAdmin(MsgUpdateGroupAdmin) returns (MsgUpdateGroupAdminResponse);
// UpdateGroupMetadata updates the group metadata with given group id and admin address.
rpc UpdateGroupMetadata(MsgUpdateGroupMetadata) returns (MsgUpdateGroupMetadataResponse);
// CreateGroupPolicy creates a new group policy using given DecisionPolicy.
rpc CreateGroupPolicy(MsgCreateGroupPolicy) returns (MsgCreateGroupPolicyResponse);
// CreateGroupWithPolicy creates a new group with policy.
rpc CreateGroupWithPolicy(MsgCreateGroupWithPolicy) returns (MsgCreateGroupWithPolicyResponse);
// UpdateGroupPolicyAdmin updates a group policy admin.
rpc UpdateGroupPolicyAdmin(MsgUpdateGroupPolicyAdmin) returns (MsgUpdateGroupPolicyAdminResponse);
// UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated.
rpc UpdateGroupPolicyDecisionPolicy(MsgUpdateGroupPolicyDecisionPolicy)
returns (MsgUpdateGroupPolicyDecisionPolicyResponse);
// UpdateGroupPolicyMetadata updates a group policy metadata.
rpc UpdateGroupPolicyMetadata(MsgUpdateGroupPolicyMetadata) returns (MsgUpdateGroupPolicyMetadataResponse);
// SubmitProposal submits a new proposal.
rpc SubmitProposal(MsgSubmitProposal) returns (MsgSubmitProposalResponse);
// WithdrawProposal withdraws a proposal.
rpc WithdrawProposal(MsgWithdrawProposal) returns (MsgWithdrawProposalResponse);
// Vote allows a voter to vote on a proposal.
rpc Vote(MsgVote) returns (MsgVoteResponse);
// Exec executes a proposal.
rpc Exec(MsgExec) returns (MsgExecResponse);
// LeaveGroup allows a group member to leave the group.
rpc LeaveGroup(MsgLeaveGroup) returns (MsgLeaveGroupResponse);
}
//
// Groups
//
// MsgCreateGroup is the Msg/CreateGroup request type.
message MsgCreateGroup {
option (cosmos.msg.v1.signer) = "admin";
// admin is the account address of the group admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// members defines the group members.
repeated MemberRequest members = 2 [(gogoproto.nullable) = false];
// metadata is any arbitrary metadata to attached to the group.
string metadata = 3;
}
// MsgCreateGroupResponse is the Msg/CreateGroup response type.
message MsgCreateGroupResponse {
// group_id is the unique ID of the newly created group.
uint64 group_id = 1;
}
// MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type.
message MsgUpdateGroupMembers {
option (cosmos.msg.v1.signer) = "admin";
// admin is the account address of the group admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// group_id is the unique ID of the group.
uint64 group_id = 2;
// member_updates is the list of members to update,
// set weight to 0 to remove a member.
repeated MemberRequest member_updates = 3 [(gogoproto.nullable) = false];
}
// MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type.
message MsgUpdateGroupMembersResponse {}
// MsgUpdateGroupAdmin is the Msg/UpdateGroupAdmin request type.
message MsgUpdateGroupAdmin {
option (cosmos.msg.v1.signer) = "admin";
// admin is the current account address of the group admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// group_id is the unique ID of the group.
uint64 group_id = 2;
// new_admin is the group new admin account address.
string new_admin = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type.
message MsgUpdateGroupAdminResponse {}
// MsgUpdateGroupMetadata is the Msg/UpdateGroupMetadata request type.
message MsgUpdateGroupMetadata {
option (cosmos.msg.v1.signer) = "admin";
// admin is the account address of the group admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// group_id is the unique ID of the group.
uint64 group_id = 2;
// metadata is the updated group's metadata.
string metadata = 3;
}
// MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response type.
message MsgUpdateGroupMetadataResponse {}
//
// Group Policies
//
// MsgCreateGroupPolicy is the Msg/CreateGroupPolicy request type.
message MsgCreateGroupPolicy {
option (cosmos.msg.v1.signer) = "admin";
option (gogoproto.goproto_getters) = false;
// admin is the account address of the group admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// group_id is the unique ID of the group.
uint64 group_id = 2;
// metadata is any arbitrary metadata attached to the group policy.
string metadata = 3;
// decision_policy specifies the group policy's decision policy.
google.protobuf.Any decision_policy = 4 [(cosmos_proto.accepts_interface) = "cosmos.group.v1.DecisionPolicy"];
}
// MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type.
message MsgCreateGroupPolicyResponse {
// address is the account address of the newly created group policy.
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// MsgUpdateGroupPolicyAdmin is the Msg/UpdateGroupPolicyAdmin request type.
message MsgUpdateGroupPolicyAdmin {
option (cosmos.msg.v1.signer) = "admin";
// admin is the account address of the group admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// group_policy_address is the account address of the group policy.
string group_policy_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// new_admin is the new group policy admin.
string new_admin = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type.
message MsgCreateGroupWithPolicy {
option (cosmos.msg.v1.signer) = "admin";
option (gogoproto.goproto_getters) = false;
// admin is the account address of the group and group policy admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// members defines the group members.
repeated MemberRequest members = 2 [(gogoproto.nullable) = false];
// group_metadata is any arbitrary metadata attached to the group.
string group_metadata = 3;
// group_policy_metadata is any arbitrary metadata attached to the group policy.
string group_policy_metadata = 4;
// group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group
// and group policy admin.
bool group_policy_as_admin = 5;
// decision_policy specifies the group policy's decision policy.
google.protobuf.Any decision_policy = 6 [(cosmos_proto.accepts_interface) = "cosmos.group.v1.DecisionPolicy"];
}
// MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type.
message MsgCreateGroupWithPolicyResponse {
// group_id is the unique ID of the newly created group with policy.
uint64 group_id = 1;
// group_policy_address is the account address of the newly created group policy.
string group_policy_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type.
message MsgUpdateGroupPolicyAdminResponse {}
// MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type.
message MsgUpdateGroupPolicyDecisionPolicy {
option (cosmos.msg.v1.signer) = "admin";
option (gogoproto.goproto_getters) = false;
// admin is the account address of the group admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// group_policy_address is the account address of group policy.
string group_policy_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// decision_policy is the updated group policy's decision policy.
google.protobuf.Any decision_policy = 3 [(cosmos_proto.accepts_interface) = "cosmos.group.v1.DecisionPolicy"];
}
// MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response type.
message MsgUpdateGroupPolicyDecisionPolicyResponse {}
// MsgUpdateGroupPolicyMetadata is the Msg/UpdateGroupPolicyMetadata request type.
message MsgUpdateGroupPolicyMetadata {
option (cosmos.msg.v1.signer) = "admin";
// admin is the account address of the group admin.
string admin = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// group_policy_address is the account address of group policy.
string group_policy_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// metadata is the updated group policy metadata.
string metadata = 3;
}
// MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type.
message MsgUpdateGroupPolicyMetadataResponse {}
//
// Proposals and Voting
//
// Exec defines modes of execution of a proposal on creation or on new vote.
enum Exec {
// An empty value means that there should be a separate
// MsgExec request for the proposal to execute.
EXEC_UNSPECIFIED = 0;
// Try to execute the proposal immediately.
// If the proposal is not allowed per the DecisionPolicy,
// the proposal will still be open and could
// be executed at a later point.
EXEC_TRY = 1;
}
// MsgSubmitProposal is the Msg/SubmitProposal request type.
message MsgSubmitProposal {
option (cosmos.msg.v1.signer) = "proposers";
option (gogoproto.goproto_getters) = false;
// group_policy_address is the account address of group policy.
string group_policy_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// proposers are the account addresses of the proposers.
// Proposers signatures will be counted as yes votes.
repeated string proposers = 2;
// metadata is any arbitrary metadata to attached to the proposal.
string metadata = 3;
// messages is a list of `sdk.Msg`s that will be executed if the proposal passes.
repeated google.protobuf.Any messages = 4;
// exec defines the mode of execution of the proposal,
// whether it should be executed immediately on creation or not.
// If so, proposers signatures are considered as Yes votes.
Exec exec = 5;
}
// MsgSubmitProposalResponse is the Msg/SubmitProposal response type.
message MsgSubmitProposalResponse {
// proposal is the unique ID of the proposal.
uint64 proposal_id = 1;
}
// MsgWithdrawProposal is the Msg/WithdrawProposal request type.
message MsgWithdrawProposal {
option (cosmos.msg.v1.signer) = "address";
// proposal is the unique ID of the proposal.
uint64 proposal_id = 1;
// address is the admin of the group policy or one of the proposer of the proposal.
string address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type.
message MsgWithdrawProposalResponse {}
// MsgVote is the Msg/Vote request type.
message MsgVote {
option (cosmos.msg.v1.signer) = "voter";
// proposal is the unique ID of the proposal.
uint64 proposal_id = 1;
// voter is the voter account address.
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// option is the voter's choice on the proposal.
VoteOption option = 3;
// metadata is any arbitrary metadata to attached to the vote.
string metadata = 4;
// exec defines whether the proposal should be executed
// immediately after voting or not.
Exec exec = 5;
}
// MsgVoteResponse is the Msg/Vote response type.
message MsgVoteResponse {}
// MsgExec is the Msg/Exec request type.
message MsgExec {
option (cosmos.msg.v1.signer) = "signer";
// proposal is the unique ID of the proposal.
uint64 proposal_id = 1;
// executor is the account address used to execute the proposal.
string executor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}
// MsgExecResponse is the Msg/Exec request type.
message MsgExecResponse {
// result is the final result of the proposal execution.
ProposalExecutorResult result = 2;
}
// MsgLeaveGroup is the Msg/LeaveGroup request type.
message MsgLeaveGroup {
option (cosmos.msg.v1.signer) = "address";
// address is the account address of the group member.
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// group_id is the unique ID of the group.
uint64 group_id = 2;
}
// MsgLeaveGroupResponse is the Msg/LeaveGroup response type.
message MsgLeaveGroupResponse {}

View File

@ -0,0 +1,317 @@
// Since: cosmos-sdk 0.46
syntax = "proto3";
package cosmos.group.v1;
option go_package = "github.com/cosmos/cosmos-sdk/x/group";
import "gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "cosmos_proto/cosmos.proto";
import "google/protobuf/any.proto";
// Member represents a group member with an account address,
// non-zero weight, metadata and added_at timestamp.
message Member {
// address is the member's account address.
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// weight is the member's voting weight that should be greater than 0.
string weight = 2;
// metadata is any arbitrary metadata attached to the member.
string metadata = 3;
// added_at is a timestamp specifying when a member was added.
google.protobuf.Timestamp added_at = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
}
// MemberRequest represents a group member to be used in Msg server requests.
// Contrary to `Member`, it doesn't have any `added_at` field
// since this field cannot be set as part of requests.
message MemberRequest {
// address is the member's account address.
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// weight is the member's voting weight that should be greater than 0.
string weight = 2;
// metadata is any arbitrary metadata attached to the member.
string metadata = 3;
}
// ThresholdDecisionPolicy is a decision policy where a proposal passes when it
// satisfies the two following conditions:
// 1. The sum of all `YES` voters' weights is greater or equal than the defined
// `threshold`.
// 2. The voting and execution periods of the proposal respect the parameters
// given by `windows`.
message ThresholdDecisionPolicy {
option (cosmos_proto.implements_interface) = "DecisionPolicy";
// threshold is the minimum weighted sum of `YES` votes that must be met or
// exceeded for a proposal to succeed.
string threshold = 1;
// windows defines the different windows for voting and execution.
DecisionPolicyWindows windows = 2;
}
// PercentageDecisionPolicy is a decision policy where a proposal passes when
// it satisfies the two following conditions:
// 1. The percentage of all `YES` voters' weights out of the total group weight
// is greater or equal than the given `percentage`.
// 2. The voting and execution periods of the proposal respect the parameters
// given by `windows`.
message PercentageDecisionPolicy {
option (cosmos_proto.implements_interface) = "DecisionPolicy";
// percentage is the minimum percentage the weighted sum of `YES` votes must
// meet for a proposal to succeed.
string percentage = 1;
// windows defines the different windows for voting and execution.
DecisionPolicyWindows windows = 2;
}
// DecisionPolicyWindows defines the different windows for voting and execution.
message DecisionPolicyWindows {
// voting_period is the duration from submission of a proposal to the end of voting period
// Within this times votes can be submitted with MsgVote.
google.protobuf.Duration voting_period = 1 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false];
// min_execution_period is the minimum duration after the proposal submission
// where members can start sending MsgExec. This means that the window for
// sending a MsgExec transaction is:
// `[ submission + min_execution_period ; submission + voting_period + max_execution_period]`
// where max_execution_period is a app-specific config, defined in the keeper.
// If not set, min_execution_period will default to 0.
//
// Please make sure to set a `min_execution_period` that is smaller than
// `voting_period + max_execution_period`, or else the above execution window
// is empty, meaning that all proposals created with this decision policy
// won't be able to be executed.
google.protobuf.Duration min_execution_period = 2 [(gogoproto.stdduration) = true, (gogoproto.nullable) = false];
}
// VoteOption enumerates the valid vote options for a given proposal.
enum VoteOption {
option (gogoproto.goproto_enum_prefix) = false;
// VOTE_OPTION_UNSPECIFIED defines an unspecified vote option which will
// return an error.
VOTE_OPTION_UNSPECIFIED = 0;
// VOTE_OPTION_YES defines a yes vote option.
VOTE_OPTION_YES = 1;
// VOTE_OPTION_ABSTAIN defines an abstain vote option.
VOTE_OPTION_ABSTAIN = 2;
// VOTE_OPTION_NO defines a no vote option.
VOTE_OPTION_NO = 3;
// VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option.
VOTE_OPTION_NO_WITH_VETO = 4;
}
//
// State
//
// GroupInfo represents the high-level on-chain information for a group.
message GroupInfo {
// id is the unique ID of the group.
uint64 id = 1;
// admin is the account address of the group's admin.
string admin = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// metadata is any arbitrary metadata to attached to the group.
string metadata = 3;
// version is used to track changes to a group's membership structure that
// would break existing proposals. Whenever any members weight is changed,
// or any member is added or removed this version is incremented and will
// cause proposals based on older versions of this group to fail
uint64 version = 4;
// total_weight is the sum of the group members' weights.
string total_weight = 5;
// created_at is a timestamp specifying when a group was created.
google.protobuf.Timestamp created_at = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
}
// GroupMember represents the relationship between a group and a member.
message GroupMember {
// group_id is the unique ID of the group.
uint64 group_id = 1;
// member is the member data.
Member member = 2;
}
// GroupPolicyInfo represents the high-level on-chain information for a group policy.
message GroupPolicyInfo {
option (gogoproto.equal) = true;
option (gogoproto.goproto_getters) = false;
// address is the account address of group policy.
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// group_id is the unique ID of the group.
uint64 group_id = 2;
// admin is the account address of the group admin.
string admin = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// metadata is any arbitrary metadata to attached to the group policy.
string metadata = 4;
// version is used to track changes to a group's GroupPolicyInfo structure that
// would create a different result on a running proposal.
uint64 version = 5;
// decision_policy specifies the group policy's decision policy.
google.protobuf.Any decision_policy = 6 [(cosmos_proto.accepts_interface) = "cosmos.group.v1.DecisionPolicy"];
// created_at is a timestamp specifying when a group policy was created.
google.protobuf.Timestamp created_at = 7 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
}
// Proposal defines a group proposal. Any member of a group can submit a proposal
// for a group policy to decide upon.
// A proposal consists of a set of `sdk.Msg`s that will be executed if the proposal
// passes as well as some optional metadata associated with the proposal.
message Proposal {
option (gogoproto.goproto_getters) = false;
// id is the unique id of the proposal.
uint64 id = 1;
// group_policy_address is the account address of group policy.
string group_policy_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// metadata is any arbitrary metadata to attached to the proposal.
string metadata = 3;
// proposers are the account addresses of the proposers.
repeated string proposers = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// submit_time is a timestamp specifying when a proposal was submitted.
google.protobuf.Timestamp submit_time = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
// group_version tracks the version of the group at proposal submission.
// This field is here for informational purposes only.
uint64 group_version = 6;
// group_policy_version tracks the version of the group policy at proposal submission.
// When a decision policy is changed, existing proposals from previous policy
// versions will become invalid with the `ABORTED` status.
// This field is here for informational purposes only.
uint64 group_policy_version = 7;
// status represents the high level position in the life cycle of the proposal. Initial value is Submitted.
ProposalStatus status = 8;
// final_tally_result contains the sums of all weighted votes for this
// proposal for each vote option. It is empty at submission, and only
// populated after tallying, at voting period end or at proposal execution,
// whichever happens first.
TallyResult final_tally_result = 9 [(gogoproto.nullable) = false];
// voting_period_end is the timestamp before which voting must be done.
// Unless a successfull MsgExec is called before (to execute a proposal whose
// tally is successful before the voting period ends), tallying will be done
// at this point, and the `final_tally_result`and `status` fields will be
// accordingly updated.
google.protobuf.Timestamp voting_period_end = 10 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
// executor_result is the final result of the proposal execution. Initial value is NotRun.
ProposalExecutorResult executor_result = 11;
// messages is a list of `sdk.Msg`s that will be executed if the proposal passes.
repeated google.protobuf.Any messages = 12;
}
// ProposalStatus defines proposal statuses.
enum ProposalStatus {
option (gogoproto.goproto_enum_prefix) = false;
// An empty value is invalid and not allowed.
PROPOSAL_STATUS_UNSPECIFIED = 0;
// Initial status of a proposal when submitted.
PROPOSAL_STATUS_SUBMITTED = 1;
// Final status of a proposal when the final tally is done and the outcome
// passes the group policy's decision policy.
PROPOSAL_STATUS_ACCEPTED = 2;
// Final status of a proposal when the final tally is done and the outcome
// is rejected by the group policy's decision policy.
PROPOSAL_STATUS_REJECTED = 3;
// Final status of a proposal when the group policy is modified before the
// final tally.
PROPOSAL_STATUS_ABORTED = 4;
// A proposal can be withdrawn before the voting start time by the owner.
// When this happens the final status is Withdrawn.
PROPOSAL_STATUS_WITHDRAWN = 5;
}
// ProposalExecutorResult defines types of proposal executor results.
enum ProposalExecutorResult {
option (gogoproto.goproto_enum_prefix) = false;
// An empty value is not allowed.
PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED = 0;
// We have not yet run the executor.
PROPOSAL_EXECUTOR_RESULT_NOT_RUN = 1;
// The executor was successful and proposed action updated state.
PROPOSAL_EXECUTOR_RESULT_SUCCESS = 2;
// The executor returned an error and proposed action didn't update state.
PROPOSAL_EXECUTOR_RESULT_FAILURE = 3;
}
// TallyResult represents the sum of weighted votes for each vote option.
message TallyResult {
option (gogoproto.goproto_getters) = false;
// yes_count is the weighted sum of yes votes.
string yes_count = 1;
// abstain_count is the weighted sum of abstainers.
string abstain_count = 2;
// no_count is the weighted sum of no votes.
string no_count = 3;
// no_with_veto_count is the weighted sum of veto.
string no_with_veto_count = 4;
}
// Vote represents a vote for a proposal.
message Vote {
// proposal is the unique ID of the proposal.
uint64 proposal_id = 1;
// voter is the account address of the voter.
string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// option is the voter's choice on the proposal.
VoteOption option = 3;
// metadata is any arbitrary metadata to attached to the vote.
string metadata = 4;
// submit_time is the timestamp when the vote was submitted.
google.protobuf.Timestamp submit_time = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
}

View File

@ -4,15 +4,19 @@ package cosmos.mint.v1beta1;
option go_package = "github.com/cosmos/cosmos-sdk/x/mint/types";
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
// Minter represents the minting state.
message Minter {
// current annual inflation rate
string inflation = 1
[(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
string inflation = 1 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// current annual expected provisions
string annual_provisions = 2 [
(gogoproto.moretags) = "yaml:\"annual_provisions\"",
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
@ -26,28 +30,28 @@ message Params {
string mint_denom = 1;
// maximum annual change in inflation rate
string inflation_rate_change = 2 [
(gogoproto.moretags) = "yaml:\"inflation_rate_change\"",
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// maximum inflation rate
string inflation_max = 3 [
(gogoproto.moretags) = "yaml:\"inflation_max\"",
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// minimum inflation rate
string inflation_min = 4 [
(gogoproto.moretags) = "yaml:\"inflation_min\"",
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// goal of percent bonded atoms
string goal_bonded = 5 [
(gogoproto.moretags) = "yaml:\"goal_bonded\"",
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = false
];
// expected blocks per year
uint64 blocks_per_year = 6 [(gogoproto.moretags) = "yaml:\"blocks_per_year\""];
uint64 blocks_per_year = 6;
}

View File

@ -0,0 +1,22 @@
syntax = "proto3";
package cosmos.msg.v1;
import "google/protobuf/descriptor.proto";
// TODO(fdymylja): once we fully migrate to protov2 the go_package needs to be updated.
// We need this right now because gogoproto codegen needs to import the extension.
option go_package = "github.com/cosmos/cosmos-sdk/types/msgservice";
extend google.protobuf.MessageOptions {
// signer must be used in cosmos messages in order
// to signal to external clients which fields in a
// given cosmos message must be filled with signer
// information (address).
// The field must be the protobuf name of the message
// field extended with this MessageOption.
// The field must either be of string kind, or of message
// kind in case the signer information is contained within
// a message inside the cosmos message.
repeated string signer = 11110000;
}

View File

@ -0,0 +1,26 @@
syntax = "proto3";
package cosmos.nft.v1beta1;
option go_package = "github.com/cosmos/cosmos-sdk/x/nft";
// EventSend is emitted on Msg/Send
message EventSend {
string class_id = 1;
string id = 2;
string sender = 3;
string receiver = 4;
}
// EventMint is emitted on Mint
message EventMint {
string class_id = 1;
string id = 2;
string owner = 3;
}
// EventBurn is emitted on Burn
message EventBurn {
string class_id = 1;
string id = 2;
string owner = 3;
}

View File

@ -0,0 +1,22 @@
syntax = "proto3";
package cosmos.nft.v1beta1;
import "cosmos/nft/v1beta1/nft.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/nft";
// GenesisState defines the nft module's genesis state.
message GenesisState {
// class defines the class of the nft type.
repeated cosmos.nft.v1beta1.Class classes = 1;
repeated Entry entries = 2;
}
// Entry Defines all nft owned by a person
message Entry {
// owner is the owner address of the following nft
string owner = 1;
// nfts is a group of nfts of the same owner
repeated cosmos.nft.v1beta1.NFT nfts = 2;
}

View File

@ -0,0 +1,48 @@
syntax = "proto3";
package cosmos.nft.v1beta1;
import "google/protobuf/any.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/nft";
// Class defines the class of the nft type.
message Class {
// id defines the unique identifier of the NFT classification, similar to the contract address of ERC721
string id = 1;
// name defines the human-readable name of the NFT classification. Optional
string name = 2;
// symbol is an abbreviated name for nft classification. Optional
string symbol = 3;
// description is a brief description of nft classification. Optional
string description = 4;
// uri for the class metadata stored off chain. It can define schema for Class and NFT `Data` attributes. Optional
string uri = 5;
// uri_hash is a hash of the document pointed by uri. Optional
string uri_hash = 6;
// data is the app specific metadata of the NFT class. Optional
google.protobuf.Any data = 7;
}
// NFT defines the NFT.
message NFT {
// class_id associated with the NFT, similar to the contract address of ERC721
string class_id = 1;
// id is a unique identifier of the NFT
string id = 2;
// uri for the NFT metadata stored off chain
string uri = 3;
// uri_hash is a hash of the document pointed by uri
string uri_hash = 4;
// data is an app specific data of the NFT. Optional
google.protobuf.Any data = 10;
}

View File

@ -0,0 +1,125 @@
syntax = "proto3";
package cosmos.nft.v1beta1;
import "cosmos/base/query/v1beta1/pagination.proto";
import "google/api/annotations.proto";
import "cosmos/nft/v1beta1/nft.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/nft";
// Query defines the gRPC querier service.
service Query {
// Balance queries the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721
rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) {
option (google.api.http).get = "/cosmos/nft/v1beta1/balance/{owner}/{class_id}";
}
// Owner queries the owner of the NFT based on its class and id, same as ownerOf in ERC721
rpc Owner(QueryOwnerRequest) returns (QueryOwnerResponse) {
option (google.api.http).get = "/cosmos/nft/v1beta1/owner/{class_id}/{id}";
}
// Supply queries the number of NFTs from the given class, same as totalSupply of ERC721.
rpc Supply(QuerySupplyRequest) returns (QuerySupplyResponse) {
option (google.api.http).get = "/cosmos/nft/v1beta1/supply/{class_id}";
}
// NFTs queries all NFTs of a given class or owner,choose at least one of the two, similar to tokenByIndex in
// ERC721Enumerable
rpc NFTs(QueryNFTsRequest) returns (QueryNFTsResponse) {
option (google.api.http).get = "/cosmos/nft/v1beta1/nfts";
}
// NFT queries an NFT based on its class and id.
rpc NFT(QueryNFTRequest) returns (QueryNFTResponse) {
option (google.api.http).get = "/cosmos/nft/v1beta1/nfts/{class_id}/{id}";
}
// Class queries an NFT class based on its id
rpc Class(QueryClassRequest) returns (QueryClassResponse) {
option (google.api.http).get = "/cosmos/nft/v1beta1/classes/{class_id}";
}
// Classes queries all NFT classes
rpc Classes(QueryClassesRequest) returns (QueryClassesResponse) {
option (google.api.http).get = "/cosmos/nft/v1beta1/classes";
}
}
// QueryBalanceRequest is the request type for the Query/Balance RPC method
message QueryBalanceRequest {
string class_id = 1;
string owner = 2;
}
// QueryBalanceResponse is the response type for the Query/Balance RPC method
message QueryBalanceResponse {
uint64 amount = 1;
}
// QueryOwnerRequest is the request type for the Query/Owner RPC method
message QueryOwnerRequest {
string class_id = 1;
string id = 2;
}
// QueryOwnerResponse is the response type for the Query/Owner RPC method
message QueryOwnerResponse {
string owner = 1;
}
// QuerySupplyRequest is the request type for the Query/Supply RPC method
message QuerySupplyRequest {
string class_id = 1;
}
// QuerySupplyResponse is the response type for the Query/Supply RPC method
message QuerySupplyResponse {
uint64 amount = 1;
}
// QueryNFTstRequest is the request type for the Query/NFTs RPC method
message QueryNFTsRequest {
string class_id = 1;
string owner = 2;
cosmos.base.query.v1beta1.PageRequest pagination = 3;
}
// QueryNFTsResponse is the response type for the Query/NFTs RPC methods
message QueryNFTsResponse {
repeated cosmos.nft.v1beta1.NFT nfts = 1;
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
// QueryNFTRequest is the request type for the Query/NFT RPC method
message QueryNFTRequest {
string class_id = 1;
string id = 2;
}
// QueryNFTResponse is the response type for the Query/NFT RPC method
message QueryNFTResponse {
cosmos.nft.v1beta1.NFT nft = 1;
}
// QueryClassRequest is the request type for the Query/Class RPC method
message QueryClassRequest {
string class_id = 1;
}
// QueryClassResponse is the response type for the Query/Class RPC method
message QueryClassResponse {
cosmos.nft.v1beta1.Class class = 1;
}
// QueryClassesRequest is the request type for the Query/Classes RPC method
message QueryClassesRequest {
// pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 1;
}
// QueryClassesResponse is the response type for the Query/Classes RPC method
message QueryClassesResponse {
repeated cosmos.nft.v1beta1.Class classes = 1;
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

View File

@ -0,0 +1,30 @@
syntax = "proto3";
package cosmos.nft.v1beta1;
option go_package = "github.com/cosmos/cosmos-sdk/x/nft";
import "cosmos/msg/v1/msg.proto";
// Msg defines the nft Msg service.
service Msg {
// Send defines a method to send a nft from one account to another account.
rpc Send(MsgSend) returns (MsgSendResponse);
}
// MsgSend represents a message to send a nft from one account to another account.
message MsgSend {
option (cosmos.msg.v1.signer) = "sender";
// class_id defines the unique identifier of the nft classification, similar to the contract address of ERC721
string class_id = 1;
// id defines the unique identification of nft
string id = 2;
// sender is the address of the owner of nft
string sender = 3;
// receiver is the receiver address of nft
string receiver = 4;
}
// MsgSendResponse defines the Msg/Send response type.
message MsgSendResponse {}

View File

@ -0,0 +1,14 @@
syntax = "proto3";
package cosmos.orm.module.v1alpha1;
import "cosmos/app/v1alpha1/module.proto";
// Module defines the ORM module which adds providers to the app container for
// module-scoped DB's. In the future it may provide gRPC services for interacting
// with ORM data.
message Module {
option (cosmos.app.v1alpha1.module) = {
go_import: "github.com/cosmos/cosmos-sdk/orm"
};
}

View File

@ -0,0 +1,104 @@
syntax = "proto3";
package cosmos.orm.v1;
import "google/protobuf/descriptor.proto";
extend google.protobuf.MessageOptions {
// table specifies that this message will be used as an ORM table. It cannot
// be used together with the singleton option.
TableDescriptor table = 104503790;
// singleton specifies that this message will be used as an ORM singleton. It cannot
// be used together with the table option.
SingletonDescriptor singleton = 104503791;
}
// TableDescriptor describes an ORM table.
message TableDescriptor {
// primary_key defines the primary key for the table.
PrimaryKeyDescriptor primary_key = 1;
// index defines one or more secondary indexes.
repeated SecondaryIndexDescriptor index = 2;
// id is a non-zero integer ID that must be unique within the
// tables and singletons in this file. It may be deprecated in the future when this
// can be auto-generated.
uint32 id = 3;
}
// PrimaryKeyDescriptor describes a table primary key.
message PrimaryKeyDescriptor {
// fields is a comma-separated list of fields in the primary key. Spaces are
// not allowed. Supported field types, their encodings, and any applicable constraints
// are described below.
// - uint32 are encoded as 2,3,4 or 5 bytes using a compact encoding that
// is suitable for sorted iteration (not varint encoding). This type is
// well-suited for small integers.
// - uint64 are encoded as 2,4,6 or 9 bytes using a compact encoding that
// is suitable for sorted iteration (not varint encoding). This type is
// well-suited for small integers such as auto-incrementing sequences.
// - fixed32, fixed64 are encoded as big-endian fixed width bytes and support
// sorted iteration. These types are well-suited for encoding fixed with
// decimals as integers.
// - string's are encoded as raw bytes in terminal key segments and null-terminated
// in non-terminal segments. Null characters are thus forbidden in strings.
// string fields support sorted iteration.
// - bytes are encoded as raw bytes in terminal segments and length-prefixed
// with a 32-bit unsigned varint in non-terminal segments.
// - int32, sint32, int64, sint64, sfixed32, sfixed64 are encoded as fixed width bytes with
// an encoding that enables sorted iteration.
// - google.protobuf.Timestamp and google.protobuf.Duration are encoded
// as 12 bytes using an encoding that enables sorted iteration.
// - enum fields are encoded using varint encoding and do not support sorted
// iteration.
// - bool fields are encoded as a single byte 0 or 1.
//
// All other fields types are unsupported in keys including repeated and
// oneof fields.
//
// Primary keys are prefixed by the varint encoded table id and the byte 0x0
// plus any additional prefix specified by the schema.
string fields = 1;
// auto_increment specifies that the primary key is generated by an
// auto-incrementing integer. If this is set to true fields must only
// contain one field of that is of type uint64.
bool auto_increment = 2;
}
// PrimaryKeyDescriptor describes a table secondary index.
message SecondaryIndexDescriptor {
// fields is a comma-separated list of fields in the index. The supported
// field types are the same as those for PrimaryKeyDescriptor.fields.
// Index keys are prefixed by the varint encoded table id and the varint
// encoded index id plus any additional prefix specified by the schema.
//
// In addition the field segments, non-unique index keys are suffixed with
// any additional primary key fields not present in the index fields so that the
// primary key can be reconstructed. Unique indexes instead of being suffixed
// store the remaining primary key fields in the value..
string fields = 1;
// id is a non-zero integer ID that must be unique within the indexes for this
// table and less than 32768. It may be deprecated in the future when this can
// be auto-generated.
uint32 id = 2;
// unique specifies that this an unique index.
bool unique = 3;
}
// TableDescriptor describes an ORM singleton table which has at most one instance.
message SingletonDescriptor {
// id is a non-zero integer ID that must be unique within the
// tables and singletons in this file. It may be deprecated in the future when this
// can be auto-generated.
uint32 id = 1;
}

View File

@ -0,0 +1,76 @@
syntax = "proto3";
package cosmos.orm.v1alpha1;
import "google/protobuf/descriptor.proto";
extend google.protobuf.MessageOptions {
// module_schema is used to define the ORM schema for an app module.
// All module config messages that use module_schema must also declare
// themselves as app module config messages using the cosmos.app.v1.is_module
// option.
ModuleSchemaDescriptor module_schema = 104503792;
}
// ModuleSchemaDescriptor describe's a module's ORM schema.
message ModuleSchemaDescriptor {
repeated FileEntry schema_file = 1;
// FileEntry describes an ORM file used in a module.
message FileEntry {
// id is a prefix that will be varint encoded and prepended to all the
// table keys specified in the file's tables.
uint32 id = 1;
// proto_file_name is the name of a file .proto in that contains
// table definitions. The .proto file must be in a package that the
// module has referenced using cosmos.app.v1.ModuleDescriptor.use_package.
string proto_file_name = 2;
// storage_type optionally indicates the type of storage this file's
// tables should used. If it is left unspecified, the default KV-storage
// of the app will be used.
StorageType storage_type = 3;
}
// prefix is an optional prefix that precedes all keys in this module's
// store.
bytes prefix = 2;
}
// StorageType
enum StorageType {
// STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent
// KV-storage where primary key entries are stored in merkle-tree
// backed commitment storage and indexes and seqs are stored in
// fast index storage. Note that the Cosmos SDK before store/v2alpha1
// does not support this.
STORAGE_TYPE_DEFAULT_UNSPECIFIED = 0;
// STORAGE_TYPE_MEMORY indicates in-memory storage that will be
// reloaded every time an app restarts. Tables with this type of storage
// will by default be ignored when importing and exporting a module's
// state from JSON.
STORAGE_TYPE_MEMORY = 1;
// STORAGE_TYPE_TRANSIENT indicates transient storage that is reset
// at the end of every block. Tables with this type of storage
// will by default be ignored when importing and exporting a module's
// state from JSON.
STORAGE_TYPE_TRANSIENT = 2;
// STORAGE_TYPE_INDEX indicates persistent storage which is not backed
// by a merkle-tree and won't affect the app hash. Note that the Cosmos SDK
// before store/v2alpha1 does not support this.
STORAGE_TYPE_INDEX = 3;
// STORAGE_TYPE_INDEX indicates persistent storage which is backed by
// a merkle-tree. With this type of storage, both primary and index keys
// will affect the app hash and this is generally less efficient
// than using STORAGE_TYPE_DEFAULT_UNSPECIFIED which separates index
// keys into index storage. Note that modules built with the
// Cosmos SDK before store/v2alpha1 must specify STORAGE_TYPE_COMMITMENT
// instead of STORAGE_TYPE_DEFAULT_UNSPECIFIED or STORAGE_TYPE_INDEX
// because this is the only type of persistent storage available.
STORAGE_TYPE_COMMITMENT = 4;
}

View File

@ -5,11 +5,13 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/params/types/prop
option (gogoproto.equal_all) = true;
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
// ParameterChangeProposal defines a proposal to change one or more parameters.
message ParameterChangeProposal {
option (gogoproto.goproto_getters) = false;
option (gogoproto.goproto_stringer) = false;
option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";
string title = 1;
string description = 2;

View File

@ -14,6 +14,13 @@ service Query {
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/cosmos/params/v1beta1/params";
}
// Subspaces queries for all registered subspaces and all keys for a subspace.
//
// Since: cosmos-sdk 0.46
rpc Subspaces(QuerySubspacesRequest) returns (QuerySubspacesResponse) {
option (google.api.http).get = "/cosmos/params/v1beta1/subspaces";
}
}
// QueryParamsRequest is request type for the Query/Params RPC method.
@ -30,3 +37,26 @@ message QueryParamsResponse {
// param defines the queried parameter.
ParamChange param = 1 [(gogoproto.nullable) = false];
}
// QuerySubspacesRequest defines a request type for querying for all registered
// subspaces and all keys for a subspace.
//
// Since: cosmos-sdk 0.46
message QuerySubspacesRequest {}
// QuerySubspacesResponse defines the response types for querying for all
// registered subspaces and all keys for a subspace.
//
// Since: cosmos-sdk 0.46
message QuerySubspacesResponse {
repeated Subspace subspaces = 1;
}
// Subspace defines a parameter subspace name and all the keys that exist for
// the subspace.
//
// Since: cosmos-sdk 0.46
message Subspace {
string subspace = 1;
repeated string keys = 2;
}

View File

@ -5,6 +5,7 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/slashing/types";
import "gogoproto/gogo.proto";
import "cosmos/slashing/v1beta1/slashing.proto";
import "cosmos_proto/cosmos.proto";
// GenesisState defines the slashing module's genesis state.
message GenesisState {
@ -13,32 +14,28 @@ message GenesisState {
// signing_infos represents a map between validator addresses and their
// signing infos.
repeated SigningInfo signing_infos = 2
[(gogoproto.moretags) = "yaml:\"signing_infos\"", (gogoproto.nullable) = false];
repeated SigningInfo signing_infos = 2 [(gogoproto.nullable) = false];
// missed_blocks represents a map between validator addresses and their
// missed blocks.
repeated ValidatorMissedBlocks missed_blocks = 3
[(gogoproto.moretags) = "yaml:\"missed_blocks\"", (gogoproto.nullable) = false];
repeated ValidatorMissedBlocks missed_blocks = 3 [(gogoproto.nullable) = false];
}
// SigningInfo stores validator signing info of corresponding address.
message SigningInfo {
// address is the validator address.
string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// validator_signing_info represents the signing info of this validator.
ValidatorSigningInfo validator_signing_info = 2
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"validator_signing_info\""];
ValidatorSigningInfo validator_signing_info = 2 [(gogoproto.nullable) = false];
}
// ValidatorMissedBlocks contains array of missed blocks of corresponding
// address.
message ValidatorMissedBlocks {
// address is the validator address.
string address = 1;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// missed_blocks is an array of missed blocks by the validator.
repeated MissedBlock missed_blocks = 2
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"missed_blocks\""];
repeated MissedBlock missed_blocks = 2 [(gogoproto.nullable) = false];
}
// MissedBlock contains height and missed status as boolean.

Some files were not shown because too many files have changed in this diff Show More