Provide C API to get version at runtime
enhancement
## Context
Sometimes we may want to check the emulator version through the C API at runtime (not at compile time), unfortunately there is no C API for that. A workaround is to instantiate a new machine, then check its MARCHID CSR, but it's a dirty solution.
This problem became more relevant after the Dave team asked ways to make sure they are running the correct emulator version during fraud proofs with machine-solidity-step.
## Possible solutions
We could add a `cm_get_version` to return emulator semantic version (major, minor, patch, label), plus `MARCHID`, `MIMPID` at runtime. Maybe add all values from `cartesi-machine --version-json`. Pristine uarch RAM hash would also be nice, so we could check in `machine-solidity-step` in Dave to make sure the uarch pristine RAM matches before engaging in fraud proofs.
关闭于 2025-11-27 0 条评论