cartesi/machine-emulator

Refactor cartesi-machine.lua configuration logic

Opened this issue · 0 comments

vfusco commented

Context

Problem

The configuration logic within our project, specifically within cartesi-machine.lua and the Lua binding, currently suffers from a redundancy issue. The logic overrides configuration values with identical values, which is inefficient and unneeded. The ideal behavior should be to only override configuration values that have been explicitly specified in the command line arguments.

Relevance

Addressing this issue will eliminate duplicated code, improve the readability of the code, and simplify the understanding of the configuration logic, which will be beneficial for the maintainability of the codebase.

Impact on Feature Roadmap

The current redundancy in the configuration logic, with values being defined twice, is bug-prone and could potentially introduce unexpected behaviors as new configuration options are added in the future. This, in turn, could hinder the smooth introduction and operation of future features.

Blocker Assessment

This issue is not a blocker for future developments but addressing it will significantly streamline the code, making it easier to extend and maintain.

Affected Architecture and Code

The affected files and methods in the architecture include cartesi-machine.lua and machine-config.h with a particular focus on improving the configuration logic within these files.

Possible Solutions

Improve the configuration logic within cartesi-machine.lua and on the Lua binding to ensure that only values specified on the command line are overridden, eliminating the unnecessary overriding of values with identical values.

Definition of Done

  • cartesi-machine.lua and machine config logic refactored and improved to ensure easy addition of new features with configuration options.
  • Elimination of duplicated value definitions, with configuration values only being overridden when specified on the command line.
  • Code changes are well documented and tested to ensure no regression is introduced.