starknet-foundry icon indicating copy to clipboard operation
starknet-foundry copied to clipboard

Improve validation for Scarb Version and Scarb.toml Configuration for Forge Backtrace

Open ksew1 opened this issue 1 year ago • 4 comments

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=1 will validate the Scarb version and Scarb.toml configuration.
  • e2e tests should be included to ensure that the changes are functioning as expected.

ksew1 avatar Nov 25 '24 16:11 ksew1

Can I take care of this issue?

khayss avatar Jan 22 '25 14:01 khayss

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

PoulavBhowmick03 avatar Jan 22 '25 14:01 PoulavBhowmick03

Hey @PoulavBhowmick03, what's the status of this? Do you have any draft you can publish? We are not that far from ODBoost conclusion.

cptartur avatar Jan 28 '25 13:01 cptartur

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

PoulavBhowmick03 avatar Jan 28 '25 22:01 PoulavBhowmick03

Done in #3655

ksew1 avatar Aug 28 '25 10:08 ksew1