Comments (4)
Closing this as this feature was added in #104
from vulcan.
from vulcan.
Thanks @holic.
I'm not sure how we could implement the first way you propose (report for next line) at the Vulcan layer. There might be ways we can come up with but for external calls only, which doesn't seem to be what you are looking for.
For the second method I'm sure we can figure something out. Are you proposing that we should write the report to a file or do you envision something more generic which users can later extend? For example, we could store a mapping of name -> gasUsed and then users can decide how to store the results (or log them), and we could also provide some optional and opinionated ways of doing this.
Another alternative I'm thinking of, but only works for external calls, would be to integrate something like this into our "watchers" module, so you could do something like:
address(myContract).watch();
myContract.doSomething();
// Use any of the matchers, like toEqual, toBeGreaterThan, etc
expect(address(myContract).lastCall().gasUsed).toEqual(123);
// Or print it
println("{uint}", address(myContract).lastCall().gasUsed);
Thoughts?
from vulcan.
Are you proposing that we should write the report to a file or do you envision something more generic which users can later extend?
It'd be great if we could somehow hook into + append to the existing gas report, since it already has the capability to output in different formats, do comparisons, etc. But I'm not sure how feasible that is.
At minimum, a gas-report-specific log line or trace line would do well enough for us. We can output with verbosity and parse out those messages for creating the reports we'll use in comparisons/CI, etc. Anywhere in between is great too.
I think the main thing I'd like to see (that seems to be missing from foundry/forge-std) is gas reporting for internal calls. We make use of a lot of libraries with internal methods and want to be able to test gas use of those. We arrived at our current method of comment -> codemod -> forge test -> parse output because we weren't seeing gas reports that we needed on those internal calls.
from vulcan.
Related Issues (20)
- Automate docs generation
- Create pseudo random generator
- Result/Error improvements HOT 1
- Fix or improve error message vulcan.fmt._readSlice(bytes,uint256,uint256): Slice out of bounds HOT 2
- Update forge-std
- Use new serializeJson cheatcode
- Improve pointers code
- Add basic types casting to pointers
- Explore Option type HOT 1
- Complete Request Module
- Create semver module
- Lazy json storage
- Explore generic pointers for different data locations
- New directory structure
- Member "exitCode" not found or not visible after argument-dependent lookup in struct VmSafe.FfiResult memory. HOT 2
- Add the `forge-std` version required to run vulcan HOT 3
- Adding custom error messages to Except utils HOT 1
- Improve forks docs HOT 1
- Add RPC module
- Add .json() to strings module HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vulcan.