Replies: 4 comments
-
Hi @cubele, Did you find a solution for this issue ? |
Beta Was this translation helpful? Give feedback.
-
No, I ended up removing the validity check as a workaround. |
Beta Was this translation helpful? Give feedback.
-
Can you include the bytecode you used to cause this? There definitely shouldn't be a limit on string length (except memory constraints of the actual system). What environment (e.g. chrome browser, node, Duktape) are you using? |
Beta Was this translation helpful? Give feedback.
-
Moving to discussions; if you have more feedback, please add it and we can always migrate back to an issue. :) |
Beta Was this translation helpful? Give feedback.
-
Ethers Version
6.8.1
Search Terms
regex, bytecode
Describe the Problem
When calling
ContractFactory.fromSolidity
, an assertion fails with messageinvalid BytesLike value
.After stacktracing I found that the
getBytes
function in lib.commonjs uses the following code to check the validity of the contract bytecode:typeof (value) === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i))
. This regex match seems to crash and matches null for very long strings even if it's valid.In my case, I tried to deploy a contract with ~21Kib size and it failed. I believe the problem is within the regex. I don't know if this is normal for the js regex engine, but a simpler check for this is definitely possible.
Code Snippet
Contract ABI
No response
Errors
Environment
No response
Environment (Other)
No response
Beta Was this translation helpful? Give feedback.
All reactions