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

fix(connector-besu): set contract bytecode field's max length to 49154 #3636

Open
petermetz opened this issue Nov 14, 2024 · 0 comments · May be fixed by #3637
Open

fix(connector-besu): set contract bytecode field's max length to 49154 #3636

petermetz opened this issue Nov 14, 2024 · 0 comments · May be fixed by #3637
Assignees
Labels
Besu bug Something isn't working ethereum Issues related to ethereum connector and peristence plugin good-first-issue-100-introductory Hacktoberfest Hacktoberfest participants are welcome to take a stab at issues marked with this label. P1 Priority 1: Highest Xdai Tasks/bugs related to the Xdai network and the corresponding ledger connector plugin in Cactus
Milestone

Comments

@petermetz
Copy link
Contributor

Describe the bug

Right now the Besu connector's API validates requests when deploying solidity
contracts via their bytecode such that the length of the bytecode parameter
cannot be longer than 24576 characters, but instead it should have an uper limit of
49154 characters.

See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode.
2 + (24576 * 2) = 49154 meaning that hex stores each byte in 2 characters and that
there is a 0x prefix (2 characters) which does not count towards the EVM 24576 bytecode limit."

To Reproduce

Try to deploy a contract that has 20k bytes (which is represented as 40k hex characters).
The API will refuse to accept the request due to the incorrect assumption that one hex
character equals on byte worth of bytecode.

Expected behavior

The Besu connector API should accept exctly as long bytecode as the EVM itself does on the
Ethereum mainnet.

Hyperledger Cactus release version or commit (git rev-parse --short HEAD):

main at the time of this writing:
https://github.com/hyperledger-cacti/cacti/tree/4424bf935a913ef046fcbcda822f46471a7f2b56

Hyperledger Cactus Plugins/Connectors Used

  • Besu, Ethereum, XDai

Additional context

@petermetz petermetz added Besu bug Something isn't working ethereum Issues related to ethereum connector and peristence plugin good-first-issue-100-introductory Hacktoberfest Hacktoberfest participants are welcome to take a stab at issues marked with this label. P1 Priority 1: Highest Xdai Tasks/bugs related to the Xdai network and the corresponding ledger connector plugin in Cactus labels Nov 14, 2024
@petermetz petermetz added this to the v2.0.1 milestone Nov 14, 2024
@petermetz petermetz self-assigned this Nov 14, 2024
petermetz added a commit to petermetz/cacti that referenced this issue Nov 14, 2024
Prior to this commit the Besu connector's API validated requests when deploying solidity
contracts via their bytecode such that the length of the bytecode parameter
cannot be longer than 24576 characters, but instead it should have an upper limit of
49154 characters because each byte is represented as two characters in hex.

See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode.
2 + (24576 * 2) = 49154 meaning that hex stores each byte in 2 characters and that
there is a 0x prefix (2 characters) which does not count towards the EVM 24576 bytecode limit."

Fixes hyperledger-cacti#3636

Signed-off-by: Peter Somogyvari <[email protected]>
petermetz added a commit to petermetz/cacti that referenced this issue Nov 19, 2024
Prior to this commit the Besu connector's API validated requests when deploying solidity
contracts via their bytecode such that the length of the bytecode parameter
cannot be longer than 24576 characters, but instead it should have an upper limit of
49154 characters because each byte is represented as two characters in hex.

See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode.
2 + (24576 * 2) = 49154 meaning that hex stores each byte in 2 characters and that
there is a 0x prefix (2 characters) which does not count towards the EVM 24576 bytecode limit."

Fixes hyperledger-cacti#3636

Signed-off-by: Peter Somogyvari <[email protected]>
petermetz added a commit to petermetz/cacti that referenced this issue Nov 26, 2024
Prior to this commit the Besu connector's API validated requests when deploying solidity
contracts via their bytecode such that the length of the bytecode parameter
cannot be longer than 24576 characters, but instead it should have an upper limit of
49154 characters because each byte is represented as two characters in hex.

See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode.
2 + (24576 * 2) = 49154 meaning that hex stores each byte in 2 characters and that
there is a 0x prefix (2 characters) which does not count towards the EVM 24576 bytecode limit."

Fixes hyperledger-cacti#3636

Signed-off-by: Peter Somogyvari <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Besu bug Something isn't working ethereum Issues related to ethereum connector and peristence plugin good-first-issue-100-introductory Hacktoberfest Hacktoberfest participants are welcome to take a stab at issues marked with this label. P1 Priority 1: Highest Xdai Tasks/bugs related to the Xdai network and the corresponding ledger connector plugin in Cactus
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant