Skip to content

Commit

Permalink
Moving Badge back to relay.proto as it simplifies the lava sdk proto …
Browse files Browse the repository at this point in the history
…compiling. (lavanet#532)

* Moving Badge back to relay.proto as it simplifies the lava sdk proto compiling.

* fixing dependencies

* go mod update

* removing server reflection deprecated error

* returning pertubation back to 1000
  • Loading branch information
ranlavanet authored Jun 5, 2023
1 parent 5fc37da commit 7fcdf5f
Show file tree
Hide file tree
Showing 6 changed files with 501 additions and 470 deletions.
48 changes: 40 additions & 8 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29674,6 +29674,16 @@ paths:
in: query
required: false
type: boolean
- name: pagination.reverse
description: >-
reverse is set to true if results are to be returned in the
descending order.


Since: cosmos-sdk 0.43
in: query
required: false
type: boolean
tags:
- Query
'/lavanet/lava/epochstorage/fixated_params/{index}':
Expand Down Expand Up @@ -29931,6 +29941,16 @@ paths:
in: query
required: false
type: boolean
- name: pagination.reverse
description: >-
reverse is set to true if results are to be returned in the
descending order.


Since: cosmos-sdk 0.43
in: query
required: false
type: boolean
tags:
- Query
'/lavanet/lava/epochstorage/stake_storage/{index}':
Expand Down Expand Up @@ -32083,6 +32103,16 @@ paths:
in: query
required: false
type: boolean
- name: pagination.reverse
description: >-
reverse is set to true if results are to be returned in the
descending order.


Since: cosmos-sdk 0.43
in: query
required: false
type: boolean
tags:
- Query
'/lavanet/lava/spec/spec/{ChainID}':
Expand Down Expand Up @@ -32719,6 +32749,16 @@ paths:
in: query
required: false
type: boolean
- name: pagination.reverse
description: >-
reverse is set to true if results are to be returned in the
descending order.


Since: cosmos-sdk 0.43
in: query
required: false
type: boolean
tags:
- Query
'/lavanet/lava/spec/spec_raw/{ChainID}':
Expand Down Expand Up @@ -57476,14 +57516,6 @@ definitions:
format: uint64
title: 'protobuf expected in YAML format: used "moretags" to simplify parsing'
title: used as a container struct for the subscription module
lavanet.lava.projects.ProjectKey.KEY_TYPE:
type: string
enum:
- NONE
- ADMIN
- DEVELOPER
default: NONE
title: 'bitmap, must only be power of 2'
lavanet.lava.subscription.MsgAddProjectResponse:
type: object
lavanet.lava.subscription.MsgBuyResponse:
Expand Down
20 changes: 7 additions & 13 deletions proto/pairing/badges.proto
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
syntax = "proto3";
package lavanet.lava.pairing;

option go_package = "github.com/lavanet/lava/x/pairing/types";

import "pairing/relay.proto";
import "gogoproto/gogo.proto";
import "google/protobuf/wrappers.proto";
import "epochstorage/stake_entry.proto";

option go_package = "github.com/lavanet/lava/x/pairing/types";

message Badge {
uint64 cu_allocation =1;
uint64 epoch = 2;
string address = 3;
string lava_chain_id = 4;
bytes project_sig = 5;
service BadgeGenerator {
rpc GenerateBadge(GenerateBadgeRequest) returns (GenerateBadgeResponse) {}
}

message GenerateBadgeRequest {
Expand All @@ -21,11 +19,7 @@ message GenerateBadgeRequest {
}

message GenerateBadgeResponse {
Badge badge = 1;
Badge badge = 1;
repeated lavanet.lava.epochstorage.StakeEntry pairing_list = 2 [(gogoproto.nullable) = true];
string badge_signer_address = 3;
}

service BadgeGenerator {
rpc GenerateBadge(GenerateBadgeRequest) returns (GenerateBadgeResponse) {}
}
16 changes: 11 additions & 5 deletions proto/pairing/relay.proto
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
syntax = "proto3";
package lavanet.lava.pairing;

option go_package = "github.com/lavanet/lava/x/pairing/types";

import "gogoproto/gogo.proto";
import "google/protobuf/wrappers.proto";
import "pairing/badges.proto";

option go_package = "github.com/lavanet/lava/x/pairing/types";

service Relayer {
rpc Relay (RelayRequest) returns (RelayReply) {}
Expand All @@ -27,6 +28,14 @@ message RelaySession {
Badge badge = 12;
}

message Badge {
uint64 cu_allocation =1;
uint64 epoch = 2;
string address = 3;
string lava_chain_id = 4;
bytes project_sig = 5;
}

message RelayPrivateData {
string connection_type = 1;
string api_url = 2; // some relays have associated urls that are filled with params ('/block/{height}')
Expand All @@ -48,9 +57,6 @@ message RelayRequest {
RelayPrivateData relay_data= 2;
}




message RelayReply {
bytes data = 1;
bytes sig = 2; // sign the data hash+query hash+nonce
Expand Down
2 changes: 1 addition & 1 deletion protocol/provideroptimizer/provider_optimizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ func TestProviderOptimizerPerturbation(t *testing.T) {
utils.LavaFormatDebug("rand seed", utils.Attribute{Key: "seed", Value: seed})
same := 0
chosenProvider := providerOptimizer.ChooseProvider(providersGen.providersAddresses, nil, requestCU, requestBlock, 0)[0]
runs := 100
runs := 1000
for i := 0; i < runs; i++ {
returnedProviders := providerOptimizer.ChooseProvider(providersGen.providersAddresses, nil, requestCU, requestBlock, pertrubationPercentage)
require.Equal(t, 1, len(returnedProviders))
Expand Down
Loading

0 comments on commit 7fcdf5f

Please sign in to comment.