foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Support cast run quorum private txn

Open rodionlim opened this issue 1 year ago • 1 comments

This PR is raised to support debugging Quorum private transactions with cast run. Context: https://github.com/foundry-rs/foundry/issues/9057

Motivation

Quorum private transactions are not generating the right traces with cast tooling due to the way that the client masks the actual transaction input data.

Solution

Quorum private transactions have a specified format that is unique to the blockchain. The transaction input is a 64 bytes Tessera hash, and the recovery id of a private transaction can only be 37/38. Based on the criteria, we can get the CLI to make an additional RPC call to fetch the actual private transaction input data to replace the tessera hash.

rodionlim avatar Oct 08 '24 01:10 rodionlim

Personally not a fan as it is highly vendor specific and therefore I would be hesitant to add this; not because of the proposed functionality of implementation but whenever we implement a feature in Foundry we try to be as neutral as possible, avoid having vendor-specific logic and avoid enshrining winners.

A good example of how a vendor specific request for Kontrol cheatcodes was turned into generalized functionality available to all and non-specific can be seen here: https://github.com/foundry-rs/foundry/issues/4072

zerosnacks avatar Oct 08 '24 17:10 zerosnacks

Personally not a fan as it is highly vendor specific and therefore I would be hesitant to add this; not because of the proposed functionality of implementation but whenever we implement a feature in Foundry we try to be as neutral as possible, avoid having vendor-specific logic and avoid enshrining winners.

A good example of how a vendor specific request for Kontrol cheatcodes was turned into generalized functionality available to all and non-specific can be seen here: #4072

Got it. @zerosnacks What do you think of a generic functionality like below?

Problem: Currently, there's no way to override or modify input data when simulating a transaction execution by hash. Doing so is useful for exploring what-ifs at the specified txn height and save time manually crafting an exact EVM state which may be extremely tedious. This is also no available or equivalent on cast call because cast call does not provide a way to simulate state at a transaction height within a block.

Proposed Feature:

  1. Add a flag --input-override=0x39481934 / --input-override=MODE:RAW:0x39481934 to the cast run <txHash> call. Doing so will allow us to simulate the txn call at the txn height with a different payload.
  2. Add support for a Quorum mode, e.g. --input-override=MODE:QUORUM. This will let cast fetch the input override from an external source.

frank-lim-partior avatar Feb 06 '25 01:02 frank-lim-partior

I think the functionality you describe could be useful, so I would recommend you open an issue to discuss it further. In the meantime, closing this PR for reasons above.

DaniPopes avatar Apr 29 '25 22:04 DaniPopes