Improve validation for Scarb Version and Scarb.toml Configuration for Forge Backtrace
Which component is your feature related to?
Forge
Feature Request
Currently, when annotations are missing, we return the following error:
https://github.com/foundry-rs/starknet-foundry/blob/8ce451e58b1305f7e6769451a18412970157dc1a/crates/forge-runner/src/backtrace.rs#L86
We should display a more descriptive message that clearly explains what is wrong. The message should be similar in approach to what the coverage functionality displays:
https://github.com/foundry-rs/starknet-foundry/blob/5bbfa804a1d7aac97a9df9d35b1fde3f2c08cc6d/crates/forge-runner/src/coverage_api.rs#L70
To achieve this, two new functions should be added to the backtrace file:
pub fn can_be_generated(scarb_metadata: &Metadata) -> Result<()>
pub fn is_enabled() -> bool
These functions should then be invoked in the following function: https://github.com/foundry-rs/starknet-foundry/blob/8ce451e58b1305f7e6769451a18412970157dc1a/crates/forge/src/run_tests/workspace.rs#L22
if backtrace::is_enabled() {
backtrace::can_be_generated(&scarb_metadata)?;
}
Definition of Done:
- Running with
BACKTRACE_ENV=1will validate the Scarb version andScarb.tomlconfiguration. - e2e tests should be included to ensure that the changes are functioning as expected.
Can I take care of this issue?
May I take this issue on? Can I take care of this issue? i am an active contributor in the starknet and ethereum ecosystem (my OD profile - https://app.onlydust.com/u/PoulavBhowmick03) I have a robust experience working on Rust, having contributed to Dojo and other projects and built smart contracts in Rust. ETA- 2 days
Hey @PoulavBhowmick03, what's the status of this? Do you have any draft you can publish? We are not that far from ODBoost conclusion.
Hey @PoulavBhowmick03, what's the status of this? Do you have any draft you can publish? We are not that far from ODBoost conclusion.
Gm, yes! I spoke to you on Tg. My laptop crashed so had to take it to the store. will make a PR by tomorrw
Done in #3655