Skip to content

Commit

Permalink
fix: fix block-time flag to work on anvil
Browse files Browse the repository at this point in the history
  • Loading branch information
0xthedance committed Jan 29, 2025
1 parent cb1ec06 commit 7442604
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 22 deletions.
2 changes: 1 addition & 1 deletion docs/userguides/networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ To use a different network, such as `hardhat` or Anvil nodes, use the `--network
ape networks run --network ethereum:local:foundry
```

To configure the network process, use `--block_time`, `--base-fee-multiplier`, and `--transaction-timeout` flags.
To configure the network process, use `--block_time` flag.

## Provider Interaction

Expand Down
18 changes: 2 additions & 16 deletions src/ape_networks/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,7 @@ def make_sub_tree(data: dict, create_tree: Callable) -> Tree:
@ape_cli_context()
@network_option(default="ethereum:local:node")
@click.option("--block-time", default=None, type=int, help="Block time in seconds")
@click.option("--base-fee-multiplier", default=None, type=float, help="Base fee multiplier")
@click.option(
"--transaction-timeout",
default=None,
type=int,
help="Transaction acceptance timeout in seconds",
)
def run(cli_ctx, provider, block_time, base_fee_multiplier, transaction_timeout):
def run(cli_ctx, provider, block_time):
"""
Start a subprocess node as if running independently
and stream stdout and stderr.
Expand All @@ -139,14 +132,7 @@ def run(cli_ctx, provider, block_time, base_fee_multiplier, transaction_timeout)
# Set block time if provided
if block_time is not None:
provider.network.block_time = block_time

# Set transaction acceptance timeout if provided
if transaction_timeout is not None:
provider.network.transaction_acceptance_timeout = transaction_timeout

# Set base fee multiplier if provided
if base_fee_multiplier is not None:
provider.network.base_fee_multiplier = base_fee_multiplier
provider.provider_settings.update({"block_time": block_time})

# Start showing process logs.
original_level = cli_ctx.logger.level
Expand Down
6 changes: 1 addition & 5 deletions tests/integration/cli/test_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,14 @@ def test_run_custom_network(ape_cli, runner):


@run_once
def test_run_custom_args(ape_cli, runner):
def test_run_block_time(ape_cli, runner):
cmd = (
"networks",
"run",
"--network",
"ethereum:local:test",
"--block-time",
"10",
"--base-fee-multiplier",
"1.2",
"--transaction-timeout",
"60",
)
result = runner.invoke(ape_cli, cmd)
expected = "`ape networks run` requires a provider that manages a process, not 'test'"
Expand Down

0 comments on commit 7442604

Please sign in to comment.