Skip to content

Commit

Permalink
feat: Validate and WIBOY
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Hare committed May 5, 2024
1 parent be6f0c8 commit 466cd9e
Show file tree
Hide file tree
Showing 7 changed files with 747 additions and 55 deletions.
34 changes: 34 additions & 0 deletions docs/proto/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
- [AkashInfo](#akash.provider.v1.AkashInfo)
- [BuildDep](#akash.provider.v1.BuildDep)
- [KubeInfo](#akash.provider.v1.KubeInfo)
- [ValidateRequest](#akash.provider.v1.ValidateRequest)
- [ValidateResponse](#akash.provider.v1.ValidateResponse)
- [VersionResponse](#akash.provider.v1.VersionResponse)

- [ProviderRPC](#akash.provider.v1.ProviderRPC)
Expand Down Expand Up @@ -715,6 +717,36 @@



<a name="akash.provider.v1.ValidateRequest"></a>

### ValidateRequest
ValidateRequest


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `groups` | [akash.deployment.v1beta3.GroupSpec](#akash.deployment.v1beta3.GroupSpec) | | |






<a name="akash.provider.v1.ValidateResponse"></a>

### ValidateResponse
ValidateResponse


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `min_bid_price` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | |






<a name="akash.provider.v1.VersionResponse"></a>

### VersionResponse
Expand Down Expand Up @@ -747,6 +779,8 @@
| `GetStatus` | [.google.protobuf.Empty](#google.protobuf.Empty) | [Status](#akash.provider.v1.Status) | GetStatus defines a method to query provider state buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE buf:lint:ignore RPC_RESPONSE_STANDARD_NAME | GET|/v1/status|
| `StreamStatus` | [.google.protobuf.Empty](#google.protobuf.Empty) | [Status](#akash.provider.v1.Status) stream | Status defines a method to stream provider state buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE buf:lint:ignore RPC_RESPONSE_STANDARD_NAME | |
| `Version` | [.google.protobuf.Empty](#google.protobuf.Empty) | [VersionResponse](#akash.provider.v1.VersionResponse) | Version returns version information about the provider | |
| `Validate` | [ValidateRequest](#akash.provider.v1.ValidateRequest) | [ValidateResponse](#akash.provider.v1.ValidateResponse) | Validate checks if provider will bid on given groupspec | |
| `WIBOY` | [ValidateRequest](#akash.provider.v1.ValidateRequest) | [ValidateResponse](#akash.provider.v1.ValidateResponse) | WIBOY (will I bid on you) is an alias for Validate | |

<!-- end services -->

Expand Down
543 changes: 489 additions & 54 deletions go/provider/v1/service.pb.go

Large diffs are not rendered by default.

31 changes: 30 additions & 1 deletion proto/provider/akash/provider/v1/service.proto
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
syntax = "proto3";
package akash.provider.v1;

import "gogoproto/gogo.proto";
import "google/protobuf/empty.proto";
import "google/api/annotations.proto";

import "akash/provider/v1/status.proto";
import "gogoproto/gogo.proto";
import "akash/deployment/v1beta3/groupspec.proto";

import "cosmos/base/v1beta1/coin.proto";

option go_package = "github.com/akash-network/akash-api/go/provider/v1";

Expand All @@ -27,6 +31,12 @@ service ProviderRPC {

// Version returns version information about the provider
rpc Version(google.protobuf.Empty) returns (VersionResponse);

// Validate checks if provider will bid on given groupspec
rpc Validate(ValidateRequest) returns (ValidateResponse);

// WIBOY (will I bid on you) is an alias for Validate
rpc WIBOY(ValidateRequest) returns (ValidateResponse);
}

// VersionResponse
Expand Down Expand Up @@ -114,3 +124,22 @@ message KubeInfo {
(gogoproto.jsontag) = "platform"
];
}

// ValidateRequest
message ValidateRequest {
akash.deployment.v1beta3.GroupSpec groups = 1 [
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "groups",
(gogoproto.moretags) = "yaml:\"groups\""
];
}

// ValidateResponse
message ValidateResponse {
cosmos.base.v1beta1.Coin min_bid_price = 1 [
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "min_bid_price",
(gogoproto.moretags) = "yaml:\"min_bid_price\""
];
}

185 changes: 185 additions & 0 deletions ts/src/generated/akash/provider/v1/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import Long from 'long';
import _m0 from 'protobufjs/minimal';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { Coin } from '../../../cosmos/base/v1beta1/coin';
import { Empty } from '../../../google/protobuf/empty';
import { messageTypeRegistry } from '../../../typeRegistry';
import { GroupSpec } from '../../deployment/v1beta3/groupspec';
import { Status } from './status';

/** VersionResponse */
Expand Down Expand Up @@ -50,6 +52,18 @@ export interface KubeInfo {
platform: string;
}

/** ValidateRequest */
export interface ValidateRequest {
$type: 'akash.provider.v1.ValidateRequest';
groups: GroupSpec | undefined;
}

/** ValidateResponse */
export interface ValidateResponse {
$type: 'akash.provider.v1.ValidateResponse';
minBidPrice: Coin | undefined;
}

function createBaseVersionResponse(): VersionResponse {
return {
$type: 'akash.provider.v1.VersionResponse',
Expand Down Expand Up @@ -674,6 +688,155 @@ export const KubeInfo = {

messageTypeRegistry.set(KubeInfo.$type, KubeInfo);

function createBaseValidateRequest(): ValidateRequest {
return { $type: 'akash.provider.v1.ValidateRequest', groups: undefined };
}

export const ValidateRequest = {
$type: 'akash.provider.v1.ValidateRequest' as const,

encode(
message: ValidateRequest,
writer: _m0.Writer = _m0.Writer.create(),
): _m0.Writer {
if (message.groups !== undefined) {
GroupSpec.encode(message.groups, writer.uint32(10).fork()).ldelim();
}
return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): ValidateRequest {
const reader =
input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseValidateRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}

message.groups = GroupSpec.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},

fromJSON(object: any): ValidateRequest {
return {
$type: ValidateRequest.$type,
groups: isSet(object.groups)
? GroupSpec.fromJSON(object.groups)
: undefined,
};
},

toJSON(message: ValidateRequest): unknown {
const obj: any = {};
if (message.groups !== undefined) {
obj.groups = GroupSpec.toJSON(message.groups);
}
return obj;
},

create(base?: DeepPartial<ValidateRequest>): ValidateRequest {
return ValidateRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ValidateRequest>): ValidateRequest {
const message = createBaseValidateRequest();
message.groups =
object.groups !== undefined && object.groups !== null
? GroupSpec.fromPartial(object.groups)
: undefined;
return message;
},
};

messageTypeRegistry.set(ValidateRequest.$type, ValidateRequest);

function createBaseValidateResponse(): ValidateResponse {
return {
$type: 'akash.provider.v1.ValidateResponse',
minBidPrice: undefined,
};
}

export const ValidateResponse = {
$type: 'akash.provider.v1.ValidateResponse' as const,

encode(
message: ValidateResponse,
writer: _m0.Writer = _m0.Writer.create(),
): _m0.Writer {
if (message.minBidPrice !== undefined) {
Coin.encode(message.minBidPrice, writer.uint32(10).fork()).ldelim();
}
return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): ValidateResponse {
const reader =
input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseValidateResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}

message.minBidPrice = Coin.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},

fromJSON(object: any): ValidateResponse {
return {
$type: ValidateResponse.$type,
minBidPrice: isSet(object.minBidPrice)
? Coin.fromJSON(object.minBidPrice)
: undefined,
};
},

toJSON(message: ValidateResponse): unknown {
const obj: any = {};
if (message.minBidPrice !== undefined) {
obj.minBidPrice = Coin.toJSON(message.minBidPrice);
}
return obj;
},

create(base?: DeepPartial<ValidateResponse>): ValidateResponse {
return ValidateResponse.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ValidateResponse>): ValidateResponse {
const message = createBaseValidateResponse();
message.minBidPrice =
object.minBidPrice !== undefined && object.minBidPrice !== null
? Coin.fromPartial(object.minBidPrice)
: undefined;
return message;
},
};

messageTypeRegistry.set(ValidateResponse.$type, ValidateResponse);

/** ProviderRPC defines the RPC server for provider */
export interface ProviderRPC {
/**
Expand All @@ -690,6 +853,10 @@ export interface ProviderRPC {
StreamStatus(request: Empty): Observable<Status>;
/** Version returns version information about the provider */
Version(request: Empty): Promise<VersionResponse>;
/** Validate checks if provider will bid on given groupspec */
Validate(request: ValidateRequest): Promise<ValidateResponse>;
/** WIBOY (will I bid on you) is an alias for Validate */
WIBOY(request: ValidateRequest): Promise<ValidateResponse>;
}

export const ProviderRPCServiceName = 'akash.provider.v1.ProviderRPC';
Expand All @@ -702,6 +869,8 @@ export class ProviderRPCClientImpl implements ProviderRPC {
this.GetStatus = this.GetStatus.bind(this);
this.StreamStatus = this.StreamStatus.bind(this);
this.Version = this.Version.bind(this);
this.Validate = this.Validate.bind(this);
this.WIBOY = this.WIBOY.bind(this);
}
GetStatus(request: Empty): Promise<Status> {
const data = Empty.encode(request).finish();
Expand All @@ -726,6 +895,22 @@ export class ProviderRPCClientImpl implements ProviderRPC {
VersionResponse.decode(_m0.Reader.create(data)),
);
}

Validate(request: ValidateRequest): Promise<ValidateResponse> {
const data = ValidateRequest.encode(request).finish();
const promise = this.rpc.request(this.service, 'Validate', data);
return promise.then((data) =>
ValidateResponse.decode(_m0.Reader.create(data)),
);
}

WIBOY(request: ValidateRequest): Promise<ValidateResponse> {
const data = ValidateRequest.encode(request).finish();
const promise = this.rpc.request(this.service, 'WIBOY', data);
return promise.then((data) =>
ValidateResponse.decode(_m0.Reader.create(data)),
);
}
}

interface Rpc {
Expand Down
7 changes: 7 additions & 0 deletions ts/src/generated/index.akash.base.v1beta3.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/* eslint-disable */

export * from './akash/base/v1beta3/attribute';
export * from './akash/base/v1beta3/resourcevalue';
export * from './akash/base/v1beta3/cpu';
export * from './akash/base/v1beta3/gpu';
export * from './akash/base/v1beta3/memory';
export * from './akash/base/v1beta3/storage';
export * from './akash/base/v1beta3/endpoint';
export * from './akash/base/v1beta3/resources';
1 change: 1 addition & 0 deletions ts/src/generated/index.akash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
export * as base from './index.akash.base';
export * as inventory from './index.akash.inventory';
export * as provider from './index.akash.provider';
export * as deployment from './index.akash.deployment';
1 change: 1 addition & 0 deletions ts/src/generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export * as google from './index.google';
export * as gogoproto from './index.gogoproto';
export * as akash from './index.akash';
export * as k8s from './index.k8s';
export * as cosmos from './index.cosmos';

0 comments on commit 466cd9e

Please sign in to comment.