dss icon indicating copy to clipboard operation
dss copied to clipboard

Better logging

Open kmbarry1 opened this issue 5 years ago • 1 comments

The note modifier often leaves something to be desired--for example, sometimes the most interesting and/or useful information to log is an updated storage value, not the function arguments. Other times, an event might be more user-friendly if certain logged values were not indexed (or vice-versa)...note has no way to specify which argument values should or should not be logged. Finally, note logs a fixed number of arguments and a fixed amount of calldata, but obviously this one-size-fits-all solution will generally be suboptimal.

An example: it would be nice if the event for Pot.drip() logged the latest chi value; c.f. the Tweet below. https://twitter.com/LefterisJP/status/1230168954590695425

More generally, it would be nice to replace (or augment) note with custom events.

kmbarry1 avatar Feb 19 '20 17:02 kmbarry1

Custom events sounds nice in some cases, but I would still argue for having the log of called functions. IMO every function should be noted, and any extra data that could be interesting should be logged separately.

I don't know what the gas costs of this would be, but having a log of all called functions is really nice for understanding what's going on. Perhaps if it was possible to say "only note this if it's a top-level transaction, not an internal call", then we could have the same effect without incurring huge gas costs (eg. when End . cage is called, only End . cage is noted, but not Pot . cage, which is an internal call).

ehildenb avatar Mar 06 '20 09:03 ehildenb