You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For testing my setup, I'd like to run my environment on a local chain like anvil, hardhat, or even ape networks run. However, due to how block time is calculated, it's quite difficult.
Exact issue
I have an anvil local chain running that I have run with :
anvil -b 2
The -b 2 gives it a block time of 2.
When I run the following command:
silverback run "monitoring:app" --network http://127.0.0.1:8545
I get the following stack trace
WARNING: Connecting Geth plugin to non-Geth client 'anvil'.
INFO: Loading Silverback App with settings:
BROKER_CLASS="taskiq:InMemoryBroker"
NETWORK_CHOICE="http://127.0.0.1:8545"
WARNING: Connecting Geth plugin to non-Geth client 'anvil'.
INFO: Loaded Silverback App:
NETWORK="ethereum:adhoc"
SIGNER=None
INFO: Using LiveRunner: max_exceptions=3
INFO: `ape-cache` database has not been initialized
INFO: block[block=0x45a75375d3e5e314597b98c678d592d35512fe26e4da0f6cd6c5f13aa6a92a9b] - Started
INFO: block[block=0x45a75375d3e5e314597b98c678d592d35512fe26e4da0f6cd6c5f13aa6a92a9b] - 0.010s (0.5%)
Traceback (most recent call last):
File "/PATH/venv/bin/silverback", line 8, in<module>sys.exit(cli())
File "/PATH/venv/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/PATH/venv/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/PATH/venv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/PATH/venv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/PATH/venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/PATH/venv/lib/python3.10/site-packages/click/decorators.py", line 92, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/PATH/venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/PATH/venv/lib/python3.10/site-packages/silverback/_cli.py", line 59, in run
asyncio.run(runner.run())
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
returnfuture.result()
File "/PATH/venv/lib/python3.10/site-packages/silverback/runner.py", line 61, in run
await asyncio.gather(*tasks)
File "/PATH/venv/lib/python3.10/site-packages/silverback/runner.py", line 87, in _block_task
async forblockin async_wrap_iter(
File "/PATH/venv/lib/python3.10/site-packages/silverback/utils.py", line 21, in yield_queue_items
raise exception
File "/PATH/venv/lib/python3.10/site-packages/silverback/utils.py", line 26, in iter_to_queue
foritemin it:
File "/PATH/venv/lib/python3.10/site-packages/ape/managers/chain.py", line 346, in poll_blocks
_try_timeout()
File "/PATH/venv/lib/python3.10/site-packages/ape/managers/chain.py", line 326, in _try_timeout
raise ChainError(message)
ape.exceptions.ChainError: Timed out waiting for new block (time_waited=0.0144).
This is because the timeout variable in ape/managers/chain.py::poll_blocks is set as such:
You can add new_block_timeout kwargs to app.on_ decorators, but in general make sure when you run anvil you are running it in a mode where it continuously mines blocks and not based on transactions occuring (e.g. "automine" functionality)
Overview
For testing my setup, I'd like to run my environment on a local chain like anvil, hardhat, or even
ape networks run
. However, due to how block time is calculated, it's quite difficult.Exact issue
I have an anvil local chain running that I have run with :
The
-b 2
gives it a block time of 2.When I run the following command:
I get the following stack trace
This is because the
timeout
variable inape/managers/chain.py::poll_blocks
is set as such:I'm not sure how to tell silverback that the anvil chain block time is 2.
Request / Ask
Is there a way to tell silverback/ape that the ad-hoc's block time is X?
The text was updated successfully, but these errors were encountered: