dojo icon indicating copy to clipboard operation
dojo copied to clipboard

fix(sozo): fix pre-confirmed finality status migrations

Open glihm opened this issue 4 weeks ago β€’ 1 comments

Summary by CodeRabbit

  • Bug Fixes

    • Fixed potential crash during external contract migration when block number information is unavailable.
  • New Features

    • Added Sepolia network support for the spawn-and-move example with new configuration file.
  • Updates

    • Transaction finality status options modified; ACCEPTED_ON_L1 is no longer supported.

glihm avatar Nov 06 '25 15:11 glihm

Ohayo, sensei! πŸ‘‹

Walkthrough

This PR removes the ACCEPTED_ON_L1 finality status option, updates external contract migration logic to handle missing block numbers gracefully, and introduces Sepolia network configuration for the spawn-and-move example.

Changes

Cohort / File(s) Summary
Transaction finality status updates
bin/sozo/src/commands/options/transaction.rs
Renamed PRE-CONFIRMED to PRE_CONFIRMED, removed ACCEPTED_ON_L1 variant from finality status options (now only PRE_CONFIRMED and ACCEPTED_ON_L2), updated parser to default to ACCEPTED_ON_L2 instead of recognizing three options.
Migration external contract handling
crates/sozo/ops/src/migrate/mod.rs
Changed block number handling to use default value 0 instead of panicking when unavailable; updated deployment decision logic to treat missing deploy calls as already deployed rather than returning an error.
Example network configuration
examples/spawn-and-move/Scarb.toml, examples/spawn-and-move/dojo_sepolia.toml
Added new [profile.sepolia] section to Scarb.toml; introduced new dojo_sepolia.toml configuration file defining world metadata, models, events, contracts, external contract integrations (ERC20, ERC721, ERC1155, Bank, Saloon), and environment settings for Sepolia deployment.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • bin/sozo/src/commands/options/transaction.rs: Verify that removing ACCEPTED_ON_L1 doesn't break existing client code or documentation that references this variant; confirm parser logic correctly defaults to ACCEPTED_ON_L2 across all call sites.
  • crates/sozo/ops/src/migrate/mod.rs: Validate that defaulting block number to 0 is semantically safe for external contracts; ensure the deployment-skipping logic doesn't inadvertently bypass necessary deployment steps in edge cases.
  • Configuration files: Confirm dojo_sepolia.toml external contract definitions and constructor_data align with actual on-chain contract expectations.

Pre-merge checks and finishing touches

βœ… Passed checks (3 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check βœ… Passed The title specifically references 'pre-confirmed finality status migrations', which aligns with the primary change in transaction.rs where the finality status string was updated from PRE-CONFIRMED to PRE_CONFIRMED and ACCEPTED_ON_L1 was removed.
Docstring Coverage βœ… Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • [ ] πŸ“ Generate docstrings
πŸ§ͺ Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch fix/sozo-pre-confirmed

πŸ“œ Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 3a1970e026bb8384986e86a221b2be898d8dc5a8 and c27eb11542c7aa519579021cf5bab42324172194.

πŸ“’ Files selected for processing (4)
  • bin/sozo/src/commands/options/transaction.rs (1 hunks)
  • crates/sozo/ops/src/migrate/mod.rs (2 hunks)
  • examples/spawn-and-move/Scarb.toml (1 hunks)
  • examples/spawn-and-move/dojo_sepolia.toml (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
πŸ“š Learning: 2024-11-07T13:57:57.616Z
Learnt from: glihm
Repo: dojoengine/dojo PR: 2650
File: bin/sozo/src/commands/migrate.rs:64-65
Timestamp: 2024-11-07T13:57:57.616Z
Learning: In the codebase, the use of `into()` and `try_into()` for converting `TransactionOptions` is intentional. Conversions that may fail use `try_into()`, while those that cannot fail use `into()`. This approach is appropriate and should be preserved.

Examples:
- `try_into()` is used in `bin/sozo/src/commands/migrate.rs` and `bin/sozo/src/commands/execute.rs` where conversions can fail.
- `into()` is used in `bin/sozo/src/commands/register.rs` and `bin/sozo/src/commands/auth.rs` where conversions are infallible.

Applied to files:

  • bin/sozo/src/commands/options/transaction.rs
  • crates/sozo/ops/src/migrate/mod.rs

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Nov 06 '25 15:11 coderabbitai[bot]

Included in #3377.

glihm avatar Nov 20 '25 19:11 glihm