# `StreamerMessage` revision Here's what we have right now. See details below the code snippet ```rust /// Resulting struct represents block with chunks #[derive(Debug, Serialize, Deserialize)] pub struct StreamerMessage { pub block: views::BlockView, pub shards: Vec<IndexerShard>, pub state_changes: views::StateChangesView, } #[derive(Debug, Serialize, Deserialize)] pub struct IndexerChunkView { pub author: types::AccountId, pub header: views::ChunkHeaderView, pub transactions: Vec<IndexerTransactionWithOutcome>, pub receipts: Vec<views::ReceiptView>, } #[derive(Clone, Debug, Serialize, Deserialize)] pub struct IndexerTransactionWithOutcome { pub transaction: views::SignedTransactionView, pub outcome: IndexerExecutionOutcomeWithOptionalReceipt, } #[derive(Clone, Debug, Serialize, Deserialize)] pub struct IndexerExecutionOutcomeWithOptionalReceipt { pub execution_outcome: views::ExecutionOutcomeWithIdView, pub receipt: Option<views::ReceiptView>, } #[derive(Clone, Debug, Serialize, Deserialize)] pub struct IndexerExecutionOutcomeWithReceipt { pub execution_outcome: views::ExecutionOutcomeWithIdView, pub receipt: views::ReceiptView, } #[derive(Debug, Serialize, Deserialize)] pub struct IndexerShard { pub shard_id: types::ShardId, pub chunk: Option<IndexerChunkView>, pub receipt_execution_outcomes: Vec<IndexerExecutionOutcomeWithReceipt>, } ``` ## `StreamerMessage` fields ### `block` `views::BlockView` means ```rust #[derive(Serialize, Deserialize, Debug)] pub struct BlockView { pub author: AccountId, pub header: BlockHeaderView, pub chunks: Vec<ChunkHeaderView>, } ``` So essentially it is an info about the block author, block header and chunk headers. ### `shards` `Vec<IndexerShard>` is the Indexer Framework's struct to represent the Shard. **Note, there is no such type in nearcore**. Actually `ChunkView` is the real Shard, but on indexer side we had to inject and drop some of the data, so we had to introduce that "fake" struct to fit our needs. So the `IndexerShard` holds: 1. `shard_id` artificial value, we just mark them from 0..N by order in block 1. optional `IndexerChunkView` `IndexerChunkView` is a "patched" version of original `ChunkView` with `transactions` replaced with SignedTransactionView+ExecutionOutcomeWithIdView (`IndexerTransactionWithOutcome`). **DUPLICATE of `ChunkHeaderView` the same we have in `BlockView`, though I think it's fine to duplicate it here** Also, it is optional because if chunk producer couldn't produce a chunk in time the nearcore includes the chunk from previous block and from the indexer perspective we don't want to include, so we return `None` 1. Vec of ExecutionOutcomeWithId+ReceiptView (`IndexerExecutionOutcomeWithReceipt`) for all executed receipts in the block ### `state_changes` We include `views::StateChangesView` as is without any logic behind and I think only @telezhnaya knows what to do with this stuff. ## A few duplicates findings From what I can gather, I can see only `ReceiptViews` that **might** be duplicated. We have `ReceiptViews` in 1. `IndexerChunkView.receipts` 2. `IndexerChunkView.transactions.outcome.receipt` If I'm not mistaken we don't expect to see `ReceiptView` here at all, it is optional and `ExecutionOutcome` here shouldn't include the receipts because this outcome is for transaction. 3. `IndexerShard.receipt_execution_outcomes.receipt` though we don't exepect to meet the same `ReceiptView` as we have in 1 and 2 ## Conclusion My opinion on `StremaerMessage`. There is only one proven duplicate (`ChunkHeaderView` in `block.chunks` and in `shards.chunk.header`). That duplicate seems to be reasonable. I can't suggest any changes to the `StreamerMessage`, I believe the last changes we've made to it were reasonable and fixed problems we used to have.