Skip to content

Change forge script artifact keys to support Json parsing #2473

@odyslam

Description

@odyslam

Component

Forge

Describe the feature you would like

  • Currently implementing jsonParse and forge-std helper functions. Although we don't have to use the same field names in Solidity and in the JSON (they are serially decoded as a tuple -- we only care about the correct type), I think it would be unintuitive to the programmer if a field called type in the Json appeared as transactionType in the Solidity struct
  • .transactions[].type is a special word in Solidity
  • .transactions[].tx.function is a special word in Solidity
  • .receipts[].returns is a special word in Solidity
  • transactions[].tx is a special word in Solidity
  • .transactions[].tx have some optional fields that are not serialized in case of None. That makes the struct parsing very hard, as I have to create different structs for the different combinations and the user needs to expect that (otherwise the tuple serialization will be wrong). It would be better if we serialized them with a null value, so the object is consistent with every run.

jsonParse: #2293
forge-std branch: https://github.com/odyslam/forge-std/tree/feat/parse-json
originally discussed in #2153 by @mds1

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions