Dryrunning a Trap ⛓️
Ideally you would be able to test your trap with real block/state data before deploying it for real, on-chain. Well, with the dryrun
command you can. In normal trap operation, a trap will be "monitored" by one or more opted-in operators, but with the dryrun
command you can easily test one lifecycle of this same process on your local machine with what is for all intents and purposes, a locally spun-up ad-hoc operator.
Under The Hood
One lifecycle will be performed with block(s) pulled from your specified evm endpoint, ethereum_rpc
in your drosera.toml
config file. The number of blocks pulled is determined by your configured block_sample_size
(also drosera.toml
) for the trap.
Lifecycle
- The
block_sample_size
latest blocks are fetched from your RPC endpoint, and the trapscollect
function is called for each block with the fetched block as input. - The outputs of the
collect
calls are passed as input to one call of theshould_respond
function. should_respond
will return a value offalse
for do nothing, ortrue
for execute the specifiedresponse_function
(drosera.toml
).
- Note: This does not actually take any actions to execute the
response_function
.
You've now been able to verify that your trap is functioning end-to-end, as if it was already deployed to the Drosera network.
How To Run
drosera dryrun
- Upcoming Feature: Flag to allow dryrunning a trap on historical block selections to expand this utility to a historical testing and analysis tool