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

cast abi-encode error with array of structs #10212

Closed
2 tasks done
dryruner opened this issue Mar 30, 2025 · 1 comment
Closed
2 tasks done

cast abi-encode error with array of structs #10212

dryruner opened this issue Mar 30, 2025 · 1 comment
Labels
T-bug Type: bug T-needs-triage Type: this issue needs to be labelled

Comments

@dryruner
Copy link

Component

Cast

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge Version: 1.0.0-stable Commit SHA: e144b82 Build Timestamp: 2025-02-13T20:02:34.979686000Z (1739476954) Build Profile: maxperf

What version of Foundryup are you on?

foundryup: 1.0.1

What command(s) is the bug in?

cast abi-encode

Operating System

macOS (Apple Silicon)

Describe the bug

cast abi-encode "move(((address,address,address,address,uint256),uint256)[])" "[((0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,1000),10000)]"

0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000003e80000000000000000000000000000000000000000000000000000000000002710

Above works fine, but if there is an extra parameter after the struct array it fails:

cast abi-encode "move(((address,address,address,address,uint256),uint256)[],address)" "[((0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,1000),10000)],0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"

Error: Could not ABI encode the function and arguments. Did you pass in the right types?
Error
parser error:
[((0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,1000),10000)],0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
@dryruner dryruner added T-bug Type: bug T-needs-triage Type: this issue needs to be labelled labels Mar 30, 2025
@github-project-automation github-project-automation bot moved this to Todo in Foundry Mar 30, 2025
@grandizzy
Copy link
Collaborator

@dryruner you're missing a set of parenthesis, should be

cast abi-encode "move((((address,address,address,address,uint256),uint256)[],address))" "([((0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,1000),10000)],0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48)"

0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000003e80000000000000000000000000000000000000000000000000000000000002710

thank you

@grandizzy grandizzy closed this as not planned Won't fix, can't repro, duplicate, stale Mar 31, 2025
@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug T-needs-triage Type: this issue needs to be labelled
Projects
Status: Done
Development

No branches or pull requests

2 participants