feat: increase gas cost for submit proposal (#9995)
* increase gas cost for submit proposal * fix tests * fix tests * address review changes * fix tests * review changes * revert tests Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> Co-authored-by: Robert Zaremba <robert@zaremba.ch>
This commit is contained in:
parent
16a953cc97
commit
6f335143d9
|
@ -99,6 +99,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||||
|
|
||||||
* [\#9879](https://github.com/cosmos/cosmos-sdk/pull/9879) Modify ABCI Queries to use `abci.QueryRequest` Height field if it is non-zero, otherwise continue using context height.
|
* [\#9879](https://github.com/cosmos/cosmos-sdk/pull/9879) Modify ABCI Queries to use `abci.QueryRequest` Height field if it is non-zero, otherwise continue using context height.
|
||||||
* [\#9594](https://github.com/cosmos/cosmos-sdk/pull/9594) Remove legacy REST API. Please see the [REST Endpoints Migration guide](https://docs.cosmos.network/master/migrations/rest.html) to migrate to the new REST endpoints.
|
* [\#9594](https://github.com/cosmos/cosmos-sdk/pull/9594) Remove legacy REST API. Please see the [REST Endpoints Migration guide](https://docs.cosmos.network/master/migrations/rest.html) to migrate to the new REST endpoints.
|
||||||
|
* [\#9995](https://github.com/cosmos/cosmos-sdk/pull/9995) Increased gas cost for creating proposals.
|
||||||
|
|
||||||
### CLI Breaking Changes
|
### CLI Breaking Changes
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,7 @@ func TestTickExpiredDepositPeriod(t *testing.T) {
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
wrapCtx := sdk.WrapSDKContext(ctx)
|
res, err := govMsgSvr.SubmitProposal(sdk.WrapSDKContext(ctx), newProposalMsg)
|
||||||
res, err := govMsgSvr.SubmitProposal(wrapCtx, newProposalMsg)
|
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NotNil(t, res)
|
require.NotNil(t, res)
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/armon/go-metrics"
|
"github.com/armon/go-metrics"
|
||||||
|
|
||||||
|
store "github.com/cosmos/cosmos-sdk/store/types"
|
||||||
"github.com/cosmos/cosmos-sdk/telemetry"
|
"github.com/cosmos/cosmos-sdk/telemetry"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/gov/types"
|
"github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||||
|
@ -31,6 +32,17 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *types.MsgSubmitPro
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bytes, err := proposal.Marshal()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ref: https://github.com/cosmos/cosmos-sdk/issues/9683
|
||||||
|
ctx.GasMeter().ConsumeGas(
|
||||||
|
3*store.KVGasConfig().WriteCostPerByte*uint64(len(bytes)),
|
||||||
|
"submit proposal",
|
||||||
|
)
|
||||||
|
|
||||||
defer telemetry.IncrCounter(1, types.ModuleName, "proposal")
|
defer telemetry.IncrCounter(1, types.ModuleName, "proposal")
|
||||||
|
|
||||||
votingStarted, err := k.Keeper.AddDeposit(ctx, proposal.ProposalId, msg.GetProposer(), msg.GetInitialDeposit())
|
votingStarted, err := k.Keeper.AddDeposit(ctx, proposal.ProposalId, msg.GetProposer(), msg.GetInitialDeposit())
|
||||||
|
|
Loading…
Reference in New Issue