Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Improve execution speed by using provider hooks #171

Closed
cgewecke opened this issue Jul 30, 2019 · 3 comments
Closed

Improve execution speed by using provider hooks #171

cgewecke opened this issue Jul 30, 2019 · 3 comments

Comments

@cgewecke
Copy link
Owner

Since web3.currentProvider is injected into the Truffle test context it should be possible to hijack it and wrap

  • readers onto outgoing calls (e.g. tx.input)
  • processors onto responses (e.g receipts)

Same for buidler although this needs some additional investigation since the provider there comes with it's own wrapping...

Think we can do this safely since we'll be operating inside the async envelope that mocha waits for. There will be data loss - the mocha per test output - not sure how valuable this is anyway.

It could be a 'fast' option for industrial sized suites that need to run ~ as quickly as a spec reporter.

@alcuadrado
Copy link
Collaborator

Same for buidler although this needs some additional investigation since the provider there comes with it's own wrapping...

I'm thinking about adding provider wrapping functionality to the Buidler plugin system. I think it would be useful to implement things like hardware wallet integrations. It should also work for this kind of things. What do you think?

In the meantime, I think you can monkey-patch the provider from the Buidler Runtime Environment.

@cgewecke
Copy link
Owner Author

@alcuadrado Yes a wrapping API would be really cool! Monkey patching is fine too though :)

@cgewecke
Copy link
Owner Author

This is done at hardhat-gas-reporter. Will track doing the same for ganache at #225

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants