feat: Provide Configuration Options for POB (#206) (#211)

Co-authored-by: Keefer Taylor | Tessellated <keefer@tessellated.io>
This commit is contained in:
Nikhil Vasan 2023-07-17 16:32:20 +02:00 committed by GitHub
parent 43789945e9
commit 8b5ebc310a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 322 additions and 308 deletions

View File

@ -452,7 +452,8 @@ type Module struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Authority defines the custom module authority. If not set, defaults to the governance module.
// Authority defines the custom module authority. If not set, defaults to the
// governance module.
Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"`
}

View File

@ -455,7 +455,6 @@ var (
fd_Params_max_bundle_size protoreflect.FieldDescriptor
fd_Params_escrow_account_address protoreflect.FieldDescriptor
fd_Params_reserve_fee protoreflect.FieldDescriptor
fd_Params_min_buy_in_fee protoreflect.FieldDescriptor
fd_Params_min_bid_increment protoreflect.FieldDescriptor
fd_Params_front_running_protection protoreflect.FieldDescriptor
fd_Params_proposer_fee protoreflect.FieldDescriptor
@ -467,7 +466,6 @@ func init() {
fd_Params_max_bundle_size = md_Params.Fields().ByName("max_bundle_size")
fd_Params_escrow_account_address = md_Params.Fields().ByName("escrow_account_address")
fd_Params_reserve_fee = md_Params.Fields().ByName("reserve_fee")
fd_Params_min_buy_in_fee = md_Params.Fields().ByName("min_buy_in_fee")
fd_Params_min_bid_increment = md_Params.Fields().ByName("min_bid_increment")
fd_Params_front_running_protection = md_Params.Fields().ByName("front_running_protection")
fd_Params_proposer_fee = md_Params.Fields().ByName("proposer_fee")
@ -544,8 +542,8 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto
return
}
}
if x.EscrowAccountAddress != "" {
value := protoreflect.ValueOfString(x.EscrowAccountAddress)
if len(x.EscrowAccountAddress) != 0 {
value := protoreflect.ValueOfBytes(x.EscrowAccountAddress)
if !f(fd_Params_escrow_account_address, value) {
return
}
@ -556,12 +554,6 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto
return
}
}
if x.MinBuyInFee != nil {
value := protoreflect.ValueOfMessage(x.MinBuyInFee.ProtoReflect())
if !f(fd_Params_min_buy_in_fee, value) {
return
}
}
if x.MinBidIncrement != nil {
value := protoreflect.ValueOfMessage(x.MinBidIncrement.ProtoReflect())
if !f(fd_Params_min_bid_increment, value) {
@ -598,11 +590,9 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool {
case "pob.builder.v1.Params.max_bundle_size":
return x.MaxBundleSize != uint32(0)
case "pob.builder.v1.Params.escrow_account_address":
return x.EscrowAccountAddress != ""
return len(x.EscrowAccountAddress) != 0
case "pob.builder.v1.Params.reserve_fee":
return x.ReserveFee != nil
case "pob.builder.v1.Params.min_buy_in_fee":
return x.MinBuyInFee != nil
case "pob.builder.v1.Params.min_bid_increment":
return x.MinBidIncrement != nil
case "pob.builder.v1.Params.front_running_protection":
@ -628,11 +618,9 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) {
case "pob.builder.v1.Params.max_bundle_size":
x.MaxBundleSize = uint32(0)
case "pob.builder.v1.Params.escrow_account_address":
x.EscrowAccountAddress = ""
x.EscrowAccountAddress = nil
case "pob.builder.v1.Params.reserve_fee":
x.ReserveFee = nil
case "pob.builder.v1.Params.min_buy_in_fee":
x.MinBuyInFee = nil
case "pob.builder.v1.Params.min_bid_increment":
x.MinBidIncrement = nil
case "pob.builder.v1.Params.front_running_protection":
@ -660,13 +648,10 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro
return protoreflect.ValueOfUint32(value)
case "pob.builder.v1.Params.escrow_account_address":
value := x.EscrowAccountAddress
return protoreflect.ValueOfString(value)
return protoreflect.ValueOfBytes(value)
case "pob.builder.v1.Params.reserve_fee":
value := x.ReserveFee
return protoreflect.ValueOfMessage(value.ProtoReflect())
case "pob.builder.v1.Params.min_buy_in_fee":
value := x.MinBuyInFee
return protoreflect.ValueOfMessage(value.ProtoReflect())
case "pob.builder.v1.Params.min_bid_increment":
value := x.MinBidIncrement
return protoreflect.ValueOfMessage(value.ProtoReflect())
@ -699,11 +684,9 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto
case "pob.builder.v1.Params.max_bundle_size":
x.MaxBundleSize = uint32(value.Uint())
case "pob.builder.v1.Params.escrow_account_address":
x.EscrowAccountAddress = value.Interface().(string)
x.EscrowAccountAddress = value.Bytes()
case "pob.builder.v1.Params.reserve_fee":
x.ReserveFee = value.Message().Interface().(*v1beta1.Coin)
case "pob.builder.v1.Params.min_buy_in_fee":
x.MinBuyInFee = value.Message().Interface().(*v1beta1.Coin)
case "pob.builder.v1.Params.min_bid_increment":
x.MinBidIncrement = value.Message().Interface().(*v1beta1.Coin)
case "pob.builder.v1.Params.front_running_protection":
@ -735,11 +718,6 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore
x.ReserveFee = new(v1beta1.Coin)
}
return protoreflect.ValueOfMessage(x.ReserveFee.ProtoReflect())
case "pob.builder.v1.Params.min_buy_in_fee":
if x.MinBuyInFee == nil {
x.MinBuyInFee = new(v1beta1.Coin)
}
return protoreflect.ValueOfMessage(x.MinBuyInFee.ProtoReflect())
case "pob.builder.v1.Params.min_bid_increment":
if x.MinBidIncrement == nil {
x.MinBidIncrement = new(v1beta1.Coin)
@ -769,13 +747,10 @@ func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protor
case "pob.builder.v1.Params.max_bundle_size":
return protoreflect.ValueOfUint32(uint32(0))
case "pob.builder.v1.Params.escrow_account_address":
return protoreflect.ValueOfString("")
return protoreflect.ValueOfBytes(nil)
case "pob.builder.v1.Params.reserve_fee":
m := new(v1beta1.Coin)
return protoreflect.ValueOfMessage(m.ProtoReflect())
case "pob.builder.v1.Params.min_buy_in_fee":
m := new(v1beta1.Coin)
return protoreflect.ValueOfMessage(m.ProtoReflect())
case "pob.builder.v1.Params.min_bid_increment":
m := new(v1beta1.Coin)
return protoreflect.ValueOfMessage(m.ProtoReflect())
@ -863,10 +838,6 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
l = options.Size(x.ReserveFee)
n += 1 + l + runtime.Sov(uint64(l))
}
if x.MinBuyInFee != nil {
l = options.Size(x.MinBuyInFee)
n += 1 + l + runtime.Sov(uint64(l))
}
if x.MinBidIncrement != nil {
l = options.Size(x.MinBidIncrement)
n += 1 + l + runtime.Sov(uint64(l))
@ -912,7 +883,7 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
copy(dAtA[i:], x.ProposerFee)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ProposerFee)))
i--
dAtA[i] = 0x3a
dAtA[i] = 0x32
}
if x.FrontRunningProtection {
i--
@ -922,7 +893,7 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
dAtA[i] = 0
}
i--
dAtA[i] = 0x30
dAtA[i] = 0x28
}
if x.MinBidIncrement != nil {
encoded, err := options.Marshal(x.MinBidIncrement)
@ -936,20 +907,6 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
copy(dAtA[i:], encoded)
i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))
i--
dAtA[i] = 0x2a
}
if x.MinBuyInFee != nil {
encoded, err := options.Marshal(x.MinBuyInFee)
if err != nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, err
}
i -= len(encoded)
copy(dAtA[i:], encoded)
i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))
i--
dAtA[i] = 0x22
}
if x.ReserveFee != nil {
@ -1050,7 +1007,7 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field EscrowAccountAddress", wireType)
}
var stringLen uint64
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
@ -1060,23 +1017,25 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
if byteLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
postIndex := iNdEx + byteLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.EscrowAccountAddress = string(dAtA[iNdEx:postIndex])
x.EscrowAccountAddress = append(x.EscrowAccountAddress[:0], dAtA[iNdEx:postIndex]...)
if x.EscrowAccountAddress == nil {
x.EscrowAccountAddress = []byte{}
}
iNdEx = postIndex
case 3:
if wireType != 2 {
@ -1115,42 +1074,6 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinBuyInFee", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
if x.MinBuyInFee == nil {
x.MinBuyInFee = &v1beta1.Coin{}
}
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.MinBuyInFee); err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinBidIncrement", wireType)
}
@ -1186,7 +1109,7 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
iNdEx = postIndex
case 6:
case 5:
if wireType != 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field FrontRunningProtection", wireType)
}
@ -1206,7 +1129,7 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
}
}
x.FrontRunningProtection = bool(v != 0)
case 7:
case 6:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProposerFee", wireType)
}
@ -1333,21 +1256,18 @@ type Params struct {
MaxBundleSize uint32 `protobuf:"varint,1,opt,name=max_bundle_size,json=maxBundleSize,proto3" json:"max_bundle_size,omitempty"`
// escrow_account_address is the address of the account that will receive a
// portion of the bid proceeds.
EscrowAccountAddress string `protobuf:"bytes,2,opt,name=escrow_account_address,json=escrowAccountAddress,proto3" json:"escrow_account_address,omitempty"`
EscrowAccountAddress []byte `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 *v1beta1.Coin `protobuf:"bytes,3,opt,name=reserve_fee,json=reserveFee,proto3" json:"reserve_fee,omitempty"`
// min_buy_in_fee specifies the fee that the bidder must pay to enter the
// auction.
MinBuyInFee *v1beta1.Coin `protobuf:"bytes,4,opt,name=min_buy_in_fee,json=minBuyInFee,proto3" json:"min_buy_in_fee,omitempty"`
// min_bid_increment specifies the minimum amount that the next bid must be
// greater than the previous bid.
MinBidIncrement *v1beta1.Coin `protobuf:"bytes,5,opt,name=min_bid_increment,json=minBidIncrement,proto3" json:"min_bid_increment,omitempty"`
MinBidIncrement *v1beta1.Coin `protobuf:"bytes,4,opt,name=min_bid_increment,json=minBidIncrement,proto3" json:"min_bid_increment,omitempty"`
// 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 string `protobuf:"bytes,7,opt,name=proposer_fee,json=proposerFee,proto3" json:"proposer_fee,omitempty"`
ProposerFee string `protobuf:"bytes,6,opt,name=proposer_fee,json=proposerFee,proto3" json:"proposer_fee,omitempty"`
}
func (x *Params) Reset() {
@ -1377,11 +1297,11 @@ func (x *Params) GetMaxBundleSize() uint32 {
return 0
}
func (x *Params) GetEscrowAccountAddress() string {
func (x *Params) GetEscrowAccountAddress() []byte {
if x != nil {
return x.EscrowAccountAddress
}
return ""
return nil
}
func (x *Params) GetReserveFee() *v1beta1.Coin {
@ -1391,13 +1311,6 @@ func (x *Params) GetReserveFee() *v1beta1.Coin {
return nil
}
func (x *Params) GetMinBuyInFee() *v1beta1.Coin {
if x != nil {
return x.MinBuyInFee
}
return nil
}
func (x *Params) GetMinBidIncrement() *v1beta1.Coin {
if x != nil {
return x.MinBidIncrement
@ -1433,50 +1346,45 @@ var file_pob_builder_v1_genesis_proto_rawDesc = []byte{
0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d,
0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x6f, 0x62, 0x2e, 0x62, 0x75,
0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42,
0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0xf9, 0x03,
0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0xae, 0x03,
0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x5f,
0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0d, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65,
0x12, 0x34, 0x0a, 0x16, 0x65, 0x73, 0x63, 0x72, 0x6f, 0x77, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c,
0x52, 0x14, 0x65, 0x73, 0x63, 0x72, 0x6f, 0x77, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41,
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x45, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76,
0x65, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61,
0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a,
0x01, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x46, 0x65, 0x65, 0x12, 0x49, 0x0a,
0x0e, 0x6d, 0x69, 0x6e, 0x5f, 0x62, 0x75, 0x79, 0x5f, 0x69, 0x6e, 0x5f, 0x66, 0x65, 0x65, 0x18,
0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62,
0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e,
0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0b, 0x6d, 0x69, 0x6e,
0x42, 0x75, 0x79, 0x49, 0x6e, 0x46, 0x65, 0x65, 0x12, 0x50, 0x0a, 0x11, 0x6d, 0x69, 0x6e, 0x5f,
0x62, 0x69, 0x64, 0x5f, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73,
0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09,
0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0f, 0x6d, 0x69, 0x6e, 0x42, 0x69,
0x64, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x38, 0x0a, 0x18, 0x66, 0x72,
0x6f, 0x6e, 0x74, 0x5f, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x66, 0x72,
0x6f, 0x6e, 0x74, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x12, 0x51, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72,
0x5f, 0x66, 0x65, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2e, 0xc8, 0xde, 0x1f, 0x00,
0xda, 0xde, 0x1f, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b,
0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x70,
0x6f, 0x73, 0x65, 0x72, 0x46, 0x65, 0x65, 0x3a, 0x20, 0x8a, 0xe7, 0xb0, 0x2a, 0x1b, 0x63, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x78, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64,
0x65, 0x72, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xa7, 0x01, 0x0a, 0x12, 0x63, 0x6f,
0x6d, 0x2e, 0x70, 0x6f, 0x62, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x76, 0x31,
0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
0x5a, 0x29, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61,
0x70, 0x69, 0x2f, 0x70, 0x6f, 0x62, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2f, 0x76,
0x31, 0x3b, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x50, 0x42,
0x58, 0xaa, 0x02, 0x0e, 0x50, 0x6f, 0x62, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e,
0x56, 0x31, 0xca, 0x02, 0x0e, 0x50, 0x6f, 0x62, 0x5c, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72,
0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x62, 0x5c, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65,
0x72, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
0xea, 0x02, 0x10, 0x50, 0x6f, 0x62, 0x3a, 0x3a, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x3a,
0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x01, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x46, 0x65, 0x65, 0x12, 0x50, 0x0a,
0x11, 0x6d, 0x69, 0x6e, 0x5f, 0x62, 0x69, 0x64, 0x5f, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65,
0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43,
0x6f, 0x69, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0f,
0x6d, 0x69, 0x6e, 0x42, 0x69, 0x64, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12,
0x38, 0x0a, 0x18, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x5f, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67,
0x5f, 0x70, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28,
0x08, 0x52, 0x16, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x50,
0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x51, 0x0a, 0x0c, 0x70, 0x72, 0x6f,
0x70, 0x6f, 0x73, 0x65, 0x72, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42,
0x2e, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52,
0x0b, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x46, 0x65, 0x65, 0x3a, 0x20, 0x8a, 0xe7,
0xb0, 0x2a, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x78, 0x2f,
0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xa7,
0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x62, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64,
0x65, 0x72, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b,
0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x62, 0x2f, 0x62, 0x75, 0x69, 0x6c,
0x64, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x76, 0x31,
0xa2, 0x02, 0x03, 0x50, 0x42, 0x58, 0xaa, 0x02, 0x0e, 0x50, 0x6f, 0x62, 0x2e, 0x42, 0x75, 0x69,
0x6c, 0x64, 0x65, 0x72, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0e, 0x50, 0x6f, 0x62, 0x5c, 0x42, 0x75,
0x69, 0x6c, 0x64, 0x65, 0x72, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1a, 0x50, 0x6f, 0x62, 0x5c, 0x42,
0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74,
0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, 0x50, 0x6f, 0x62, 0x3a, 0x3a, 0x42, 0x75, 0x69,
0x6c, 0x64, 0x65, 0x72, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -1500,13 +1408,12 @@ var file_pob_builder_v1_genesis_proto_goTypes = []interface{}{
var file_pob_builder_v1_genesis_proto_depIdxs = []int32{
1, // 0: pob.builder.v1.GenesisState.params:type_name -> pob.builder.v1.Params
2, // 1: pob.builder.v1.Params.reserve_fee:type_name -> cosmos.base.v1beta1.Coin
2, // 2: pob.builder.v1.Params.min_buy_in_fee:type_name -> cosmos.base.v1beta1.Coin
2, // 3: pob.builder.v1.Params.min_bid_increment:type_name -> cosmos.base.v1beta1.Coin
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
2, // 2: pob.builder.v1.Params.min_bid_increment:type_name -> cosmos.base.v1beta1.Coin
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_pob_builder_v1_genesis_proto_init() }

View File

@ -18,49 +18,49 @@ import (
sync "sync"
)
var _ protoreflect.List = (*_MsgAuctionBid_4_list)(nil)
var _ protoreflect.List = (*_MsgAuctionBid_3_list)(nil)
type _MsgAuctionBid_4_list struct {
type _MsgAuctionBid_3_list struct {
list *[][]byte
}
func (x *_MsgAuctionBid_4_list) Len() int {
func (x *_MsgAuctionBid_3_list) Len() int {
if x.list == nil {
return 0
}
return len(*x.list)
}
func (x *_MsgAuctionBid_4_list) Get(i int) protoreflect.Value {
func (x *_MsgAuctionBid_3_list) Get(i int) protoreflect.Value {
return protoreflect.ValueOfBytes((*x.list)[i])
}
func (x *_MsgAuctionBid_4_list) Set(i int, value protoreflect.Value) {
func (x *_MsgAuctionBid_3_list) Set(i int, value protoreflect.Value) {
valueUnwrapped := value.Bytes()
concreteValue := valueUnwrapped
(*x.list)[i] = concreteValue
}
func (x *_MsgAuctionBid_4_list) Append(value protoreflect.Value) {
func (x *_MsgAuctionBid_3_list) Append(value protoreflect.Value) {
valueUnwrapped := value.Bytes()
concreteValue := valueUnwrapped
*x.list = append(*x.list, concreteValue)
}
func (x *_MsgAuctionBid_4_list) AppendMutable() protoreflect.Value {
func (x *_MsgAuctionBid_3_list) AppendMutable() protoreflect.Value {
panic(fmt.Errorf("AppendMutable can not be called on message MsgAuctionBid at list field Transactions as it is not of Message kind"))
}
func (x *_MsgAuctionBid_4_list) Truncate(n int) {
func (x *_MsgAuctionBid_3_list) Truncate(n int) {
*x.list = (*x.list)[:n]
}
func (x *_MsgAuctionBid_4_list) NewElement() protoreflect.Value {
func (x *_MsgAuctionBid_3_list) NewElement() protoreflect.Value {
var v []byte
return protoreflect.ValueOfBytes(v)
}
func (x *_MsgAuctionBid_4_list) IsValid() bool {
func (x *_MsgAuctionBid_3_list) IsValid() bool {
return x.list != nil
}
@ -157,7 +157,7 @@ func (x *fastReflection_MsgAuctionBid) Range(f func(protoreflect.FieldDescriptor
}
}
if len(x.Transactions) != 0 {
value := protoreflect.ValueOfList(&_MsgAuctionBid_4_list{list: &x.Transactions})
value := protoreflect.ValueOfList(&_MsgAuctionBid_3_list{list: &x.Transactions})
if !f(fd_MsgAuctionBid_transactions, value) {
return
}
@ -229,9 +229,9 @@ func (x *fastReflection_MsgAuctionBid) Get(descriptor protoreflect.FieldDescript
return protoreflect.ValueOfMessage(value.ProtoReflect())
case "pob.builder.v1.MsgAuctionBid.transactions":
if len(x.Transactions) == 0 {
return protoreflect.ValueOfList(&_MsgAuctionBid_4_list{})
return protoreflect.ValueOfList(&_MsgAuctionBid_3_list{})
}
listValue := &_MsgAuctionBid_4_list{list: &x.Transactions}
listValue := &_MsgAuctionBid_3_list{list: &x.Transactions}
return protoreflect.ValueOfList(listValue)
default:
if descriptor.IsExtension() {
@ -259,7 +259,7 @@ func (x *fastReflection_MsgAuctionBid) Set(fd protoreflect.FieldDescriptor, valu
x.Bid = value.Message().Interface().(*v1beta1.Coin)
case "pob.builder.v1.MsgAuctionBid.transactions":
lv := value.List()
clv := lv.(*_MsgAuctionBid_4_list)
clv := lv.(*_MsgAuctionBid_3_list)
x.Transactions = *clv.list
default:
if fd.IsExtension() {
@ -290,7 +290,7 @@ func (x *fastReflection_MsgAuctionBid) Mutable(fd protoreflect.FieldDescriptor)
if x.Transactions == nil {
x.Transactions = [][]byte{}
}
value := &_MsgAuctionBid_4_list{list: &x.Transactions}
value := &_MsgAuctionBid_3_list{list: &x.Transactions}
return protoreflect.ValueOfList(value)
case "pob.builder.v1.MsgAuctionBid.bidder":
panic(fmt.Errorf("field bidder of message pob.builder.v1.MsgAuctionBid is not mutable"))
@ -314,7 +314,7 @@ func (x *fastReflection_MsgAuctionBid) NewField(fd protoreflect.FieldDescriptor)
return protoreflect.ValueOfMessage(m.ProtoReflect())
case "pob.builder.v1.MsgAuctionBid.transactions":
list := [][]byte{}
return protoreflect.ValueOfList(&_MsgAuctionBid_4_list{list: &list})
return protoreflect.ValueOfList(&_MsgAuctionBid_3_list{list: &list})
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: pob.builder.v1.MsgAuctionBid"))
@ -433,7 +433,7 @@ func (x *fastReflection_MsgAuctionBid) ProtoMethods() *protoiface.Methods {
copy(dAtA[i:], x.Transactions[iNdEx])
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Transactions[iNdEx])))
i--
dAtA[i] = 0x22
dAtA[i] = 0x1a
}
}
if x.Bid != nil {
@ -448,7 +448,7 @@ func (x *fastReflection_MsgAuctionBid) ProtoMethods() *protoiface.Methods {
copy(dAtA[i:], encoded)
i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded)))
i--
dAtA[i] = 0x1a
dAtA[i] = 0x12
}
if len(x.Bidder) > 0 {
i -= len(x.Bidder)
@ -538,7 +538,7 @@ func (x *fastReflection_MsgAuctionBid) ProtoMethods() *protoiface.Methods {
}
x.Bidder = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
case 2:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Bid", wireType)
}
@ -574,7 +574,7 @@ func (x *fastReflection_MsgAuctionBid) ProtoMethods() *protoiface.Methods {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
iNdEx = postIndex
case 4:
case 3:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Transactions", wireType)
}
@ -1877,10 +1877,10 @@ type MsgAuctionBid struct {
Bidder string `protobuf:"bytes,1,opt,name=bidder,proto3" json:"bidder,omitempty"`
// bid is the amount of coins that the bidder is bidding to participate in the
// auction.
Bid *v1beta1.Coin `protobuf:"bytes,3,opt,name=bid,proto3" json:"bid,omitempty"`
Bid *v1beta1.Coin `protobuf:"bytes,2,opt,name=bid,proto3" json:"bid,omitempty"`
// transactions are the bytes of the transactions that the bidder wants to
// bundle together.
Transactions [][]byte `protobuf:"bytes,4,rep,name=transactions,proto3" json:"transactions,omitempty"`
Transactions [][]byte `protobuf:"bytes,3,rep,name=transactions,proto3" json:"transactions,omitempty"`
}
func (x *MsgAuctionBid) Reset() {
@ -2047,11 +2047,11 @@ var file_pob_builder_v1_tx_proto_rawDesc = []byte{
0x6e, 0x42, 0x69, 0x64, 0x12, 0x30, 0x0a, 0x06, 0x62, 0x69, 0x64, 0x64, 0x65, 0x72, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73,
0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06,
0x62, 0x69, 0x64, 0x64, 0x65, 0x72, 0x12, 0x36, 0x0a, 0x03, 0x62, 0x69, 0x64, 0x18, 0x03, 0x20,
0x62, 0x69, 0x64, 0x64, 0x65, 0x72, 0x12, 0x36, 0x0a, 0x03, 0x62, 0x69, 0x64, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73,
0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x09,
0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x03, 0x62, 0x69, 0x64, 0x12, 0x22,
0x0a, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04,
0x0a, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03,
0x20, 0x03, 0x28, 0x0c, 0x52, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x3a, 0x2f, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x62, 0x69, 0x64,
0x64, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x1b, 0x70, 0x6f, 0x62, 0x2f, 0x78, 0x2f, 0x62, 0x75,

View File

@ -7,9 +7,10 @@ import "cosmos/app/v1alpha1/module.proto";
// Module is the config object of the builder module.
message Module {
option (cosmos.app.v1alpha1.module) = {
go_import: "github.com/skip-mev/pob/x/builder"
go_import : "github.com/skip-mev/pob/x/builder"
};
// Authority defines the custom module authority. If not set, defaults to the governance module.
// Authority defines the custom module authority. If not set, defaults to the
// governance module.
string authority = 2;
}

View File

@ -8,9 +8,7 @@ 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 {
@ -22,16 +20,16 @@ message Params {
// escrow_account_address is the address of the account that will receive a
// portion of the bid proceeds.
string escrow_account_address = 2;
bytes escrow_account_address = 2;
// reserve_fee specifies the bid floor for the auction.
cosmos.base.v1beta1.Coin reserve_fee = 3
[(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 = 4
[(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
// front_running_protection specifies whether front running and sandwich
// attack protection is enabled.
@ -40,7 +38,7 @@ message Params {
// proposer_fee defines the portion of the winning bid that goes to the block
// proposer that proposed the block.
string proposer_fee = 6 [
(gogoproto.nullable) = false,
(gogoproto.nullable) = false,
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"
];
}

View File

@ -116,9 +116,12 @@ func (s *IntegrationTestSuite) initNodes() {
val0ConfigDir := s.chain.validators[0].configDir()
// Define the builder module parameters
escrowAddress, err := sdk.AccAddressFromBech32("cosmos14j5j2lsx7629590jvpk3vj0xe9w8203jf4yknk")
s.Require().Nil(err, "Unexpected error decoding escrow address")
params := types.Params{
MaxBundleSize: 5,
EscrowAccountAddress: "cosmos14j5j2lsx7629590jvpk3vj0xe9w8203jf4yknk",
EscrowAccountAddress: escrowAddress,
ReserveFee: sdk.NewCoin(app.BondDenom, sdk.NewInt(1000000)),
MinBidIncrement: sdk.NewCoin(app.BondDenom, sdk.NewInt(1000000)),
ProposerFee: sdk.NewDecWithPrec(1, 2),

View File

@ -49,7 +49,7 @@ func (s *IntegrationTestSuite) TestValidBids() {
name: "Valid auction bid",
test: func() {
// Get escrow account balance to ensure that it is updated correctly
escrowBalance := s.queryBalanceOf(escrowAddress, app.BondDenom)
escrowBalance := s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom)
// Create a bundle with a single transaction
bundle := [][]byte{
@ -76,14 +76,14 @@ func (s *IntegrationTestSuite) TestValidBids() {
// Ensure that the escrow account has the correct balance
expectedEscrowFee := s.calculateProposerEscrowSplit(bid)
s.Require().Equal(escrowBalance.Add(expectedEscrowFee), s.queryBalanceOf(escrowAddress, app.BondDenom))
s.Require().Equal(escrowBalance.Add(expectedEscrowFee), s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom))
},
},
{
name: "Valid bid with multiple other transactions",
test: func() {
// Get escrow account balance to ensure that it is updated correctly
escrowBalance := s.queryBalanceOf(escrowAddress, app.BondDenom)
escrowBalance := s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom)
// Create a bundle with a multiple transaction that is valid
bundle := make([][]byte, maxBundleSize)
@ -132,14 +132,14 @@ func (s *IntegrationTestSuite) TestValidBids() {
// Ensure that the escrow account has the correct balance
expectedEscrowFee := s.calculateProposerEscrowSplit(bid)
s.Require().Equal(escrowBalance.Add(expectedEscrowFee), s.queryBalanceOf(escrowAddress, app.BondDenom))
s.Require().Equal(escrowBalance.Add(expectedEscrowFee), s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom))
},
},
{
name: "iterative bidding from the same account",
test: func() {
// Get escrow account balance to ensure that it is updated correctly
escrowBalance := s.queryBalanceOf(escrowAddress, app.BondDenom)
escrowBalance := s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom)
// Create a bundle with a multiple transaction that is valid
bundle := make([][]byte, maxBundleSize)
@ -191,14 +191,14 @@ func (s *IntegrationTestSuite) TestValidBids() {
// Ensure that the escrow account has the correct balance
expectedEscrowFee := s.calculateProposerEscrowSplit(bid3)
s.Require().Equal(escrowBalance.Add(expectedEscrowFee), s.queryBalanceOf(escrowAddress, app.BondDenom))
s.Require().Equal(escrowBalance.Add(expectedEscrowFee), s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom))
},
},
{
name: "bid with a bundle with transactions that are already in the mempool",
test: func() {
// Get escrow account balance to ensure that it is updated correctly
escrowBalance := s.queryBalanceOf(escrowAddress, app.BondDenom)
escrowBalance := s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom)
// Create a bundle with a multiple transaction that is valid
bundle := make([][]byte, maxBundleSize)
@ -251,14 +251,14 @@ func (s *IntegrationTestSuite) TestValidBids() {
// Ensure that the escrow account has the correct balance
expectedEscrowFee := s.calculateProposerEscrowSplit(bid)
s.Require().Equal(escrowBalance.Add(expectedEscrowFee), s.queryBalanceOf(escrowAddress, app.BondDenom))
s.Require().Equal(escrowBalance.Add(expectedEscrowFee), s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom))
},
},
{
name: "searcher attempts to include several txs in the same block to invalidate auction (we extract bid regardless)",
test: func() {
// Get escrow account balance to ensure that it is updated correctly
escrowBalance := s.queryBalanceOf(escrowAddress, app.BondDenom)
escrowBalance := s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom)
// Create a bundle with a multiple transaction that is valid
bundle := make([][]byte, maxBundleSize)
@ -310,7 +310,7 @@ func (s *IntegrationTestSuite) TestValidBids() {
// Ensure that the escrow account has the correct balance
expectedEscrowFee := s.calculateProposerEscrowSplit(bid)
s.Require().Equal(escrowBalance.Add(expectedEscrowFee), s.queryBalanceOf(escrowAddress, app.BondDenom))
s.Require().Equal(escrowBalance.Add(expectedEscrowFee), s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom))
},
},
}
@ -359,7 +359,7 @@ func (s *IntegrationTestSuite) TestMultipleBids() {
name: "broadcasting bids to two different validators (both should execute over several blocks) with same bid",
test: func() {
// Get escrow account balance to ensure that it is updated correctly
escrowBalance := s.queryBalanceOf(escrowAddress, app.BondDenom)
escrowBalance := s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom)
// Create a bundle with a multiple transaction that is valid
bundle := make([][]byte, maxBundleSize)
@ -417,14 +417,14 @@ func (s *IntegrationTestSuite) TestMultipleBids() {
// Ensure that the escrow account has the correct balance (both bids should have been extracted by this point)
expectedEscrowFee := s.calculateProposerEscrowSplit(bid).Add(s.calculateProposerEscrowSplit(bid2))
s.Require().Equal(escrowBalance.Add(expectedEscrowFee), s.queryBalanceOf(escrowAddress, app.BondDenom))
s.Require().Equal(escrowBalance.Add(expectedEscrowFee), s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom))
},
},
{
name: "multi-block auction bids with different bids",
test: func() {
// Get escrow account balance to ensure that it is updated correctly
escrowBalance := s.queryBalanceOf(escrowAddress, app.BondDenom)
escrowBalance := s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom)
// Create a bundle with a multiple transaction that is valid
bundle := make([][]byte, maxBundleSize)
@ -485,14 +485,14 @@ func (s *IntegrationTestSuite) TestMultipleBids() {
// Ensure that the escrow account has the correct balance (both bids should have been extracted by this point)
expectedEscrowFee := s.calculateProposerEscrowSplit(bid).Add(s.calculateProposerEscrowSplit(bid2))
s.Require().Equal(escrowBalance.Add(expectedEscrowFee), s.queryBalanceOf(escrowAddress, app.BondDenom))
s.Require().Equal(escrowBalance.Add(expectedEscrowFee), s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom))
},
},
{
name: "Multiple bid transactions with second bid being smaller than min bid increment (same account)",
test: func() {
// Get escrow account balance
escrowBalance := s.queryBalanceOf(escrowAddress, app.BondDenom)
escrowBalance := s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom)
// Create a bundle with a single transaction
bundle := [][]byte{
@ -527,7 +527,7 @@ func (s *IntegrationTestSuite) TestMultipleBids() {
// Ensure that the escrow account has the correct balance
expectedEscrowFee := s.calculateProposerEscrowSplit(bid)
s.Require().Equal(expectedEscrowFee.Add(escrowBalance), s.queryBalanceOf(escrowAddress, app.BondDenom))
s.Require().Equal(expectedEscrowFee.Add(escrowBalance), s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom))
// Wait another block to make sure the second bid is not executed
s.waitForABlock()
@ -538,7 +538,7 @@ func (s *IntegrationTestSuite) TestMultipleBids() {
name: "Multiple transactions with second bid being smaller than min bid increment (different account)",
test: func() {
// Get escrow account balance
escrowBalance := s.queryBalanceOf(escrowAddress, app.BondDenom)
escrowBalance := s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom)
// Create a bundle with a single transaction
bundle := [][]byte{
@ -573,7 +573,7 @@ func (s *IntegrationTestSuite) TestMultipleBids() {
// Ensure that the escrow account has the correct balance
expectedEscrowFee := s.calculateProposerEscrowSplit(bid)
s.Require().Equal(expectedEscrowFee.Add(escrowBalance), s.queryBalanceOf(escrowAddress, app.BondDenom))
s.Require().Equal(expectedEscrowFee.Add(escrowBalance), s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom))
// Wait another block to make sure the second bid is not executed
s.waitForABlock()
@ -584,7 +584,7 @@ func (s *IntegrationTestSuite) TestMultipleBids() {
name: "Multiple transactions with increasing bids but first bid has same bundle so it should fail in later block (same account)",
test: func() {
// Get escrow account balance
escrowBalance := s.queryBalanceOf(escrowAddress, app.BondDenom)
escrowBalance := s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom)
// Create a bundle with a single transaction
bundle := [][]byte{
@ -619,7 +619,7 @@ func (s *IntegrationTestSuite) TestMultipleBids() {
// Ensure that the escrow account has the correct balance
expectedEscrowFee := s.calculateProposerEscrowSplit(bid2)
s.Require().Equal(expectedEscrowFee.Add(escrowBalance), s.queryBalanceOf(escrowAddress, app.BondDenom))
s.Require().Equal(expectedEscrowFee.Add(escrowBalance), s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom))
// Wait for a block to be created and ensure that the first bid was not executed
s.waitForABlock()
@ -630,7 +630,7 @@ func (s *IntegrationTestSuite) TestMultipleBids() {
name: "Multiple transactions with increasing bids but first bid has same bundle so it should fail in later block (different account)",
test: func() {
// Get escrow account balance
escrowBalance := s.queryBalanceOf(escrowAddress, app.BondDenom)
escrowBalance := s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom)
// Create a bundle with a single transaction
bundle := [][]byte{
@ -665,7 +665,7 @@ func (s *IntegrationTestSuite) TestMultipleBids() {
// Ensure that the escrow account has the correct balance
expectedEscrowFee := s.calculateProposerEscrowSplit(bid2)
s.Require().Equal(expectedEscrowFee.Add(escrowBalance), s.queryBalanceOf(escrowAddress, app.BondDenom))
s.Require().Equal(expectedEscrowFee.Add(escrowBalance), s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom))
// Wait for a block to be created and ensure that the first bid was not executed
s.waitForABlock()
@ -676,7 +676,7 @@ func (s *IntegrationTestSuite) TestMultipleBids() {
name: "Multiple transactions with increasing bids and different bundles (one should execute)",
test: func() {
// Get escrow account balance
escrowBalance := s.queryBalanceOf(escrowAddress, app.BondDenom)
escrowBalance := s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom)
// Create a bundle with a single transaction
firstBundle := [][]byte{
@ -717,7 +717,7 @@ func (s *IntegrationTestSuite) TestMultipleBids() {
// Ensure that the escrow account has the correct balance
expectedEscrowFee := s.calculateProposerEscrowSplit(bid2)
s.Require().Equal(expectedEscrowFee.Add(escrowBalance), s.queryBalanceOf(escrowAddress, app.BondDenom))
s.Require().Equal(expectedEscrowFee.Add(escrowBalance), s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom))
// Wait for a block to be created and ensure that the second bid is executed
s.waitForABlock()
@ -1004,14 +1004,14 @@ func (s *IntegrationTestSuite) TestInvalidBids() {
}
for _, tc := range testCases {
escrowBalance := s.queryBalanceOf(escrowAddress, app.BondDenom)
escrowBalance := s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom)
// Wait for a block to be created and run the test
s.waitForABlock()
s.Run(tc.name, tc.test)
// Get escrow account balance to ensure that it is not changed
s.Require().Equal(escrowBalance, s.queryBalanceOf(escrowAddress, app.BondDenom))
s.Require().Equal(escrowBalance, s.queryBalanceOf(sdk.AccAddress(escrowAddress).String(), app.BondDenom))
}
}

View File

@ -173,7 +173,7 @@ func (suite *KeeperTestSuite) TestValidateBidInfo() {
params := types.Params{
MaxBundleSize: maxBundleSize,
ReserveFee: reserveFee,
EscrowAccountAddress: escrowAddress.String(),
EscrowAccountAddress: escrowAddress,
FrontRunningProtection: frontRunningProtection,
MinBidIncrement: minBidIncrement,
}

View File

@ -8,6 +8,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
rewardsaddressprovider "github.com/skip-mev/pob/x/builder/rewards_address_provider"
"github.com/skip-mev/pob/x/builder/types"
)
@ -15,15 +16,15 @@ type Keeper struct {
cdc codec.BinaryCodec
storeKey storetypes.StoreKey
bankKeeper types.BankKeeper
distrKeeper types.DistributionKeeper
stakingKeeper types.StakingKeeper
bankKeeper types.BankKeeper
rewardsAddressProvider types.RewardsAddressProvider
// The address that is capable of executing a MsgUpdateParams message.
// Typically this will be the governance module's address.
authority string
}
// NewKeeper is a wrapper around NewKeeperWithRewardsAddressProvider for backwards compatibility.
func NewKeeper(
cdc codec.BinaryCodec,
storeKey storetypes.StoreKey,
@ -32,6 +33,30 @@ func NewKeeper(
distrKeeper types.DistributionKeeper,
stakingKeeper types.StakingKeeper,
authority string,
) Keeper {
// Build a rewards address provider
rewardsAddressProvider := rewardsaddressprovider.NewProposerRewardsAddressProvider(
distrKeeper,
stakingKeeper,
)
return NewKeeperWithRewardsAddressProvider(
cdc,
storeKey,
accountKeeper,
bankKeeper,
rewardsAddressProvider,
authority,
)
}
func NewKeeperWithRewardsAddressProvider(
cdc codec.BinaryCodec,
storeKey storetypes.StoreKey,
accountKeeper types.AccountKeeper,
bankKeeper types.BankKeeper,
rewardsAddressProvider types.RewardsAddressProvider,
authority string,
) Keeper {
// Ensure that the authority address is valid.
if _, err := sdk.AccAddressFromBech32(authority); err != nil {
@ -44,12 +69,11 @@ func NewKeeper(
}
return Keeper{
cdc: cdc,
storeKey: storeKey,
bankKeeper: bankKeeper,
distrKeeper: distrKeeper,
stakingKeeper: stakingKeeper,
authority: authority,
cdc: cdc,
storeKey: storeKey,
bankKeeper: bankKeeper,
rewardsAddressProvider: rewardsAddressProvider,
authority: authority,
}
}
@ -113,12 +137,7 @@ func (k Keeper) GetEscrowAccount(ctx sdk.Context) (sdk.AccAddress, error) {
return nil, err
}
account, err := sdk.AccAddressFromBech32(params.EscrowAccountAddress)
if err != nil {
return nil, err
}
return account, nil
return params.EscrowAccountAddress, nil
}
// GetReserveFee returns the reserve fee of the builder module.

View File

@ -42,10 +42,7 @@ func (m MsgServer) AuctionBid(goCtx context.Context, msg *types.MsgAuctionBid) (
return nil, fmt.Errorf("the number of transactions in the bid is greater than the maximum allowed; expected <= %d, got %d", params.MaxBundleSize, len(msg.Transactions))
}
escrowAddress, err := sdk.AccAddressFromBech32(params.EscrowAccountAddress)
if err != nil {
return nil, err
}
escrowAddress := params.EscrowAccountAddress
var proposerReward sdk.Coins
if params.ProposerFee.IsZero() {
@ -54,14 +51,13 @@ func (m MsgServer) AuctionBid(goCtx context.Context, msg *types.MsgAuctionBid) (
return nil, err
}
} else {
prevPropConsAddr := m.distrKeeper.GetPreviousProposerConsAddr(ctx)
prevProposer := m.stakingKeeper.ValidatorByConsAddr(ctx, prevPropConsAddr)
rewardsAddress := m.rewardsAddressProvider.GetRewardsAddress(ctx)
// determine the amount of the bid that goes to the (previous) proposer
bid := sdk.NewDecCoinsFromCoins(msg.Bid)
proposerReward, _ = bid.MulDecTruncate(params.ProposerFee).TruncateDecimal()
if err := m.bankKeeper.SendCoins(ctx, bidder, sdk.AccAddress(prevProposer.GetOperator()), proposerReward); err != nil {
if err := m.bankKeeper.SendCoins(ctx, bidder, rewardsAddress, proposerReward); err != nil {
return nil, err
}

View File

@ -60,7 +60,7 @@ func (suite *KeeperTestSuite) TestMsgAuctionBid() {
malleate: func() {
params := types.DefaultParams()
params.ProposerFee = sdk.ZeroDec()
params.EscrowAccountAddress = escrow.Address.String()
params.EscrowAccountAddress = escrow.Address
suite.builderKeeper.SetParams(suite.ctx, params)
suite.bankKeeper.EXPECT().
@ -85,7 +85,7 @@ func (suite *KeeperTestSuite) TestMsgAuctionBid() {
malleate: func() {
params := types.DefaultParams()
params.ProposerFee = sdk.MustNewDecFromStr("0.30")
params.EscrowAccountAddress = escrow.Address.String()
params.EscrowAccountAddress = escrow.Address
suite.builderKeeper.SetParams(suite.ctx, params)
suite.distrKeeper.EXPECT().
@ -163,7 +163,7 @@ func (suite *KeeperTestSuite) TestMsgUpdateParams() {
Params: types.Params{
ProposerFee: sdk.MustNewDecFromStr("0.1"),
MaxBundleSize: 2,
EscrowAccountAddress: suite.authorityAccount.String(),
EscrowAccountAddress: suite.authorityAccount,
MinBidIncrement: sdk.NewInt64Coin("foo", 100),
ReserveFee: sdk.NewInt64Coin("foo", 100),
},

View File

@ -0,0 +1,47 @@
package rewardsaddressprovider
import (
"cosmossdk.io/depinject"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/pob/x/builder/types"
)
// FixedAddressRewardsAddressProvider provides auction profits to a fixed address
type FixedAddressRewardsAddressProvider struct {
rewardsAddress sdk.AccAddress
}
// NewFixedAddressRewardsAddressProvider creates a reward provider for a fixed address.
func NewFixedAddressRewardsAddressProvider(
rewardsAddress sdk.AccAddress,
) types.RewardsAddressProvider {
return &FixedAddressRewardsAddressProvider{
rewardsAddress: rewardsAddress,
}
}
func (p *FixedAddressRewardsAddressProvider) GetRewardsAddress(_ sdk.Context) sdk.AccAddress {
return p.rewardsAddress
}
// Dependency injection
type FixedAddressDepInjectInput struct {
depinject.In
AccountKeeper types.AccountKeeper
}
type FixedAddressDepInjectOutput struct {
depinject.Out
RewardsAddressProvider types.RewardsAddressProvider
}
func ProvideModuleAddress(in FixedAddressDepInjectInput) FixedAddressDepInjectOutput {
rewardAddressProvider := NewFixedAddressRewardsAddressProvider(
in.AccountKeeper.GetModuleAddress(types.ModuleName),
)
return FixedAddressDepInjectOutput{RewardsAddressProvider: rewardAddressProvider}
}

View File

@ -0,0 +1,56 @@
package rewardsaddressprovider
import (
"cosmossdk.io/depinject"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/skip-mev/pob/x/builder/types"
)
// ProposerRewardsAddressProvider provides auction profits to the block proposer.
type ProposerRewardsAddressProvider struct {
distrKeeper types.DistributionKeeper
stakingKeeper types.StakingKeeper
}
// NewFixedAddressRewardsAddressProvider creates a reward provider for a fixed address.
func NewProposerRewardsAddressProvider(
distrKeeper types.DistributionKeeper,
stakingKeeper types.StakingKeeper,
) types.RewardsAddressProvider {
return &ProposerRewardsAddressProvider{
distrKeeper: distrKeeper,
stakingKeeper: stakingKeeper,
}
}
func (p *ProposerRewardsAddressProvider) GetRewardsAddress(context sdk.Context) sdk.AccAddress {
prevPropConsAddr := p.distrKeeper.GetPreviousProposerConsAddr(context)
prevProposer := p.stakingKeeper.ValidatorByConsAddr(context, prevPropConsAddr)
return sdk.AccAddress(prevProposer.GetOperator())
}
// Dependency injection
type ProposerRewardsDepInjectInput struct {
depinject.In
types.DistributionKeeper
types.StakingKeeper
}
type ProposerRewardsDepInjectOutput struct {
depinject.Out
RewardsAddressProvider types.RewardsAddressProvider
}
func ProvideProposerRewards(in ProposerRewardsDepInjectInput) ProposerRewardsDepInjectOutput {
rewardAddressProvider := NewProposerRewardsAddressProvider(
in.DistributionKeeper,
in.StakingKeeper,
)
return ProposerRewardsDepInjectOutput{RewardsAddressProvider: rewardAddressProvider}
}

View File

@ -26,3 +26,8 @@ type DistributionKeeper interface {
type StakingKeeper interface {
ValidatorByConsAddr(sdk.Context, sdk.ConsAddress) stakingtypes.ValidatorI
}
// RewardsAddressProvider is an interface that provides an address where auction profits are sent.
type RewardsAddressProvider interface {
GetRewardsAddress(context sdk.Context) sdk.AccAddress
}

View File

@ -78,7 +78,7 @@ type Params struct {
MaxBundleSize uint32 `protobuf:"varint,1,opt,name=max_bundle_size,json=maxBundleSize,proto3" json:"max_bundle_size,omitempty"`
// escrow_account_address is the address of the account that will receive a
// portion of the bid proceeds.
EscrowAccountAddress string `protobuf:"bytes,2,opt,name=escrow_account_address,json=escrowAccountAddress,proto3" json:"escrow_account_address,omitempty"`
EscrowAccountAddress []byte `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_bid_increment specifies the minimum amount that the next bid must be
@ -132,11 +132,11 @@ func (m *Params) GetMaxBundleSize() uint32 {
return 0
}
func (m *Params) GetEscrowAccountAddress() string {
func (m *Params) GetEscrowAccountAddress() []byte {
if m != nil {
return m.EscrowAccountAddress
}
return ""
return nil
}
func (m *Params) GetReserveFee() types.Coin {
@ -168,37 +168,37 @@ func init() {
func init() { proto.RegisterFile("pob/builder/v1/genesis.proto", fileDescriptor_287f1bdff5ccfc33) }
var fileDescriptor_287f1bdff5ccfc33 = []byte{
// 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, 0x02, 0x24, 0x18, 0x6e, 0x70, 0xa9, 0x95, 0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 0x79, 0xbd, 0xb3, 0x57, 0x32, 0xf3, 0xb1, 0xce, 0x70, 0x2e, 0x39, 0xe9, 0xa6,
0xeb, 0x5e, 0x07, 0xba, 0x38, 0x25, 0xe6, 0x73, 0x05, 0x1a, 0x1f, 0x42, 0x9e, 0x0c, 0x6e, 0x35,
0x8e, 0x00, 0x5e, 0x45, 0x5f, 0x6e, 0x2e, 0xf6, 0x1f, 0xdf, 0xab, 0x9b, 0xdf, 0x6d, 0x56, 0x37,
0xbe, 0xe9, 0xe5, 0x22, 0xf4, 0xae, 0x16, 0xa1, 0xf7, 0x6b, 0x11, 0x7a, 0x5f, 0x97, 0x61, 0xef,
0x6a, 0x19, 0xf6, 0x7e, 0x2c, 0xc3, 0xde, 0x87, 0xa7, 0xf7, 0x0c, 0xf5, 0x29, 0xab, 0x0e, 0x38,
0x34, 0xa4, 0xdd, 0xcd, 0x3f, 0x1a, 0xd6, 0x35, 0xeb, 0xdb, 0x05, 0x7a, 0xfe, 0x3b, 0x00, 0x00,
0xff, 0xff, 0x3d, 0xb6, 0x59, 0xc6, 0xb9, 0x02, 0x00, 0x00,
}
func (m *GenesisState) Marshal() (dAtA []byte, err error) {
@ -497,7 +497,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field EscrowAccountAddress", wireType)
}
var stringLen uint64
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenesis
@ -507,23 +507,25 @@ func (m *Params) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
if byteLen < 0 {
return ErrInvalidLengthGenesis
}
postIndex := iNdEx + intStringLen
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthGenesis
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.EscrowAccountAddress = string(dAtA[iNdEx:postIndex])
m.EscrowAccountAddress = append(m.EscrowAccountAddress[:0], dAtA[iNdEx:postIndex]...)
if m.EscrowAccountAddress == nil {
m.EscrowAccountAddress = []byte{}
}
iNdEx = postIndex
case 3:
if wireType != 2 {

View File

@ -101,23 +101,13 @@ func TestMsgUpdateParams(t *testing.T) {
},
expectPass: false,
},
{
description: "invalid message with invalid params (invalid escrow address)",
msg: types.MsgUpdateParams{
Authority: sdk.AccAddress([]byte("test")).String(),
Params: types.Params{
EscrowAccountAddress: "test",
},
},
expectPass: false,
},
{
description: "valid message",
msg: types.MsgUpdateParams{
Authority: sdk.AccAddress([]byte("test")).String(),
Params: types.Params{
ProposerFee: sdk.NewDec(1),
EscrowAccountAddress: sdk.AccAddress([]byte("test")).String(),
EscrowAccountAddress: sdk.AccAddress([]byte("test")),
ReserveFee: sdk.NewCoin("test", sdk.NewInt(100)),
MinBidIncrement: sdk.NewCoin("test", sdk.NewInt(100)),
},
@ -130,7 +120,7 @@ func TestMsgUpdateParams(t *testing.T) {
Authority: sdk.AccAddress([]byte("test")).String(),
Params: types.Params{
ProposerFee: sdk.NewDec(1),
EscrowAccountAddress: sdk.AccAddress([]byte("test")).String(),
EscrowAccountAddress: sdk.AccAddress([]byte("test")),
ReserveFee: sdk.NewCoin("test", sdk.NewInt(100)),
MinBidIncrement: sdk.NewCoin("test2", sdk.NewInt(100)),
},
@ -143,7 +133,7 @@ func TestMsgUpdateParams(t *testing.T) {
Authority: sdk.AccAddress([]byte("test")).String(),
Params: types.Params{
ProposerFee: sdk.NewDec(1),
EscrowAccountAddress: sdk.AccAddress([]byte("test")).String(),
EscrowAccountAddress: sdk.AccAddress([]byte("test")),
},
},
expectPass: false,
@ -154,7 +144,7 @@ func TestMsgUpdateParams(t *testing.T) {
Authority: sdk.AccAddress([]byte("test")).String(),
Params: types.Params{
ProposerFee: sdk.NewDec(1),
EscrowAccountAddress: sdk.AccAddress([]byte("test")).String(),
EscrowAccountAddress: sdk.AccAddress([]byte("test")),
ReserveFee: sdk.NewCoin("test", sdk.NewInt(100)),
MinBidIncrement: sdk.NewCoin("test", sdk.NewInt(0)),
},

View File

@ -10,7 +10,7 @@ import (
var (
DefaultMaxBundleSize uint32 = 2
DefaultEscrowAccountAddress string = authtypes.NewModuleAddress(ModuleName).String()
DefaultEscrowAccountAddress = authtypes.NewModuleAddress(ModuleName)
DefaultReserveFee = sdk.NewCoin("stake", sdk.NewInt(1))
DefaultMinBidIncrement = sdk.NewCoin("stake", sdk.NewInt(1))
DefaultFrontRunningProtection = true
@ -20,7 +20,7 @@ var (
// NewParams returns a new Params instance with the provided values.
func NewParams(
maxBundleSize uint32,
escrowAccountAddress string,
escrowAccountAddress []byte,
reserveFee, minBidIncrement sdk.Coin,
frontRunningProtection bool,
proposerFee sdk.Dec,
@ -49,9 +49,6 @@ func DefaultParams() Params {
// Validate performs basic validation on the parameters.
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)
}
@ -97,11 +94,3 @@ func validateProposerFee(v sdk.Dec) error {
return nil
}
func validateEscrowAccountAddress(account string) error {
if _, err := sdk.AccAddressFromBech32(account); err != nil {
return fmt.Errorf("invalid escrow account address (%s)", err)
}
return nil
}