-
Notifications
You must be signed in to change notification settings - Fork 33
Utility Session Protocol
user_name edited this page Apr 28, 2023
·
4 revisions
*WIP: Run TODO*SEARCH=utility/session* make todo*search
to identify all the WIP related to session generation.*
Pocket
satisfies the V1 Utility Specification's Session Protocol by implementing the following function from the Utility Module Interface and returning a Session Protobuf:
GetSession(appAddr string, sessionHeight int64, relayChain string, geoZone string) (*coreTypes.Session, error)
The following is a simplification of the session creation flow for illustrative purposes only.
See session.go and session_test.go for the full implementation.
- Create a session object from the seed data
- Create a key concatenating and hashing the seed data
sessionId = Hash(sessionHeight + blockHash + geoZone + relayChain + appPublicKey)
- Get an ordered list of the public keys of servicers and fishermen who are:
- actively staked
- staked within geo-zone
- staked for relay-chain
- Use a pseudo-random selection algorithm to retrieve the fishermen and servicers for for the sessionId
sequenceDiagram
%% The `Querier` is anyone (app or not) that asks to retrieve session metadata
actor Q AS Querier
participant S AS Session Hydrator
participant WS AS WorldState
Q->>WS: Who are the servicers and fisherman ([app], [relayChain], [geoZone])
WS->>S: seedData = (height, blockHash, [geoZone], [relayChain], [app])
S->>S: sessionId = hash(concat(seedData))
WS->>S: servicerList = Ordered list of public keys of applicable servicers
S->>S: sessionServicers = pseudorandomSelect(sessionKey, servicerList, max)
WS->>S: fishList = Ordered list of public keys of applicable fishermen
S->>S: sessionFishermen = pseudorandomSelect(sessionKey, fishList, max)
S->>Q: SessionServicers, sessionFishermen
Contents
- Home
- Persistence
- Changelog
-
Persistence
- Indexer
- Rpc
- Runtime
- State_Machine
-
Guides
- Roadmap
-
Guides
- Learning
- Guides
-
Guides
- Contributing
- Devlog
-
Guides
- Dependencies
-
Guides
- Releases
- Guides
- P2P
-
Shared
- Crypto
- Shared
-
Shared
- Modules
-
Build
- Config
- Consensus
-
Guides
- Telemetry
- Utility
- Logger