Closed RawthiL closed 2 weeks ago
Thanks for bringing this up @RawthiL and @jorgecuesta!
I updated some parts of the issue, but for reference, here is the implementation in Morse: https://github.com/pokt-network/pocket-core/pull/1463/files
After synching on this with @okdas, we believe this should be "as simple as" the business logic that would accompany the following configuration changes:
- signing_key_name: supplier1
+ default_signing_key_name: supplier1
smt_store_path: smt_stores
metrics:
enabled: true
addr: :9090
pocket_node:
query_node_rpc_url: tcp://127.0.0.1:36657
query_node_grpc_url: tcp://127.0.0.1:36658
tx_node_rpc_url: tcp://127.0.0.1:36657
suppliers:
- service_id: anvil
+ # implicitly supplier1
listen_url: http://localhost:6942
service_config:
backend_url: http://localhost:8081
publicly_exposed_endpoints:
- localhost
- service_id: svc2
+ signing_key_name: supplier2
listen_url: http://localhost:6943
service_config:
backend_url: http://localhost:8082
publicly_exposed_endpoints:
- notlocalhost
pprof:
enabled: false
addr: localhost:6060
With some additional specs w.r.t. how to route the request to the right supplier, this is how I imagined it could be.
Given that:
Supplier
s from staking with the same service_id
.Supplier
s to have the same publicly_exposed_endpoint
.listen_url
(which is great for lean clients).Assuming that we have a config with 2 Supplier
s in our lean client like the following:
suppliers:
- service_id: anvil
signing_key_name: supplier1
listen_url: http://localhost:9999
service_config:
backend_url: http://localhost:8081
publicly_exposed_endpoints:
- leanclienthost
- service_id: anvil
signing_key_name: supplier2
listen_url: http://localhost:9999
service_config:
backend_url: http://localhost:8082
publicly_exposed_endpoints:
- leanclienthost
Here, both Supplier
s provide the same service_id
on the same listen_url
and publicly_exposed_endpoints
. Which makes it ambiguous on how to select which Supplier
will be signing requests.
With the idea of:
publicly_exposed_endpoints
across different Supplier
s).listen_url
s in the config. Because we'd have to run 2500 HTTP servers if we want to collocate 2500 different Supplier
sWe're left with a few solutions:
Suppliers
s do not provide the same service_id
. If supplier1
provides svc1
, then supplier2
cannot. (I personally don't like this solution and suspect lean client operators would want to have multiple Supplier
s with for the same service_id
)supplier_address
field in the RelayRequest
proto like the following
message RelayRequest {
RelayRequestMetadata meta = 1 [(gogoproto.nullable) = false];
bytes payload = 2;
+ string supplier_address = 3;
}
Which will be populated by the Gateway
when selecting a Supplier
for a RelayRequest
.
This is possible because:
Supplier
(url) before signing the RelayRequest
supplier_address
field from the signable bytes if we want to sign before selecting a Supplier
or keep the relay request acceptable by any Supplier
from the Session
.I believe the later is the simplest solution, and the most direct path to have lean clients given our current implementation.
I believe the later is the simplest solution, and the most direct path to have lean clients given our current implementation.
supplier_address
like right now is happening on the relays. publicly_exposed_endpoints
and listen_urls
should not be considered as unique, to be honest.@red-0ne is there any way to get information about which supplier relay is arriving for using RelayRequestMetadata
? Seems like the Session
has a list of Suppliers
:
repeated poktroll.shared.Supplier suppliers = 6;
I think we can match/route to suppliers on RelayMiner based on that array. Or am I thinking nonsense?
Btw, if we translate the current (Morse) lean pocket client to the relay miner config it would look like this:
suppliers:
- service_id: anvil
signing_key_name: supplier1
listen_url: http://localhost:9999
service_config:
backend_url: http://localhost:8081
publicly_exposed_endpoints:
- leanclienthost1
- service_id: anvil
signing_key_name: supplier2
listen_url: http://localhost:9999
service_config:
backend_url: http://localhost:8081
publicly_exposed_endpoints:
- leanclienthost2
Difference between your snippet and that snippet are:
publicly_exposed_endpoints
- that is currently requests are routed.backend_url
to relay requests to.@okdas ,
We can use the Supplier
s list from the Session
but that doesn't exclude the possibility that supplier1
and supplier2
could be in that set, since the Session
's Supplier
s set construction is not aware of the suppliers that are being collocated. And this possibility grows with the number of Supplier
s collocated.
Having distinct publicly_exposed_endpoints
could also be a solution but that would involve:
Supplier
s. The on-chain logic does not know about the ones that will be collocated so it cannot allow for some and deny for others without adding complexity.RelayMiner
operators have to setup as many hostnames
as there are Supplier
s they want to collocate.Discussed offline. We'll add Supplier
address to RelayRequestMetadata
which should enable what we need. The important thing to note is that it MUST be hydrated by the Application
before the relay is sent.
Have a protocol change that makes sure that, at staking time hostnames are unique across all Suppliers. The on-chain logic does not know about the ones that will be collocated so it cannot allow for some and deny for others without adding complexity.
I'd rather avoid this but can see it become a necessity due to other reasons. For now, let's just table it in our minds and it'll come up again if necessary.
See #532 for documentation when we pick this up.
Objective
Enable a
N:1 Supplier:RelayMiner
relation, i.e. connect multiple Suppliers to the same RelayMiner process.This is required for mid-large node runners operations and economical constraints.
Origin Document
This comment refers the a
N:1 Supplier:RelayMiner
relation as "not okay" when it is fundamental for mid-large node runners.Without this feature the hardware costs of these operations will be at least 6 times higher due to hardware requirements.
More context at this discord thread.
Related Lean Pocket data:
Goals
Deliverables
Supplier
s:pkg/relayer/config
) to:signing_key_names
array in thesuppliers
entries.default_signing_key_names
that act as a default value for thesuppliers
entries that lacksigning_key_names
RelayRequestMetadata
proto (proto/poktroll/relay.proto
) to add thesupplier_address
fieldrelayerProxy
struct (pkg/relayer/proxy
) to:rp.signingKeyName
entry.rp.serverConfigs.SupplierConfigsMap
as a source of truth for the available signing keysRelayRequestMetadata.SupplierAddress
is effectively present inrp.serverConfigs.SupplierConfigsMap[ServiceId].SigningKeyNames
and serving the requestedServiceId
RelayRequestMetadata.SupplierAddress
to pick the right signingSupplier
Non-goals / Non-deliverables
GeoMesh
. This is aLeanPOKT
parity only.General deliverables
Creator: @RawthiL Co-Owners: @jorgecuesta