src/contains all Rust sources. The core simulation logic lives insrc/lib.rs, while the CLI entry point issrc/main.rs.- Domain modules are split by concern, such as
src/transaction.rs,src/wallet.rs, andsrc/economic_graph.rs. - Example configuration lives at
config.toml.example; the running config is read fromconfig.tomlby default. - Generated artifacts include
graph.svgproduced after a simulation run.
cargo buildcompiles the library and binary.cargo runruns the simulation usingconfig.toml(or setCONFIG_FILE=path/to/config.toml).cargo testruns unit tests embedded in the source files.- Optional:
cargo fmtapplies standard Rust formatting if available.
- Use Rust 2021 edition conventions with 4-space indentation.
- Naming:
snake_casefor functions/variables,CamelCasefor types/traits, andSCREAMING_SNAKE_CASEfor constants. - Keep modules focused; prefer adding new files in
src/rather than growing monolithic modules.
- Tests are defined inline in source files with
#[test]functions. - Place module-specific tests near the code they cover (e.g.,
src/actions.rsandsrc/lib.rsalready contain tests). - Run
cargo testbefore submitting changes; add tests for new behaviors or bug fixes.
- Commit messages follow short, imperative summaries (e.g., “Add unit tests for payment strategies”).
- PRs should include a concise description, steps to validate (
cargo testorcargo run), and any relevant output artifacts (e.g., updatedgraph.svgwhen behavior changes).
- Copy
config.toml.exampletoconfig.tomland customize settings such assimulation.seedandwallet_types. - The binary writes a transaction graph to
graph.svg; include it in reviews when output structure changes.