Consider renaming fields and changing types in the broadcast JSON output files
Component
Forge
Describe the feature you would like
Right now in the broadcast logs there are two fields with names we should consider changing due to conflicts with language keywords.
-
functionis a keyword in JS, solidity, and likely other languages. I'd suggest renaming this tofunctionSigsince the full signature is shown -
typeis also a keyword in many languages. I'd suggest renaming totxType
There are also fields where the output types should be changed (I recall discussing this in the past but not sure if we're tracking anywhere so figured I'd mention it here). First, in the transactions array:
-
transaction.typeshould be a number, currently it's a hex string -
transaction.gasshould be a number, currently it's a hex string - Addresses are not logged as checksummed but they should be (also tracked in https://github.com/foundry-rs/foundry/issues/2975)
- When a function argument is an address, the arguments array omits the
0xprefix but it should be included. - When a function argument is a boolean, the arguments array contains a string of
"true"instead of a boolean oftrue(same forfalse)
In the receipts array:
-
transactionIndexcan be a number, currently it's a hex string -
blockNumbercan be a number, currently it's a hex string - In the logs array,
transactionIndex,logIndex, andtransactionLogIndexcan all be numbers, currently they are hex strings -
cumulativeGasUsedcan be a number, currently it's a hex string -
gasUsedcan be a number, currently it's a hex string - Addresses are not logged as checksummed but they should be
-
statusis a hex string but should be either a boolean or a number of1or0
The above list is not comprehensive and there may be other fields that should have a more readable type.
These suggestions deviate from the ethereum JSON RPC spec in the sense that all numbers are "quantities" which means they're returned from the node as hex strings with as few leading zeros as possible. However, this makes the data less readable and harder to parse, and I don't think there's a reason why these log files need to strictly follow the spec.
Additional context
No response