pokt-network / poktroll

The official Shannon upgrade implementation of the Pocket Network Protocol implemented using Rollkit.dev
MIT License
15 stars 7 forks source link

[Utility] Per-chain Relays To Token Multiplier #494

Open Olshansk opened 2 months ago

Olshansk commented 2 months ago

Objective

Feature parity with RTTM from Morse.

Origin Document

Goals

Deliverables

Non-goals / Non-deliverables

Estimated Days of Work

2 days

Disclaimer: This is the total projected number of estimated hours to completion & merge. The owner of this tickets is expected to use this GitHub issue to communicate with the core protocol team along the way, with update & feedback for each deliverable throughout the duration of this work._


Creator: @Olshansk Co-Owners: @moatus

rBurgett commented 1 month ago

@Olshansk I'd be happy to take this.

Olshansk commented 1 month ago

@rBurgett Sounds great!

Few questions / suggestions (some redundancy from our offline conversations but posting here for posterity)

  1. Q1: When do you think you'll be able to start?
  2. S1: Please start with a draft PR and cc the team (@bryanchriswhite, @Olshansk, @red-0ne) before diving too deep into the implementation, tests, docs, etc...
  3. S2: Make sure to look into ignite to see if there is any scaffolding opportunity (less work, standards, etc...)

CCing @moatus for visibility.

rBurgett commented 1 month ago

I'll start tomorrow and work on it as I can around my current, full work schedule. I'll have a draft PR up by Monday.

Olshansk commented 1 month ago

Screenshot 2024-06-05 at 1 01 39 PM Screenshot 2024-06-05 at 1 01 43 PM Screenshot 2024-06-05 at 1 01 47 PM Screenshot 2024-06-05 at 1 02 20 PM Screenshot 2024-06-05 at 1 02 28 PM Screenshot 2024-06-05 at 1 02 35 PM Screenshot 2024-06-05 at 1 02 39 PM

Olshansk commented 1 month ago

@rBurgett I found this thread in the cosmos docs: error while using map in txs w/ the tl;dr is that you can use maps in txs.

Screenshot 2024-06-05 at 1 03 49 PM

Olshansk commented 1 month ago

Also, I noticed that we're "re-inventing the wheel" on how params are updated. I did so by surching for "update-params"

Screenshot 2024-06-05 at 1 04 16 PM

Olshansk commented 1 month ago

I decided to dive deeper into the whole thing and have an alternative suggestion. CCing @bryanchriswhite and @moatus for context too.

  1. We keep the default ComputeUnitToToken multiple as is.
  2. We update the Service protobuf to have a compute_units_to_token_multiplier
message Service {
  // For example, what if we want to request a session for a certain service but with some additional configs that identify it?
  string id = 1; // Unique identifier for the service

  // TODO_TECHDEBT: Name is currently unused but acts as a reminder that an optional onchain representation of the service is necessary
  string name = 2; // (Optional) Semantic human readable name for the service

+  uint64 compute_units_to_token_multiplier = 3;
}
  1. The owner of the Service (i.e. the Source owner) is the only one who can update the multiplier on their source.
  2. The default for it is based on (1)
  3. During session settlement, we query the service and leverage it there
  4. We won't need a global RTTM map (simplifying things)
rBurgett commented 1 month ago

@Olshansk that is an interesting alternative. Using a global RTTM map and serializing it as a string isn't complicated, imo, but I'll defer to your suggestion. Now, regarding number four where you say that the default should be the compute_units_to_tokens_multiplier, do you mean that 1) when a service is created we should set that as the service's compute_units_to_tokens_multiplier value? Or, 2) that should we treat the cuttm as an optional service param and fallback to the default during session settlement if a service-specific cuttm is not set?

Olshansk commented 1 month ago

tl;dr Let's do the following:


This is a result per an offline discussion with @moatus @RawthiL and @studna.

Screenshot_2024-06-05_at_2 59 01_PM

Screenshot 2024-06-05 at 7 47 03 PM

rBurgett commented 1 month ago

Sounds like a plan.