Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughIntroduces configurable class size limits. Adds ClassSizeConfig (u64 fields) to StarknetConfig and wires it through CLI (three new flags) and core logic. check_class_size now consumes limits from config instead of constants. Public constants are retyped from usize to u64. add_declare_transaction passes the new config to checks. Integration tests updated to pass and assert new limits; new unit tests cover each limit. Documentation updated to reflect configurable limits and revised defaults, including Sierra length value in versioned docs. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Pre-merge checks and finishing touches❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
8fe403d to
95acfb4
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (4)
website/docs/server-config.md (1)
54-65: Good docs update; add a permalink and minor copy tweak.
- Prefer a permalink to constants (specific commit) to avoid line drift in main.
- Consider “Starknet chain info” (lowercase “chain”) for consistency.
Example link style:
- https://github.com/0xSpaceShard/starknet-devnet/blob//crates/starknet-devnet-core/src/constants.rs#L121
tests/integration/general_integration_tests.rs (1)
73-92: to_string() usage for numeric CLI args is fine.Consistent and readable. Consider expanding env-var parity test to include the three new flags in a follow-up.
Also applies to: 105-111
crates/starknet-devnet/src/cli.rs (1)
288-292: Wiring CLI → config is correct.Values properly populate ClassSizeConfig.
Consider adding simple validation (e.g., nonzero) if zero has no defined semantics.
crates/starknet-devnet-core/src/starknet/add_declare_transaction.rs (1)
35-37: Avoid narrowing casts when enforcing configurable limitsCasting the
u64limits down tousizeloses information on 32-bit targets (and for any caller who configures a value >usize::MAX), effectively shrinking the cap and causing false rejections. Compare in the wideru64domain instead by lifting the measured lengths tou64(widening cast) before checking.- if serialized_class.len() > config.maximum_contract_class_size as usize - || sierra_length > config.maximum_sierra_length as usize - || casm_length > config.maximum_contract_bytecode_size as usize + let serialized_class_len_u64 = serialized_class.len() as u64; + let sierra_length_u64 = sierra_length as u64; + let casm_length_u64 = casm_length as u64; + + if serialized_class_len_u64 > config.maximum_contract_class_size + || sierra_length_u64 > config.maximum_sierra_length + || casm_length_u64 > config.maximum_contract_bytecode_size
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
crates/starknet-devnet-core/src/constants.rs(1 hunks)crates/starknet-devnet-core/src/starknet/add_declare_transaction.rs(4 hunks)crates/starknet-devnet-core/src/starknet/starknet_config.rs(4 hunks)crates/starknet-devnet/src/cli.rs(3 hunks)tests/integration/general_integration_tests.rs(2 hunks)website/docs/server-config.md(1 hunks)website/versioned_docs/version-0.6.0/server-config.md(1 hunks)
🔇 Additional comments (6)
website/versioned_docs/version-0.6.0/server-config.md (1)
60-60: Sierra length default matches code. LGTM.Value aligns with MAXIMUM_SIERRA_LENGTH = 81,920.
tests/integration/general_integration_tests.rs (1)
64-68: Config round‑trip extended with class_size_config. LGTM.crates/starknet-devnet-core/src/starknet/starknet_config.rs (3)
45-61: ClassSizeConfig addition looks solid.Default wires to MAXIMUM_*; serde on StarknetConfig will expose it via devnet_getConfig.
149-149: Field added to StarknetConfig. LGTM.
195-195: Default initialization of class_size_config. LGTM.crates/starknet-devnet-core/src/constants.rs (1)
121-123: All MAXIMUM_ constants are cast to usize before .len() comparisons; no changes required*
Co-authored-by: 3alpha <lg@shardlabs.io>
* While cherry-picking, also applied typos-cli fix Co-authored-by: 3alpha <lg@shardlabs.io>
Usage related changes
--maximum-contract-class-size <BYTES>--maximum-contract-bytecode-size <FELTS>--maximum-sierra-length <FELTS>Development related changes
N/A
Checklist:
./scripts/format.sh./scripts/clippy_check.sh./scripts/check_unused_deps.sh./scripts/check_spelling.sh./website/README.mdSummary by CodeRabbit