Skip to content

Commit

Permalink
Allow custom commands to test node
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchiavini committed May 24, 2024
1 parent d1638f6 commit af2dcd4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions boa_zksync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def set_zksync_env(url):
boa.set_deployer_class(ZksyncDeployer)


def set_zksync_test_env():
boa.set_env(ZksyncEnv(rpc=EraTestNode()))
def set_zksync_test_env(node_args=()):
boa.set_env(ZksyncEnv(rpc=EraTestNode(node_args=node_args)))
boa.set_deployer_class(ZksyncDeployer)


Expand Down
9 changes: 6 additions & 3 deletions boa_zksync/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ class EraTestNode(EthereumRPC):
]

def __init__(
self, inner_rpc: Optional[EthereumRPC] = None, block_identifier="safe"
self,
inner_rpc: Optional[EthereumRPC] = None,
block_identifier="safe",
node_args=(),
):
self.inner_rpc = inner_rpc

Expand All @@ -64,9 +67,9 @@ def __init__(
if isinstance(block_identifier, int)
else []
)
fork_args = ["fork", inner_rpc._rpc_url] + fork_at if inner_rpc else ["run"]
command = ["fork", inner_rpc._rpc_url] + fork_at if inner_rpc else ["run"]
self._test_node = Popen(
["era_test_node", "--port", f"{port}"] + fork_args,
["era_test_node", "--port", f"{port}"] + list(node_args) + command,
stdout=sys.stdout,
stderr=sys.stderr,
)
Expand Down

0 comments on commit af2dcd4

Please sign in to comment.