Skip to content

Conversation

@anuragchvn-blip
Copy link

PR Description for Issue #71 Implementation

Title: Implement retry/resume functionality for [[create]] & [[setup]] steps

Description:

This PR implements the retry and resume functionality for both [[create]] and [[setup]] steps as requested in issue #71.

Changes Made:

  1. Create Steps Resume:

    • Added logic to check existing entries in the named_txs table before deploying contracts
    • Contracts that already exist in the database are skipped during subsequent runs
    • Proper counting mechanism to track multiple deployments with the same name
  2. Setup Steps Resume:

    • Created setup_progress table with scenario_hash and last_step_index fields
    • Added get_setup_progress and update_setup_progress database methods
    • Implemented step indexing to track completed setup transactions
    • Resume execution from the last completed step
  3. Database Schema:

    • Added setup_progress table: (scenario_hash TEXT PRIMARY KEY, last_step_index INTEGER NOT NULL)
    • ON CONFLICT handling for progress updates
  4. Error Handling:

    • Proper failure handling that preserves progress when setup steps revert
    • Execution stops on failure while maintaining completed steps

Technical Details:

  • Create steps use name-based lookup in named_txs to determine which deployments to skip
  • Setup steps use scenario hash-based progress tracking with step indexing
  • Both implementations handle the redeploy flag properly
  • Progress is preserved in the database for resumable execution

Testing:

  • Database-level tests validate the setup_progress functionality
  • Integration tests verify the resume behavior works correctly
  • Existing functionality remains unchanged

This resolves issue #71 by allowing users to resume failed scenario deployments without losing progress.

- Add get_named_txs, get_setup_progress, and update_setup_progress methods to DbOps trait for
  resumable deployments and setup progress tracking
- Implement these methods with SQLite queries in SqliteDb, including progress persistence
- Create setup_progress table to record last completed setup step per scenario hash
- Modify TestScenario to check existing named transactions and skip deployment if already done
- Add logic to track and persist setup step progress, skipping completed steps on reruns
- Introduce SetupStepFailed error for failed setup steps to halt execution and preserve progress
- Enhance mock database implementation with stub methods for resumable functionality
- Update rusqlite dependency to use bundled features
- Add entries to .gitignore for Foundry binaries and macOS DS_Store files
- Include unit tests verifying resumable methods and progress updates in SqliteDb implementation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant