From 5ebc67bfd610d66e034de1640b3843ec61ed3406 Mon Sep 17 00:00:00 2001 From: turtlebasket Date: Thu, 22 Sep 2022 00:16:09 +0000 Subject: [PATCH] fully migrate to colinearcore params - No more auctionconfig - Now includes GPU model list support - CPU vendors are still hardcoded --- config.yml | 5 + docs/static/openapi.yml | 271 +++++++++ proto/colinearcore/auction.proto | 6 + proto/colinearcore/hardware.proto | 9 - proto/colinearcore/params.proto | 30 + x/colinearcore/auctionconfig/config.go | 35 -- x/colinearcore/client/cli/tx_new_auction.go | 5 +- .../keeper/msg_server_lock_funds.go | 3 +- .../keeper/msg_server_new_auction.go | 19 +- x/colinearcore/keeper/msg_server_new_bid.go | 7 +- x/colinearcore/types/auction.pb.go | 206 ++++++- x/colinearcore/types/hardware.pb.go | 62 +- x/colinearcore/types/keys.go | 5 + x/colinearcore/types/params.pb.go | 568 +++++++++++++++++- 14 files changed, 1087 insertions(+), 144 deletions(-) delete mode 100644 x/colinearcore/auctionconfig/config.go diff --git a/config.yml b/config.yml index 779a5e3..bd9ef31 100644 --- a/config.yml +++ b/config.yml @@ -25,6 +25,11 @@ genesis: staking: params: bond_denom: "uclr" + colinearcore: + params: + gpuModels: + gtx-1050-ti: 0 + gtx-1650-ti: 0 accounts: - name: alice diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 4c23957..e0dc2e9 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -171,6 +171,24 @@ paths: format: uint64 remaining: type: string + gpus: + type: array + items: + type: string + title: hardware specs + cpuArch: + type: string + enum: + - ANY + - INTEL + - AMD + default: ANY + memMb: + type: string + format: uint64 + storageGb: + type: string + format: uint64 pagination: type: object properties: @@ -318,6 +336,24 @@ paths: format: uint64 remaining: type: string + gpus: + type: array + items: + type: string + title: hardware specs + cpuArch: + type: string + enum: + - ANY + - INTEL + - AMD + default: ANY + memMb: + type: string + format: uint64 + storageGb: + type: string + format: uint64 default: description: An unexpected error response. schema: @@ -436,6 +472,64 @@ paths: params: description: params holds all the parameters of this module. type: object + properties: + gpuModels: + type: object + additionalProperties: + type: integer + format: int64 + title: hardware options + auctionGas: + type: integer + format: int64 + title: gas config + auctionTime: + type: integer + format: int64 + title: auction config + minLeasePeriod: + type: integer + format: int64 + maxLeasePeriod: + type: integer + format: int64 + allowedAuctionDenoms: + type: array + items: + type: string + maxVerifiedProviders: + type: integer + format: int64 + title: >- + Maximum number of verified providers; this is to prevent + buffer overflow + + attacks since provider list is not committed to chain + state and costs 0 gas + providerMinLockedUClr: + type: integer + format: int64 + title: |- + Minimum required staked CLR to be a provider (i.e. to bid) + 500 CLR + providerLockedSlashUClr: + type: integer + format: int64 + title: |- + Amount slashed when a provider is offline during an audit + 100 CLR + providerAuditFrequency: + type: integer + format: int64 + title: |- + Blocks between provider audits + 400 blocks ~400-1200min + providerAuditLength: + type: integer + format: int64 + title: |- + Blocks before an audit ping must be returned + 3 blocks ~4-12sec description: >- QueryParamsResponse is response type for the Query/Params RPC method. @@ -30861,6 +30955,24 @@ definitions: format: uint64 remaining: type: string + gpus: + type: array + items: + type: string + title: hardware specs + cpuArch: + type: string + enum: + - ANY + - INTEL + - AMD + default: ANY + memMb: + type: string + format: uint64 + storageGb: + type: string + format: uint64 colinear.colinearcore.Bid: type: object properties: @@ -30868,6 +30980,13 @@ definitions: type: string amount: type: string + colinear.colinearcore.CpuArchitecture: + type: string + enum: + - ANY + - INTEL + - AMD + default: ANY colinear.colinearcore.LockedUsers: type: object properties: @@ -30898,6 +31017,64 @@ definitions: format: uint64 colinear.colinearcore.Params: type: object + properties: + gpuModels: + type: object + additionalProperties: + type: integer + format: int64 + title: hardware options + auctionGas: + type: integer + format: int64 + title: gas config + auctionTime: + type: integer + format: int64 + title: auction config + minLeasePeriod: + type: integer + format: int64 + maxLeasePeriod: + type: integer + format: int64 + allowedAuctionDenoms: + type: array + items: + type: string + maxVerifiedProviders: + type: integer + format: int64 + title: >- + Maximum number of verified providers; this is to prevent buffer + overflow + + attacks since provider list is not committed to chain state and costs + 0 gas + providerMinLockedUClr: + type: integer + format: int64 + title: |- + Minimum required staked CLR to be a provider (i.e. to bid) + 500 CLR + providerLockedSlashUClr: + type: integer + format: int64 + title: |- + Amount slashed when a provider is offline during an audit + 100 CLR + providerAuditFrequency: + type: integer + format: int64 + title: |- + Blocks between provider audits + 400 blocks ~400-1200min + providerAuditLength: + type: integer + format: int64 + title: |- + Blocks before an audit ping must be returned + 3 blocks ~4-12sec description: Params defines the parameters for the module. colinear.colinearcore.QueryAllAuctionResponse: type: object @@ -30937,6 +31114,24 @@ definitions: format: uint64 remaining: type: string + gpus: + type: array + items: + type: string + title: hardware specs + cpuArch: + type: string + enum: + - ANY + - INTEL + - AMD + default: ANY + memMb: + type: string + format: uint64 + storageGb: + type: string + format: uint64 pagination: type: object properties: @@ -31026,6 +31221,24 @@ definitions: format: uint64 remaining: type: string + gpus: + type: array + items: + type: string + title: hardware specs + cpuArch: + type: string + enum: + - ANY + - INTEL + - AMD + default: ANY + memMb: + type: string + format: uint64 + storageGb: + type: string + format: uint64 colinear.colinearcore.QueryGetLockedUsersResponse: type: object properties: @@ -31056,6 +31269,64 @@ definitions: params: description: params holds all the parameters of this module. type: object + properties: + gpuModels: + type: object + additionalProperties: + type: integer + format: int64 + title: hardware options + auctionGas: + type: integer + format: int64 + title: gas config + auctionTime: + type: integer + format: int64 + title: auction config + minLeasePeriod: + type: integer + format: int64 + maxLeasePeriod: + type: integer + format: int64 + allowedAuctionDenoms: + type: array + items: + type: string + maxVerifiedProviders: + type: integer + format: int64 + title: >- + Maximum number of verified providers; this is to prevent buffer + overflow + + attacks since provider list is not committed to chain state and + costs 0 gas + providerMinLockedUClr: + type: integer + format: int64 + title: |- + Minimum required staked CLR to be a provider (i.e. to bid) + 500 CLR + providerLockedSlashUClr: + type: integer + format: int64 + title: |- + Amount slashed when a provider is offline during an audit + 100 CLR + providerAuditFrequency: + type: integer + format: int64 + title: |- + Blocks between provider audits + 400 blocks ~400-1200min + providerAuditLength: + type: integer + format: int64 + title: |- + Blocks before an audit ping must be returned + 3 blocks ~4-12sec description: QueryParamsResponse is response type for the Query/Params RPC method. cosmos.base.query.v1beta1.PageRequest: type: object diff --git a/proto/colinearcore/auction.proto b/proto/colinearcore/auction.proto index 0002484..aeefa42 100644 --- a/proto/colinearcore/auction.proto +++ b/proto/colinearcore/auction.proto @@ -4,6 +4,7 @@ package colinear.colinearcore; option go_package = "colinear/x/colinearcore/types"; import "colinearcore/bid.proto"; +import "colinearcore/hardware.proto"; message Auction { string index = 1; @@ -17,4 +18,9 @@ message Auction { uint64 leaseStart = 9; uint64 leaseEnd = 10; string remaining = 11; + // hardware specs + repeated string gpus = 12; + CpuArchitecture cpuArch = 13; + uint64 memMb = 14; + uint64 storageGb = 15; } diff --git a/proto/colinearcore/hardware.proto b/proto/colinearcore/hardware.proto index 3c3f520..774972f 100644 --- a/proto/colinearcore/hardware.proto +++ b/proto/colinearcore/hardware.proto @@ -3,15 +3,6 @@ package colinear.colinearcore; option go_package = "colinear/x/colinearcore/types"; -enum GpuModel { - RTX_2080 = 0; - RTX_2080_TI = 1; - RTX_3070 = 2; - RTX_3070_TI = 3; - RTX_3080 = 4; - RTX_3080_TI = 5; -} - enum CpuArchitecture { ANY = 0; INTEL = 1; diff --git a/proto/colinearcore/params.proto b/proto/colinearcore/params.proto index 6e9f9a1..d095740 100644 --- a/proto/colinearcore/params.proto +++ b/proto/colinearcore/params.proto @@ -8,5 +8,35 @@ option go_package = "colinear/x/colinearcore/types"; // Params defines the parameters for the module. message Params { option (gogoproto.goproto_stringer) = false; + // hardware options + map gpuModels = 1; // maps GPU model to puzzle difficulty + + // gas config + uint32 auctionGas = 2; + + // auction config + uint32 auctionTime = 3; + uint32 minLeasePeriod = 4; + uint32 maxLeasePeriod = 5; + repeated string allowedAuctionDenoms = 6; + + // Maximum number of verified providers; this is to prevent buffer overflow + // attacks since provider list is not committed to chain state and costs 0 gas + uint32 maxVerifiedProviders = 7; + + // Minimum required staked CLR to be a provider (i.e. to bid) + // 500 CLR + uint32 providerMinLockedUClr = 8; + // Amount slashed when a provider is offline during an audit + // 100 CLR + uint32 providerLockedSlashUClr = 9; + + // Blocks between provider audits + // 400 blocks ~400-1200min + uint32 providerAuditFrequency = 10; + // Blocks before an audit ping must be returned + // 3 blocks ~4-12sec + uint32 providerAuditLength = 11; + } diff --git a/x/colinearcore/auctionconfig/config.go b/x/colinearcore/auctionconfig/config.go deleted file mode 100644 index b7ac9c9..0000000 --- a/x/colinearcore/auctionconfig/config.go +++ /dev/null @@ -1,35 +0,0 @@ -package auctionconfig - -// Allowed Denoms -// note: as a slice, values can't be immutable, but length can be -var AllowedAuctionDenoms = [...]string{"uusdc", "uclr"} - -const ( - // Times - AuctionTime = 10 // 10 blocks = ~10-30 seconds - - // Lease Period Requirements (seconds) - MinLeasePeriod = 3_600 // 1 hour - MaxLeasePeriod = 8_035_200 // 3 months - - // Maximum number of verified providers; this is to prevent buffer overflow - // attacks since provider list is not committed to chain state and costs 0 gas - MaxVerifiedProviders = 1000 - - // Minimum required staked CLR to be a provider (i.e. to bid) - // 500 CLR - ProviderMinLockedUClr = 500_000_000 - // Amount slashed when a provider is offline during an audit - // 100 CLR - ProviderLockedSlashUClr = 100_000_000 - - // Blocks between provider audits - // 400 blocks ~400-1200min - ProviderAuditFrequency = 400 - // Blocks before an audit ping must be returned - // 3 blocks ~4-12sec - ProviderAuditLength = 4 - - // Gas Fees - AuctionGas = 10 -) diff --git a/x/colinearcore/client/cli/tx_new_auction.go b/x/colinearcore/client/cli/tx_new_auction.go index a0d67a6..b1a26b3 100644 --- a/x/colinearcore/client/cli/tx_new_auction.go +++ b/x/colinearcore/client/cli/tx_new_auction.go @@ -3,7 +3,6 @@ package cli import ( "strconv" - "colinear/x/colinearcore/auctionconfig" "colinear/x/colinearcore/types" "github.com/cosmos/cosmos-sdk/client" @@ -19,7 +18,9 @@ func CmdNewAuction() *cobra.Command { Use: "new-auction [name] [description] [ceiling] [denom] [end date] [verified providers (separated by spaces)...]", Short: "Broadcast message newAuction", // Args: cobra.ExactArgs(5), - Args: cobra.RangeArgs(5, auctionconfig.MaxVerifiedProviders+5), + // below: we're hardcoding the max providers param since we + // can't check chain params locally + Args: cobra.RangeArgs(5, 1005), RunE: func(cmd *cobra.Command, args []string) (err error) { argName := args[0] argDescription := args[1] diff --git a/x/colinearcore/keeper/msg_server_lock_funds.go b/x/colinearcore/keeper/msg_server_lock_funds.go index de20e88..0148b49 100644 --- a/x/colinearcore/keeper/msg_server_lock_funds.go +++ b/x/colinearcore/keeper/msg_server_lock_funds.go @@ -5,7 +5,6 @@ import ( "fmt" "math/big" - "colinear/x/colinearcore/auctionconfig" "colinear/x/colinearcore/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -28,7 +27,7 @@ func (k msgServer) LockFunds(goCtx context.Context, msg *types.MsgLockFunds) (*t // return nil, errors.New("unable to get locked users") } - required := big.NewInt(auctionconfig.ProviderMinLockedUClr) + required := big.NewInt(int64(k.GetParams(ctx).ProviderMinLockedUClr)) paying := new(big.Int) paying.SetString(msg.Amount, 10) diff --git a/x/colinearcore/keeper/msg_server_new_auction.go b/x/colinearcore/keeper/msg_server_new_auction.go index ce6ee24..26da787 100644 --- a/x/colinearcore/keeper/msg_server_new_auction.go +++ b/x/colinearcore/keeper/msg_server_new_auction.go @@ -7,7 +7,6 @@ import ( "math/big" "strconv" - "colinear/x/colinearcore/auctionconfig" "colinear/x/colinearcore/memdb" "colinear/x/colinearcore/types" @@ -26,27 +25,27 @@ func (k msgServer) NewAuction(goCtx context.Context, msg *types.MsgNewAuction) ( auctionLen := msg.LeaseEnd - uint64(ctx.BlockTime().Unix()) // check that submitted denom is allowed - for _, denom := range auctionconfig.AllowedAuctionDenoms { + for _, denom := range k.GetParams(ctx).AllowedAuctionDenoms { if msg.Denom == denom { goto found } } - return nil, fmt.Errorf("denom %s is not allowed; must be in %v", msg.Denom, auctionconfig.AllowedAuctionDenoms) + return nil, fmt.Errorf("denom %s is not allowed; must be in %v", msg.Denom, k.GetParams(ctx).AllowedAuctionDenoms) found: - if auctionLen < auctionconfig.MinLeasePeriod { + if uint32(auctionLen) < k.GetParams(ctx).MinLeasePeriod { return nil, fmt.Errorf( "Auction length %d is below min lease period of %d", auctionLen, - auctionconfig.MinLeasePeriod, + k.GetParams(ctx).MinLeasePeriod, ) } - if auctionLen > auctionconfig.MaxLeasePeriod { + if uint32(auctionLen) > k.GetParams(ctx).MaxLeasePeriod { return nil, fmt.Errorf( "Auction length %d is above max lease period of %d", auctionLen, - auctionconfig.MaxLeasePeriod, + k.GetParams(ctx).MaxLeasePeriod, ) } @@ -55,8 +54,8 @@ found: return nil, fmt.Errorf("sender address `%s` format invalid (bech32 required)", msg.Creator) } - if len(msg.VerifiedProviders) > auctionconfig.MaxVerifiedProviders { - return nil, fmt.Errorf("must submit no more than %d verified providers (got %d)", auctionconfig.MaxVerifiedProviders, len(msg.VerifiedProviders)) + if uint32(len(msg.VerifiedProviders)) > k.GetParams(ctx).MaxVerifiedProviders { + return nil, fmt.Errorf("must submit no more than %d verified providers (got %d)", k.GetParams(ctx).MaxVerifiedProviders, len(msg.VerifiedProviders)) } bech32Len := len("colinear") + 39 @@ -78,7 +77,7 @@ found: Description: msg.Description, // best bid -> null // Best: new(types.Bid), - Deadline: uint64(ctx.BlockHeight()) + auctionconfig.AuctionTime, + Deadline: uint64(ctx.BlockHeight()) + uint64(k.GetParams(ctx).AuctionTime), Denom: msg.Denom, Owner: msg.Creator, Ceiling: msg.Ceiling, diff --git a/x/colinearcore/keeper/msg_server_new_bid.go b/x/colinearcore/keeper/msg_server_new_bid.go index 3cdda62..921e57d 100644 --- a/x/colinearcore/keeper/msg_server_new_bid.go +++ b/x/colinearcore/keeper/msg_server_new_bid.go @@ -7,7 +7,6 @@ import ( "math/big" "reflect" - "colinear/x/colinearcore/auctionconfig" "colinear/x/colinearcore/memdb" "colinear/x/colinearcore/types" @@ -22,13 +21,13 @@ func (k msgServer) NewBid(goCtx context.Context, msg *types.MsgNewBid) (*types.M return nil, errors.New("unable to read locked providers (uninitialized)") } if lockedAmtStr, ok := lockedUsers.Users[msg.Creator]; !ok { - return nil, fmt.Errorf("provider has not locked CLR tokens (min: %d uCLR)", auctionconfig.ProviderMinLockedUClr) + return nil, fmt.Errorf("provider has not locked CLR tokens (min: %d uCLR)", k.GetParams(ctx).ProviderMinLockedUClr) } else { lockedAmt := new(big.Int) lockedAmt.SetString(lockedAmtStr, 10) - required := big.NewInt(auctionconfig.ProviderMinLockedUClr) + required := big.NewInt(int64(k.GetParams(ctx).ProviderMinLockedUClr)) if lockedAmt.Cmp(required) == -1 { - return nil, fmt.Errorf("provider has not locked enough CLR tokens (min: %d uCLR, locked: %s)", auctionconfig.ProviderMinLockedUClr, lockedAmt.String()) + return nil, fmt.Errorf("provider has not locked enough CLR tokens (min: %d uCLR, locked: %s)", k.GetParams(ctx).ProviderMinLockedUClr, lockedAmt.String()) } } diff --git a/x/colinearcore/types/auction.pb.go b/x/colinearcore/types/auction.pb.go index ac9e021..790f512 100644 --- a/x/colinearcore/types/auction.pb.go +++ b/x/colinearcore/types/auction.pb.go @@ -34,6 +34,11 @@ type Auction struct { LeaseStart uint64 `protobuf:"varint,9,opt,name=leaseStart,proto3" json:"leaseStart,omitempty"` LeaseEnd uint64 `protobuf:"varint,10,opt,name=leaseEnd,proto3" json:"leaseEnd,omitempty"` Remaining string `protobuf:"bytes,11,opt,name=remaining,proto3" json:"remaining,omitempty"` + // hardware specs + Gpus []string `protobuf:"bytes,12,rep,name=gpus,proto3" json:"gpus,omitempty"` + CpuArch CpuArchitecture `protobuf:"varint,13,opt,name=cpuArch,proto3,enum=colinear.colinearcore.CpuArchitecture" json:"cpuArch,omitempty"` + MemMb uint64 `protobuf:"varint,14,opt,name=memMb,proto3" json:"memMb,omitempty"` + StorageGb uint64 `protobuf:"varint,15,opt,name=storageGb,proto3" json:"storageGb,omitempty"` } func (m *Auction) Reset() { *m = Auction{} } @@ -146,6 +151,34 @@ func (m *Auction) GetRemaining() string { return "" } +func (m *Auction) GetGpus() []string { + if m != nil { + return m.Gpus + } + return nil +} + +func (m *Auction) GetCpuArch() CpuArchitecture { + if m != nil { + return m.CpuArch + } + return CpuArchitecture_ANY +} + +func (m *Auction) GetMemMb() uint64 { + if m != nil { + return m.MemMb + } + return 0 +} + +func (m *Auction) GetStorageGb() uint64 { + if m != nil { + return m.StorageGb + } + return 0 +} + func init() { proto.RegisterType((*Auction)(nil), "colinear.colinearcore.Auction") } @@ -153,26 +186,31 @@ func init() { func init() { proto.RegisterFile("colinearcore/auction.proto", fileDescriptor_c2581508d43e9c55) } var fileDescriptor_c2581508d43e9c55 = []byte{ - // 298 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0x3f, 0x4f, 0xf3, 0x30, - 0x10, 0xc6, 0xeb, 0xbe, 0xe9, 0xbf, 0xeb, 0x66, 0xbd, 0x20, 0x2b, 0x02, 0x2b, 0x62, 0xea, 0x94, - 0x4a, 0x30, 0x30, 0x53, 0x89, 0x2f, 0x50, 0x36, 0x36, 0x27, 0x3e, 0x21, 0x4b, 0x89, 0x1d, 0x39, - 0x46, 0x94, 0x6f, 0xc1, 0x57, 0x62, 0x63, 0xec, 0xc8, 0x88, 0x92, 0x2f, 0x82, 0x6c, 0x2b, 0x90, - 0x4a, 0x6c, 0xfe, 0x3d, 0xf7, 0xdc, 0xdd, 0x63, 0x1d, 0xa4, 0xa5, 0xa9, 0x94, 0x46, 0x61, 0x4b, - 0x63, 0x71, 0x2b, 0x9e, 0x4b, 0xa7, 0x8c, 0xce, 0x1b, 0x6b, 0x9c, 0xa1, 0x67, 0x43, 0x2d, 0x1f, - 0x9b, 0xd2, 0xf3, 0x93, 0x96, 0x42, 0xc9, 0x68, 0xbf, 0x7a, 0x9f, 0xc2, 0xe2, 0x2e, 0x0e, 0xa0, - 0xff, 0x61, 0xa6, 0xb4, 0xc4, 0x03, 0x23, 0x19, 0xd9, 0xac, 0xf6, 0x11, 0x28, 0x85, 0x44, 0x8b, - 0x1a, 0xd9, 0x34, 0x88, 0xe1, 0x4d, 0x33, 0x58, 0x4b, 0x6c, 0x4b, 0xab, 0x1a, 0xdf, 0xc8, 0xfe, - 0x85, 0xd2, 0x58, 0xa2, 0x39, 0x24, 0x05, 0xb6, 0x8e, 0x25, 0x19, 0xd9, 0xac, 0xaf, 0xd3, 0xfc, - 0xcf, 0x54, 0xf9, 0x4e, 0xc9, 0x7d, 0xf0, 0xd1, 0x14, 0x96, 0x12, 0x85, 0xf4, 0x35, 0x36, 0xcb, - 0xc8, 0x26, 0xd9, 0xff, 0x30, 0x65, 0xb0, 0x28, 0x51, 0x55, 0x4a, 0x3f, 0xb1, 0x79, 0xd8, 0x34, - 0xa0, 0x4f, 0x2c, 0x51, 0x9b, 0x9a, 0x2d, 0x62, 0xe2, 0x00, 0x5e, 0x35, 0x2f, 0x1a, 0x2d, 0x5b, - 0x46, 0x35, 0x00, 0xe5, 0x00, 0x15, 0x8a, 0x16, 0x1f, 0x9c, 0xb0, 0x8e, 0xad, 0xc2, 0x8e, 0x91, - 0xe2, 0x13, 0x04, 0xba, 0xd7, 0x92, 0x41, 0x4c, 0x30, 0x30, 0xbd, 0x80, 0x95, 0xc5, 0x5a, 0x28, - 0xed, 0x33, 0xac, 0xc3, 0xd4, 0x5f, 0x61, 0x77, 0xfb, 0xd1, 0x71, 0x72, 0xec, 0x38, 0xf9, 0xea, - 0x38, 0x79, 0xeb, 0xf9, 0xe4, 0xd8, 0xf3, 0xc9, 0x67, 0xcf, 0x27, 0x8f, 0x97, 0xc3, 0x6f, 0xb7, - 0x87, 0xed, 0xc9, 0x01, 0xdc, 0x6b, 0x83, 0x6d, 0x31, 0x0f, 0x37, 0xb8, 0xf9, 0x0e, 0x00, 0x00, - 0xff, 0xff, 0x5b, 0x39, 0x9d, 0x8f, 0xd0, 0x01, 0x00, 0x00, + // 380 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xb1, 0xae, 0xd3, 0x30, + 0x14, 0x86, 0x6b, 0x9a, 0x36, 0xad, 0x0b, 0x45, 0xb2, 0x00, 0x59, 0x01, 0xa2, 0x88, 0x01, 0x65, + 0x4a, 0xa5, 0x32, 0xb0, 0xd2, 0x22, 0xc4, 0xc4, 0x12, 0x36, 0x36, 0xc7, 0x3e, 0x6a, 0x2d, 0x35, + 0x76, 0xe4, 0x38, 0x6a, 0x79, 0x0b, 0x1e, 0x0b, 0x89, 0xa5, 0x23, 0xe3, 0x55, 0xfb, 0x22, 0x57, + 0xb6, 0x95, 0xdb, 0x56, 0xba, 0x77, 0xf3, 0xff, 0xff, 0xe7, 0xf8, 0x7c, 0x3e, 0x32, 0x4e, 0xb8, + 0xde, 0x49, 0x05, 0xcc, 0x70, 0x6d, 0x60, 0xc1, 0x3a, 0x6e, 0xa5, 0x56, 0x45, 0x63, 0xb4, 0xd5, + 0xe4, 0x75, 0x9f, 0x15, 0xd7, 0x45, 0xc9, 0x9b, 0x9b, 0x96, 0x4a, 0x8a, 0x50, 0x9e, 0xbc, 0xbd, + 0xf1, 0xb7, 0xcc, 0x88, 0x3d, 0x33, 0x10, 0xc2, 0x0f, 0xff, 0x86, 0x38, 0x5e, 0x85, 0xdb, 0xc9, + 0x2b, 0x3c, 0x92, 0x4a, 0xc0, 0x81, 0xa2, 0x0c, 0xe5, 0xd3, 0x32, 0x08, 0x42, 0x70, 0xa4, 0x58, + 0x0d, 0xf4, 0x99, 0x37, 0xfd, 0x99, 0x64, 0x78, 0x26, 0xa0, 0xe5, 0x46, 0x36, 0xae, 0x91, 0x0e, + 0x7d, 0x74, 0x6d, 0x91, 0x02, 0x47, 0x15, 0xb4, 0x96, 0x46, 0x19, 0xca, 0x67, 0xcb, 0xa4, 0x78, + 0x14, 0xb9, 0x58, 0x4b, 0x51, 0xfa, 0x3a, 0x92, 0xe0, 0x89, 0x00, 0x26, 0x5c, 0x46, 0x47, 0x19, + 0xca, 0xa3, 0xf2, 0x41, 0x13, 0x8a, 0x63, 0x0e, 0x72, 0x27, 0xd5, 0x86, 0x8e, 0xfd, 0xa4, 0x5e, + 0x3a, 0x62, 0x01, 0x4a, 0xd7, 0x34, 0x0e, 0xc4, 0x5e, 0x38, 0x57, 0xef, 0x15, 0x18, 0x3a, 0x09, + 0xae, 0x17, 0x24, 0xc5, 0x78, 0x07, 0xac, 0x85, 0x9f, 0x96, 0x19, 0x4b, 0xa7, 0x7e, 0xc6, 0x95, + 0xe3, 0x08, 0xbc, 0xfa, 0xa6, 0x04, 0xc5, 0x81, 0xa0, 0xd7, 0xe4, 0x1d, 0x9e, 0x1a, 0xa8, 0x99, + 0x54, 0x8e, 0x61, 0xe6, 0x6f, 0xbd, 0x18, 0x6e, 0x43, 0x9b, 0xa6, 0x6b, 0xe9, 0xf3, 0x6c, 0xe8, + 0x36, 0xe4, 0xce, 0xe4, 0x0b, 0x8e, 0x79, 0xd3, 0xad, 0x0c, 0xdf, 0xd2, 0x17, 0x19, 0xca, 0xe7, + 0xcb, 0x8f, 0x4f, 0xac, 0xe0, 0x6b, 0xa8, 0x92, 0x16, 0xb8, 0xed, 0x0c, 0x94, 0x7d, 0x9b, 0x7b, + 0x45, 0x0d, 0xf5, 0x8f, 0x8a, 0xce, 0x3d, 0x4c, 0x10, 0x8e, 0xa4, 0xb5, 0xda, 0xb0, 0x0d, 0x7c, + 0xaf, 0xe8, 0x4b, 0x9f, 0x5c, 0x8c, 0xf5, 0xe7, 0xbf, 0xa7, 0x14, 0x1d, 0x4f, 0x29, 0xba, 0x3b, + 0xa5, 0xe8, 0xcf, 0x39, 0x1d, 0x1c, 0xcf, 0xe9, 0xe0, 0xff, 0x39, 0x1d, 0xfc, 0x7a, 0xdf, 0x0f, + 0x5d, 0x1c, 0x16, 0x37, 0xff, 0xc1, 0xfe, 0x6e, 0xa0, 0xad, 0xc6, 0xfe, 0x37, 0x7c, 0xba, 0x0f, + 0x00, 0x00, 0xff, 0xff, 0x29, 0x90, 0xf6, 0xec, 0x77, 0x02, 0x00, 0x00, } func (m *Auction) Marshal() (dAtA []byte, err error) { @@ -195,6 +233,30 @@ func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.StorageGb != 0 { + i = encodeVarintAuction(dAtA, i, uint64(m.StorageGb)) + i-- + dAtA[i] = 0x78 + } + if m.MemMb != 0 { + i = encodeVarintAuction(dAtA, i, uint64(m.MemMb)) + i-- + dAtA[i] = 0x70 + } + if m.CpuArch != 0 { + i = encodeVarintAuction(dAtA, i, uint64(m.CpuArch)) + i-- + dAtA[i] = 0x68 + } + if len(m.Gpus) > 0 { + for iNdEx := len(m.Gpus) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Gpus[iNdEx]) + copy(dAtA[i:], m.Gpus[iNdEx]) + i = encodeVarintAuction(dAtA, i, uint64(len(m.Gpus[iNdEx]))) + i-- + dAtA[i] = 0x62 + } + } if len(m.Remaining) > 0 { i -= len(m.Remaining) copy(dAtA[i:], m.Remaining) @@ -332,6 +394,21 @@ func (m *Auction) Size() (n int) { if l > 0 { n += 1 + l + sovAuction(uint64(l)) } + if len(m.Gpus) > 0 { + for _, s := range m.Gpus { + l = len(s) + n += 1 + l + sovAuction(uint64(l)) + } + } + if m.CpuArch != 0 { + n += 1 + sovAuction(uint64(m.CpuArch)) + } + if m.MemMb != 0 { + n += 1 + sovAuction(uint64(m.MemMb)) + } + if m.StorageGb != 0 { + n += 1 + sovAuction(uint64(m.StorageGb)) + } return n } @@ -687,6 +764,95 @@ func (m *Auction) Unmarshal(dAtA []byte) error { } m.Remaining = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Gpus", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + 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 ErrInvalidLengthAuction + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAuction + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Gpus = append(m.Gpus, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CpuArch", wireType) + } + m.CpuArch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CpuArch |= CpuArchitecture(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MemMb", wireType) + } + m.MemMb = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MemMb |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StorageGb", wireType) + } + m.StorageGb = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAuction + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StorageGb |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipAuction(dAtA[iNdEx:]) diff --git a/x/colinearcore/types/hardware.pb.go b/x/colinearcore/types/hardware.pb.go index f9a7637..5b9dde9 100644 --- a/x/colinearcore/types/hardware.pb.go +++ b/x/colinearcore/types/hardware.pb.go @@ -20,43 +20,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type GpuModel int32 - -const ( - GpuModel_RTX_2080 GpuModel = 0 - GpuModel_RTX_2080_TI GpuModel = 1 - GpuModel_RTX_3070 GpuModel = 2 - GpuModel_RTX_3070_TI GpuModel = 3 - GpuModel_RTX_3080 GpuModel = 4 - GpuModel_RTX_3080_TI GpuModel = 5 -) - -var GpuModel_name = map[int32]string{ - 0: "RTX_2080", - 1: "RTX_2080_TI", - 2: "RTX_3070", - 3: "RTX_3070_TI", - 4: "RTX_3080", - 5: "RTX_3080_TI", -} - -var GpuModel_value = map[string]int32{ - "RTX_2080": 0, - "RTX_2080_TI": 1, - "RTX_3070": 2, - "RTX_3070_TI": 3, - "RTX_3080": 4, - "RTX_3080_TI": 5, -} - -func (x GpuModel) String() string { - return proto.EnumName(GpuModel_name, int32(x)) -} - -func (GpuModel) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b5d8e515bcf89b12, []int{0} -} - type CpuArchitecture int32 const ( @@ -82,30 +45,25 @@ func (x CpuArchitecture) String() string { } func (CpuArchitecture) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b5d8e515bcf89b12, []int{1} + return fileDescriptor_b5d8e515bcf89b12, []int{0} } func init() { - proto.RegisterEnum("colinear.colinearcore.GpuModel", GpuModel_name, GpuModel_value) proto.RegisterEnum("colinear.colinearcore.CpuArchitecture", CpuArchitecture_name, CpuArchitecture_value) } func init() { proto.RegisterFile("colinearcore/hardware.proto", fileDescriptor_b5d8e515bcf89b12) } var fileDescriptor_b5d8e515bcf89b12 = []byte{ - // 214 bytes of a gzipped FileDescriptorProto + // 152 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xce, 0xcf, 0xc9, 0xcc, 0x4b, 0x4d, 0x2c, 0x4a, 0xce, 0x2f, 0x4a, 0xd5, 0xcf, 0x48, 0x2c, 0x4a, 0x29, 0x4f, 0x2c, - 0x4a, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x85, 0x49, 0xea, 0x21, 0xab, 0xd2, 0x4a, - 0xe7, 0xe2, 0x70, 0x2f, 0x28, 0xf5, 0xcd, 0x4f, 0x49, 0xcd, 0x11, 0xe2, 0xe1, 0xe2, 0x08, 0x0a, - 0x89, 0x88, 0x37, 0x32, 0xb0, 0x30, 0x10, 0x60, 0x10, 0xe2, 0xe7, 0xe2, 0x86, 0xf1, 0xe2, 0x43, - 0x3c, 0x05, 0x18, 0x61, 0xd2, 0xc6, 0x06, 0xe6, 0x06, 0x02, 0x4c, 0x30, 0x69, 0x10, 0x0f, 0x24, - 0xcd, 0x8c, 0x90, 0xb6, 0x30, 0x10, 0x60, 0x41, 0x48, 0x43, 0x74, 0xb3, 0x6a, 0xe9, 0x71, 0xf1, - 0x3b, 0x17, 0x94, 0x3a, 0x16, 0x25, 0x67, 0x64, 0x96, 0xa4, 0x26, 0x97, 0x94, 0x16, 0xa5, 0x0a, - 0xb1, 0x73, 0x31, 0x3b, 0xfa, 0x45, 0x0a, 0x30, 0x08, 0x71, 0x72, 0xb1, 0x7a, 0xfa, 0x85, 0xb8, - 0xfa, 0x08, 0x30, 0x82, 0xc5, 0x7c, 0x5d, 0x04, 0x98, 0x9c, 0xcc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, - 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, - 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x16, 0xe6, 0x01, 0xfd, 0x0a, 0x7d, 0x14, 0x1f, 0x97, 0x54, - 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0xfd, 0x6b, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xbe, 0x59, - 0x42, 0x58, 0x0e, 0x01, 0x00, 0x00, + 0x4a, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x85, 0x49, 0xea, 0x21, 0xab, 0xd2, 0xd2, + 0xe3, 0xe2, 0x77, 0x2e, 0x28, 0x75, 0x2c, 0x4a, 0xce, 0xc8, 0x2c, 0x49, 0x4d, 0x2e, 0x29, 0x2d, + 0x4a, 0x15, 0x62, 0xe7, 0x62, 0x76, 0xf4, 0x8b, 0x14, 0x60, 0x10, 0xe2, 0xe4, 0x62, 0xf5, 0xf4, + 0x0b, 0x71, 0xf5, 0x11, 0x60, 0x04, 0x8b, 0xf9, 0xba, 0x08, 0x30, 0x39, 0x99, 0x9f, 0x78, 0x24, + 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, + 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x2c, 0xcc, 0x5c, 0xfd, 0x0a, 0x7d, 0x14, 0x87, + 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x9d, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, + 0x17, 0xf0, 0x7c, 0xa7, 0xa5, 0x00, 0x00, 0x00, } diff --git a/x/colinearcore/types/keys.go b/x/colinearcore/types/keys.go index c7fd06e..b374fe6 100644 --- a/x/colinearcore/types/keys.go +++ b/x/colinearcore/types/keys.go @@ -36,6 +36,11 @@ const ( AuctionCreatedEventCreator = "creator" AuctionCreatedIndex = "auction-id" AuctionCreatedCeiling = "ceiling" + // hardware + // AuctionCreatedGpu = "gpu" + // AuctionCreatedCpuArch = "cpu-arch" + // AuctionCreatedMemMb = "mem-mb" + // AuctionCreatedStorage = "storage" ) const ( diff --git a/x/colinearcore/types/params.pb.go b/x/colinearcore/types/params.pb.go index 6d9abc8..3b49660 100644 --- a/x/colinearcore/types/params.pb.go +++ b/x/colinearcore/types/params.pb.go @@ -25,6 +25,30 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { + // hardware options + GpuModels map[string]uint32 `protobuf:"bytes,1,rep,name=gpuModels,proto3" json:"gpuModels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + // gas config + AuctionGas uint32 `protobuf:"varint,2,opt,name=auctionGas,proto3" json:"auctionGas,omitempty"` + // auction config + AuctionTime uint32 `protobuf:"varint,3,opt,name=auctionTime,proto3" json:"auctionTime,omitempty"` + MinLeasePeriod uint32 `protobuf:"varint,4,opt,name=minLeasePeriod,proto3" json:"minLeasePeriod,omitempty"` + MaxLeasePeriod uint32 `protobuf:"varint,5,opt,name=maxLeasePeriod,proto3" json:"maxLeasePeriod,omitempty"` + AllowedAuctionDenoms []string `protobuf:"bytes,6,rep,name=allowedAuctionDenoms,proto3" json:"allowedAuctionDenoms,omitempty"` + // Maximum number of verified providers; this is to prevent buffer overflow + // attacks since provider list is not committed to chain state and costs 0 gas + MaxVerifiedProviders uint32 `protobuf:"varint,7,opt,name=maxVerifiedProviders,proto3" json:"maxVerifiedProviders,omitempty"` + // Minimum required staked CLR to be a provider (i.e. to bid) + // 500 CLR + ProviderMinLockedUClr uint32 `protobuf:"varint,8,opt,name=providerMinLockedUClr,proto3" json:"providerMinLockedUClr,omitempty"` + // Amount slashed when a provider is offline during an audit + // 100 CLR + ProviderLockedSlashUClr uint32 `protobuf:"varint,9,opt,name=providerLockedSlashUClr,proto3" json:"providerLockedSlashUClr,omitempty"` + // Blocks between provider audits + // 400 blocks ~400-1200min + ProviderAuditFrequency uint32 `protobuf:"varint,10,opt,name=providerAuditFrequency,proto3" json:"providerAuditFrequency,omitempty"` + // Blocks before an audit ping must be returned + // 3 blocks ~4-12sec + ProviderAuditLength uint32 `protobuf:"varint,11,opt,name=providerAuditLength,proto3" json:"providerAuditLength,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -59,23 +83,119 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo +func (m *Params) GetGpuModels() map[string]uint32 { + if m != nil { + return m.GpuModels + } + return nil +} + +func (m *Params) GetAuctionGas() uint32 { + if m != nil { + return m.AuctionGas + } + return 0 +} + +func (m *Params) GetAuctionTime() uint32 { + if m != nil { + return m.AuctionTime + } + return 0 +} + +func (m *Params) GetMinLeasePeriod() uint32 { + if m != nil { + return m.MinLeasePeriod + } + return 0 +} + +func (m *Params) GetMaxLeasePeriod() uint32 { + if m != nil { + return m.MaxLeasePeriod + } + return 0 +} + +func (m *Params) GetAllowedAuctionDenoms() []string { + if m != nil { + return m.AllowedAuctionDenoms + } + return nil +} + +func (m *Params) GetMaxVerifiedProviders() uint32 { + if m != nil { + return m.MaxVerifiedProviders + } + return 0 +} + +func (m *Params) GetProviderMinLockedUClr() uint32 { + if m != nil { + return m.ProviderMinLockedUClr + } + return 0 +} + +func (m *Params) GetProviderLockedSlashUClr() uint32 { + if m != nil { + return m.ProviderLockedSlashUClr + } + return 0 +} + +func (m *Params) GetProviderAuditFrequency() uint32 { + if m != nil { + return m.ProviderAuditFrequency + } + return 0 +} + +func (m *Params) GetProviderAuditLength() uint32 { + if m != nil { + return m.ProviderAuditLength + } + return 0 +} + func init() { proto.RegisterType((*Params)(nil), "colinear.colinearcore.Params") + proto.RegisterMapType((map[string]uint32)(nil), "colinear.colinearcore.Params.GpuModelsEntry") } func init() { proto.RegisterFile("colinearcore/params.proto", fileDescriptor_54a22962c5c35285) } var fileDescriptor_54a22962c5c35285 = []byte{ - // 131 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xce, 0xcf, 0xc9, - 0xcc, 0x4b, 0x4d, 0x2c, 0x4a, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, - 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x85, 0x49, 0xe9, 0x21, 0xab, 0x91, 0x12, 0x49, 0xcf, - 0x4f, 0xcf, 0x07, 0xab, 0xd0, 0x07, 0xb1, 0x20, 0x8a, 0x95, 0xf8, 0xb8, 0xd8, 0x02, 0xc0, 0x9a, - 0xad, 0x58, 0x66, 0x2c, 0x90, 0x67, 0x70, 0x32, 0x3f, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, - 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, - 0x39, 0x86, 0x28, 0x59, 0x98, 0x69, 0xfa, 0x15, 0xfa, 0x28, 0x96, 0x97, 0x54, 0x16, 0xa4, 0x16, - 0x27, 0xb1, 0x81, 0xcd, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x70, 0x9f, 0x63, 0x4b, 0x99, - 0x00, 0x00, 0x00, + // 419 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x4d, 0x6f, 0xd3, 0x30, + 0x18, 0xc7, 0xeb, 0xb5, 0x2b, 0xf4, 0xa9, 0x98, 0x90, 0xe9, 0xc0, 0x4c, 0x22, 0x44, 0x1c, 0x50, + 0x0f, 0x28, 0x45, 0x03, 0xc1, 0x34, 0x71, 0x19, 0x6f, 0x93, 0x50, 0x27, 0x55, 0xe1, 0xe5, 0xc0, + 0xcd, 0x24, 0x0f, 0x99, 0xb5, 0xc4, 0x0e, 0x76, 0x32, 0x9a, 0x6f, 0xc1, 0x91, 0x23, 0x1f, 0x87, + 0xe3, 0x8e, 0x1c, 0x51, 0x7b, 0xe5, 0x43, 0xa0, 0x3a, 0x89, 0x48, 0x50, 0x76, 0xf3, 0xf3, 0xff, + 0xfd, 0x7f, 0xf6, 0xc1, 0x0f, 0xdc, 0x0e, 0x54, 0x2c, 0x24, 0x72, 0x1d, 0x28, 0x8d, 0xb3, 0x94, + 0x6b, 0x9e, 0x18, 0x2f, 0xd5, 0x2a, 0x53, 0x74, 0xb7, 0x46, 0x5e, 0xb3, 0xb3, 0x37, 0x89, 0x54, + 0xa4, 0x6c, 0x63, 0xb6, 0x39, 0x95, 0xe5, 0x7b, 0x7f, 0x06, 0x30, 0x5c, 0x58, 0x9b, 0xbe, 0x81, + 0x51, 0x94, 0xe6, 0x27, 0x2a, 0xc4, 0xd8, 0x30, 0xe2, 0xf6, 0xa7, 0xe3, 0xfd, 0x07, 0x5e, 0xe7, + 0x5d, 0x5e, 0x69, 0x78, 0xc7, 0x75, 0xfd, 0x95, 0xcc, 0x74, 0xe1, 0xff, 0xd3, 0xa9, 0x03, 0xc0, + 0xf3, 0x20, 0x13, 0x4a, 0x1e, 0x73, 0xc3, 0xb6, 0x5c, 0x32, 0xbd, 0xe6, 0x37, 0x12, 0xea, 0xc2, + 0xb8, 0x9a, 0xde, 0x89, 0x04, 0x59, 0xdf, 0x16, 0x9a, 0x11, 0xbd, 0x0f, 0x3b, 0x89, 0x90, 0x73, + 0xe4, 0x06, 0x17, 0xa8, 0x85, 0x0a, 0xd9, 0xc0, 0x96, 0xfe, 0x4b, 0x6d, 0x8f, 0x2f, 0x9b, 0xbd, + 0xed, 0xaa, 0xd7, 0x4a, 0xe9, 0x3e, 0x4c, 0x78, 0x1c, 0xab, 0xaf, 0x18, 0x1e, 0x95, 0xaf, 0xbc, + 0x44, 0xa9, 0x12, 0xc3, 0x86, 0x6e, 0x7f, 0x3a, 0xf2, 0x3b, 0xd9, 0xc6, 0x49, 0xf8, 0xf2, 0x03, + 0x6a, 0xf1, 0x59, 0x60, 0xb8, 0xd0, 0xea, 0x5c, 0x84, 0xa8, 0x0d, 0xbb, 0x62, 0x5f, 0xe8, 0x64, + 0xf4, 0x31, 0xec, 0xa6, 0xd5, 0x70, 0x22, 0xe4, 0x5c, 0x05, 0x67, 0x18, 0xbe, 0x7f, 0x11, 0x6b, + 0x76, 0xd5, 0x4a, 0xdd, 0x90, 0x1e, 0xc0, 0xad, 0x1a, 0x94, 0xe9, 0xdb, 0x98, 0x9b, 0x53, 0xeb, + 0x8d, 0xac, 0x77, 0x19, 0xa6, 0x4f, 0xe0, 0x66, 0x8d, 0x8e, 0xf2, 0x50, 0x64, 0xaf, 0x35, 0x7e, + 0xc9, 0x51, 0x06, 0x05, 0x03, 0x2b, 0x5e, 0x42, 0xe9, 0x43, 0xb8, 0xd1, 0x22, 0x73, 0x94, 0x51, + 0x76, 0xca, 0xc6, 0x56, 0xea, 0x42, 0x7b, 0xcf, 0x60, 0xa7, 0xfd, 0xe1, 0xf4, 0x3a, 0xf4, 0xcf, + 0xb0, 0x60, 0xc4, 0x25, 0xd3, 0x91, 0xbf, 0x39, 0xd2, 0x09, 0x6c, 0x9f, 0xf3, 0x38, 0xc7, 0xea, + 0xcb, 0xcb, 0xe1, 0x70, 0xeb, 0x80, 0x1c, 0x0e, 0xbe, 0xff, 0xb8, 0xdb, 0x7b, 0xfe, 0xf4, 0xe7, + 0xca, 0x21, 0x17, 0x2b, 0x87, 0xfc, 0x5e, 0x39, 0xe4, 0xdb, 0xda, 0xe9, 0x5d, 0xac, 0x9d, 0xde, + 0xaf, 0xb5, 0xd3, 0xfb, 0x78, 0xa7, 0x5e, 0xb0, 0xd9, 0x72, 0xd6, 0xda, 0xed, 0xac, 0x48, 0xd1, + 0x7c, 0x1a, 0xda, 0x75, 0x7d, 0xf4, 0x37, 0x00, 0x00, 0xff, 0xff, 0x05, 0x9c, 0x24, 0xe5, 0xf8, + 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -98,6 +218,77 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.ProviderAuditLength != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.ProviderAuditLength)) + i-- + dAtA[i] = 0x58 + } + if m.ProviderAuditFrequency != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.ProviderAuditFrequency)) + i-- + dAtA[i] = 0x50 + } + if m.ProviderLockedSlashUClr != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.ProviderLockedSlashUClr)) + i-- + dAtA[i] = 0x48 + } + if m.ProviderMinLockedUClr != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.ProviderMinLockedUClr)) + i-- + dAtA[i] = 0x40 + } + if m.MaxVerifiedProviders != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxVerifiedProviders)) + i-- + dAtA[i] = 0x38 + } + if len(m.AllowedAuctionDenoms) > 0 { + for iNdEx := len(m.AllowedAuctionDenoms) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AllowedAuctionDenoms[iNdEx]) + copy(dAtA[i:], m.AllowedAuctionDenoms[iNdEx]) + i = encodeVarintParams(dAtA, i, uint64(len(m.AllowedAuctionDenoms[iNdEx]))) + i-- + dAtA[i] = 0x32 + } + } + if m.MaxLeasePeriod != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MaxLeasePeriod)) + i-- + dAtA[i] = 0x28 + } + if m.MinLeasePeriod != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.MinLeasePeriod)) + i-- + dAtA[i] = 0x20 + } + if m.AuctionTime != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.AuctionTime)) + i-- + dAtA[i] = 0x18 + } + if m.AuctionGas != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.AuctionGas)) + i-- + dAtA[i] = 0x10 + } + if len(m.GpuModels) > 0 { + for k := range m.GpuModels { + v := m.GpuModels[k] + baseI := i + i = encodeVarintParams(dAtA, i, uint64(v)) + i-- + dAtA[i] = 0x10 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintParams(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintParams(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + } + } return len(dAtA) - i, nil } @@ -118,6 +309,47 @@ func (m *Params) Size() (n int) { } var l int _ = l + if len(m.GpuModels) > 0 { + for k, v := range m.GpuModels { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovParams(uint64(len(k))) + 1 + sovParams(uint64(v)) + n += mapEntrySize + 1 + sovParams(uint64(mapEntrySize)) + } + } + if m.AuctionGas != 0 { + n += 1 + sovParams(uint64(m.AuctionGas)) + } + if m.AuctionTime != 0 { + n += 1 + sovParams(uint64(m.AuctionTime)) + } + if m.MinLeasePeriod != 0 { + n += 1 + sovParams(uint64(m.MinLeasePeriod)) + } + if m.MaxLeasePeriod != 0 { + n += 1 + sovParams(uint64(m.MaxLeasePeriod)) + } + if len(m.AllowedAuctionDenoms) > 0 { + for _, s := range m.AllowedAuctionDenoms { + l = len(s) + n += 1 + l + sovParams(uint64(l)) + } + } + if m.MaxVerifiedProviders != 0 { + n += 1 + sovParams(uint64(m.MaxVerifiedProviders)) + } + if m.ProviderMinLockedUClr != 0 { + n += 1 + sovParams(uint64(m.ProviderMinLockedUClr)) + } + if m.ProviderLockedSlashUClr != 0 { + n += 1 + sovParams(uint64(m.ProviderLockedSlashUClr)) + } + if m.ProviderAuditFrequency != 0 { + n += 1 + sovParams(uint64(m.ProviderAuditFrequency)) + } + if m.ProviderAuditLength != 0 { + n += 1 + sovParams(uint64(m.ProviderAuditLength)) + } return n } @@ -156,6 +388,322 @@ func (m *Params) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GpuModels", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.GpuModels == nil { + m.GpuModels = make(map[string]uint32) + } + var mapkey string + var mapvalue uint32 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthParams + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthParams + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else { + iNdEx = entryPreIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.GpuModels[mapkey] = mapvalue + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionGas", wireType) + } + m.AuctionGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AuctionGas |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AuctionTime", wireType) + } + m.AuctionTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AuctionTime |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinLeasePeriod", wireType) + } + m.MinLeasePeriod = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinLeasePeriod |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxLeasePeriod", wireType) + } + m.MaxLeasePeriod = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxLeasePeriod |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowedAuctionDenoms", 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 + } + m.AllowedAuctionDenoms = append(m.AllowedAuctionDenoms, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxVerifiedProviders", wireType) + } + m.MaxVerifiedProviders = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxVerifiedProviders |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderMinLockedUClr", wireType) + } + m.ProviderMinLockedUClr = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProviderMinLockedUClr |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderLockedSlashUClr", wireType) + } + m.ProviderLockedSlashUClr = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProviderLockedSlashUClr |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAuditFrequency", wireType) + } + m.ProviderAuditFrequency = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProviderAuditFrequency |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAuditLength", wireType) + } + m.ProviderAuditLength = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProviderAuditLength |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:])