hyperledger-cacti/cacti

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

Closed this issue · 0 comments

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