Skip to content

docs: Revise Simulator Documentation #1302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 64 additions & 17 deletions docs/simulator/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,80 @@

There are 3 configuration sets:
1. [BlockStreamConfig](#blockstreamconfig): contains the configuration for the Block Stream Simulator logic.
1. [GeneratorConfig](#generatorconfig): contains the configuration for the Block Stream Simulator generation module.
1. [BlockGeneratorConfig](#blockGeneratorConfig): contains the configuration for the Block Stream Simulator generation module.

Check notice on line 5 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L5

Expected: #blockgeneratorconfig; Actual: #blockGeneratorConfig
1. [SimulatorStartupDataConfig](#simulatorstartupdataconfig): contains the configuration for the Block Stream Simulator startup data.

Check notice on line 6 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L6

Expected: 80; Actual: 133
1. [UnorderedStreamConfig](#unorderedstreamconfig): contains the configuration for the Unordered Stream Simulator logic.

Check notice on line 7 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L7

Expected: 80; Actual: 120
1. [ConsumerConfig](#consumerConfig): contains the configuration for the Consumer Simulator logic.

Check notice on line 8 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L8

Expected: #consumerconfig; Actual: #consumerConfig

Check notice on line 8 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L8

Expected: 80; Actual: 98
1. [GrpcConfig](#grpcconfig): contains the configuration for the gRPC communication with the Block-Node.
1. [PrometheusConfig](#prometheusconfig): contains the configuration for the Prometheus.

## BlockStreamConfig

Uses the prefix `blockStream` so all properties should start with `blockStream.`

| Key | Description | Default Value |
|:-------------------------|:------------------------------------------------------------------------------------------------------------------------------------|----------------:|
| `simulatorMode` | The desired simulator mode to use, it can be either `PUBLISHER` or `CONSUMER`. | `PUBLISHER` |
| `delayBetweenBlockItems` | The delay between each block item in nanoseconds, only applicable when streamingMode=CONSTANT_RATE | `1_500_000` |
| `maxBlockItemsToStream` | exit condition for the simulator and the circular implementations such as `BlockAsDir` or `BlockAsFile` implementations | `10_000` |
| `streamingMode` | can either be `CONSTANT_RATE` or `MILLIS_PER_BLOCK` | `CONSTANT_RATE` |
| `millisecondsPerBlock` | if streamingMode is `MILLIS_PER_BLOCK` this will be the time to wait between blocks in milliseconds | `1_000` |
| `blockItemsBatchSize` | the number of block items to send in a single batch, however if a block has less block items, it will send all the items in a block | `1_000` |
| Key | Description | Default Value |
|:----------------------------|:------------------------------------------------------------------------------------------------------------------------------------|----------------:|
| `simulatorMode` | The desired simulator mode to use, it can be either `PUBLISHER` or `CONSUMER`. | `PUBLISHER` |
| `lastKnownStatusesCapacity` | The store capacity for the last known statuses. | `10` |
| `delayBetweenBlockItems` | The delay between each block item in nanoseconds, only applicable when streamingMode=CONSTANT_RATE | `1_500_000` |
| `maxBlockItemsToStream` | The maximum number of block items to stream before stopping | `100_000` |

Check notice on line 21 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L21

Expected: 80; Actual: 184
| `streamingMode` | Can either be `CONSTANT_RATE` or `MILLIS_PER_BLOCK` | `CONSTANT_RATE` |
| `millisecondsPerBlock` | If streamingMode is `MILLIS_PER_BLOCK` this will be the time to wait between blocks in milliseconds | `1_000` |

Check notice on line 23 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L23

Expected: 80; Actual: 184
| `blockItemsBatchSize` | The number of block items to send in a single batch, however if a block has less block items, it will send all the items in a block | `1_000` |

Check notice on line 24 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L24

Expected: 80; Actual: 184
| `midBlockFailType` | The type of failure to occur while streaming. It can be `NONE`, `ABRUPT` or `EOS` | `NONE` |

Check notice on line 25 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L25

Expected: 80; Actual: 184
| `midBlockFailOffset` | The index where the failure will occur, only applicable if midBlockFailType is not `NONE` | `0` |

Check notice on line 26 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L26

Expected: 80; Actual: 184

## GeneratorConfig
## BlockGeneratorConfig

Uses the prefix `generator` so all properties should start with `generator.`

| Key | Description | Default Value |
|:------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------:|
| `generationMode` | The desired generation Mode to use, it can only be `DIR` or `AD_HOC` | `DIR` |
| `folderRootPath` | If the generationMode is DIR this will be used as the source of the recording to stream to the Block-Node | `` |
| `managerImplementation` | The desired implementation of the BlockStreamManager to use, it can only be `BlockAsDirBlockStreamManager`, `BlockAsFileBlockStreamManager` or `BlockAsFileLargeDataSets` | `BlockAsFileBlockStreamManager` |
| `paddedLength` | on the `BlockAsFileLargeDataSets` implementation, the length of the padded left zeroes `000001.blk.gz` | 36 |
| `fileExtension` | on the `BlockAsFileLargeDataSets` implementation, the extension of the files to be streamed | `.blk.gz` |
| Key | Description | Default Value |
|:--------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------:|
| `generationMode` | The desired generation Mode to use, it can only be `DIR` or `CRAFT` | `DIR` |

Check notice on line 34 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L34

Expected: 80; Actual: 236
| `minEventsPerBlock` | The minimum number of events per block | `1` |

Check notice on line 35 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L35

Expected: 80; Actual: 236
| `maxEventsPerBlock` | The maximum number of events per block | `10` |
| `minTransactionsPerEvent` | The minimum number of transactions per event | `1` |
| `maxTransactionsPerEvent` | The maximum number of transactions per event | `10` |
| `folderRootPath` | If the generationMode is `DIR` this will be used as the source of the recording to stream to the Block-Node | `` |
| `managerImplementation` | The desired implementation of the BlockStreamManager to use, it can only be `BlockAsDirBlockStreamManager`, `BlockAsFileBlockStreamManager` or `BlockAsFileLargeDataSets` | `BlockAsFileBlockStreamManager` |
| `paddedLength` | On the `BlockAsFileLargeDataSets` implementation, the length of the padded left zeroes `000001.blk.gz` | `36` |

Check notice on line 41 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L41

Expected: 80; Actual: 236
| `fileExtension` | On the `BlockAsFileLargeDataSets` implementation, the extension of the files to be streamed | `.blk.gz` |

Check notice on line 42 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L42

Expected: 80; Actual: 236
| `startBlockNumber` | The block number to start streaming from | `0` |
| `endBlockNumber` | The block number to stop streaming at | `-1` |

Check notice on line 44 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L44

Expected: 80; Actual: 236
| `invalidBlockHash` | If set to true, will send invalid block root hash | `false` |

## SimulatorStartupDataConfig

Uses the prefix `simulator.startup.data` so all properties should start with `simulator.startup.data.`

| Key | Description | Default Value |
|:---------------------------|:-----------------------------------------------------------------|-------------------------------------------:|
| `enabled` | Whether the startup data functionality is enabled | `false` |

Check notice on line 53 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L53

Expected: 80; Actual: 143
| `latestAckBlockNumberPath` | Path to the file containing the latest acknowledged block number | `/opt/simulator/data/latestAckBlockNumber` |

Check notice on line 54 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L54

Expected: 80; Actual: 143
| `latestAckBlockHashPath` | Path to the file containing the latest acknowledged block hash | `/opt/simulator/data/latestAckBlockHash` |

## UnorderedStreamConfig

Uses the prefix `unorderedStream` so all properties should start with `unorderedStream.`

| Key | Description | Default Value |
|:-------------------------|:-------------------------------------------------------------------------|--------------:|
| `enabled` | Whether to enable the unordered streaming mode | `false` |

Check notice on line 63 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L63

Expected: 80; Actual: 119
| `availableBlocks` | The numbers of the blocks which will be considered available for sending | `[1-10]` |

Check notice on line 64 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L64

Expected: 80; Actual: 119
| `sequenceScrambleLevel` | The coefficient used to randomly scramble the stream | `0` |
| `fixedStreamingSequence` | The numbers of the blocks which will form the steam | `1,2,4,3` |

Check notice on line 66 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L66

Expected: 80; Actual: 119

## ConsumerConfig

Uses the prefix `consumer` so all properties should start with `consumer.`

| Key | Description | Default Value |
|:------------------------|:--------------------------------------------------------------------------------------------------------|--------------:|
| `startBlockNumber` | The block number from which to start consuming | `-1` |

Check notice on line 74 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L74

Expected: 80; Actual: 151
| `endBlockNumber` | The block number at which to stop consuming | `-1` |

Check notice on line 75 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L75

Expected: 80; Actual: 151
| `slowDownType` | The type of slow down to apply while consuming, it can be `NONE`, `FIXED`, `RANDOM`, `RANDOM_WITH_WAIT` | `NONE` |

Check notice on line 76 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L76

Expected: 80; Actual: 151
| `slowDownMilliseconds` | The slowdown in milliseconds | `2` |

Check notice on line 77 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L77

Expected: 80; Actual: 151
| `slowDownForBlockRange` | The range of blocks to apply the slowdown | `10-30` |

Check notice on line 78 in docs/simulator/configuration.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/simulator/configuration.md#L78

Expected: 80; Actual: 151

## GrpcConfig

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
* Defines the configuration for the BlockStreamManager (Generator) of blocks in the Hedera Block Simulator.
*
* @param generationMode the mode of block generation (e.g., directory-based)
* @param minEventsPerBlock the minimum number of events per block
* @param maxEventsPerBlock the maximum number of events per block
* @param minTransactionsPerEvent the minimum number of transactions per event
* @param maxTransactionsPerEvent the maximum number of transactions per event
* @param folderRootPath the root path of the folder containing block files
* @param managerImplementation the implementation class name of the block stream manager
* @param paddedLength the length to which block identifiers are padded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* @param streamingMode the mode of streaming for the block stream (e.g., time-based, count-based)
* @param millisecondsPerBlock the duration in milliseconds for each block when using time-based streaming
* @param blockItemsBatchSize the number of block items to stream in each batch
* @param midBlockFailType the type of failure to occur while streaming
* @param midBlockFailOffset the index of the failing block
*/
@ConfigData("blockStream")
public record BlockStreamConfig(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
import com.swirlds.config.api.ConfigProperty;
import org.hiero.block.simulator.config.logging.Loggable;

/**
* Defines the configuration data for the consumer.
*
* @param startBlockNumber the block number from which to start consuming
* @param endBlockNumber the block number at which to stop consuming
*/
@ConfigData("consumer")
public record ConsumerConfig(
@Loggable @ConfigProperty(defaultValue = "-1") long startBlockNumber,
Expand Down
Loading