You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If there is none it will wait to be notified about new work.
If there is some it will run the import stream potentially getting back pressure from sections of the stream. In other words the import task will not take on new work until the current work is complete
Task Loop
flowchart TD
I(Import Loop) -.-> |Check if work to do| ST{{State}}
ST -.-> |Yes| I
ST -.-> |No| N
I --> |range: i..=j| IS[import stream]
IS --> N[wait to be notified]
N --> I
Loading
Import Stream
get sealed header associated with a block height
validate the sealed metadata with the consensus module
fetch all transactions associated with the block header
send full sealed block to the importer
If any of these stages fail, drop the stream and reset the shared state.
Stream example diagram
flowchart TD
R[range_iterator] --> |sub range m..=n|GH[get_header_range]
GH --> |get_header future| BP1
subgraph BP1[Back pressure if MAX_GET_HEADER_REQUESTS is reached ]
B1[stream::buffered MAX_GET_HEADER_REQUESTS]
end
B1 --> FL[stream::flattern]
FL --> |Header| GT[get_transactions]
GT --> |get_transactions future| BP2
subgraph BP2[Back pressure if MAX_GET_TXNS_REQUESTS is reached ]
B2[stream::buffered MAX_GET_TXNS_REQUESTS]
end
B2 --> |Block| BP3
subgraph BP3[Back pressure while execute is running]
SB[tokio::spawn_blocking]
SB --> E[Execute]
end
Loading
Ports
APIs that the import task will need from other services
traitP2P{/// Get the sealed block associated with the provided block heightasyncfnget_sealed_block_header(height:BlockHeight) -> Result<(Sealed<Header>,PeerId)>;/// Get all transactions associated with a block id from a specific peerasyncfnget_block_transactions(block_id:BlockId,peer_id:PeerId) -> Result<Vec<Transaction>>;}traitImporter{/// Execute the provided block in verification mode and permanently commit the state if it's validasyncfnexecute_and_commit(&self,block:SealedBlock) -> Result<()>;}traitConsensus{/// Given a previous block header, validate the next header follows the consensus rulesasyncfnvalidate_next_header(previous_header:Sealed<Header>,new_header:Sealed<Header>);}
The text was updated successfully, but these errors were encountered:
The import task will check for work to do.
Task Loop
Import Stream
If any of these stages fail, drop the stream and reset the shared state.
Stream example diagram
Ports
APIs that the import task will need from other services
The text was updated successfully, but these errors were encountered: