From 058072e37a76caf5a5ed53e0b2a47822d821b5f5 Mon Sep 17 00:00:00 2001 From: codchen Date: Thu, 4 May 2023 10:18:14 +0800 Subject: [PATCH] add test & min processable rent --- proto/dex/params.proto | 4 ++ x/dex/contract/abci.go | 4 +- x/dex/keeper/params.go | 4 ++ x/dex/module.go | 2 +- x/dex/module_test.go | 11 ++-- x/dex/types/params.go | 4 ++ x/dex/types/params.pb.go | 111 +++++++++++++++++++++++++++------------ 7 files changed, 99 insertions(+), 41 deletions(-) diff --git a/proto/dex/params.proto b/proto/dex/params.proto index d38d59fa33..e23b06c3c9 100644 --- a/proto/dex/params.proto +++ b/proto/dex/params.proto @@ -43,4 +43,8 @@ message Params { (gogoproto.jsontag) = "gas_allowance_per_settlement", (gogoproto.moretags) = "yaml:\"gas_allowance_per_settlement\"" ]; + uint64 min_processable_rent = 9 [ + (gogoproto.jsontag) = "min_processable_rent", + (gogoproto.moretags) = "yaml:\"min_processable_rent\"" + ]; } diff --git a/x/dex/contract/abci.go b/x/dex/contract/abci.go index ef59065c86..e846ab2d92 100644 --- a/x/dex/contract/abci.go +++ b/x/dex/contract/abci.go @@ -105,7 +105,7 @@ func EndBlockerAtomic(ctx sdk.Context, keeper *keeper.Keeper, validContractsInfo // restore keeper in-memory state newGoContext := context.WithValue(ctx.Context(), dexutils.DexMemStateContextKey, memStateCopy) - return filterNewValidContracts(ctx, env), getOutOfRentContracts(ctx, env), ctx.WithContext(newGoContext), false + return filterNewValidContracts(ctx, env), getOutOfRentContracts(env), ctx.WithContext(newGoContext), false } func newEnv(ctx sdk.Context, validContractsInfo []types.ContractInfoV2, keeper *keeper.Keeper) *environment { @@ -271,7 +271,7 @@ func filterNewValidContracts(ctx sdk.Context, env *environment) []types.Contract return newValidContracts } -func getOutOfRentContracts(ctx sdk.Context, env *environment) []types.ContractInfoV2 { +func getOutOfRentContracts(env *environment) []types.ContractInfoV2 { outOfRentContracts := []types.ContractInfoV2{} for _, contract := range env.validContractsInfo { if env.outOfRentContractAddresses.Contains(contract.ContractAddr) { diff --git a/x/dex/keeper/params.go b/x/dex/keeper/params.go index e6e3e3bab4..520cdf8213 100644 --- a/x/dex/keeper/params.go +++ b/x/dex/keeper/params.go @@ -16,6 +16,10 @@ func (k Keeper) GetSettlementGasAllowance(ctx sdk.Context, numSettlements int) u return k.GetParams(ctx).GasAllowancePerSettlement * uint64(numSettlements) } +func (k Keeper) GetMinProcessableRent(ctx sdk.Context) uint64 { + return k.GetParams(ctx).MinProcessableRent +} + // SetParams set the params func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { k.Paramstore.SetParamSet(ctx, ¶ms) diff --git a/x/dex/module.go b/x/dex/module.go index 6215c48604..4188d273f9 100644 --- a/x/dex/module.go +++ b/x/dex/module.go @@ -227,7 +227,7 @@ func (am AppModule) getAllContractInfo(ctx sdk.Context) []types.ContractInfoV2 { // Do not process any contract that has zero rent balance defer telemetry.MeasureSince(time.Now(), am.Name(), "get_all_contract_info") allRegisteredContracts := am.keeper.GetAllContractInfo(ctx) - validContracts := utils.Filter(allRegisteredContracts, func(c types.ContractInfoV2) bool { return c.RentBalance > 0 }) + validContracts := utils.Filter(allRegisteredContracts, func(c types.ContractInfoV2) bool { return c.RentBalance > am.keeper.GetMinProcessableRent(ctx) }) telemetry.SetGauge(float32(len(allRegisteredContracts)), am.Name(), "num_of_registered_contracts") telemetry.SetGauge(float32(len(validContracts)), am.Name(), "num_of_valid_contracts") telemetry.SetGauge(float32(len(allRegisteredContracts)-len(validContracts)), am.Name(), "num_of_zero_balance_contracts") diff --git a/x/dex/module_test.go b/x/dex/module_test.go index 5b00085afa..c1b5667b60 100644 --- a/x/dex/module_test.go +++ b/x/dex/module_test.go @@ -616,6 +616,10 @@ func TestEndBlockRollbackWithRentCharge(t *testing.T) { Amount: sdk.MustNewDecFromStr("10000"), }, ) + // overwrite params for testing + params := dexkeeper.GetParams(ctx) + params.MinProcessableRent = 0 + dexkeeper.SetParams(ctx, params) ctx = ctx.WithBlockHeight(1) creatorBalanceBefore := bankkeeper.GetBalance(ctx, testAccount, "usei") @@ -625,8 +629,9 @@ func TestEndBlockRollbackWithRentCharge(t *testing.T) { require.Equal(t, 0, len(matchResult.Orders)) // rent should still be charged even if the contract failed, so no rent should be sent to the creator after // auto unregister - _, err = dexkeeper.GetContract(ctx, contractAddr.String()) - require.NotNil(t, err) // auto-unregistered + c, err := dexkeeper.GetContract(ctx, contractAddr.String()) + require.Nil(t, err) // out-of-rent contract should not be auto-unregistered + require.Equal(t, uint64(0), c.RentBalance) // rent balance should be drained creatorBalanceAfter := bankkeeper.GetBalance(ctx, testAccount, "usei") require.Equal(t, creatorBalanceBefore, creatorBalanceAfter) } @@ -671,6 +676,6 @@ func TestEndBlockContractWithoutPair(t *testing.T) { ti := tracing.Info{ Tracer: &tr, } - _, _, success := contract.EndBlockerAtomic(ctx, &testApp.DexKeeper, []types.ContractInfoV2{contractInfo}, &ti) + _, _, _, success := contract.EndBlockerAtomic(ctx, &testApp.DexKeeper, []types.ContractInfoV2{contractInfo}, &ti) require.True(t, success) } diff --git a/x/dex/types/params.go b/x/dex/types/params.go index b2bb7a1908..4599264b24 100644 --- a/x/dex/types/params.go +++ b/x/dex/types/params.go @@ -17,6 +17,7 @@ var ( KeyDefaultGasPerCancel = []byte("KeyDefaultGasPerCancel") KeyMinRentDeposit = []byte("KeyMinRentDeposit") KeyGasAllowancePerSettlement = []byte("KeyGasAllowancePerSettlement") + KeyMinProcessableRent = []byte("KeyMinProcessableRent") ) const ( @@ -27,6 +28,7 @@ const ( DefaultDefaultGasPerCancel = 55000 DefaultMinRentDeposit = 10000000 // 10 sei DefaultGasAllowancePerSettlement = 10000 + DefaultMinProcessableRent = 100000 ) var DefaultSudoCallGasPrice = sdk.NewDecWithPrec(1, 1) // 0.1 @@ -49,6 +51,7 @@ func DefaultParams() Params { DefaultGasPerCancel: DefaultDefaultGasPerCancel, MinRentDeposit: DefaultMinRentDeposit, GasAllowancePerSettlement: DefaultGasAllowancePerSettlement, + MinProcessableRent: DefaultMinProcessableRent, } } @@ -63,6 +66,7 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeyDefaultGasPerCancel, &p.DefaultGasPerCancel, validateUint64Param), paramtypes.NewParamSetPair(KeyMinRentDeposit, &p.MinRentDeposit, validateUint64Param), paramtypes.NewParamSetPair(KeyGasAllowancePerSettlement, &p.GasAllowancePerSettlement, validateUint64Param), + paramtypes.NewParamSetPair(KeyMinProcessableRent, &p.MinProcessableRent, validateUint64Param), } } diff --git a/x/dex/types/params.pb.go b/x/dex/types/params.pb.go index 383a933dfe..36119e16c5 100644 --- a/x/dex/types/params.pb.go +++ b/x/dex/types/params.pb.go @@ -34,6 +34,7 @@ type Params struct { DefaultGasPerCancel uint64 `protobuf:"varint,6,opt,name=default_gas_per_cancel,json=defaultGasPerCancel,proto3" json:"default_gas_per_cancel" yaml:"default_gas_per_cancel"` MinRentDeposit uint64 `protobuf:"varint,7,opt,name=min_rent_deposit,json=minRentDeposit,proto3" json:"min_rent_deposit" yaml:"min_rent_deposit"` GasAllowancePerSettlement uint64 `protobuf:"varint,8,opt,name=gas_allowance_per_settlement,json=gasAllowancePerSettlement,proto3" json:"gas_allowance_per_settlement" yaml:"gas_allowance_per_settlement"` + MinProcessableRent uint64 `protobuf:"varint,9,opt,name=min_processable_rent,json=minProcessableRent,proto3" json:"min_processable_rent" yaml:"min_processable_rent"` } func (m *Params) Reset() { *m = Params{} } @@ -117,6 +118,13 @@ func (m *Params) GetGasAllowancePerSettlement() uint64 { return 0 } +func (m *Params) GetMinProcessableRent() uint64 { + if m != nil { + return m.MinProcessableRent + } + return 0 +} + func init() { proto.RegisterType((*Params)(nil), "seiprotocol.seichain.dex.Params") } @@ -124,41 +132,44 @@ func init() { func init() { proto.RegisterFile("dex/params.proto", fileDescriptor_e49286500ccff43e) } var fileDescriptor_e49286500ccff43e = []byte{ - // 544 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00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 0x95, 0x0a, 0xad, 0x69, 0x54, 0x0a, 0x3d, 0x69, 0xf6, 0xd5, 0xdc, 0x0f, 0x3b, - 0xd7, 0x84, 0xc7, 0x26, 0x75, 0x3e, 0xd8, 0xed, 0x8c, 0xb0, 0xa8, 0x00, 0x26, 0xa3, 0x04, 0x72, - 0x2e, 0x88, 0x74, 0xb7, 0x8c, 0x2b, 0x28, 0x15, 0xba, 0xc5, 0x2a, 0x85, 0x1e, 0xd5, 0x96, 0x9b, - 0xc4, 0x0f, 0x1f, 0x64, 0x84, 0x85, 0xc0, 0xe4, 0x49, 0x1d, 0x38, 0x5f, 0x2c, 0x7b, 0x5f, 0xbf, - 0x01, 0x53, 0xca, 0x3f, 0x6b, 0x9b, 0x79, 0x8d, 0x00, 0x29, 0x29, 0x64, 0xc0, 0xa4, 0xbb, 0x6d, - 0x3c, 0x83, 0x52, 0xa1, 0x3b, 0x7b, 0x95, 0x42, 0x4f, 0x6b, 0xe7, 0x5d, 0x2d, 0x3f, 0x7c, 0x9c, - 0x62, 0xf1, 0x66, 0x45, 0x87, 0x50, 0x9c, 0xfe, 0x65, 0x47, 0xdb, 0xdf, 0xce, 0x51, 0xeb, 0xf7, - 0x39, 0xb2, 0xfa, 0x83, 0x8b, 0xb9, 0x67, 0x5d, 0xce, 0x3d, 0xeb, 0xd7, 0xdc, 0xb3, 0xbe, 0x2e, - 0xbc, 0xd6, 0xe5, 0xc2, 0x6b, 0xfd, 0x58, 0x78, 0xad, 0x8f, 0xdd, 0x7f, 0xd6, 0x41, 0x00, 0xe9, - 0xae, 0xb6, 0xde, 0x7c, 0x31, 0x6b, 0x1f, 0x4c, 0x03, 0xfd, 0xff, 0x60, 0x36, 0x63, 0xb4, 0x69, - 0xf8, 0xf3, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x06, 0x0d, 0x5e, 0xe5, 0x33, 0x04, 0x00, 0x00, + // 581 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0x3f, 0x6f, 0xd4, 0x30, + 0x18, 0xc6, 0x2f, 0x50, 0x4a, 0x9b, 0x01, 0x9d, 0xdc, 0x3f, 0x84, 0x52, 0xe2, 0x2a, 0x48, 0xa8, + 0x4b, 0x2f, 0x03, 0x42, 0x88, 0x32, 0x20, 0xae, 0x45, 0xb7, 0x20, 0x71, 0x4a, 0x27, 0x58, 0x22, + 0x5f, 0xf2, 0x92, 0x5a, 0x75, 0xec, 0x28, 0x76, 0x45, 0xfb, 0x0d, 0x3a, 0x32, 0x32, 0xf6, 0xe3, + 0x74, 0xec, 0x88, 0x18, 0x2c, 0xd4, 0x2e, 0x28, 0x63, 0x3e, 0x01, 0xb2, 0x73, 0xc7, 0xd1, 0x6b, + 0xae, 0xd3, 0xf9, 0x9e, 0xdf, 0x23, 0x3f, 0xef, 0x13, 0xc9, 0xaf, 0xdb, 0x4d, 0xe1, 0x24, 0x2c, + 0x48, 0x49, 0x72, 0xd9, 0x2b, 0x4a, 0xa1, 0x04, 0xf2, 0x24, 0x50, 0x7b, 0x4a, 0x04, 0xeb, 0x49, + 0xa0, 0xc9, 0x21, 0xa1, 0xbc, 0x97, 0xc2, 0xc9, 0xc6, 0x6a, 0x26, 0x32, 0x61, 0x51, 0x68, 0x4e, + 0x8d, 0x3f, 0x38, 0x5b, 0x72, 0x17, 0x87, 0xf6, 0x02, 0x74, 0xea, 0x7a, 0x45, 0x49, 0x13, 0x88, + 0x25, 0x27, 0x85, 0x3c, 0x14, 0x2a, 0x2e, 0x41, 0x01, 0x57, 0x54, 0x70, 0xcf, 0xd9, 0x72, 0xb6, + 0x17, 0xfa, 0xef, 0x2a, 0x8d, 0xe7, 0x7a, 0x6a, 0x8d, 0xf1, 0x29, 0xc9, 0xd9, 0x6e, 0x30, 0xcf, + 0x11, 0x44, 0xeb, 0x16, 0x1d, 0x8c, 0x49, 0x34, 0x01, 0x48, 0xb9, 0x2b, 0xf2, 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1b, 0x26, 0x3c, 0x09, 0xcd, 0x2a, + 0xb2, 0x8f, 0x70, 0xb4, 0x68, 0xf9, 0xcb, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6c, 0xa1, 0x71, + 0xd8, 0x9e, 0x04, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -204,6 +215,9 @@ func (this *Params) Equal(that interface{}) bool { if this.GasAllowancePerSettlement != that1.GasAllowancePerSettlement { return false } + if this.MinProcessableRent != that1.MinProcessableRent { + return false + } return true } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -226,6 +240,11 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.MinProcessableRent != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MinProcessableRent)) + i-- + dAtA[i] = 0x48 + } if m.GasAllowancePerSettlement != 0 { i = encodeVarintParams(dAtA, i, uint64(m.GasAllowancePerSettlement)) i-- @@ -314,6 +333,9 @@ func (m *Params) Size() (n int) { if m.GasAllowancePerSettlement != 0 { n += 1 + sovParams(uint64(m.GasAllowancePerSettlement)) } + if m.MinProcessableRent != 0 { + n += 1 + sovParams(uint64(m.MinProcessableRent)) + } return n } @@ -519,6 +541,25 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinProcessableRent", wireType) + } + m.MinProcessableRent = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinProcessableRent |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:])