change consensus domain name to validator and simplify schema

This commit is contained in:
musitdev 2023-09-15 10:44:38 +02:00
parent baaa8e4eae
commit 357e63a14d
2 changed files with 60 additions and 97 deletions

View File

@ -1,6 +1,6 @@
# Architecture # Architecture
## Modules ## Domains
### Validator ### Validator
Manage real time generated data by the validator. Manage real time generated data by the validator.
@ -20,7 +20,7 @@ Provide these subscription:
* Leader schedule * Leader schedule
* sent Tx at confirmed and / or finalized: notify when a Tx sent is confirmed or finalized. * sent Tx at confirmed and / or finalized: notify when a Tx sent is confirmed or finalized.
A new subscription is added: Sent Tx confirmed/ finalized. SendTx module send Tx signature to the consensus module and when a Tx sent is confirmed (or finalized), it is notified on this subscription. A new subscription is added: Sent Tx confirmed/ finalized. SendTx module send Tx signature to the Validator domain and when a Tx sent is confirmed (or finalized), it is notified on this subscription.
It avoids to call getSignatureStatuses in a pull mode. It avoids to call getSignatureStatuses in a pull mode.
#### Sub domain Cluster #### Sub domain Cluster
@ -39,7 +39,7 @@ Implements the sendTx call.
### History ### History
Manage history function like getBlocks. Manage history function like getBlocks.
A special use case is the getSignatureStatuses because on process its the Consensus module that provide tha data. A special use case is the getSignatureStatuses because on process its the Validator domain that provide tha data.
### RPC ### RPC
It's an entry point for all call and dispatch the call to the right function. It's an entry point for all call and dispatch the call to the right function.
@ -49,13 +49,13 @@ It's an entry point for all call and dispatch the call to the right function.
```mermaid ```mermaid
flowchart TD flowchart TD
subgraph Send Tx Domain subgraph Send Tx Domain
SendTx("SendTx API SendTx("SendTx Domain
send_transaction()") send_transaction()")
end end
subgraph History Domain subgraph History Domain
History("History API History("History Domain
at confirm/finalized at confirm/finalized
getBlock() getBlock()
@ -72,7 +72,7 @@ flowchart TD
Validator process Validator process
+ GRPC Geyser"] + GRPC Geyser"]
Consensus("Validator API Consensus("Validator Domain
getVoteAccounts() getVoteAccounts()
getLeaderSchedule() getLeaderSchedule()
@ -83,7 +83,7 @@ flowchart TD
getSignatureStatuses() getSignatureStatuses()
") ")
Cluster("Cluster API Cluster("Cluster Domain
getClusterNodes()") getClusterNodes()")
end end
@ -91,10 +91,10 @@ flowchart TD
Validator-- "geyser data" -->Consensus Validator-- "geyser data" -->Consensus
Validator-- "Cluster info" -->Cluster Validator-- "Cluster info" -->Cluster
Consensus-- "Block Info/Leader Schedule" -->SendTx Consensus-- "Block Info/Slot/Leader Schedule" -->SendTx
Consensus-- "confirmed Tx" -->SendTx Consensus-- "confirmed Tx" -->SendTx
Cluster-- "Cluster info" -->SendTx Cluster-- "Cluster info" -->SendTx
Consensus-- "Full Block / Epoch" -->History Consensus-- "Full Block/Slot/Epoch" -->History
History<-. "old data" .-> Faithfull History<-. "old data" .-> Faithfull
History<-. "recent data" .-> Storage History<-. "recent data" .-> Storage
@ -195,47 +195,25 @@ The logic organization will be.
```mermaid ```mermaid
flowchart TD flowchart TD
SendTx("Send Tx SendTx("Send Tx")
[Module] History("History")
subgraph Validator_Domain
Send Tx to cluster") Cluster("Cluster Info")
History("History
[Module]
Get Block and Tx") Consensus("Validator")
end
Cluster("Cluster Info
[Module]
Cluster data")
Consensus("Validator
[Module]
Manage realtime produced data
by the validator")
Stream("Stream Stream("Stream
Manage message routing Manage message routing
between module.") between module.")
Consensus-- "Send Full Block" -->Stream Consensus-- "Send [Full&Info Block, Slot, Leader Schedule, Epoch info, Tx confirmed]" -->Stream
Consensus-- "Send Block Info" -->Stream
Consensus-- "Send Slot" -->Stream
Consensus-- "Send Leader Schedule" -->Stream
Consensus-- "Send Epoch info" -->Stream
Consensus-- "Send Sent Tx confirmed/finalized" -->Stream
Consensus-- "Send geyser cluster info" -->Stream
Cluster-- "Send Cluster Info" -->Stream Cluster-- "Send Cluster Info" -->Stream
SendTx-- "Send sendTx" -->Stream SendTx-- "Sent sendTx" -->Stream
Stream-- "Cluster Info sub" -->SendTx Stream-- "[Slot, Leader Schedule, Block and Epoch info, Tx confirmed] sub" -->SendTx
Stream-- "Block Info sub" -->SendTx Stream-- "[Sent Tx] sub" -->Consensus
Stream-- "Leader Schedule sub" -->SendTx Stream-- "[Full Block, Slot, Epoch info] sub" -->History
Stream-- "Sent Tx confirmed/finalized sub" -->SendTx
Stream-- "Sent Tx sub" -->Consensus
Stream-- "Full Block sub" -->History
Stream-- "Epoch info sub" -->History
Stream-- "geyser cluster info sub" -->Cluster
classDef consensus fill:#1168bd,stroke:#0b4884,color:#ffffff classDef consensus fill:#1168bd,stroke:#0b4884,color:#ffffff
classDef history fill:#666,stroke:#0b4884,color:#ffffff classDef history fill:#666,stroke:#0b4884,color:#ffffff
@ -253,66 +231,51 @@ flowchart TD
Each domain implements its own bootsrap. A domain impl running can send boostrap data to a starting one. Each domain implements its own bootsrap. A domain impl running can send boostrap data to a starting one.
## Deployment example ## Deployment example
```mermaid ```mermaid
flowchart TD flowchart TD
SendTx1("Send Tx Host1") subgraph SendTx Host1
SendTx2("Send Tx Host2") SendTx1("Send Tx impl")
subgraph Data_instance1
History1("History1")
end end
subgraph Data_instance2 subgraph SendTx Host2
History2("History2") SendTx2("Send Tx impl")
end end
subgraph Data_instance3 subgraph History Host1
History3("History3") History1("History impl")
end
subgraph History Host2
History2("History impl")
end
subgraph History Host3
History3("History impl")
end end
subgraph Validator1_Host subgraph Validator Host1
Validator1["Solana Validator"] Validator1["Solana Validator"]
Consensus1("Validator") Consensus1("Validator impl")
Cluster1("Cluster Info") Cluster1("Cluster impl")
end end
subgraph Validator2_Host subgraph Validator Host2
Validator2["Solana Validator"] Validator2["Solana Validator"]
Consensus2("Validator") Consensus2("Validator impl")
Cluster2("Cluster Info") Cluster2("Cluster impl")
end end
RPC["RPC entry point RPC["RPC entry point
dispatch on started servers"] dispatch on started servers"]
Stream("Stream")
RPC== "Send sendTx" ==>SendTx1 RPC== "Send sendTx" ==>SendTx1
RPC== "Send sendTx" ==>SendTx2 RPC== "Send sendTx" ==>SendTx2
SendTx1-- "Send Tx sent" -->Stream
SendTx2-- "Send Tx sent" -->Stream
Stream-- "Block Info" -->SendTx1
Stream-- "Block Info" -->SendTx2
Stream-- "Cluster Schedule" -->SendTx1
Stream-- "Cluster Schedule" -->SendTx2
Consensus1-- "Send consensus data" -->Stream RPC== "getVoteAccounts" ==>Consensus1
Consensus2-- "Send consensus data" -->Stream RPC== "getVoteAccounts" ==>Consensus2
RPC<== "getVoteAccounts" ==>Consensus1
RPC<== "getVoteAccounts" ==>Consensus2
Stream-- "Block sub" -->History1 RPC== "getBlock" ==>History1
Stream-- "Block sub" -->History2 RPC== "getBlock" ==>History2
Stream-- "Block sub" -->History3 RPC== "getBlock" ==>History3
RPC<== "getBlock" ==>History1
RPC<== "getBlock" ==>History2
RPC<== "getBlock" ==>History3
Cluster1-- "Send Cluster info" -->Stream RPC== "getClusterNodes" ==>Cluster1
Cluster2-- "Send Cluster info" -->Stream RPC== "getClusterNodes" ==>Cluster2
RPC<== "getClusterNodes" ==>Cluster1
RPC<== "getClusterNodes" ==>Cluster2
Validator1-- "Geyser data" -->Consensus1
Validator1-- "Geyser data" -->Cluster1
Validator2-- "Geyser data" -->Consensus2
Validator2-- "Geyser data" -->Cluster2
classDef consensus fill:#1168bd,stroke:#0b4884,color:#ffffff classDef consensus fill:#1168bd,stroke:#0b4884,color:#ffffff
classDef history fill:#666,stroke:#0b4884,color:#ffffff classDef history fill:#666,stroke:#0b4884,color:#ffffff
@ -322,11 +285,11 @@ flowchart TD
class SendTx1 sendtx class SendTx1 sendtx
class SendTx2 sendtx class SendTx2 sendtx
class Data_instance1 redgray class Cluster1 greengray
class Data_instance2 redgray class Cluster2 greengray
class Data_instance3 redgray class Consensus1 consensus
class Validator1_Host consensus class Consensus2 consensus
class Validator2_Host consensus class History1 redgray
class Cluster greengray class History2 redgray
class History3 redgray
``` ```

View File

@ -55,7 +55,7 @@ Method calls:
##### Cluster info Domain ##### Cluster info Domain
- [getclusternodes](https://docs.solana.com/api/http#getclusternodes) not in geyser plugin can be get from gossip. Try to update gyser first. - [getclusternodes](https://docs.solana.com/api/http#getclusternodes) not in geyser plugin can be get from gossip. Try to update gyser first.
##### Consensus Domain ##### Validator Domain
- [getslot](https://docs.solana.com/api/http#getslot) Need top add 2 new commitment level for first shred seen and half confirm (1/3 of the stake has voted on the block) - [getslot](https://docs.solana.com/api/http#getslot) Need top add 2 new commitment level for first shred seen and half confirm (1/3 of the stake has voted on the block)
- [getBlockHeight](https://docs.solana.com/api/http#getblockheight) - [getBlockHeight](https://docs.solana.com/api/http#getblockheight)
- [getblocktime](https://docs.solana.com/api/http#getblocktime) based on voting. Algo to define - [getblocktime](https://docs.solana.com/api/http#getblocktime) based on voting. Algo to define
@ -76,7 +76,7 @@ Method calls:
##### Send transaction Domain ##### Send transaction Domain
- [sendtransaction](https://docs.solana.com/api/http#sendtransaction) done by Lite-RPC - [sendtransaction](https://docs.solana.com/api/http#sendtransaction) done by Lite-RPC
##### Current work on Consensus: ##### Current work on Validator domain:
getvoteaccounts: Stream from geyser getvoteaccounts: Stream from geyser
@ -214,7 +214,7 @@ Algo:
- send the batch to the TPU port of the current slot leader and next slot leader - send the batch to the TPU port of the current slot leader and next slot leader
#### Consensus Domain #### Validator Domain
This domain concerns the connected validator activity. It get and process data that are generated inside the validator (LeaderSchedule) or concerning current block processing (update stake account). This domain concerns the connected validator activity. It get and process data that are generated inside the validator (LeaderSchedule) or concerning current block processing (update stake account).
##### Data ##### Data
@ -728,11 +728,11 @@ For node info it seems that the stake is not needed. The gossip process is:
-> crdsgossip_pull::filter_pull_responses() -> crdsgossip_pull::filter_pull_responses()
-> crds::upserts() update the cluster table. -> crds::upserts() update the cluster table.
#### Cross domain Consensus/History #### Cross domain Validator/History
Some function are implemented inside several domain. THe main reason is because the RPC call aggregate teh 2 domains. Some function are implemented inside several domain. THe main reason is because the RPC call aggregate teh 2 domains.
The concerned doma in are: The concerned doma in are:
* Consensus for answer at process * Validator for answer at process
* History for answer at confirm and finalized. * History for answer at confirm and finalized.
###### getSignatureStatuses ###### getSignatureStatuses
@ -757,7 +757,7 @@ info: Unless the searchTransactionHistory configuration parameter is included, t
"Err": <ERR> - Transaction failed with TransactionError "Err": <ERR> - Transaction failed with TransactionError
Sources: Sources:
For consensus domain: For Validator domain:
Get data at process Get data at process
geyser plugin subscribe to Tx at process. geyser plugin subscribe to Tx at process.
@ -786,7 +786,7 @@ If the searchTransactionHistory is set to true:
Sources Sources
For block in Consensus. For block in Validator domain.
Need vote account and stake and vote tx to calculate the commitment on each block. See BlockCommitmentService::aggregate_commitment(). Need vote account and stake and vote tx to calculate the commitment on each block. See BlockCommitmentService::aggregate_commitment().
For totalStake can be calculated or get from the epoch subscription. For totalStake can be calculated or get from the epoch subscription.