foundry icon indicating copy to clipboard operation
foundry copied to clipboard

feat(`cheatcodes`): add `vm.signTypedData` cheatcode to Foundry

Open aviggiano opened this issue 8 months ago • 8 comments

Component

Forge

Describe the feature you would like

I am building safe-utils to help automate the proposal of Safe transactions through Foundry.

One common use case of governance multisigs is Safe signers who use Ledger wallets.

The issue is that Ledger removed blind signing, so the eth_sign method invoked by vm.sign does not work.

This feature request proposes introducing a new vm.signTypedData similar to cast wallet sign --data. Since foundry already has JSON encoding/decoding cheatcodes, we could rely on the user to correctly construct the data parameters, and only pass them to the VM method.

Additional context

No response

aviggiano avatar Apr 09 '25 10:04 aviggiano

nadtech-hub avatar Apr 09 '25 23:04 nadtech-hub

@zerosnacks if it's avialable, may i take it ?

Haxry avatar Apr 15 '25 05:04 Haxry

sounds good @Haxry thank you!

grandizzy avatar Apr 15 '25 12:04 grandizzy

@grandizzy @aviggiano lmk if i am wrong ,

the user will provide the structured json data according to the EIP712 , the vm.signTypedData cheatcode should take it as input along with the private key and should generate the digest which should then be signed as done by vm.sign

right ?

Haxry avatar Apr 16 '25 11:04 Haxry

@aviggiano pls chime in, if EIP712 you're looking for maybe https://github.com/foundry-rs/foundry/issues/4818 to consider?

grandizzy avatar Apr 16 '25 11:04 grandizzy

@Haxry yes this was my idea

@grandizzy #4818 is nice but I think it is independent from my feature request, no?

aviggiano avatar Apr 16 '25 12:04 aviggiano

It feels like it could go into ally first too no? And then get merged into foundry?

https://github.com/alloy-rs/alloy/issues/2349

PatrickAlphaC avatar Apr 25 '25 19:04 PatrickAlphaC

This would be great!

bowd avatar Jun 02 '25 19:06 bowd