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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

GovernorCompatibilityBravo encodes calldata incorrectly #3099

Closed
GeraldHost opened this issue Jan 10, 2022 · 3 comments 路 Fixed by #3100
Closed

GovernorCompatibilityBravo encodes calldata incorrectly #3099

GeraldHost opened this issue Jan 10, 2022 · 3 comments 路 Fixed by #3100

Comments

@GeraldHost
Copy link

When using the propose function in GovernorCompatibilityBravo with function signatures along with calldata the resulting encoded calldata is incorrect.

馃捇 Environment

4.4.1

馃摑 Details

It seems that calling propose in GovernorCompatibilityBravo with signatures and calldata ends up calling
function _encodeCalldata(string[] memory signatures, bytes[] memory calldatas)
which then calls
abi.encodeWithSignature(signatures[i], calldatas[i]).
This causes the calldata + signature to be encoded incorrectly.

In GovernorBravo the calldata and signatures get sent to the timelock seperatley and they then get encoded with: abi.encodePacked(bytes4(keccak256(bytes(signature))), data);

As I understand it the issue is that abi.encodeWithSignature is expecting the arguments to be like this: abi.encodeWithSignature(add(uint256, uint256), 1, 2)
but really it is getting this
abi.encodeWithSignature("add(uint256,uint256)", 0x0...010....02).

@frangio
Copy link
Contributor

frangio commented Jan 10, 2022

Thank you for reporting this I believe you're correct, we'll release a fix as soon as possible.

@Amxx
Copy link
Collaborator

Amxx commented Jan 10, 2022

@GeraldHost can you confirm #3100 addresses your findings?

@GeraldHost
Copy link
Author

@Amxx yes looks good thank you!

This was referenced Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants