Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: prepare release for 0.2.4-alpha.1 #265

Merged
merged 7 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## v0.2.4-alpha.1
This release includes 4 features and 1 bugfix.

Features:
* [#256](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/256) feat: add Nagqu fork name for upcoming upgrading
* [#258](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/258) feat: add flag to enable or disable heavy queries
* [#263](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/263) feat: add MsgRenewGroupMember to renew storage group member
* [#262](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/262) feat: add MsgUpdateStorageProviderStatus to update sp status

Fix:
* [#257](https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/257) fix: add bls proof in proposal description

## v0.2.3
This is a official release for v0.2.3, includes all the changes since v0.2.2.

## v0.2.3-alpha.5
This is a maintenance release.

Expand Down
3 changes: 2 additions & 1 deletion baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,8 @@ func (app *BaseApp) CreateQueryContext(height int64, prove bool, path ...string)
// branch the commit-multistore for safety
ctx := sdk.NewContext(cacheMS, qs.ctx.BlockHeader(), true, app.upgradeChecker, app.logger).
WithMinGasPrices(app.minGasPrices).
WithBlockHeight(height)
WithBlockHeight(height).
WithEnableUnsafeQuery(app.enableUnsafeQuery)

if height != lastBlockHeight {
rms, ok := app.cms.(*rootmulti.Store)
Expand Down
5 changes: 4 additions & 1 deletion baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,11 @@ type BaseApp struct { //nolint: maligned
// upgradeChecker is a hook function from the upgrade module to check upgrade is executed or not.
upgradeChecker func(ctx sdk.Context, name string) bool

// Signatures of recent blocks to speed up
// sigCache caches the signatures of recent blocks to speed up
sigCache *lru.ARCCache

// enableUnsafeQuery defines whether the unsafe queries will be enabled or not
enableUnsafeQuery bool
}

// NewBaseApp returns a reference to an initialized BaseApp. It accepts a
Expand Down
5 changes: 5 additions & 0 deletions baseapp/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ func SetChainID(chainID string) func(*BaseApp) {
return func(app *BaseApp) { app.chainID = chainID }
}

// SetEnableUnsafeQuery sets the flag to enable unsafe query in BaseApp.
func SetEnableUnsafeQuery(enabled bool) func(*BaseApp) {
return func(app *BaseApp) { app.enableUnsafeQuery = enabled }
}

func (app *BaseApp) SetName(name string) {
if app.sealed {
panic("SetName() on sealed BaseApp")
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ replace (
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.23.0

github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v0.0.2-alpha.2
github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-cometbft v0.0.2
github.com/cometbft/cometbft-db => github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1
github.com/cosmos/iavl => github.com/bnb-chain/greenfield-iavl v0.20.1-alpha.1
github.com/cosmos/iavl => github.com/bnb-chain/greenfield-iavl v0.20.1

// Downgraded to avoid bugs in following commits which caused simulations to fail.
// dgrijalva/jwt-go is deprecated and doesn't receive security updates.
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,12 @@ github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsy
github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI=
github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k=
github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c=
github.com/bnb-chain/greenfield-cometbft v0.0.2-alpha.2 h1:ys9kmgtRx04wcCextE6CrVmbL1bJDklWr+hWgm1y2k4=
github.com/bnb-chain/greenfield-cometbft v0.0.2-alpha.2/go.mod h1:EBmwmUdaNbGPyGjf1cMuoN3pAeM2tQu7Lfg95813EAw=
github.com/bnb-chain/greenfield-cometbft v0.0.2 h1:bRamS8Lq1lA3ttRLZBha22uiNG5tqN+diD3hapdUCYI=
github.com/bnb-chain/greenfield-cometbft v0.0.2/go.mod h1:EBmwmUdaNbGPyGjf1cMuoN3pAeM2tQu7Lfg95813EAw=
github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1 h1:XcWulGacHVRiSCx90Q8Y//ajOrLNBQWR/KDB89dy3cU=
github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1/go.mod h1:ey1CiK4bYo1RBNJLRiVbYr5CMdSxci9S/AZRINLtppI=
github.com/bnb-chain/greenfield-iavl v0.20.1-alpha.1 h1:ZnIcvkkQVurg0OaAwmUGn2cK5bZbffjVChFyhh86HMk=
github.com/bnb-chain/greenfield-iavl v0.20.1-alpha.1/go.mod h1:oLksTs8dfh7DYIKBro7hbRQ+ewls7ghJ27pIXlbEXyI=
github.com/bnb-chain/greenfield-iavl v0.20.1 h1:y3L64GU99otNp27/xLVBTDbv4eroR6CzoYz0rbaVotM=
github.com/bnb-chain/greenfield-iavl v0.20.1/go.mod h1:oLksTs8dfh7DYIKBro7hbRQ+ewls7ghJ27pIXlbEXyI=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc=
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
Expand Down
4 changes: 4 additions & 0 deletions server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ type BaseConfig struct {
// AppDBBackend defines the type of Database to use for the application and snapshots databases.
// An empty string indicates that the Tendermint config's DBBackend value should be used.
AppDBBackend string `mapstructure:"app-db-backend"`

// EnableUnsafeQuery enable/disable unsafe query apis.
EnableUnsafeQuery bool `mapstructure:"enable-unsafe-query"`
}

// APIConfig defines the API listener configuration.
Expand Down Expand Up @@ -279,6 +282,7 @@ func DefaultConfig() *Config {
IAVLDisableFastNode: false,
IAVLLazyLoading: false,
AppDBBackend: "",
EnableUnsafeQuery: false,
},
Telemetry: telemetry.Config{
Enabled: false,
Expand Down
4 changes: 4 additions & 0 deletions server/config/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ iavl-lazy-loading = {{ .BaseConfig.IAVLLazyLoading }}
# Second fallback (if the types.DBBackend also isn't set), is the db-backend value set in Tendermint's config.toml.
app-db-backend = "{{ .BaseConfig.AppDBBackend }}"

# EnableUnsafeQuery enables or disables the unsafe queries.
# Default is false.
enable-unsafe-query = "{{ .BaseConfig.EnableUnsafeQuery }}"

###############################################################################
### Upgrade Configuration ###
###############################################################################
Expand Down
3 changes: 3 additions & 0 deletions server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ const (
FlagDisableIAVLFastNode = "iavl-disable-fastnode"
FlagIAVLLazyLoading = "iavl-lazy-loading"

FlagEnableUnsafeQuery = "enable-unsafe-query"

// state sync-related flags
FlagStateSyncSnapshotInterval = "state-sync.snapshot-interval"
FlagStateSyncSnapshotKeepRecent = "state-sync.snapshot-keep-recent"
Expand Down Expand Up @@ -186,6 +188,7 @@ is performed. Note, when enabled, gRPC will also be automatically enabled.
cmd.Flags().Uint(FlagInvCheckPeriod, 0, "Assert registered invariants every N blocks")
cmd.Flags().Uint64(FlagMinRetainBlocks, 0, "Minimum block height offset during ABCI commit to prune Tendermint blocks")
cmd.Flags().String(FlagEventing, sdk.EventingOptionEverything, "Eventing strategy (everything|nothing)")
cmd.Flags().Bool(FlagEnableUnsafeQuery, false, "Define if unsafe query should be enabled (unsafe - use it at your own risk)")

cmd.Flags().Bool(FlagAPIEnable, false, "Define if the API server should be enabled")
cmd.Flags().Bool(FlagAPISwagger, false, "Define if swagger documentation should automatically be registered (Note: the API must also be enabled)")
Expand Down
1 change: 1 addition & 0 deletions server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ func DefaultBaseappOptions(appOpts types.AppOptions) []func(*baseapp.BaseApp) {
),
baseapp.SetIAVLLazyLoading(cast.ToBool(appOpts.Get(FlagIAVLLazyLoading))),
baseapp.SetChainID(chainID),
baseapp.SetEnableUnsafeQuery(cast.ToBool(appOpts.Get(FlagEnableUnsafeQuery))),
}
}

Expand Down
11 changes: 11 additions & 0 deletions types/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type Context struct {
upgradeChecker func(ctx Context, name string) bool
txSize uint64 // The tx bytes length
sigCache *lru.ARCCache
enableUnsafeQuery bool
}

// Proposed rename, not done to avoid API breakage
Expand Down Expand Up @@ -76,6 +77,10 @@ func (c Context) IsUpgraded(name string) bool {
return c.upgradeChecker(c, name)
}

func (c Context) IsEnableUnsafeQuery() bool {
return c.enableUnsafeQuery
}

// clone the header before returning
func (c Context) BlockHeader() tmproto.Header {
msg := proto.Clone(&c.header).(*tmproto.Header)
Expand Down Expand Up @@ -279,6 +284,12 @@ func (c Context) WithSigCache(cache *lru.ARCCache) Context {
return c
}

// WithEnableUnsafeQuery returns a Context with unsafe query enabled
func (c Context) WithEnableUnsafeQuery(enabled bool) Context {
c.enableUnsafeQuery = enabled
return c
}

// TODO: remove???
func (c Context) IsZero() bool {
return c.ms == nil
Expand Down
9 changes: 9 additions & 0 deletions types/query/pagination.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"google.golang.org/grpc/status"

"github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)

// DefaultPage is the default `page` number for queries.
Expand All @@ -23,6 +24,14 @@ const DefaultLimit = 100
// which equals the maximum value that can be stored in uint64
const MaxLimit = math.MaxUint64

// CheckOffsetQueryNotAllowed is used for checking query which offset/count total parameter is not allowed
func CheckOffsetQueryNotAllowed(ctx sdk.Context, req *PageRequest) error {
if req != nil && (req.Offset > 0 || req.CountTotal) && !ctx.IsEnableUnsafeQuery() {
return status.Error(codes.InvalidArgument, "query with offset/count total is not allowed")
}
return nil
}

// ParsePagination validate PageRequest and returns page number & limit.
func ParsePagination(pageReq *PageRequest) (page, limit int, err error) {
offset := 0
Expand Down
3 changes: 2 additions & 1 deletion x/auth/keeper/deterministic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package keeper_test

import (
"encoding/hex"
"github.com/cosmos/cosmos-sdk/types/query"
"sort"
"testing"

Expand Down Expand Up @@ -129,7 +130,7 @@ func (suite *DeterministicTestSuite) TestGRPCQueryAccounts() {
numAccs := rapid.IntRange(1, 10).Draw(t, "accounts")
accs := suite.createAndSetAccounts(t, numAccs)

req := &types.QueryAccountsRequest{Pagination: testdata.PaginationGenerator(t, uint64(numAccs)).Draw(t, "accounts")}
req := &types.QueryAccountsRequest{Pagination: &query.PageRequest{}}
testdata.DeterministicIterations(suite.ctx, suite.Require(), req, suite.queryClient.Accounts, 0, true)

for i := 0; i < numAccs; i++ {
Expand Down
6 changes: 6 additions & 0 deletions x/auth/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ func (ak AccountKeeper) Accounts(c context.Context, req *types.QueryAccountsRequ
}

ctx := sdk.UnwrapSDKContext(c)

// offset query is not allowed
if err := query.CheckOffsetQueryNotAllowed(ctx, req.Pagination); err != nil {
return nil, err
}

store := ctx.KVStore(ak.storeKey)
accountsStore := prefix.NewStore(store, types.AddressStoreKeyPrefix)

Expand Down
4 changes: 3 additions & 1 deletion x/evidence/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ func (k Keeper) AllEvidence(c context.Context, req *types.QueryAllEvidenceReques
}
ctx := sdk.UnwrapSDKContext(c)

k.GetAllEvidence(ctx)
if err := query.CheckOffsetQueryNotAllowed(ctx, req.Pagination); err != nil {
return nil, err
}

var evidence []*codectypes.Any
store := ctx.KVStore(k.storeKey)
Expand Down
2 changes: 2 additions & 0 deletions x/gashub/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func DefaultGenesisState() *GenesisState {
*NewMsgGasParamsWithFixedGas("/greenfield.sp.MsgDeposit", 1.2e3),
*NewMsgGasParamsWithFixedGas("/greenfield.sp.MsgEditStorageProvider", 2e7),
*NewMsgGasParamsWithFixedGas("/greenfield.sp.MsgUpdateSpStoragePrice", 2e7),
*NewMsgGasParamsWithFixedGas("/greenfield.sp.MsgUpdateStorageProviderStatus", 1.2e3),
*NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgCreateBucket", 2.4e3),
*NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgDeleteBucket", 1.2e3),
*NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgMirrorBucket", 1.2e3),
Expand All @@ -102,6 +103,7 @@ func DefaultGenesisState() *GenesisState {
*NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgLeaveGroup", 1.2e3),
*NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgUpdateGroupMember", 1.2e3),
*NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgUpdateGroupExtra", 1.2e3),
*NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgRenewGroupMember", 1.2e3),
*NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgMirrorGroup", 1.2e3),
*NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgPutPolicy", 2.4e3),
*NewMsgGasParamsWithFixedGas("/greenfield.storage.MsgDeletePolicy", 1.2e3),
Expand Down
3 changes: 2 additions & 1 deletion x/staking/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ Where create_validator_proposal.json contains:
"from": "0x7b5Fe22B5446f7C62Ea27B8BD71CeF94e03f3dF2",
"relayer_address": "${RELAYER_ADDR}",
"challenger_address": "${CHALLENGER_ADDR}",
"bls_key": "${VALIDATOR_BLS}"
"bls_key": "${VALIDATOR_BLS}",
"bls_proof": "${VALIDATOR_BLS_PROOF}"
}
],
"metadata": "",
Expand Down
3 changes: 3 additions & 0 deletions x/upgrade/types/upgrade_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import (
const (
// EnablePublicDelegationUpgrade is the upgrade name for enabling public delegation
EnablePublicDelegationUpgrade = "EnablePublicDelegationUpgrade"

// Nagqu is the upgrade name for following features:
Nagqu = "Nagqu"
)

// The default upgrade config for networks
Expand Down
Loading