Skip to content

Add Pause/Unpause Commands for Staking Contract Testing #521

@akrem-chabchoub

Description

@akrem-chabchoub

Add Pause/Unpause Commands for Staking Contract Testing

Problem

Currently, testing stake withdrawal functionality in beekeeper requires manual intervention to pause/unpause the staking contract. The withdrawal behavior is designed as a security feature where withdrawals are only allowed when the contract is paused, but this makes automated testing difficult.

Current Behavior

  • stake withdraw fails with "contract is not paused" error during normal operation
  • This is expected security behavior - withdrawals are only allowed when the staking contract is paused
  • Manual pause/unpause requires direct contract interaction or admin access

Proposed Solution

Add two new commands to the stake subcommand:

# Pause the staking contract to allow withdrawals
./dist/beekeeper stake pause --cluster-name <cluster>

# Unpause the staking contract to resume normal operations  
./dist/beekeeper stake unpause --cluster-name <cluster>

Use Cases

  1. Testing withdrawal functionality - Pause contract, test withdrawals, then unpause
  2. Integration testing - Automated testing of complete stake lifecycle
  3. Development/debugging - Easier testing of stake-related features
  4. Emergency scenarios - Quick contract pause/unpause for testing

Implementation Details

  • Commands should use the same contract configuration as the existing stake check
  • Include proper error handling and transaction confirmation
  • Add status checks to prevent redundant operations
  • Require admin privileges (same as current stake check)

Example Usage

# Test complete withdrawal flow
./dist/beekeeper stake pause --cluster-name local-dns
./dist/beekeeper stake withdraw --cluster-name local-dns  # Now succeeds
./dist/beekeeper stake unpause --cluster-name local-dns

Security Considerations

  • Commands require admin/owner privileges
  • Should include clear warnings about contract state changes
  • Consider adding confirmation prompts for production use

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions