From 968168166df065e182d6201b06900b66b8779eea Mon Sep 17 00:00:00 2001 From: ccamel Date: Mon, 3 Apr 2023 14:28:28 +0200 Subject: [PATCH] feat(logic): implement default predicate cost --- x/logic/keeper/interpreter.go | 25 ++++-- x/logic/types/params.pb.go | 146 ++++++++++++++++++++++++---------- 2 files changed, 122 insertions(+), 49 deletions(-) diff --git a/x/logic/keeper/interpreter.go b/x/logic/keeper/interpreter.go index c4547c20..5d81fc14 100644 --- a/x/logic/keeper/interpreter.go +++ b/x/logic/keeper/interpreter.go @@ -16,7 +16,10 @@ import ( "github.com/samber/lo" ) -const defaultCost = uint64(1) +const ( + defaultPredicateCost = uint64(1) + defaultWeightFactor = uint64(1) +) func (k Keeper) limits(ctx goctx.Context) types.Limits { params := k.GetParams(sdk.UnwrapSDKContext(ctx)) @@ -102,14 +105,16 @@ func (k Keeper) newInterpreter(ctx goctx.Context) (*prolog.Interpreter, error) { whitelist := util.NonZeroOrDefault(interpreterParams.PredicatesWhitelist, interpreter.RegistryNames) blacklist := interpreterParams.GetPredicatesBlacklist() - gasMeter := meter.WithWeightedMeter(sdkctx.GasMeter(), gasPolicy.WeightingFactor.Uint64()) + gasMeter := meter.WithWeightedMeter(sdkctx.GasMeter(), nonNilNorZeroOrDefaultUint64(gasPolicy.WeightingFactor, defaultWeightFactor)) predicates := lo.Reduce( lo.Map( lo.Filter( interpreter.RegistryNames, filterPredicates(whitelist, blacklist)), - toPredicate(gasPolicy.GetPredicateCosts())), + toPredicate( + nonNilNorZeroOrDefaultUint64(gasPolicy.DefaultPredicateCost, defaultPredicateCost), + gasPolicy.GetPredicateCosts())), func(agg interpreter.Predicates, item lo.Tuple2[string, uint64], index int) interpreter.Predicates { agg[item.A] = item.B return agg @@ -138,14 +143,24 @@ func filterPredicates(whitelist []string, blacklist []string) func(string, int) // toPredicate converts the given predicate costs to a function that returns the cost for the given predicate as // a pair of predicate name and cost. -func toPredicate(predicateCosts []types.PredicateCost) func(string, int) lo.Tuple2[string, uint64] { +func toPredicate(defaultCost uint64, predicateCosts []types.PredicateCost) func(string, int) lo.Tuple2[string, uint64] { return func(predicate string, _ int) lo.Tuple2[string, uint64] { for _, c := range predicateCosts { if util.PredicateEq(predicate)(c.Predicate) { - return lo.T2(predicate, c.Cost.Uint64()) + return lo.T2(predicate, nonNilNorZeroOrDefaultUint64(c.Cost, defaultCost)) } } return lo.T2(predicate, defaultCost) } } + +// nonNilNorZeroOrDefaultUint64 returns the value of the given sdkmath.Uint if it is not nil and not zero, otherwise it returns the +// given default value. +func nonNilNorZeroOrDefaultUint64(v *sdkmath.Uint, defaultValue uint64) uint64 { + if v == nil || v.IsZero() { + return defaultValue + } + + return v.Uint64() +} diff --git a/x/logic/types/params.pb.go b/x/logic/types/params.pb.go index bc22767e..d739e6a6 100644 --- a/x/logic/types/params.pb.go +++ b/x/logic/types/params.pb.go @@ -213,14 +213,18 @@ func (m *Interpreter) GetBootstrap() string { } // GasPolicy defines the policy for calculating predicate invocation costs and the resulting gas consumption. +// The gas policy is defined as a list of predicates and their associated unit costs, a default unit cost for predicates +// if not specified in the list, and a weighting factor that is applied to the unit cost of each predicate to yield. type GasPolicy struct { // WeightingFactor is the factor that is applied to the unit cost of each predicate // to yield the gas value. - // If not provided or set to 0, the default value of 10000 is used. + // If not provided or set to 0, the value is set to 1. WeightingFactor *github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,1,opt,name=weighting_factor,json=weightingFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"weighting_factor,omitempty" yaml:"weighting_factor"` + // DefaultPredicateCost is the default unit cost of a predicate when not specified in the PredicateCosts list. + // If not provided or set to 0, the value is set to 1. + DefaultPredicateCost *github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,2,opt,name=default_predicate_cost,json=defaultPredicateCost,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"default_predicate_cost,omitempty" yaml:"default_predicate_cost"` // PredicateCosts is the list of predicates and their associated unit costs. - // If not provided, all predicates have a unit cost of 1 by default. - PredicateCosts []PredicateCost `protobuf:"bytes,2,rep,name=predicate_costs,json=predicateCosts,proto3" json:"predicate_costs" yaml:"predicate_cost"` + PredicateCosts []PredicateCost `protobuf:"bytes,3,rep,name=predicate_costs,json=predicateCosts,proto3" json:"predicate_costs" yaml:"predicate_cost"` } func (m *GasPolicy) Reset() { *m = GasPolicy{} } @@ -323,47 +327,49 @@ func init() { func init() { proto.RegisterFile("logic/v1beta2/params.proto", fileDescriptor_3af0daa241de0fa3) } var fileDescriptor_3af0daa241de0fa3 = []byte{ - // 638 bytes of a gzipped FileDescriptorProto + // 666 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xbd, 0x6f, 0xd3, 0x4e, - 0x18, 0xc7, 0xe3, 0xb4, 0xca, 0xef, 0xe7, 0x8b, 0xfa, 0xc2, 0xd1, 0x0a, 0x13, 0x20, 0xae, 0xae, - 0x03, 0x1d, 0x20, 0x16, 0x05, 0x31, 0x54, 0x62, 0x71, 0x11, 0xe5, 0x6d, 0xa8, 0x0e, 0xf1, 0x22, - 0x04, 0xb2, 0x2e, 0xce, 0xe1, 0x9e, 0x6a, 0xe7, 0x2c, 0xdf, 0x85, 0x26, 0x1d, 0xf9, 0x0b, 0x18, - 0x19, 0x59, 0xf8, 0x5f, 0xca, 0xd6, 0x11, 0x31, 0x58, 0xa8, 0x5d, 0x98, 0xbb, 0xb2, 0x20, 0x9f, - 0x2f, 0xb6, 0x6b, 0x21, 0xa1, 0xb0, 0x24, 0xd6, 0xf3, 0x7c, 0x9f, 0xcf, 0xf7, 0xb9, 0xc7, 0xf7, - 0x18, 0x74, 0x42, 0x1e, 0x30, 0xdf, 0x79, 0x7f, 0xab, 0x4f, 0x25, 0xd9, 0x74, 0x62, 0x92, 0x90, - 0x48, 0xf4, 0xe2, 0x84, 0x4b, 0x0e, 0x17, 0x54, 0xae, 0xa7, 0x73, 0x9d, 0x95, 0x80, 0x07, 0x5c, - 0x65, 0x9c, 0xec, 0x29, 0x17, 0xa1, 0x0f, 0x4d, 0xd0, 0xda, 0x55, 0x55, 0xf0, 0x15, 0x68, 0xb3, - 0xa1, 0xa4, 0x49, 0x9c, 0x50, 0x49, 0x13, 0xcb, 0x58, 0x33, 0x36, 0xda, 0x9b, 0x9d, 0xde, 0x39, - 0x4a, 0xef, 0x51, 0xa9, 0x70, 0x3b, 0x47, 0xa9, 0xdd, 0x38, 0x4b, 0x6d, 0x38, 0x21, 0x51, 0xb8, - 0x85, 0x2a, 0xc5, 0x08, 0x57, 0x51, 0xf0, 0x3e, 0x68, 0x85, 0x2c, 0x62, 0x52, 0x58, 0x4d, 0x05, - 0x5d, 0xad, 0x41, 0x9f, 0xaa, 0xa4, 0xbb, 0xaa, 0x79, 0x0b, 0x39, 0x2f, 0x2f, 0x41, 0x58, 0xd7, - 0x42, 0x0c, 0x40, 0x40, 0x84, 0x17, 0xf3, 0x90, 0xf9, 0x13, 0x6b, 0x4e, 0x91, 0xac, 0x1a, 0x69, - 0x87, 0x88, 0x5d, 0x95, 0x77, 0x2f, 0x6b, 0xd8, 0x85, 0x1c, 0x56, 0x56, 0x22, 0x6c, 0x06, 0x53, - 0xd5, 0xd6, 0xfc, 0xa7, 0xcf, 0x76, 0x03, 0x7d, 0x6d, 0x82, 0x56, 0xde, 0x03, 0x1c, 0x80, 0xff, - 0x22, 0x32, 0xf6, 0x02, 0x22, 0xd4, 0x00, 0x4c, 0xf7, 0xc9, 0x51, 0x6a, 0x1b, 0xdf, 0x53, 0xfb, - 0x7a, 0xc0, 0xe4, 0xde, 0xa8, 0xdf, 0xf3, 0x79, 0xe4, 0xf8, 0x5c, 0x44, 0x5c, 0xe8, 0xbf, 0x9b, - 0x62, 0xb0, 0xef, 0xc8, 0x49, 0x4c, 0x45, 0xef, 0x39, 0x1b, 0xca, 0xb3, 0xd4, 0xb6, 0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9, 0x29, 0x3d, 0x9a, 0x7d, 0x4a, 0xba, 0x63, 0xd5, 0x67, 0xee, 0xd9, 0x2b, 0xaa, 0x73, 0xff, + 0xf8, 0xb4, 0x61, 0x9c, 0x9c, 0x36, 0x8c, 0x9f, 0xa7, 0x0d, 0xe3, 0xd3, 0x59, 0xa3, 0x74, 0x72, + 0xd6, 0x28, 0x7d, 0x3f, 0x6b, 0x94, 0xde, 0xac, 0xe7, 0x1c, 0xf8, 0x41, 0x78, 0x4f, 0xfd, 0xe9, + 0xd9, 0x43, 0x3b, 0xf9, 0xba, 0x2b, 0x8b, 0x6e, 0x55, 0x7d, 0xb0, 0xef, 0xfe, 0x09, 0x00, 0x00, + 0xff, 0xff, 0xc3, 0xc1, 0xb6, 0x82, 0xf3, 0x05, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -557,8 +563,20 @@ func (m *GasPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a + } + } + if m.DefaultPredicateCost != nil { + { + size := m.DefaultPredicateCost.Size() + i -= size + if _, err := m.DefaultPredicateCost.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 } if m.WeightingFactor != nil { { @@ -699,6 +717,10 @@ func (m *GasPolicy) Size() (n int) { l = m.WeightingFactor.Size() n += 1 + l + sovParams(uint64(l)) } + if m.DefaultPredicateCost != nil { + l = m.DefaultPredicateCost.Size() + n += 1 + l + sovParams(uint64(l)) + } if len(m.PredicateCosts) > 0 { for _, e := range m.PredicateCosts { l = e.Size() @@ -1250,6 +1272,42 @@ func (m *GasPolicy) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultPredicateCost", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Uint + m.DefaultPredicateCost = &v + if err := m.DefaultPredicateCost.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PredicateCosts", wireType) }