How Contracts Are Collected

snforge supports two mechanisms for collecting contracts used in tests. The default one depends on Scarb version used and can be controlled with --no-optimization flag.

📝 Note

Enabling new mechanism requires Scarb version >= 2.8.3.

Differences Between Collection Mechanisms

FeatureOld MechanismOptimised Mechanism
Using contracts from /src
Using contracts from /tests
Using contracts from modules marked with #[cfg(test)]
Using contracts from dependencies
Contracts more closely resemble ones from real network
Less compilation steps required (faster compilation)
Additional compilation step required (scarb build)