foundry-rs / foundry-rs/foundry
Allow avoiding passing large arguments through program args
- Dominant language
- Rust
- Stars
- 10.6k
- Forks
- 2.6k
- Avg merge
- 18h 20m
- Merged PRs (30d)
- 510
Description
### Component
Forge, Cast
### Have you ensured that all of these are up to date?
- [X] Foundry
- [X] Foundryup
### What version of Foundry are you on?
forge 0.2.0 (50756e5 2023-05-29T00:04:27.574210907Z)
### What command(s) is the bug in?
_No response_
### Operating System
Linux
### Describe the bug
Many commands require passing data of arbitrary size as program args:
- cast abi-encode
- cast access-list
- cast call
- cast calldata
- cast disassemble
- cast estimate
- cast pretty-calldata
- cast publish
- cast rpc
- cast send
- cast wallet sign
- forge create
- forge script
Usually these are Solidity function arguments, but sometimes these are raw transaction payloads or RPC JSONs. The problem is that Linux (other OS-es probably too) puts a hard limit on the size of the program args, throwing `Argument list too long` if violated. For regular kernel builds it's just 128KB per arg, which for hex-encoded data halves the limit to just 64KB, it's very easy to hit it and there's no workaround.
There are a few approaches for passing arbitrarily-sized args without limitations:
- Stdin. Convenient to use, has no size limitations, but it'd put a hard limit of a single arbitrarily-sized arg per command, e.g. it may be tricky to support the interactive wallet.
- Files. Not very convenient to use, has no size limitations, wouldn't collide with any parameters.
- Enviroment variables. Rather convenient to use, but does have some OS-dependent limitations, wouldn't collide with any parameters.
Any of these solutions would need to work along the regular passing by args to keep the backward compatibility.
Contributor guide
Assessment
This issue has not been assessed yet.