Closed leighmcculloch closed 1 year ago
It appears the cost output does show up when verbose output is enabled, regardless of whether --cost
is specified. Looking at the code I don't see any references to the cost
parameter.
If the intention is to display cost data only in verbose mode, then I think it will be unintuitive to discover. Viewing cost information about blockchain transactions in general is a first-class concern. Verbose modes in tools are usually reserved for debugging, or when users need to more completely understand the internals of what is happening.
As part of, or as a follow up to, fixing this bug and reintroducing cost analysis as a first-class feature, it would be helpful to add docs for it, which other than being a necessity will also help us evaluate if the developer experience is good. The docs issue is:
Happy to hear suggestions on how the output format can be improved (@leighmcculloch mentioned on the discord).
I don't think this ever worked against the real live network. It logs a host "Budget" object after execution (which is why you get very detailed output about wasm execution). But for the real network we don't have that. Maybe the closest we could do would be to log the SorobanResources
for the txn, which would give us read_bytes, write_bytes, insns and footprint?
It used to work in sandbox.
If we were to make it available for networks, using SorobanResources
available from preflight would make sense. 👍🏻
footprint
Speaking of the footprint, there also used to be a --footprint
option, but that was removed from the invoke command as well. I see the footprint in the verbose output now.
It's not obvious to me that moving these both into verbose leads to intuitive access to that information. Both footprint and cost are more than diagnostic/debug information, they're information about a contract that I think should be very accessible.
The idea at the time was to allow filters in lieu of flags for each type of log. e.g. -f soroban_cli::log::footprint=debug
. I am also considering defaulting to output logs to a file so you wouldn't need to rerun the command again to see any transaction related info.
I think the separate --cost
and --footprint
flags are going to be easier for users to discover (they'll be in the man page, etc.), than the subsystem-logging approach.
Second, I'm not a huge fan of logs default secretly going off to some file somewhere. But I'm pretty familiar with bash output redirection etc, so maybe that's not typical of our target devs. 🤷
How about listing all the possible filters in the man page?
I've tried to avoid bash specific solutions since we want to support windows. But I do think networked transaction logs would be useful when users need to report errors (perhaps we could add a command to display the log file).
separate
--cost
and--footprint
flags are going to be easier for users to discover
+1. Logs are great for debugging and getting into the internal workings of things and it's good we output those details there, but sometimes it's helpful to just get cost info, and I imagine in the future we might want to control the output format of the cost info and logs won't be a convenient way to do that. E.g. we might end up adding --output plain|json
to invoke, and then cost, footprint, and return-value outputs can be streamed json objects. Regardless of all that though, the main sell I think is feature discovery. When it's in logs, it doesn't feel like a first-class feature.
Alternatively, we add the options back, and those options just enable the logs filtered for those specific thing? Discoverable, and all items are found in one place.
What version are you using?
What did you do?
What did you expect to see?
I expected to see the cost table outputted, that looks like this:
What did you see instead?
Nothing. Nothing is output.
Prior discussion