Replies: 1 comment
-
Account Delegation StatusThe primary technique utilized by the routing logic will be based on the High-Level Routing Algorithm
Low-Level RoutingFor redundancy, the router should maintain several connection pools (both
Thoughts on LatencyRegular cases when states are fetched from expected sources should have @GabrielePicco @thlorenz that's my current approach to implemenation of routing logic, ideas and constructive criticism are welcome |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
General Overview
The development of a utility service is required to streamline the differentiation between the Base Layer Blockchain (BLB) and Ephemeral Rollups (ER) during request processing. This service will enable client requests to be automatically routed to the appropriate destination based on predefined rules and contextual information extracted from the request itself.
The routing functionality encompasses two distinct scenarios:
At this stage, it appears that the second type of routing—selecting among multiple ERs—is best managed on the client side, as it requires significant context to ensure correct proxying. Consequently, the initial development phase will focus on the first scenario: determining the final destination of a request between the BLB and ER.
Routing Logic
The routing logic primarily hinges on the delegation status of accounts. Specifically:
To achieve optimal performance, the router must have access to real-time delegation information and maintain an up-to-date record of all delegated accounts. One potential implementation approach involves maintaining a persistent WebSocket (WS) connection pool to the base layer, subscribing to updates on all accounts involved in delegation-related transactions. This setup would enable near real-time updates of account status changes.
Supported Request Types
sendTransaction
Routing will depend on the accounts referenced in the transaction's instructions.
simulateTransaction
Uses the same logic as
sendTransaction
.getAccountInfo
Routing is based on the public key of the requested account. If the account is marked as delegated, the request is routed to the ER; otherwise, it is sent to the BLB.
getBalance
Follows the same logic as
getAccountInfo
.getMultipleAccounts
Requests can be split and routed to both ER and BLB, depending on the delegation status of each account.
getTokenAccountsBalance
Uses the same logic as
getAccountInfo
orgetBalance
.Unsupported Request Types
getProgramAccounts
,getTokenAccountsByOwner
,getTokenAccountsByDelegate
These requests are challenging to support due to the need to fetch data from both BLB and ER, which could result in inconsistent state responses.
getLargestAccount
,getLargestTokenAccounts
Encounter similar issues as
getProgramAccounts
.Ambiguous Support
getTransaction
,getSignatureStatuses
Routing these requests based on transaction signatures is unclear, as the target could be on the BLB, an ER, or non-existent.
getSignaturesForAddress
Regardless of an account's delegation status, transactions could exist on both BLB and ER. Aggregating and organizing these transactions may be impractical and could lead to significant complexity.
Requests Exclusively Supported by BLB
Requests such as
getSupply
,getSlot
, andgetLeaderSchedule
are inherently tied to the base layer and do not require delegation-aware routing.Potential Challenges
Race Conditions
sendTransaction
Followed bygetAccountInfo
When a
sendTransaction
containing a delegation instruction is immediately followed by agetAccountInfo
for the same account, the router might mistakenly query the BLB before receiving an update about the account's delegation status. This is an edge case but can be addressed by rechecking the account's status after receiving the response and re-querying the ER if necessary.Consecutive
sendTransaction
RequestsA related issue arises when a delegation transaction is immediately followed by another transaction targeting the newly delegated account. If the delegation fails, the routing logic may require complex fallback rules depending on the nature of the failure.
WebSocket Support
It remains unclear whether the router should support WebSocket subscriptions (or a subset of the Solana specification). Managing dynamic subscriptions and recreating them on different endpoints based on delegation status could introduce significant complexity and potential errors.
Beta Was this translation helpful? Give feedback.
All reactions