-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: Improved Logging and Flag Redesign for anvil-zksync #576
Comments
That's a very nice write-up. Like it a lot. Thoughts here:
User should probably never have to do So probably we just need to separate the concepts. Foundry has a shell wrapper with custom macros for it, and they, in fact, forbid using So we can probably just implement a similar wrapper for a shell (also note that it handles verbosity) and use it instead of both |
Thank you Dustin!
log_user_calls = true
log_system_calls = false
log_l1 = true Then the CLI options like
|
@sayon I'm not sure if the ability to fine-tune the parameters is actually needed (at least, for now). You usually just need either more or less information, depending on the situation. |
Thanks for the feedback. Yes, much better approach to make use of a shell wrapper with macro usage. I started refactoring #578 to use a simplified version of Foundrys implementation. 🙏 Any particular thoughts on |
On logging by categories vs
|
Great write-up and initiative!
|
Summary
This proposal aims to redesign the logging and trace cli options for
anvil-zksync
to improve usability, consistency, and scalability. The changes include consolidating verbosity flags, restructuring gas and VM reporting options.Motivation
The current debugging CLI options for
anvil-zksync
includes multiple overlapping and sometimes unclear options for configuring logs and traces. Simplifying and unifying these options will improve developer experience, improve maintainability and keep consistency with anvil counterpart.Proposed Design
tracing
in favour of pure stdout loggingVerbosity Levels
Propose consolidating logging into a tiered verbosity system (
-v
) with five levels:v
: Includes console logs, and meta logs (e.g.tracing::info!("created log filter '{:#x}'", self.id_counter);
, impersonation changes )vv
: Includes user calls and event call traces.vvv
: Includes system calls, system event call traces.vvvv
: Includes system calls, system event calls, and precompiles traces.vvvvv
: Includes all of the above plus user/system l1-l2 logs (maybe storage logs?).Example user trace (
-vv
)Example system trace (
-vvv
):Example user, system, precompiles (
-vvvv
):Storage Logs
To include storage logs in the verbosity system is to be discussed. They are quite noisy as they are so many.
One of the use cases for showing storage logs is contract optimizations and ensuring you make use of repeated writes as often instead of initial writes, but how can we make the logs reflect that use case / value?
They can be filtered between read / write (current display)
JSON dump
To facilitate programmatic log analysis, add an optional format flag:
--json
: Outputs logs in JSON formatGas Reporting
Change
--show-gas-details
to a gas reporting table:-gas-report [summary|verbose]
:summary
(default): Provides a high-level overview of gas usage. (Similar to what is shown now, a gas breakdown)Alternatively we could consolidate
summary
andverbose
so it shows what functions are included in the execution gas breakdown?I think for most devs, understanding what part of their contract / project consumes the most gas is what is of value. How can we emphasizes this?
verbose
: Includes detailed function call breakdowns similar to hardhat-gas-reporter (below)anvil-zksync
it would be reported per tx rather then for an entire suite somin
,max
andavg
would not be relevant. Rather it would be a table outlining the gas used per contract function call, deployment costs.--show-gas-details
option we currently have available.VM Reporting
Move VM details to follow similar naming convention rather then
--show-vm-details
:-vm-report
Offline Mode
Refine the behaviour of
--offline
to strictly enforce offline operations. Currently not well respected.Deprecated Flags
The following flags will be removed or aliased, with deprecation warnings provided for a few releases:
d
(can default to-vv
).-show-events
(included in verbosity levels)-show-calls
(included in verbosity levels)--show-outputs
(included in verbosity levels)-show-gas-details
(turns to--gas-report
)-show-vm-details
(turns to--vm-report
)-resolve-hashes
(will be turned on unlessoffline
is used, same as anvil)--show-storage-logs
(tbd what that becomes)Where applicable, users will be directed to the new flag equivalents.
[WIP] Transition Plan
Phase 1: Deprecation
Introduce New Flags:
v
,vv
, etc.),-gas-report
,-vm-report
Deprecation Warnings & Logs:
Whenever a deprecated flag (e.g.
d
,-show-events
, etc.) is used, print a deprecation warning indicating which new flag to use instead. For example:Documentation Updates:
Phase 2: Remove deprecated flags
The text was updated successfully, but these errors were encountered: