Skip to content

Commit

Permalink
Adding chain id config for local chain
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheng Lundquist committed Dec 11, 2024
1 parent f2ed7c8 commit 78be111
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/agent0/core/hyperdrive/interactive/local_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class Config(Chain.Config):
"""Number of seconds to advance time for every mined block. Uses real time if None."""
chain_host: str | None = None
"""The host to bind for the anvil chain. Defaults to `127.0.0.1`."""
chain_id: int | None = None
"""The chain ID for the local anvil chain."""
# TODO allow chain_port to be None to allow for automatically finding an open port within range.
chain_port: int = 10_000
"""The port to bind for the anvil chain. Will fail if this port is being used."""
Expand Down Expand Up @@ -138,6 +140,9 @@ def __init__(
if fork_block_number is not None:
anvil_launch_args.extend(["--fork-block-number", str(fork_block_number)])

if config.chain_id is not None:
anvil_launch_args.extend(("--chain-id", str(config.chain_id)))

# This process never stops, so we run this in the background and explicitly clean up later
if config.verbose:
self.anvil_process = subprocess.Popen( # pylint: disable=consider-using-with
Expand Down

0 comments on commit 78be111

Please sign in to comment.