Open JoseRodrigues443 opened 2 years ago
@haseebrabbani thank you for the fast response 💯
However please take into consideration that the projects still have the agent.(py/js/ts)
and seen in the image below.
The problem is that the agent file executes the method getEthersProvider()
that requires the jsonRpcUrl
, with that it became impossible to test the pipeline without putting client secrets on the repo.
What I did to fix that was:
handleBlock
method available so the CLI continues to workprovideHandleBlock
logic that allows testing the core logic without having the jsonRpcUrl
setthis is awesome! really appreciate adding these Github actions 🙌🏼
some points though:
- renaming the agent entry point (i.e. agent.ts -> agentCore.ts) will prevent the agent from running. the CLI looks for a file called agent.js/ts/py to begin execution
- the default object exported from the agent.js/ts file must provide the handler(s) using the
handleTransaction
key- you bring up a good point about getJsonRpcUrl preventing tests from running without specifying a forta.config.json. I have been planning to set some sort of ENV variable when running tests that would allow this to work
hey @JoseRodrigues443 🙂 I just released JS SDK v0.0.39 and Python SDK v0.0.13 which fixes the issue of getJsonRpcUrl
throwing an error when running unit tests. I have updated the problem examples (flash-loan-ts, minimum-balance-py, minimum-balance-ts) so you shouldn't need to split out those agent files anymore. Would you mind integrating with the latest changes and trying to run the build? I would love to merge this PR 🙌🏼
Fixed @haseebrabbani
Description
Currently, if I or the community wants to add a new example there is no pipeline to guarantee code quality. Also to test if any breaking change on the Forta agent occurred this is a great repo to catch and test that.
So this PR adds a GitHub action that runs a pipeline that builds each agent example and then runs the test battery
An example of this pipeline running can be seen here.
Also, the agent's tests required always a
jsonRpcUrl
in theforta.config.json
config file, making it hard to run the pipeline without any keys or secrets, so was provided a way to test the mocked version without the methodgetEthersProvider()
breaking the build.Type of change
How Has This Been Tested?
All the Javascript and Typescript agents now can run the tests.
Checklist: