Skip to content

Conversation

@xjjda22
Copy link

@xjjda22 xjjda22 commented Dec 21, 2025

What I did

Fixed Issue #443: --non_interactive flag now correctly skips execution address verification prompts.

When --non_interactive flag is used, the CLI was still showing confirmation prompts for execution_address verification, breaking automation workflows.

This fix adds and not config.non_interactive guards to prevent prompts from showing in non-interactive mode, following the same pattern used in 12+ other locations in the codebase.

Changes:

  • Added guard to prompt_if block (line 181)
  • Added explicit guard to confirmation prompt logic (line 192)
  • All validations preserved, backward compatible

Related issue

Fixes #443: #443

When --non_interactive flag is used, the CLI was still showing
confirmation prompts for execution_address verification, breaking
automation workflows.

This fix ensures that:
1. The prompt_if conditional prompt is skipped in non-interactive mode
2. The confirmation prompt logic explicitly checks non_interactive flag

The fix maintains all security validations while allowing fully
automated execution when --non_interactive is enabled.

Changes:
- Added 'and not config.non_interactive' guard to prompt_if block
- Added explicit guard to confirmation prompt logic
- Follows the same pattern used in 12+ other locations in the codebase

Fixes ethstaker#443
@valefar-on-discord
Copy link
Collaborator

Can you provide a command that reproduces this issue? Doing a simple
python -m ethstaker_deposit --non_interactive existing-mnemonic --execution_address {some_address}
Works as expected in main.

@valefar-on-discord valefar-on-discord added the run-tests Request tests to run on the CI label Dec 21, 2025
@xjjda22
Copy link
Author

xjjda22 commented Dec 22, 2025

Can you provide a command that reproduces this issue? Doing a simple python -m ethstaker_deposit --non_interactive existing-mnemonic --execution_address {some_address} Works as expected in main.

seems correct that a simple command with --execution_address works as expected.

The issue is in captive_prompt_callback where the prompt_if block (lines 178-181) executes before the non_interactive check, so it could show prompts in non-interactive mode. The confirmation prompt also needs an explicit guard.

To reproduce the issue, omit --execution_address on the current main branch:

mkdir -p /tmp/test_keys && python -m ethstaker_deposit \
  --non_interactive \
  --ignore_connectivity \
  existing-mnemonic \
  --num_validators 1 \
  --keystore_password "testpassword123" \
  --folder /tmp/test_keys \
  --mnemonic "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" \
  --mnemonic_password ""

On main, this may still prompt for the execution address even with --non_interactive. The fix adds explicit non_interactive checks (following the pattern used in 11+ other locations) to ensure prompts are consistently skipped, addressing issue #443.

@valefar-on-discord
Copy link
Collaborator

@xjjda22 In your example, there would be a prompt for the validator_start_index, chain, and execution_address as these arguments are not provided

% python -m ethstaker_deposit \
  --non_interactive \
  --ignore_connectivity \
  existing-mnemonic \
  --num_validators 1 \
  --keystore_password "testpassword123" \
  --mnemonic "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
Enter the index (key number) you wish to start generating more keys from. For example, if you've generated 4 keys in the past, you'd enter 4 here. [0]: 0
Please choose the (mainnet or testnet) network/chain name [mainnet, sepolia, hoodi, ephemery, gnosis, chiado]:  [mainnet]: mainnet
Please enter the optional withdrawal address. Note that you CANNOT change it once you have set it on chain. []: 

I'm not understanding the underlying concern. non_interactive can be a dangerous flag given what it does and the purpose is to skip confirmations, not prompts. When you do not provide an argument you should be asked what you want that value to be regardless of mode. And in non_interactive, any argument provided will not be confirmed as far as I can test.

If the user does not want to set an execution address, they can provide --execution_address="".

@xjjda22
Copy link
Author

xjjda22 commented Dec 22, 2025

@xjjda22 In your example, there would be a prompt for the validator_start_index, chain, and execution_address as these arguments are not provided

% python -m ethstaker_deposit \
  --non_interactive \
  --ignore_connectivity \
  existing-mnemonic \
  --num_validators 1 \
  --keystore_password "testpassword123" \
  --mnemonic "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
Enter the index (key number) you wish to start generating more keys from. For example, if you've generated 4 keys in the past, you'd enter 4 here. [0]: 0
Please choose the (mainnet or testnet) network/chain name [mainnet, sepolia, hoodi, ephemery, gnosis, chiado]:  [mainnet]: mainnet
Please enter the optional withdrawal address. Note that you CANNOT change it once you have set it on chain. []: 

I'm not understanding the underlying concern. non_interactive can be a dangerous flag given what it does and the purpose is to skip confirmations, not prompts. When you do not provide an argument you should be asked what you want that value to be regardless of mode. And in non_interactive, any argument provided will not be confirmed as far as I can test.

If the user does not want to set an execution address, they can provide --execution_address="".

It appears this PR is addressing a non-issue. The current implementation already correctly handles non-interactive mode by skipping confirmations while still allowing prompts for missing arguments when appropriate.

I'll close this PR since the fix is unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-tests Request tests to run on the CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--non-interactive still asks to verify --execution_address

2 participants