Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing arguments to cast {call,send} through stdin #7890

Open
guidanoli opened this issue May 8, 2024 · 1 comment
Open

Allow passing arguments to cast {call,send} through stdin #7890

guidanoli opened this issue May 8, 2024 · 1 comment
Labels
T-feature Type: feature

Comments

@guidanoli
Copy link

Component

Cast

Describe the feature you would like

There are several cast commands which can potentially receive lengthy arguments. Those are often limited by the underlying host OS to a couple of kilobytes, which, in some situations, might not be enough.

One alternative is to receive such arguments via stdin. It can be formatted as JSON, which is a format already in use for the output of some cast commands. For example:

cast call $to 'func(uint256,address,bytes)' < arguments.json

Where arguments.json might have the following data:

[
  "42",
  "0x41b1a0649752af1b28b3dc29a1556eee781e4a4c",
  "0x9f24c52e0fcd1ac696d00405c3bd5adc558c48936919ac5ab3718fcb7d70f93f..."
]

Alternatively, arguments can be separated line-by-line...

cast call $to 'func(uint256,address,bytes)' < arguments.txt

Where arguments.txt might have the following data:

42
0x41b1a0649752af1b28b3dc29a1556eee781e4a4c
0x9f24c52e0fcd1ac696d00405c3bd5adc558c48936919ac5ab3718fcb7d70f93f...

Additional context

This stemmed from an application I'm developing, called Bugless.
We were using go-ethereum to sign transactions to anvil, but then we changed the underlying framework, and opted to sign transactions with cast instead.
The problem is that some transactions can be quite big, and cast doesn't work because of the argument size limit imposed by the underlying OS, Linux.
If cast doesn't implement a workaround, we might rewrite our CLI tool using viem.

@guidanoli guidanoli added the T-feature Type: feature label May 8, 2024
@guidanoli
Copy link
Author

guidanoli commented May 8, 2024

If stdin is a bad idea, an option like --arguments <argument-file> would also work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-feature Type: feature
Projects
None yet
Development

No branches or pull requests

1 participant