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

parser error when using cast and struct of arrays containing bytes params #6998

Closed
2 tasks done
fedealconada opened this issue Feb 2, 2024 · 2 comments
Closed
2 tasks done
Labels
T-bug Type: bug

Comments

@fedealconada
Copy link

fedealconada commented Feb 2, 2024

Component

Cast

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (84d9842 2024-02-02T00:19:34.098872000Z)

What command(s) is the bug in?

cast send

Operating System

macOS (Apple Silicon)

Describe the bug

hi!

i'm trying to execute this function, which receives an array of a struct which contains several params including some bytes ones.

cast send --private-key $PRIVATE_KEY $CONTRACT "handleOps((address,uint256,bytes,bytes,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address)" "[(0x0000000000000000000000000000000000000000,0,'0x1','0x1',0,0,0,0,0,'0x1','0x1')]" $PUBLIC_KEY --rpc-url $RPC_URL

this is what i'm receiving:

image

i noticed that if i try removing all the bytes params and sending it like this:
"handleOps((address,uint256,uint256,uint256,uint256,uint256,uint256)[],address)" "[(0x0000000000000000000000000000000000000000,0,0,0,0,0,0)]"

it also fails but with a different error which makes me think that the issue is on the bytes params.

image

either i'm not passing them correctly or there's something wrong.

if i try removing all of the params which are not bytes, sending it like this:

"handleOps((bytes,bytes,bytes,bytes)[],address)" "[('0x1','0x1','0x1','0x1')]"

i'm again receiving the 1st error:

image

thanks!

@fedealconada fedealconada added the T-bug Type: bug label Feb 2, 2024
@gakonst gakonst added this to Foundry Feb 2, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Feb 2, 2024
@klkvr
Copy link
Member

klkvr commented Feb 9, 2024

bytes can't have an odd length.

please check if "[(0x0000000000000000000000000000000000000000,0,0x10,0x10,0,0,0,0,0,0x10,0x10)]" will work

@DaniPopes
Copy link
Member

The error message is rough, but the message is "Odd number of digits" so 0x1 should be 0x01

As for the RPC error that's just a contract revert on your end.

@jenpaff jenpaff moved this from Todo to Completed in Foundry Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
Archived in project
Development

No branches or pull requests

3 participants