refactor: remove min-buy-in param (#135)

Co-authored-by: David Terpay <35130517+davidterpay@users.noreply.github.com>
This commit is contained in:
Aleksandr Bezobchuk 2023-05-15 11:43:03 -04:00 committed by GitHub
parent 1de8de75c1
commit 7db24f2c29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 55 additions and 174 deletions

View File

@ -186,6 +186,8 @@ $ go install github.com/skip-mev/pob
}
```
## Params
Note, before building or upgrading the application, make sure to initialize the
escrow address for POB in the parameters of the module. The default parameters
do not initialize an escrow address as that should be determined by governance.

View File

@ -244,7 +244,6 @@ func (suite *ABCITestSuite) TestGetBidsFromVoteExtensions() {
func (suite *ABCITestSuite) TestBuildTOB() {
params := buildertypes.Params{
MaxBundleSize: 4,
MinBuyInFee: sdk.NewCoin("foo", sdk.NewInt(100)),
ReserveFee: sdk.NewCoin("foo", sdk.NewInt(100)),
MinBidIncrement: sdk.NewCoin("foo", sdk.NewInt(100)),
FrontRunningProtection: true,

View File

@ -24,7 +24,6 @@ func (suite *ABCITestSuite) TestPrepareProposal() {
// auction configuration
maxBundleSize uint32 = 10
reserveFee = sdk.NewCoin("foo", sdk.NewInt(1000))
minBuyInFee = sdk.NewCoin("foo", sdk.NewInt(1000))
frontRunningProtection = true
)
@ -292,7 +291,6 @@ func (suite *ABCITestSuite) TestPrepareProposal() {
params := buildertypes.Params{
MaxBundleSize: maxBundleSize,
ReserveFee: reserveFee,
MinBuyInFee: minBuyInFee,
FrontRunningProtection: frontRunningProtection,
MinBidIncrement: suite.minBidIncrement,
}
@ -362,7 +360,6 @@ func (suite *ABCITestSuite) TestProcessProposal() {
// auction set up
maxBundleSize uint32 = 10
reserveFee = sdk.NewCoin("foo", sdk.NewInt(1000))
minBuyInFee = sdk.NewCoin("foo", sdk.NewInt(1000))
)
cases := []struct {
@ -747,7 +744,6 @@ func (suite *ABCITestSuite) TestProcessProposal() {
params := buildertypes.Params{
MaxBundleSize: maxBundleSize,
ReserveFee: reserveFee,
MinBuyInFee: minBuyInFee,
FrontRunningProtection: true,
MinBidIncrement: suite.minBidIncrement,
}

View File

@ -12,7 +12,6 @@ func (suite *ABCITestSuite) TestExtendVoteExtensionHandler() {
params := types.Params{
MaxBundleSize: 5,
ReserveFee: sdk.NewCoin("foo", sdk.NewInt(10)),
MinBuyInFee: sdk.NewCoin("foo", sdk.NewInt(10)),
FrontRunningProtection: true,
MinBidIncrement: suite.minBidIncrement,
}
@ -148,7 +147,6 @@ func (suite *ABCITestSuite) TestVerifyVoteExtensionHandler() {
params := types.Params{
MaxBundleSize: 5,
ReserveFee: sdk.NewCoin("foo", sdk.NewInt(100)),
MinBuyInFee: sdk.NewCoin("foo", sdk.NewInt(100)),
FrontRunningProtection: true,
MinBidIncrement: sdk.NewCoin("foo", sdk.NewInt(10)), // can't be tested atm
}

View File

@ -8,7 +8,9 @@ import "amino/amino.proto";
option go_package = "github.com/skip-mev/pob/x/builder/types";
// GenesisState defines the genesis state of the x/builder module.
message GenesisState { Params params = 1 [ (gogoproto.nullable) = false ]; }
message GenesisState {
Params params = 1 [(gogoproto.nullable) = false];
}
// Params defines the parameters of the x/builder module.
message Params {
@ -24,26 +26,21 @@ message Params {
// reserve_fee specifies the bid floor for the auction.
cosmos.base.v1beta1.Coin reserve_fee = 3
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
// min_buy_in_fee specifies the fee that the bidder must pay to enter the
// auction.
cosmos.base.v1beta1.Coin min_buy_in_fee = 4
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
[(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
// min_bid_increment specifies the minimum amount that the next bid must be
// greater than the previous bid.
cosmos.base.v1beta1.Coin min_bid_increment = 5
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
cosmos.base.v1beta1.Coin min_bid_increment = 4
[(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
// front_running_protection specifies whether front running and sandwich
// attack protection is enabled.
bool front_running_protection = 6;
bool front_running_protection = 5;
// proposer_fee defines the portion of the winning bid that goes to the block
// proposer that proposed the block.
string proposer_fee = 7 [
(gogoproto.nullable) = false,
string proposer_fee = 6 [
(gogoproto.nullable) = false,
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"
];
}
}

View File

@ -112,7 +112,6 @@ func (s *IntegrationTestSuite) initNodes() {
MaxBundleSize: 5,
EscrowAccountAddress: "cosmos14j5j2lsx7629590jvpk3vj0xe9w8203jf4yknk",
ReserveFee: sdk.NewCoin(app.BondDenom, sdk.NewInt(1000000)),
MinBuyInFee: sdk.NewCoin(app.BondDenom, sdk.NewInt(1000000)),
MinBidIncrement: sdk.NewCoin(app.BondDenom, sdk.NewInt(1000000)),
ProposerFee: sdk.NewDecWithPrec(1, 2),
}

View File

@ -97,7 +97,6 @@ func (suite *AnteTestSuite) TestAnteHandler() {
// Auction setup
maxBundleSize uint32 = 5
reserveFee = sdk.NewCoin("foo", sdk.NewInt(100))
minBuyInFee = sdk.NewCoin("foo", sdk.NewInt(100))
minBidIncrement = sdk.NewCoin("foo", sdk.NewInt(100))
frontRunningProtection = true
)
@ -139,23 +138,12 @@ func (suite *AnteTestSuite) TestAnteHandler() {
},
false,
},
{
"bid is greater than reserve fee but has insufficient balance to pay the buy in fee",
func() {
balance = sdk.NewCoins(sdk.NewCoin("foo", sdk.NewInt(1000)))
bid = sdk.NewCoin("foo", sdk.NewInt(101))
reserveFee = sdk.NewCoin("foo", sdk.NewInt(100))
minBuyInFee = sdk.NewCoin("foo", sdk.NewInt(1000))
},
false,
},
{
"valid auction bid tx",
func() {
balance = sdk.NewCoins(sdk.NewCoin("foo", sdk.NewInt(10000)))
bid = sdk.NewCoin("foo", sdk.NewInt(1000))
reserveFee = sdk.NewCoin("foo", sdk.NewInt(100))
minBuyInFee = sdk.NewCoin("foo", sdk.NewInt(100))
},
true,
},
@ -173,7 +161,6 @@ func (suite *AnteTestSuite) TestAnteHandler() {
balance = sdk.NewCoins(sdk.NewCoin("foo", sdk.NewInt(10000)))
bid = sdk.NewCoin("foo", sdk.NewInt(1000))
reserveFee = sdk.NewCoin("foo", sdk.NewInt(100))
minBuyInFee = sdk.NewCoin("foo", sdk.NewInt(100))
insertTopBid = true
topBidder = bidder
@ -239,7 +226,6 @@ func (suite *AnteTestSuite) TestAnteHandler() {
err := suite.builderKeeper.SetParams(suite.ctx, buildertypes.Params{
MaxBundleSize: maxBundleSize,
ReserveFee: reserveFee,
MinBuyInFee: minBuyInFee,
MinBidIncrement: minBidIncrement,
FrontRunningProtection: frontRunningProtection,
})

View File

@ -75,17 +75,10 @@ func (k Keeper) ValidateAuctionBid(ctx sdk.Context, bidder sdk.AccAddress, bid,
}
}
// Get the pay-to-play fee.
minBuyInFee, err := k.GetMinBuyInFee(ctx)
if err != nil {
return err
}
// Ensure the bidder has enough funds to cover all the inclusion fees.
minBalance := bid.Add(minBuyInFee)
// ensure the bidder has enough funds to cover all the inclusion fees
balances := k.bankKeeper.GetAllBalances(ctx, bidder)
if !balances.IsAllGTE(sdk.NewCoins(minBalance)) {
return fmt.Errorf("insufficient funds to bid %s (reserve fee + bid) with balance %s", minBalance, balances)
if !balances.IsAllGTE(sdk.NewCoins(bid)) {
return fmt.Errorf("insufficient funds to bid %s with balance %s", bid, balances)
}
return nil

View File

@ -21,7 +21,6 @@ func (suite *KeeperTestSuite) TestValidateBidInfo() {
// Auction params
maxBundleSize uint32 = 10
reserveFee = sdk.NewCoin("foo", sdk.NewInt(1000))
minBuyInFee = sdk.NewCoin("foo", sdk.NewInt(1000))
minBidIncrement = sdk.NewCoin("foo", sdk.NewInt(1000))
escrowAddress = sdk.AccAddress([]byte("escrow"))
frontRunningProtection = true
@ -53,14 +52,6 @@ func (suite *KeeperTestSuite) TestValidateBidInfo() {
},
false,
},
{
"bid amount equals the balance (not accounting for the reserve fee)",
func() {
balance = sdk.NewCoins(sdk.NewCoin("foo", sdk.NewInt(2000)))
bid = sdk.NewCoin("foo", sdk.NewInt(2000))
},
false,
},
{
"too many transactions in the bundle",
func() {
@ -174,7 +165,6 @@ func (suite *KeeperTestSuite) TestValidateBidInfo() {
params := buildertypes.Params{
MaxBundleSize: maxBundleSize,
ReserveFee: reserveFee,
MinBuyInFee: minBuyInFee,
EscrowAccountAddress: escrowAddress.String(),
FrontRunningProtection: frontRunningProtection,
MinBidIncrement: minBidIncrement,

View File

@ -131,16 +131,6 @@ func (k Keeper) GetReserveFee(ctx sdk.Context) (sdk.Coin, error) {
return params.ReserveFee, nil
}
// GetMinBuyInFee returns the fee that the bidder must pay to enter the builder.
func (k Keeper) GetMinBuyInFee(ctx sdk.Context) (sdk.Coin, error) {
params, err := k.GetParams(ctx)
if err != nil {
return sdk.Coin{}, err
}
return params.MinBuyInFee, nil
}
// GetMinBidIncrement returns the minimum bid increment for the builder.
func (k Keeper) GetMinBidIncrement(ctx sdk.Context) (sdk.Coin, error) {
params, err := k.GetParams(ctx)

View File

@ -164,7 +164,6 @@ func (suite *KeeperTestSuite) TestMsgUpdateParams() {
ProposerFee: sdk.MustNewDecFromStr("0.1"),
MaxBundleSize: 2,
EscrowAccountAddress: suite.authorityAccount.String(),
MinBuyInFee: sdk.NewInt64Coin("foo", 100),
MinBidIncrement: sdk.NewInt64Coin("foo", 100),
ReserveFee: sdk.NewInt64Coin("foo", 100),
},

View File

@ -81,18 +81,15 @@ type Params struct {
EscrowAccountAddress string `protobuf:"bytes,2,opt,name=escrow_account_address,json=escrowAccountAddress,proto3" json:"escrow_account_address,omitempty"`
// reserve_fee specifies the bid floor for the auction.
ReserveFee types.Coin `protobuf:"bytes,3,opt,name=reserve_fee,json=reserveFee,proto3" json:"reserve_fee"`
// min_buy_in_fee specifies the fee that the bidder must pay to enter the
// auction.
MinBuyInFee types.Coin `protobuf:"bytes,4,opt,name=min_buy_in_fee,json=minBuyInFee,proto3" json:"min_buy_in_fee"`
// min_bid_increment specifies the minimum amount that the next bid must be
// greater than the previous bid.
MinBidIncrement types.Coin `protobuf:"bytes,5,opt,name=min_bid_increment,json=minBidIncrement,proto3" json:"min_bid_increment"`
MinBidIncrement types.Coin `protobuf:"bytes,4,opt,name=min_bid_increment,json=minBidIncrement,proto3" json:"min_bid_increment"`
// front_running_protection specifies whether front running and sandwich
// attack protection is enabled.
FrontRunningProtection bool `protobuf:"varint,6,opt,name=front_running_protection,json=frontRunningProtection,proto3" json:"front_running_protection,omitempty"`
FrontRunningProtection bool `protobuf:"varint,5,opt,name=front_running_protection,json=frontRunningProtection,proto3" json:"front_running_protection,omitempty"`
// proposer_fee defines the portion of the winning bid that goes to the block
// proposer that proposed the block.
ProposerFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=proposer_fee,json=proposerFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"proposer_fee"`
ProposerFee github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=proposer_fee,json=proposerFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"proposer_fee"`
}
func (m *Params) Reset() { *m = Params{} }
@ -149,13 +146,6 @@ func (m *Params) GetReserveFee() types.Coin {
return types.Coin{}
}
func (m *Params) GetMinBuyInFee() types.Coin {
if m != nil {
return m.MinBuyInFee
}
return types.Coin{}
}
func (m *Params) GetMinBidIncrement() types.Coin {
if m != nil {
return m.MinBidIncrement
@ -178,38 +168,37 @@ func init() {
func init() { proto.RegisterFile("pob/builder/v1/genesis.proto", fileDescriptor_287f1bdff5ccfc33) }
var fileDescriptor_287f1bdff5ccfc33 = []byte{
// 493 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x4f, 0x6f, 0xd3, 0x30,
0x18, 0x87, 0x1b, 0x36, 0x0a, 0x73, 0xf7, 0x47, 0x8b, 0xa6, 0x2a, 0x0c, 0x94, 0x55, 0x3b, 0x8c,
0x6a, 0xd2, 0x6c, 0x15, 0x38, 0x20, 0x6e, 0x2d, 0x63, 0xa8, 0xb7, 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, 0x21, 0x4f,
0x5a, 0xb7, 0x8e, 0x23, 0x80, 0x77, 0x9d, 0x6f, 0x37, 0x17, 0xfb, 0xcf, 0xef, 0xd5, 0x4d, 0xef,
0x86, 0xb4, 0x9e, 0x84, 0xfe, 0xe5, 0x3c, 0x0e, 0xae, 0xe6, 0x71, 0xf0, 0x7b, 0x1e, 0x07, 0xdf,
0x17, 0x71, 0xe3, 0x6a, 0x11, 0x37, 0x7e, 0x2e, 0xe2, 0xc6, 0xe7, 0x97, 0xf7, 0x02, 0xf5, 0x29,
0x2b, 0x0f, 0x38, 0x4c, 0x88, 0x1d, 0xf3, 0x7f, 0x0e, 0x97, 0x9a, 0x35, 0xdd, 0x2c, 0xbe, 0xfe,
0x1b, 0x00, 0x00, 0xff, 0xff, 0x28, 0xf5, 0xc2, 0xb1, 0x04, 0x03, 0x00, 0x00,
// 472 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x41, 0x4f, 0xd4, 0x40,
0x14, 0xc7, 0xb7, 0x82, 0x1b, 0x99, 0x05, 0x09, 0x0d, 0xd9, 0x54, 0x34, 0x65, 0xc3, 0x01, 0x37,
0x24, 0xcc, 0x64, 0xd5, 0x83, 0xf1, 0xb6, 0x2b, 0x62, 0xbc, 0xad, 0xe5, 0xe6, 0xa5, 0x99, 0x4e,
0x1f, 0x75, 0x02, 0x33, 0xd3, 0xcc, 0x4c, 0xeb, 0xca, 0x47, 0xf0, 0xe4, 0xc7, 0xf0, 0x64, 0xf8,
0x18, 0x1c, 0x39, 0x1a, 0x0f, 0xc4, 0xec, 0x1e, 0xf8, 0x1a, 0xa6, 0x33, 0x05, 0xf1, 0xc8, 0xa5,
0x6d, 0xe6, 0xf7, 0xe6, 0xff, 0x7f, 0xff, 0xbe, 0x87, 0x9e, 0x95, 0x2a, 0x23, 0x59, 0xc5, 0x4f,
0x73, 0xd0, 0xa4, 0x1e, 0x91,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 0x02, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
@ -274,7 +263,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x3a
dAtA[i] = 0x32
if m.FrontRunningProtection {
i--
if m.FrontRunningProtection {
@ -283,7 +272,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
dAtA[i] = 0
}
i--
dAtA[i] = 0x30
dAtA[i] = 0x28
}
{
size, err := m.MinBidIncrement.MarshalToSizedBuffer(dAtA[:i])
@ -294,16 +283,6 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
{
size, err := m.MinBuyInFee.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintGenesis(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
{
size, err := m.ReserveFee.MarshalToSizedBuffer(dAtA[:i])
@ -367,8 +346,6 @@ func (m *Params) Size() (n int) {
}
l = m.ReserveFee.Size()
n += 1 + l + sovGenesis(uint64(l))
l = m.MinBuyInFee.Size()
n += 1 + l + sovGenesis(uint64(l))
l = m.MinBidIncrement.Size()
n += 1 + l + sovGenesis(uint64(l))
if m.FrontRunningProtection {
@ -582,39 +559,6 @@ func (m *Params) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MinBuyInFee", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.MinBuyInFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field MinBidIncrement", wireType)
}
@ -647,7 +591,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 6:
case 5:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field FrontRunningProtection", wireType)
}
@ -667,7 +611,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
}
}
m.FrontRunningProtection = bool(v != 0)
case 7:
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProposerFee", wireType)
}

View File

@ -120,7 +120,6 @@ func TestMsgUpdateParams(t *testing.T) {
EscrowAccountAddress: sdk.AccAddress([]byte("test")).String(),
ReserveFee: sdk.NewCoin("test", sdk.NewInt(100)),
MinBidIncrement: sdk.NewCoin("test", sdk.NewInt(100)),
MinBuyInFee: sdk.NewCoin("test", sdk.NewInt(100)),
},
},
expectPass: true,
@ -134,7 +133,6 @@ func TestMsgUpdateParams(t *testing.T) {
EscrowAccountAddress: sdk.AccAddress([]byte("test")).String(),
ReserveFee: sdk.NewCoin("test", sdk.NewInt(100)),
MinBidIncrement: sdk.NewCoin("test2", sdk.NewInt(100)),
MinBuyInFee: sdk.NewCoin("test3", sdk.NewInt(100)),
},
},
expectPass: false,

View File

@ -11,7 +11,6 @@ var (
DefaultMaxBundleSize uint32 = 2
DefaultEscrowAccountAddress string
DefaultReserveFee = sdk.Coin{}
DefaultMinBuyInFee = sdk.Coin{}
DefaultMinBidIncrement = sdk.Coin{}
DefaultFrontRunningProtection = true
DefaultProposerFee = sdk.ZeroDec()
@ -21,7 +20,7 @@ var (
func NewParams(
maxBundleSize uint32,
escrowAccountAddress string,
reserveFee, minBuyInFee, minBidIncrement sdk.Coin,
reserveFee, minBidIncrement sdk.Coin,
frontRunningProtection bool,
proposerFee sdk.Dec,
) Params {
@ -29,7 +28,6 @@ func NewParams(
MaxBundleSize: maxBundleSize,
EscrowAccountAddress: escrowAccountAddress,
ReserveFee: reserveFee,
MinBuyInFee: minBuyInFee,
MinBidIncrement: minBidIncrement,
FrontRunningProtection: frontRunningProtection,
ProposerFee: proposerFee,
@ -42,7 +40,6 @@ func DefaultParams() Params {
DefaultMaxBundleSize,
DefaultEscrowAccountAddress,
DefaultReserveFee,
DefaultMinBuyInFee,
DefaultMinBidIncrement,
DefaultFrontRunningProtection,
DefaultProposerFee,
@ -54,27 +51,20 @@ func (p Params) Validate() error {
if err := validateEscrowAccountAddress(p.EscrowAccountAddress); err != nil {
return err
}
if err := validateFee(p.ReserveFee); err != nil {
return fmt.Errorf("invalid reserve fee (%s)", err)
}
if err := validateFee(p.MinBuyInFee); err != nil {
return fmt.Errorf("invalid minimum buy-in fee (%s)", err)
}
if err := validateFee(p.MinBidIncrement); err != nil {
return fmt.Errorf("invalid minimum bid increment (%s)", err)
}
denoms := map[string]struct{}{
p.ReserveFee.Denom: {},
p.MinBuyInFee.Denom: {},
p.MinBidIncrement.Denom: {},
}
if len(denoms) != 1 {
return fmt.Errorf("mismatched auction fee denoms: minimum bid increment (%s), minimum buy-in fee (%s), reserve fee (%s)", p.MinBidIncrement, p.MinBuyInFee, p.ReserveFee)
return fmt.Errorf("mismatched auction fee denoms: minimum bid increment (%s), reserve fee (%s)", p.MinBidIncrement, p.ReserveFee)
}
return validateProposerFee(p.ProposerFee)