Assessment reports>Blobstream X>Discussion>Confusing variable names

Confusing variable names

Clear and consistent names for variables and functions help prevent confusion and make it easier to reason about the code. In some parts of the codebase, names could be improved to increase consistency and reduce possibility of confusion.

The prove_data_commitment function has an argument called start_block. In the closure used as the map function in the mapreduce call, a variable called start_block occurs as well but with a different meaning — it is the first block of the batch. To reduce confusion, we recommend using more distinct names, such as global_start_block for the function argument and batch_start_block in the closure.

Variables containing hashes of block headers are inconsistent in the naming scheme, some called something_header, others something_header_hash.

In many places, names such as start_block are used for the height of a block in Tendermint terminology. A name such as start_block_height would thus make the content of the variable clearer.

Zellic © 2024Back to top ↑