From cd30e0d8ef505b97a2dee1760c21b25894ae1cf6 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Fri, 6 Sep 2024 13:06:20 +0800 Subject: [PATCH 01/11] begin adding new parameters --- proto/feemarket/feemarket/v1/params.proto | 6 + x/feemarket/README.md | 1 + x/feemarket/types/eip1559.go | 1 + x/feemarket/types/eip1559_aimd.go | 1 + x/feemarket/types/params.go | 2 + x/feemarket/types/params.pb.go | 147 +++++++++++++++++----- 6 files changed, 128 insertions(+), 30 deletions(-) diff --git a/proto/feemarket/feemarket/v1/params.proto b/proto/feemarket/feemarket/v1/params.proto index 3038ada..8c3119d 100644 --- a/proto/feemarket/feemarket/v1/params.proto +++ b/proto/feemarket/feemarket/v1/params.proto @@ -89,4 +89,10 @@ message Params { // DistributeFees is a boolean that determines whether the fees are burned or // distributed to all stakers. bool distribute_fees = 12; + + // BurnAllFees is a boolean that determines whether all fees are burned instead of being distributed. + bool burn_all_fees = 13; + + // EnableTips is a boolean that determines whether tips are enabled. + bool enable_tips = 14; } diff --git a/x/feemarket/README.md b/x/feemarket/README.md index 4635cb6..1326248 100644 --- a/x/feemarket/README.md +++ b/x/feemarket/README.md @@ -38,6 +38,7 @@ AIMD EIP-1559 introduces a few new parameters to the EIP-1559 fee market: * **`MaxLearningRate`**: This is the maximum learning rate that can be applied to the base fee. This must be a value that is between `[0, 1]`. * **`MinLearningRate`**: This is the minimum learning rate that can be applied to the base fee. This must be a value that is between `[0, 1]`. * **`Delta`**: This is a trailing constant that is used to smooth the learning rate. In order to further converge the long term net gas usage and net gas goal, we introduce another integral term which tracks how much gas off from 0 gas we’re at. We add a constant c which basically forces the fee to slowly trend in some direction until this has gone to 0. +* **`BurnAllFees`**: This is a boolean that determines whether all fees are burned instead of being distributed. When set to `true`, it overrides the `DistributeFees` parameter. The calculation for the updated base fee for the next block is as follows: diff --git a/x/feemarket/types/eip1559.go b/x/feemarket/types/eip1559.go index b42757c..a3ea3c9 100644 --- a/x/feemarket/types/eip1559.go +++ b/x/feemarket/types/eip1559.go @@ -60,6 +60,7 @@ func DefaultParams() Params { DefaultMaxLearningRate, DefaultFeeDenom, true, + false, ) } diff --git a/x/feemarket/types/eip1559_aimd.go b/x/feemarket/types/eip1559_aimd.go index ac07474..4318d79 100644 --- a/x/feemarket/types/eip1559_aimd.go +++ b/x/feemarket/types/eip1559_aimd.go @@ -68,6 +68,7 @@ func DefaultAIMDParams() Params { DefaultAIMDMaxLearningRate, DefaultAIMDFeeDenom, true, + false, ) } diff --git a/x/feemarket/types/params.go b/x/feemarket/types/params.go index 267f2b0..ee2a79c 100644 --- a/x/feemarket/types/params.go +++ b/x/feemarket/types/params.go @@ -20,6 +20,7 @@ func NewParams( maxLearningRate math.LegacyDec, feeDenom string, enabled bool, + BurnAllFees bool, ) Params { return Params{ Alpha: alpha, @@ -33,6 +34,7 @@ func NewParams( Window: window, FeeDenom: feeDenom, Enabled: enabled, + BurnAllFees: BurnAllFees, } } diff --git a/x/feemarket/types/params.pb.go b/x/feemarket/types/params.pb.go index ac312b3..4f783ca 100644 --- a/x/feemarket/types/params.pb.go +++ b/x/feemarket/types/params.pb.go @@ -45,7 +45,7 @@ type Params struct { // // Must be [0, 0.5]. Gamma cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=gamma,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"gamma"` - // Delta is the amount we additively increase/decrease the base fee when the + // Delta is the amount we additively increase/decrease the gas price when the // net block utilization difference in the window is above/below the target // utilization. Delta cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=delta,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"delta"` @@ -69,6 +69,10 @@ type Params struct { // DistributeFees is a boolean that determines whether the fees are burned or // distributed to all stakers. DistributeFees bool `protobuf:"varint,12,opt,name=distribute_fees,json=distributeFees,proto3" json:"distribute_fees,omitempty"` + // BurnAllFees is a boolean that determines whether all fees are burned instead of being distributed. + BurnAllFees bool `protobuf:"varint,13,opt,name=burn_all_fees,json=burnAllFees,proto3" json:"burn_all_fees,omitempty"` + // EnableTips is a boolean that determines whether tips are enabled. + EnableTips bool `protobuf:"varint,14,opt,name=enable_tips,json=enableTips,proto3" json:"enable_tips,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -139,6 +143,20 @@ func (m *Params) GetDistributeFees() bool { return false } +func (m *Params) GetBurnAllFees() bool { + if m != nil { + return m.BurnAllFees + } + return false +} + +func (m *Params) GetEnableTips() bool { + if m != nil { + return m.EnableTips + } + return false +} + func init() { proto.RegisterType((*Params)(nil), "feemarket.feemarket.v1.Params") } @@ -148,35 +166,38 @@ func init() { } var fileDescriptor_3907de4df2e1c66e = []byte{ - // 447 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x86, 0x63, 0x48, 0xd2, 0x64, 0x41, 0x54, 0x2c, 0x50, 0x2d, 0xad, 0xe4, 0x46, 0x70, 0x20, - 0x97, 0xda, 0x0a, 0xbc, 0x41, 0x14, 0xa8, 0x90, 0x7a, 0xa8, 0x2c, 0x71, 0x41, 0x02, 0x6b, 0x6c, - 0x4f, 0x9c, 0x55, 0xbc, 0xbb, 0x96, 0x77, 0x93, 0xa6, 0x3c, 0x05, 0x0f, 0xc3, 0x43, 0xf4, 0x58, - 0x71, 0x42, 0x1c, 0x2a, 0x94, 0xbc, 0x02, 0x0f, 0x80, 0x76, 0x1d, 0x48, 0xe1, 0x68, 0x6e, 0xff, - 0x3f, 0x33, 0xff, 0xb7, 0xa3, 0x95, 0x86, 0x3c, 0x9f, 0x22, 0x0a, 0xa8, 0xe6, 0x68, 0xc2, 0x9d, - 0x5a, 0x8e, 0xc2, 0x12, 0x2a, 0x10, 0x3a, 0x28, 0x2b, 0x65, 0x14, 0x3d, 0xf8, 0xd3, 0x0a, 0x76, - 0x6a, 0x39, 0x3a, 0x7c, 0x9a, 0x2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x03, 0x6f, 0xd8, - 0x8e, 0x1e, 0x09, 0x58, 0x8d, 0x6d, 0xef, 0xdd, 0xae, 0x45, 0x0f, 0x48, 0xf7, 0x82, 0xcb, 0x4c, - 0x5d, 0xb0, 0xbe, 0x1b, 0xda, 0x3a, 0x7a, 0x44, 0xfa, 0x53, 0xc4, 0x38, 0x43, 0xa9, 0x04, 0x23, - 0x76, 0xc5, 0xa8, 0x37, 0x45, 0x9c, 0x58, 0x4f, 0x19, 0xd9, 0x43, 0x09, 0x49, 0x81, 0x19, 0xbb, - 0x37, 0xf0, 0x86, 0xbd, 0xe8, 0xb7, 0xa5, 0x2f, 0xc8, 0x7e, 0xc6, 0xb5, 0xa9, 0x78, 0xb2, 0x30, - 0x18, 0x4f, 0x11, 0x35, 0xbb, 0xef, 0x26, 0x1e, 0xec, 0xca, 0x6f, 0x10, 0xf5, 0xf8, 0xed, 0xd5, - 0xda, 0xf7, 0xae, 0xd7, 0xbe, 0xf7, 0x63, 0xed, 0x7b, 0x9f, 0x37, 0x7e, 0xeb, 0x7a, 0xe3, 0xb7, - 0xbe, 0x6d, 0xfc, 0xd6, 0xfb, 0x30, 0xe7, 0x66, 0xb6, 0x48, 0x82, 0x54, 0x89, 0x50, 0xcf, 0x79, - 0x79, 0x22, 0x70, 0x79, 0xeb, 0x10, 0x57, 0xb7, 0xb4, 0xb9, 0x2c, 0x51, 0x27, 0x5d, 0x77, 0x48, - 0xaf, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0x33, 0xa4, 0xbf, 0xc2, 0xb8, 0x03, 0x00, 0x00, + // 484 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0xc1, 0x6e, 0xd3, 0x4c, + 0x14, 0x85, 0xe3, 0xff, 0x4f, 0xd3, 0x64, 0x42, 0x5b, 0x31, 0x40, 0x35, 0xb4, 0x92, 0x13, 0x95, + 0x05, 0xd9, 0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, 0x58, 0xbd, 0x32, 0xc8, 0xf6, 0xe9, + 0x07, 0x42, 0x05, 0xcf, 0xc3, 0x08, 0x14, 0x86, 0x29, 0x98, 0xbf, 0xcc, 0x63, 0x64, 0x3b, 0x55, + 0xa9, 0x07, 0x82, 0xe7, 0x43, 0x50, 0x78, 0x06, 0xea, 0xc2, 0x90, 0xe8, 0x7b, 0x72, 0xdf, 0xf0, + 0x33, 0x84, 0x32, 0xe7, 0x79, 0x1a, 0x96, 0xa0, 0x91, 0x35, 0xfe, 0x05, 0x7f, 0xbe, 0x41, 0x8d, + 0x41, 0x3b, 0x3c, 0x2c, 0xff, 0xc2, 0xef, 0x56, 0xc7, 0xc3, 0xf2, 0x0f, 0xfc, 0x33, 0xf2, 0xc8, + 0xe0, 0xa3, 0x4c, 0xc6, 0xb3, 0x70, 0xae, 0x79, 0xc6, 0x3f, 0x82, 0xe6, 0x32, 0x67, 0xcd, 0xae, + 0xd7, 0xab, 0x8f, 0x1f, 0x08, 0x58, 0x0e, 0xcd, 0xee, 0xed, 0x76, 0x45, 0x0f, 0x49, 0xe3, 0x92, + 0xe7, 0x89, 0xbc, 0x64, 0x2d, 0x1b, 0xda, 0x28, 0x7a, 0x4c, 0x5a, 0x13, 0xc4, 0x30, 0xc1, 0x5c, + 0x0a, 0x46, 0xcc, 0x89, 0xe3, 0xe6, 0x04, 0x71, 0x64, 0x34, 0x65, 0x64, 0x17, 0x73, 0x88, 0x32, + 0x4c, 0x58, 0xbb, 0xeb, 0xf5, 0x9a, 0xe3, 0x5f, 0x92, 0x3e, 0x25, 0x07, 0x09, 0x57, 0xba, 0xe4, + 0xd1, 0x5c, 0x63, 0x38, 0x41, 0x54, 0xec, 0x9e, 0x4d, 0xec, 0x6f, 0xed, 0x57, 0x88, 0x8a, 0x9e, + 0x90, 0xbd, 0x68, 0x5e, 0xe6, 0x21, 0x64, 0x99, 0x8b, 0xed, 0xd9, 0x58, 0xdb, 0x98, 0x2f, 0xb2, + 0xcc, 0x66, 0x3a, 0xa4, 0xed, 0xb8, 0xa1, 0xe6, 0x85, 0x62, 0xfb, 0x36, 0x41, 0x9c, 0xf5, 0x86, + 0x17, 0x6a, 0xf8, 0xfa, 0x7a, 0xe5, 0x7b, 0x37, 0x2b, 0xdf, 0xfb, 0xb1, 0xf2, 0xbd, 0x4f, 0x6b, + 0xbf, 0x76, 0xb3, 0xf6, 0x6b, 0xdf, 0xd6, 0x7e, 0xed, 0x5d, 0x90, 0x72, 0x3d, 0x9d, 0x47, 0xfd, + 0x58, 0x8a, 0x40, 0xcd, 0x78, 0x71, 0x2a, 0x70, 0x71, 0xe7, 0x35, 0x2f, 0xef, 0xcc, 0xfa, 0xaa, + 0x40, 0x15, 0x35, 0xec, 0x6b, 0x7c, 0xfe, 0x33, 0x00, 0x00, 0xff, 0xff, 0x75, 0xd8, 0x43, 0x9e, + 0xfd, 0x03, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -199,6 +220,26 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.EnableTips { + i-- + if m.EnableTips { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x70 + } + if m.BurnAllFees { + i-- + if m.BurnAllFees { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x68 + } if m.DistributeFees { i-- if m.DistributeFees { @@ -356,6 +397,12 @@ func (m *Params) Size() (n int) { if m.DistributeFees { n += 2 } + if m.BurnAllFees { + n += 2 + } + if m.EnableTips { + n += 2 + } return n } @@ -742,6 +789,46 @@ func (m *Params) Unmarshal(dAtA []byte) error { } } m.DistributeFees = bool(v != 0) + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnAllFees", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BurnAllFees = bool(v != 0) + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EnableTips", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EnableTips = bool(v != 0) default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) From a510586db0ce4160cd2d64201cf51d432521ba56 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Fri, 6 Sep 2024 15:43:57 +0800 Subject: [PATCH 02/11] Add the disable tips parameter --- proto/feemarket/feemarket/v1/params.proto | 5 +- x/feemarket/post/fee.go | 7 +- x/feemarket/types/params.go | 8 +- x/feemarket/types/params.pb.go | 106 +++++++--------------- x/feemarket/types/params_test.go | 54 +++++++++++ 5 files changed, 96 insertions(+), 84 deletions(-) diff --git a/proto/feemarket/feemarket/v1/params.proto b/proto/feemarket/feemarket/v1/params.proto index 8c3119d..064eff0 100644 --- a/proto/feemarket/feemarket/v1/params.proto +++ b/proto/feemarket/feemarket/v1/params.proto @@ -90,9 +90,6 @@ message Params { // distributed to all stakers. bool distribute_fees = 12; - // BurnAllFees is a boolean that determines whether all fees are burned instead of being distributed. - bool burn_all_fees = 13; - // EnableTips is a boolean that determines whether tips are enabled. - bool enable_tips = 14; + bool enable_tips = 13; } diff --git a/x/feemarket/post/fee.go b/x/feemarket/post/fee.go index 108af3e..256b721 100644 --- a/x/feemarket/post/fee.go +++ b/x/feemarket/post/fee.go @@ -158,7 +158,7 @@ func (dfd FeeMarketDeductDecorator) PayOutFeeAndTip(ctx sdk.Context, fee, tip sd var events sdk.Events - // deduct the fees and tip + // deduct the fees if !fee.IsNil() { err := DeductCoins(dfd.bankKeeper, ctx, sdk.NewCoins(fee), params.DistributeFees) if err != nil { @@ -171,8 +171,9 @@ func (dfd FeeMarketDeductDecorator) PayOutFeeAndTip(ctx sdk.Context, fee, tip sd )) } - proposer := sdk.AccAddress(ctx.BlockHeader().ProposerAddress) - if !tip.IsNil() { + // Only process tips if EnableTips is true + if params.EnableTips && !tip.IsNil() { + proposer := sdk.AccAddress(ctx.BlockHeader().ProposerAddress) err := SendTip(dfd.bankKeeper, ctx, proposer, sdk.NewCoins(tip)) if err != nil { return err diff --git a/x/feemarket/types/params.go b/x/feemarket/types/params.go index ee2a79c..e7357d9 100644 --- a/x/feemarket/types/params.go +++ b/x/feemarket/types/params.go @@ -20,7 +20,7 @@ func NewParams( maxLearningRate math.LegacyDec, feeDenom string, enabled bool, - BurnAllFees bool, + enableTips bool, ) Params { return Params{ Alpha: alpha, @@ -34,7 +34,7 @@ func NewParams( Window: window, FeeDenom: feeDenom, Enabled: enabled, - BurnAllFees: BurnAllFees, + EnableTips: enableTips, } } @@ -84,6 +84,10 @@ func (p *Params) ValidateBasic() error { return fmt.Errorf("fee denom must be set") } + if p.EnableTips && !p.Enabled { + return fmt.Errorf("tips cannot be enabled when the fee market is disabled") + } + return nil } diff --git a/x/feemarket/types/params.pb.go b/x/feemarket/types/params.pb.go index 4f783ca..cdac22a 100644 --- a/x/feemarket/types/params.pb.go +++ b/x/feemarket/types/params.pb.go @@ -69,10 +69,8 @@ type Params struct { // DistributeFees is a boolean that determines whether the fees are burned or // distributed to all stakers. DistributeFees bool `protobuf:"varint,12,opt,name=distribute_fees,json=distributeFees,proto3" json:"distribute_fees,omitempty"` - // BurnAllFees is a boolean that determines whether all fees are burned instead of being distributed. - BurnAllFees bool `protobuf:"varint,13,opt,name=burn_all_fees,json=burnAllFees,proto3" json:"burn_all_fees,omitempty"` // EnableTips is a boolean that determines whether tips are enabled. - EnableTips bool `protobuf:"varint,14,opt,name=enable_tips,json=enableTips,proto3" json:"enable_tips,omitempty"` + EnableTips bool `protobuf:"varint,13,opt,name=enable_tips,json=enableTips,proto3" json:"enable_tips,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -143,13 +141,6 @@ func (m *Params) GetDistributeFees() bool { return false } -func (m *Params) GetBurnAllFees() bool { - if m != nil { - return m.BurnAllFees - } - return false -} - func (m *Params) GetEnableTips() bool { if m != nil { return m.EnableTips @@ -166,38 +157,36 @@ func init() { } var fileDescriptor_3907de4df2e1c66e = []byte{ - // 484 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0xc1, 0x6e, 0xd3, 0x4c, - 0x14, 0x85, 0xe3, 0xff, 0x4f, 0xd3, 0x64, 0x42, 0x5b, 0x31, 0x40, 0x35, 0xb4, 0x92, 0x13, 0x95, - 0x05, 0xd9, 0x34, 0x56, 0xe0, 0x09, 0x88, 0x02, 0x15, 0x52, 0x17, 0x55, 0x04, 0x1b, 0x24, 0xb0, - 0xae, 0xed, 0x1b, 0x67, 0x14, 0x8f, 0xc7, 0xf2, 0x4c, 0xd2, 0x94, 0xa7, 0xe0, 0x61, 0xd8, 0xf0, - 0x06, 0x5d, 0x56, 0xac, 0x10, 0x8b, 0x0a, 0x25, 0x2f, 0x82, 0x66, 0x26, 0x90, 0xc2, 0xd2, 0xec, - 0xee, 0x39, 0xf7, 0x9c, 0xcf, 0x57, 0x96, 0x86, 0x3c, 0x99, 0x20, 0x0a, 0x28, 0x67, 0xa8, 0x83, - 0xed, 0xb4, 0x18, 0x04, 0x05, 0x94, 0x20, 0x54, 0xbf, 0x28, 0xa5, 0x96, 0xf4, 0xf0, 0xf7, 0xaa, - 0xbf, 0x9d, 0x16, 0x83, 0xa3, 0xc7, 0xb1, 0x54, 0x42, 0xaa, 0xd0, 0xa6, 0x02, 0x27, 0x5c, 0xe5, - 0xe8, 0x61, 0x2a, 0x53, 0xe9, 0x7c, 0x33, 0x39, 0xf7, 0xe4, 0x4b, 0x83, 0x34, 0x2e, 0x2c, 0x99, - 0x9e, 0x91, 0x1d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c, 0x5a, 0x13, 0xc4, 0x30, 0xc1, 0x5c, - 0x0a, 0x46, 0xcc, 0x89, 0xe3, 0xe6, 0x04, 0x71, 0x64, 0x34, 0x65, 0x64, 0x17, 0x73, 0x88, 0x32, - 0x4c, 0x58, 0xbb, 0xeb, 0xf5, 0x9a, 0xe3, 0x5f, 0x92, 0x3e, 0x25, 0x07, 0x09, 0x57, 0xba, 0xe4, - 0xd1, 0x5c, 0x63, 0x38, 0x41, 0x54, 0xec, 0x9e, 0x4d, 0xec, 0x6f, 0xed, 0x57, 0x88, 0x8a, 0x9e, - 0x90, 0xbd, 0x68, 0x5e, 0xe6, 0x21, 0x64, 0x99, 0x8b, 0xed, 0xd9, 0x58, 0xdb, 0x98, 0x2f, 0xb2, - 0xcc, 0x66, 0x3a, 0xa4, 0xed, 0xb8, 0xa1, 0xe6, 0x85, 0x62, 0xfb, 0x36, 0x41, 0x9c, 0xf5, 0x86, - 0x17, 0x6a, 0xf8, 0xfa, 0x7a, 0xe5, 0x7b, 0x37, 0x2b, 0xdf, 0xfb, 0xb1, 0xf2, 0xbd, 0x4f, 0x6b, - 0xbf, 0x76, 0xb3, 0xf6, 0x6b, 0xdf, 0xd6, 0x7e, 0xed, 0x5d, 0x90, 0x72, 0x3d, 0x9d, 0x47, 0xfd, - 0x58, 0x8a, 0x40, 0xcd, 0x78, 0x71, 0x2a, 0x70, 0x71, 0xe7, 0x35, 0x2f, 0xef, 0xcc, 0xfa, 0xaa, - 0x40, 0x15, 0x35, 0xec, 0x6b, 0x7c, 0xfe, 0x33, 0x00, 0x00, 0xff, 0xff, 0x75, 0xd8, 0x43, 0x9e, - 0xfd, 0x03, 0x00, 0x00, + // 463 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0x41, 0x6e, 0xd3, 0x40, + 0x14, 0x86, 0x63, 0x48, 0xdd, 0x64, 0x0a, 0x54, 0x0c, 0x50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0xfd, 0x3a, 0x44, 0xac, 0xf5, 0x8e, 0x97, 0x6a, 0xf4, 0xf6, 0x72, + 0xe5, 0x39, 0x57, 0x2b, 0xcf, 0xf9, 0xb5, 0xf2, 0x9c, 0x2f, 0x6b, 0xaf, 0x75, 0xb5, 0xf6, 0x5a, + 0x3f, 0xd6, 0x5e, 0xeb, 0x43, 0x90, 0x71, 0x3d, 0x9d, 0xc7, 0x7e, 0x22, 0x45, 0xa0, 0x66, 0xbc, + 0x3c, 0x16, 0xb8, 0xb8, 0xf1, 0x52, 0x97, 0x37, 0x66, 0x7d, 0x51, 0xa2, 0x8a, 0xdd, 0xfa, 0xa5, + 0xbd, 0xfa, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xf7, 0xfb, 0xfc, 0x97, 0xd9, 0x03, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -228,16 +217,6 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0 } i-- - dAtA[i] = 0x70 - } - if m.BurnAllFees { - i-- - if m.BurnAllFees { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- dAtA[i] = 0x68 } if m.DistributeFees { @@ -397,9 +376,6 @@ func (m *Params) Size() (n int) { if m.DistributeFees { n += 2 } - if m.BurnAllFees { - n += 2 - } if m.EnableTips { n += 2 } @@ -790,26 +766,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { } m.DistributeFees = bool(v != 0) case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BurnAllFees", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BurnAllFees = bool(v != 0) - case 14: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field EnableTips", wireType) } diff --git a/x/feemarket/types/params_test.go b/x/feemarket/types/params_test.go index 721bfa8..2e05efd 100644 --- a/x/feemarket/types/params_test.go +++ b/x/feemarket/types/params_test.go @@ -273,6 +273,60 @@ func TestParams(t *testing.T) { }, expectedErr: true, }, + { + name: "enable tips when fee market is disabled", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + Delta: math.LegacyMustNewDecFromStr("0.1"), + MaxBlockUtilization: 3, + MinBaseGasPrice: math.LegacyMustNewDecFromStr("1.0"), + MinLearningRate: math.LegacyMustNewDecFromStr("0.01"), + MaxLearningRate: math.LegacyMustNewDecFromStr("0.05"), + FeeDenom: types.DefaultFeeDenom, + Enabled: false, + EnableTips: true, + }, + expectedErr: true, + }, + { + name: "valid params with tips enabled", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + Delta: math.LegacyMustNewDecFromStr("0.1"), + MaxBlockUtilization: 3, + MinBaseGasPrice: math.LegacyMustNewDecFromStr("1.0"), + MinLearningRate: math.LegacyMustNewDecFromStr("0.01"), + MaxLearningRate: math.LegacyMustNewDecFromStr("0.05"), + FeeDenom: types.DefaultFeeDenom, + Enabled: true, + EnableTips: true, + }, + expectedErr: false, + }, + { + name: "valid params with tips disabled", + p: types.Params{ + Window: 1, + Alpha: math.LegacyMustNewDecFromStr("0.1"), + Beta: math.LegacyMustNewDecFromStr("0.1"), + Gamma: math.LegacyMustNewDecFromStr("0.1"), + Delta: math.LegacyMustNewDecFromStr("0.1"), + MaxBlockUtilization: 3, + MinBaseGasPrice: math.LegacyMustNewDecFromStr("1.0"), + MinLearningRate: math.LegacyMustNewDecFromStr("0.01"), + MaxLearningRate: math.LegacyMustNewDecFromStr("0.05"), + FeeDenom: types.DefaultFeeDenom, + Enabled: true, + EnableTips: false, + }, + expectedErr: false, + }, } for _, tc := range testCases { From 1b401f082fee9ed1b78f3f435fd389fb82c5ec00 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Fri, 6 Sep 2024 15:52:31 +0800 Subject: [PATCH 03/11] describe EnableTips --- x/feemarket/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/feemarket/README.md b/x/feemarket/README.md index 1326248..570cba1 100644 --- a/x/feemarket/README.md +++ b/x/feemarket/README.md @@ -37,8 +37,8 @@ AIMD EIP-1559 introduces a few new parameters to the EIP-1559 fee market: * **`Gamma`**: This determines whether you are additively increase or multiplicatively decreasing the learning rate based on the target and current block utilization. This must be a value that is between `[0, 1]`. For example, if `Gamma = 0.25`, then we multiplicatively decrease the learning rate if the average ratio of current block size to max block size over some window of blocks is within `(0.25, 0.75)` and additively increase it if outside that range. * **`MaxLearningRate`**: This is the maximum learning rate that can be applied to the base fee. This must be a value that is between `[0, 1]`. * **`MinLearningRate`**: This is the minimum learning rate that can be applied to the base fee. This must be a value that is between `[0, 1]`. -* **`Delta`**: This is a trailing constant that is used to smooth the learning rate. In order to further converge the long term net gas usage and net gas goal, we introduce another integral term which tracks how much gas off from 0 gas we’re at. We add a constant c which basically forces the fee to slowly trend in some direction until this has gone to 0. -* **`BurnAllFees`**: This is a boolean that determines whether all fees are burned instead of being distributed. When set to `true`, it overrides the `DistributeFees` parameter. +* **`Delta`**: This is a trailing constant that is used to smooth the learning rate. In order to further converge the long term net gas usage and net gas goal, we introduce another integral term which tracks how much gas off from 0 gas we're at. We add a constant c which basically forces the fee to slowly trend in some direction until this has gone to 0. +* **`EnableTips`**: This is a boolean parameter that determines whether tips are allowed in the fee market. When set to `true`, users can include optional tips with their transactions, which are paid directly to the block proposer. This can incentivize faster transaction processing during periods of high network congestion. When set to `false`, the tip mechanism is disabled, and all fees are processed according to the base fee calculation. The calculation for the updated base fee for the next block is as follows: From 74dd5293db7e42ebc541620b07ffc68fc0868444 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Fri, 6 Sep 2024 15:56:45 +0800 Subject: [PATCH 04/11] clarify naked bools by assigning them as default variables --- x/feemarket/types/eip1559.go | 10 ++++++++-- x/feemarket/types/eip1559_aimd.go | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/x/feemarket/types/eip1559.go b/x/feemarket/types/eip1559.go index a3ea3c9..1f9912e 100644 --- a/x/feemarket/types/eip1559.go +++ b/x/feemarket/types/eip1559.go @@ -42,6 +42,12 @@ var ( // DefaultFeeDenom is the Cosmos SDK default bond denom. DefaultFeeDenom = sdk.DefaultBondDenom + + // DefaultEnabled: is the fee market enabled. + DefaultEnabled = true + + // DefaultEnableTips is the default enable tips. + DefaultEnableTips = true ) // DefaultParams returns a default set of parameters that implements @@ -59,8 +65,8 @@ func DefaultParams() Params { DefaultMinLearningRate, DefaultMaxLearningRate, DefaultFeeDenom, - true, - false, + DefaultEnabled, + DefaultEnableTips, ) } diff --git a/x/feemarket/types/eip1559_aimd.go b/x/feemarket/types/eip1559_aimd.go index 4318d79..9491829 100644 --- a/x/feemarket/types/eip1559_aimd.go +++ b/x/feemarket/types/eip1559_aimd.go @@ -49,6 +49,12 @@ var ( // DefaultAIMDFeeDenom is the Cosmos SDK default bond denom. DefaultAIMDFeeDenom = DefaultFeeDenom + + // DefaultAIMDEnabled is the default enabled. + DefaultAIMDEnabled = true + + // DefaultAIMDEnableTips is the default enable tips. + DefaultAIMDEnableTips = true ) // DefaultAIMDParams returns a default set of parameters that implements @@ -67,8 +73,8 @@ func DefaultAIMDParams() Params { DefaultAIMDMinLearningRate, DefaultAIMDMaxLearningRate, DefaultAIMDFeeDenom, - true, - false, + DefaultAIMDEnabled, + DefaultAIMDEnableTips, ) } From 5bffc8733a5c065b17fedf24705b29752ac87508 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sat, 7 Sep 2024 10:31:15 +0800 Subject: [PATCH 05/11] add 18 gas to existing tests and enable thelper, errcheck and testifylint --- .golangci.yml | 4 +- tests/app/app.go | 4 +- tests/app/export.go | 25 +++++++++--- tests/e2e/go.mod | 38 +++++++++--------- tests/e2e/go.sum | 68 ++++++++++++++++----------------- testutils/keeper/keeper.go | 11 +++--- x/feemarket/ante/suite/suite.go | 3 ++ x/feemarket/post/fee_test.go | 60 +++++++++++++++++++++++++++-- 8 files changed, 146 insertions(+), 67 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index f00a33c..0b37ec6 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -26,7 +26,9 @@ linters: - typecheck - unconvert - unused - # - errcheck + - errcheck + - thelper + - testifylint issues: exclude-rules: diff --git a/tests/app/app.go b/tests/app/app.go index f5aab81..8ed1ded 100644 --- a/tests/app/app.go +++ b/tests/app/app.go @@ -592,7 +592,9 @@ func (app *SimApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*ab if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { panic(err) } - app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()) + if err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()); err != nil { + panic(err) + } return app.ModuleManager.InitGenesis(ctx, app.appCodec, genesisState) } diff --git a/tests/app/export.go b/tests/app/export.go index eb4465d..71e014f 100644 --- a/tests/app/export.go +++ b/tests/app/export.go @@ -167,7 +167,7 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [] /* Handle staking state. */ // iterate through redelegations, reset creation height - app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { + err = app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { for i := range red.Entries { red.Entries[i].CreationHeight = 0 } @@ -177,9 +177,12 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [] } return false }) + if err != nil { + panic(err) + } // iterate through unbonding delegations, reset creation height - app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { + err = app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { for i := range ubd.Entries { ubd.Entries[i].CreationHeight = 0 } @@ -189,6 +192,9 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [] } return false }) + if err != nil { + panic(err) + } // Iterate through validators by power descending, reset bond heights, and // update bond intra-tx counters. @@ -208,7 +214,10 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [] validator.Jailed = true } - app.StakingKeeper.SetValidator(ctx, validator) + err = app.StakingKeeper.SetValidator(ctx, validator) + if err != nil { + panic(err) + } counter++ } @@ -225,12 +234,18 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs [] /* Handle slashing state. */ // reset start height on signing infos - app.SlashingKeeper.IterateValidatorSigningInfos( + err = app.SlashingKeeper.IterateValidatorSigningInfos( ctx, func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) { info.StartHeight = 0 - app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info) + err = app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info) + if err != nil { + panic(err) + } return false }, ) + if err != nil { + log.Fatal(err) + } } diff --git a/tests/e2e/go.mod b/tests/e2e/go.mod index 5ad972e..2243687 100644 --- a/tests/e2e/go.mod +++ b/tests/e2e/go.mod @@ -1,6 +1,8 @@ module github.com/skip-mev/feemarket/tests/e2e -go 1.22.3 +go 1.22.6 + +toolchain go1.23.0 replace ( cosmossdk.io/client/v2 => cosmossdk.io/client/v2 v2.0.0-beta.1.0.20240124105859-5ad1805d0e79 @@ -15,8 +17,8 @@ replace ( require ( cosmossdk.io/math v1.3.0 - github.com/cometbft/cometbft v0.38.8 - github.com/cosmos/cosmos-sdk v0.50.7 + github.com/cometbft/cometbft v0.38.11 + github.com/cosmos/cosmos-sdk v0.50.9 github.com/pelletier/go-toml/v2 v2.2.2 github.com/skip-mev/chaintestutil v0.0.0-20240514161515-056d7ba45610 github.com/skip-mev/feemarket v1.0.1 @@ -24,7 +26,7 @@ require ( github.com/strangelove-ventures/interchaintest/v8 v8.4.0 github.com/stretchr/testify v1.9.0 go.uber.org/zap v1.27.0 - google.golang.org/grpc v1.64.1 + google.golang.org/grpc v1.65.0 ) require ( @@ -36,15 +38,15 @@ require ( cloud.google.com/go/storage v1.41.0 // indirect cosmossdk.io/api v0.7.5 // indirect cosmossdk.io/collections v0.4.0 // indirect - cosmossdk.io/core v0.11.0 // indirect - cosmossdk.io/depinject v1.0.0-alpha.4 // indirect + cosmossdk.io/core v0.11.1 // indirect + cosmossdk.io/depinject v1.0.0 // indirect cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/log v1.3.1 // indirect cosmossdk.io/store v1.1.0 // indirect cosmossdk.io/x/evidence v0.1.1 // indirect cosmossdk.io/x/feegrant v0.1.1 // indirect - cosmossdk.io/x/tx v0.13.3 // indirect - cosmossdk.io/x/upgrade v0.1.3 // indirect + cosmossdk.io/x/tx v0.13.4 // indirect + cosmossdk.io/x/upgrade v0.1.4 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect @@ -80,7 +82,7 @@ require ( github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/gogoproto v1.5.0 // indirect + github.com/cosmos/gogoproto v1.6.0 // indirect github.com/cosmos/iavl v1.1.2 // indirect github.com/cosmos/ibc-go/modules/capability v1.0.0 // indirect github.com/cosmos/ibc-go/v8 v8.2.1 // indirect @@ -235,21 +237,21 @@ require ( go.opentelemetry.io/otel/sdk v1.26.0 // indirect go.opentelemetry.io/otel/trace v1.26.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.24.0 // indirect + golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect - golang.org/x/mod v0.18.0 // indirect - golang.org/x/net v0.26.0 // indirect + golang.org/x/mod v0.20.0 // indirect + golang.org/x/net v0.28.0 // indirect golang.org/x/oauth2 v0.20.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/term v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.23.0 // indirect + golang.org/x/term v0.23.0 // indirect + golang.org/x/text v0.17.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.22.0 // indirect + golang.org/x/tools v0.24.0 // indirect google.golang.org/api v0.180.0 // indirect google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect diff --git a/tests/e2e/go.sum b/tests/e2e/go.sum index a30990e..4e90421 100644 --- a/tests/e2e/go.sum +++ b/tests/e2e/go.sum @@ -192,10 +192,10 @@ cosmossdk.io/client/v2 v2.0.0-beta.1.0.20240124105859-5ad1805d0e79 h1:Hr1t0fCq1n cosmossdk.io/client/v2 v2.0.0-beta.1.0.20240124105859-5ad1805d0e79/go.mod h1:8pN6LSVReNnIxrC2QGcvuIJ/m1pJN6FNYn2kAYtYftI= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= -cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= -cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= -cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= -cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= +cosmossdk.io/core v0.11.1 h1:h9WfBey7NAiFfIcUhDVNS503I2P2HdZLebJlUIs8LPA= +cosmossdk.io/core v0.11.1/go.mod h1:OJzxcdC+RPrgGF8NJZR2uoQr56tc7gfBKhiKeDO7hH0= +cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= +cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= @@ -210,10 +210,10 @@ cosmossdk.io/x/evidence v0.1.1 h1:Ks+BLTa3uftFpElLTDp9L76t2b58htjVbSZ86aoK/E4= cosmossdk.io/x/evidence v0.1.1/go.mod h1:OoDsWlbtuyqS70LY51aX8FBTvguQqvFrt78qL7UzeNc= cosmossdk.io/x/feegrant v0.1.1 h1:EKFWOeo/pup0yF0svDisWWKAA9Zags6Zd0P3nRvVvw8= cosmossdk.io/x/feegrant v0.1.1/go.mod h1:2GjVVxX6G2fta8LWj7pC/ytHjryA6MHAJroBWHFNiEQ= -cosmossdk.io/x/tx v0.13.3 h1:Ha4mNaHmxBc6RMun9aKuqul8yHiL78EKJQ8g23Zf73g= -cosmossdk.io/x/tx v0.13.3/go.mod h1:I8xaHv0rhUdIvIdptKIqzYy27+n2+zBVaxO6fscFhys= -cosmossdk.io/x/upgrade v0.1.3 h1:q4XpXc6zp0dX6x74uBtfN6+J7ikaQev5Bla6Q0ADLK8= -cosmossdk.io/x/upgrade v0.1.3/go.mod h1:jOdQhnaY5B8CDUoUbed23/Lre0Dk+r6BMQE40iKlVVQ= +cosmossdk.io/x/tx v0.13.4 h1:Eg0PbJgeO0gM8p5wx6xa0fKR7hIV6+8lC56UrsvSo0Y= +cosmossdk.io/x/tx v0.13.4/go.mod h1:BkFqrnGGgW50Y6cwTy+JvgAhiffbGEKW6KF9ufcDpvk= +cosmossdk.io/x/upgrade v0.1.4 h1:/BWJim24QHoXde8Bc64/2BSEB6W4eTydq0X/2f8+g38= +cosmossdk.io/x/upgrade v0.1.4/go.mod h1:9v0Aj+fs97O+Ztw+tG3/tp5JSlrmT7IcFhAebQHmOPo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -353,8 +353,8 @@ github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/cometbft/cometbft v0.38.8 h1:XyJ9Cu3xqap6xtNxiemrO8roXZ+KS2Zlu7qQ0w1trvU= -github.com/cometbft/cometbft v0.38.8/go.mod h1:xOoGZrtUT+A5izWfHSJgl0gYZUE7lu7Z2XIS1vWG/QQ= +github.com/cometbft/cometbft v0.38.11 h1:6bNDUB8/xq4uYonYwIfGc9OqK1ZH4NkdaMmR1LZIJqk= +github.com/cometbft/cometbft v0.38.11/go.mod h1:jHPx9vQpWzPHEAiYI/7EDKaB1NXhK6o3SArrrY8ExKc= github.com/cometbft/cometbft-db v0.10.0 h1:VMBQh88zXn64jXVvj39tlu/IgsGR84T7ImjS523DCiU= github.com/cometbft/cometbft-db v0.10.0/go.mod h1:7RR7NRv99j7keWJ5IkE9iZibUTKYdtepXTp7Ra0FxKk= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= @@ -371,16 +371,16 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/cosmos-sdk v0.50.7 h1:LsBGKxifENR/DN4E1RZaitsyL93HU44x0p8EnMHp4V4= -github.com/cosmos/cosmos-sdk v0.50.7/go.mod h1:84xDDJEHttRT7NDGwBaUOLVOMN0JNE9x7NbsYIxXs1s= +github.com/cosmos/cosmos-sdk v0.50.9 h1:gt2usjz0H0qW6KwAxWw7ZJ3XU8uDwmhN+hYG3nTLeSg= +github.com/cosmos/cosmos-sdk v0.50.9/go.mod h1:TMH6wpoYBcg7Cp5BEg8fneLr+8XloNQkf2MRNF9V6JE= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= -github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= +github.com/cosmos/gogoproto v1.6.0 h1:Xm0F/96O5Ox4g6xGgjA41rWaaPjYtOdTi59uBcV2qEE= +github.com/cosmos/gogoproto v1.6.0/go.mod h1:Y+g956rcUf2vr4uwtCcK/1Xx9BWVluCtcI9vsh0GHmk= github.com/cosmos/iavl v1.1.2 h1:zL9FK7C4L/P4IF1Dm5fIwz0WXCnn7Bp1M2FxH0ayM7Y= github.com/cosmos/iavl v1.1.2/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM= github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE= @@ -1205,8 +1205,8 @@ golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1246,8 +1246,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= -golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= +golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1307,8 +1307,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1350,8 +1350,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1450,13 +1450,13 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= +golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= +golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1467,8 +1467,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1535,8 +1535,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= -golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= +golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= +golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1717,8 +1717,8 @@ google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda h1:wu/KJm9KJwpfHWh google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda/go.mod h1:g2LLCvCeCSir/JJSWosk19BR4NVxGqHUC6rxIRsd7Aw= google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3 h1:QW9+G6Fir4VcRXVH8x3LilNAb6cxBGLa6+GM4hRwexE= google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3/go.mod h1:kdrSS/OiLkPrNUpzD4aHgCq2rVuC/YRxok32HXZ4vRE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 h1:SbSDUWW1PAO24TNpLdeheoYPd7kllICcLU52x6eD4kQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1760,8 +1760,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA= -google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/testutils/keeper/keeper.go b/testutils/keeper/keeper.go index 6f15b49..cf6b818 100644 --- a/testutils/keeper/keeper.go +++ b/testutils/keeper/keeper.go @@ -36,14 +36,15 @@ var additionalMaccPerms = map[string][]string{ } // NewTestSetup returns initialized instances of all the keepers and message servers of the modules -func NewTestSetup(t testing.TB, options ...testkeeper.SetupOption) (sdk.Context, TestKeepers, TestMsgServers) { +func NewTestSetup(tb testing.TB, options ...testkeeper.SetupOption) (sdk.Context, TestKeepers, TestMsgServers) { + tb.Helper() options = append(options, testkeeper.WithAdditionalModuleAccounts(additionalMaccPerms)) - _, tk, tms := testkeeper.NewTestSetup(t, options...) + _, tk, tms := testkeeper.NewTestSetup(tb, options...) // initialize extra keeper feeMarketKeeper := FeeMarket(tk.Initializer, tk.AccountKeeper) - require.NoError(t, tk.Initializer.LoadLatest()) + require.NoError(tb, tk.Initializer.LoadLatest()) // initialize msg servers feeMarketMsgSrv := feemarketkeeper.NewMsgServer(feeMarketKeeper) @@ -54,9 +55,9 @@ func NewTestSetup(t testing.TB, options ...testkeeper.SetupOption) (sdk.Context, }, false, log.NewNopLogger()) err := feeMarketKeeper.SetState(ctx, feemarkettypes.DefaultState()) - require.NoError(t, err) + require.NoError(tb, err) err = feeMarketKeeper.SetParams(ctx, feemarkettypes.DefaultParams()) - require.NoError(t, err) + require.NoError(tb, err) testKeepers := TestKeepers{ TestKeepers: tk, diff --git a/x/feemarket/ante/suite/suite.go b/x/feemarket/ante/suite/suite.go index 5113539..b3de1fc 100644 --- a/x/feemarket/ante/suite/suite.go +++ b/x/feemarket/ante/suite/suite.go @@ -107,6 +107,7 @@ func (s *TestSuite) SetAccountBalances(accounts []TestAccountBalance) { // SetupTestSuite setups a new test, with new app, context, and anteHandler. func SetupTestSuite(t *testing.T, mock bool) *TestSuite { + t.Helper() s := &TestSuite{} s.EncCfg = MakeTestEncodingConfig() @@ -203,6 +204,7 @@ type TestCaseArgs struct { // DeliverMsgs constructs a tx and runs it through the ante handler. This is used to set the context for a test case, for // example to test for replay protection. func (s *TestSuite) DeliverMsgs(t *testing.T, privs []cryptotypes.PrivKey, msgs []sdk.Msg, feeAmount sdk.Coins, gasLimit uint64, accNums, accSeqs []uint64, chainID string, simulate bool) (sdk.Context, error) { + t.Helper() require.NoError(t, s.TxBuilder.SetMsgs(msgs...)) s.TxBuilder.SetFeeAmount(feeAmount) s.TxBuilder.SetGasLimit(gasLimit) @@ -213,6 +215,7 @@ func (s *TestSuite) DeliverMsgs(t *testing.T, privs []cryptotypes.PrivKey, msgs } func (s *TestSuite) RunTestCase(t *testing.T, tc TestCase, args TestCaseArgs) { + t.Helper() require.NoError(t, s.TxBuilder.SetMsgs(args.Msgs...)) s.TxBuilder.SetFeeAmount(args.FeeAmount) s.TxBuilder.SetGasLimit(args.GasLimit) diff --git a/x/feemarket/post/fee_test.go b/x/feemarket/post/fee_test.go index af67585..78a3db3 100644 --- a/x/feemarket/post/fee_test.go +++ b/x/feemarket/post/fee_test.go @@ -153,7 +153,7 @@ func TestPostHandleMock(t *testing.T) { const ( baseDenom = "stake" resolvableDenom = "atom" - expectedConsumedGas = 10631 + expectedConsumedGas = 10649 expectedConsumedSimGas = expectedConsumedGas + post.BankSendGasConsumption gasLimit = expectedConsumedSimGas ) @@ -166,6 +166,60 @@ func TestPostHandleMock(t *testing.T) { validResolvableFeeWithTip := sdk.NewCoins(sdk.NewCoin(resolvableDenom, validFeeAmountWithTip.TruncateInt())) testCases := []antesuite.TestCase{ + { + Name: "tips enabled, should pass with tip to proposer", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil).Once() + s.MockBankKeeper.On("SendCoinsFromModuleToAccount", mock.Anything, types.FeeCollectorName, mock.Anything, mock.Anything).Return(nil).Once() + + params := types.DefaultParams() + params.EnableTips = true + err := s.FeeMarketKeeper.SetParams(s.Ctx, params) + s.Require().NoError(err) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFeeWithTip, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedGas, + Mock: true, + }, + { + Name: "tips disabled, should pass with tip to fee collector", + Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { + accs := s.CreateTestAccounts(1) + s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), + types.FeeCollectorName, mock.Anything).Return(nil).Once() + s.MockBankKeeper.On("SendCoinsFromModuleToAccount", mock.Anything, types.FeeCollectorName, mock.Anything, mock.Anything).Return(nil).Once() + + params := types.DefaultParams() + params.EnableTips = false + err := s.FeeMarketKeeper.SetParams(s.Ctx, params) + s.Require().NoError(err) + + return antesuite.TestCaseArgs{ + Msgs: []sdk.Msg{testdata.NewTestMsg(accs[0].Account.GetAddress())}, + GasLimit: gasLimit, + FeeAmount: validFeeWithTip, + } + }, + RunAnte: true, + RunPost: true, + Simulate: false, + ExpPass: true, + ExpErr: nil, + ExpectConsumedGas: expectedConsumedGas, + Mock: true, + }, { Name: "signer has no funds", Malleate: func(s *antesuite.TestSuite) antesuite.TestCaseArgs { @@ -539,9 +593,9 @@ func TestPostHandle(t *testing.T) { const ( baseDenom = "stake" resolvableDenom = "atom" - expectedConsumedGas = 36650 + expectedConsumedGas = 36668 - expectedConsumedGasResolve = 36524 // slight difference due to denom resolver + expectedConsumedGasResolve = 36542 // slight difference due to denom resolver gasLimit = 100000 ) From 980ef201822dfc3dae579dc4c46a69759dc0388e Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sat, 7 Sep 2024 10:47:33 +0800 Subject: [PATCH 06/11] fix gas and fix the tips disabled case so we don't look for a send --- x/feemarket/post/fee_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x/feemarket/post/fee_test.go b/x/feemarket/post/fee_test.go index 78a3db3..7165ca6 100644 --- a/x/feemarket/post/fee_test.go +++ b/x/feemarket/post/fee_test.go @@ -199,7 +199,6 @@ func TestPostHandleMock(t *testing.T) { accs := s.CreateTestAccounts(1) s.MockBankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, accs[0].Account.GetAddress(), types.FeeCollectorName, mock.Anything).Return(nil).Once() - s.MockBankKeeper.On("SendCoinsFromModuleToAccount", mock.Anything, types.FeeCollectorName, mock.Anything, mock.Anything).Return(nil).Once() params := types.DefaultParams() params.EnableTips = false @@ -407,7 +406,7 @@ func TestPostHandleMock(t *testing.T) { Simulate: false, ExpPass: true, ExpErr: nil, - ExpectConsumedGas: 15340, // extra gas consumed because msg server is run, but deduction is skipped + ExpectConsumedGas: 15412, // extra gas consumed because msg server is run, but deduction is skipped Mock: true, }, { From c2ee8de56bc17314b55f5aecacf0730eee40d96a Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sat, 7 Sep 2024 10:57:32 +0800 Subject: [PATCH 07/11] fix gas on an additional test case --- x/feemarket/post/fee_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/feemarket/post/fee_test.go b/x/feemarket/post/fee_test.go index 7165ca6..b0680d8 100644 --- a/x/feemarket/post/fee_test.go +++ b/x/feemarket/post/fee_test.go @@ -216,7 +216,7 @@ func TestPostHandleMock(t *testing.T) { Simulate: false, ExpPass: true, ExpErr: nil, - ExpectConsumedGas: expectedConsumedGas, + ExpectConsumedGas: expectedConsumedGas - 18, Mock: true, }, { From cc4ce72a0d05a52b19f1a189fef6f04020aab7ff Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sat, 7 Sep 2024 10:58:58 +0800 Subject: [PATCH 08/11] fix gas on TestPostHandle/Case_fee_market_is_enabled_during_the_transaction_-should_pass_and_skip_deduction_until_next_block --- x/feemarket/post/fee_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/feemarket/post/fee_test.go b/x/feemarket/post/fee_test.go index b0680d8..1d2762c 100644 --- a/x/feemarket/post/fee_test.go +++ b/x/feemarket/post/fee_test.go @@ -818,7 +818,7 @@ func TestPostHandle(t *testing.T) { Simulate: false, ExpPass: true, ExpErr: nil, - ExpectConsumedGas: 15340, // extra gas consumed because msg server is run, but bank keepers are skipped + ExpectConsumedGas: 15412, // extra gas consumed because msg server is run, but bank keepers are skipped Mock: false, }, { From 0225d4b3cab2f7d70cd6fe1a26dbe48bcff0ce84 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sat, 7 Sep 2024 11:19:37 +0800 Subject: [PATCH 09/11] signer has enough funds, should pass, no tip --- x/feemarket/post/fee_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/feemarket/post/fee_test.go b/x/feemarket/post/fee_test.go index 1d2762c..738e5cc 100644 --- a/x/feemarket/post/fee_test.go +++ b/x/feemarket/post/fee_test.go @@ -703,7 +703,7 @@ func TestPostHandle(t *testing.T) { Simulate: false, ExpPass: true, ExpErr: nil, - ExpectConsumedGas: 36650, + ExpectConsumedGas: 36650 + 18, Mock: false, }, { From 4da3b752ed497e78b170f80c50bb667322a1a04e Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sat, 7 Sep 2024 11:21:16 +0800 Subject: [PATCH 10/11] signer has enough funds, should pass with tip --- x/feemarket/post/fee_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/feemarket/post/fee_test.go b/x/feemarket/post/fee_test.go index 738e5cc..341713e 100644 --- a/x/feemarket/post/fee_test.go +++ b/x/feemarket/post/fee_test.go @@ -752,7 +752,7 @@ func TestPostHandle(t *testing.T) { Simulate: false, ExpPass: true, ExpErr: nil, - ExpectConsumedGas: 36650, + ExpectConsumedGas: 36650 + 18, Mock: false, }, { From b6a541c9c44eeea57127e2a17b816d255d9811a3 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Fri, 13 Sep 2024 14:51:48 +0800 Subject: [PATCH 11/11] combine fee and tip when tips aren't enabled --- x/feemarket/post/fee.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/x/feemarket/post/fee.go b/x/feemarket/post/fee.go index 256b721..971f2b3 100644 --- a/x/feemarket/post/fee.go +++ b/x/feemarket/post/fee.go @@ -158,20 +158,21 @@ func (dfd FeeMarketDeductDecorator) PayOutFeeAndTip(ctx sdk.Context, fee, tip sd var events sdk.Events - // deduct the fees - if !fee.IsNil() { - err := DeductCoins(dfd.bankKeeper, ctx, sdk.NewCoins(fee), params.DistributeFees) + // Combine fee and tip if tips are not enabled + totalFee := fee + if !params.EnableTips && !tip.IsNil() { + totalFee = totalFee.Add(tip) + } + + // Deduct the total fee (which may include the tip) + if !totalFee.IsNil() { + err := DeductCoins(dfd.bankKeeper, ctx, sdk.NewCoins(totalFee), params.DistributeFees) if err != nil { return err } - - events = append(events, sdk.NewEvent( - feemarkettypes.EventTypeFeePay, - sdk.NewAttribute(sdk.AttributeKeyFee, fee.String()), - )) } - // Only process tips if EnableTips is true + // Process the tip separately if tips are enabled if params.EnableTips && !tip.IsNil() { proposer := sdk.AccAddress(ctx.BlockHeader().ProposerAddress) err := SendTip(dfd.bankKeeper, ctx, proposer, sdk.NewCoins(tip))