-
EnvironmentTestnet Provide a brief description of the functionality you're trying to implement.I am trying to deploy instances of a contract A from Factory contract B This is a common procedure ERC-1167: Minimal Proxy Contract on every EVM chain What is the specific issue or error you're encountering?
Can you share the error messages or logs you're receiving, if any?
Have you made any recent changes to the contract before encountering this issue?No Are there any external libraries or contracts that your contract interacts with?No Can you provide the relevant portions of your contract code where the issue is occurring?
Have you tried to isolate the problem, and if so, what were the results?I have a success only through manual trigger of the create2 function. What steps have you already taken to try to resolve the issue?I have been following the bot suggestions Repo Link (Optional)No response Additional DetailsNo response |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 6 replies
-
Hi @kirilaa 👋 Do you have a link to the source code? With just the snippet you've provided, it's difficult to diagnose the exact reason this is occurring. I'm interested in why you're passing Check out the docs here for an example of a factory in zkSync. |
Beta Was this translation helpful? Give feedback.
-
Hi @kirilaa, I noticed on the transactions you shared you set values for bytecodes post-deployment. TLDR is this pattern is currently unsupported by the zkEVM. Below I give more background on what's happening here. EIP 1167 and Dynamic Bytecode Declaration The EIP 1167 is written directly in EVM bytecode, which is quite different from the bytecode that zkEVM operates on. As a result, it's currently not feasible to use EIP 1167 on zkSync's Era. To support this pattern, we'd need to craft an entirely new "minimal" bytecode sequence. The benefits of using this minimal proxy pattern on Era might not be as significant as on Ethereum. Since deploying duplicated contracts on Era could be more cost-effective compared to Ethereum but this is something we might need to validate. So you can't dynamically declare bytecode for factories right now as mentioned here. Additional Note on Fetching Deployed Bytecode It is also worth noting that fetching the bytecode for a deployed contract is also currently unsupported as mentioned here. Examples I made a repo to exemplify what happens when you dynamically declare bytecode for factories vs declaring it and having the compiler know of the bytecode here. To see run the examples and see the differences:
You might notice that the path where the bytecode is defined statically runs without errors. On the other hand, running the dynamically declared bytecode path returns the ...
error: Error: processing response error (body="{\"jsonrpc\":\"2.0\",\"error\":{\"code\":3,\"message\":\"execution reverted: Deployment failed\",\"data\":\"0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000114465706c6f796d656e74206661696c6564000000000000000000000000000000\"},\"id\":50}\n", error={"code":3,"data":"0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000114465706c6f796d656e74206661696c6564000000000000000000000000000000"}, requestBody="{\"method\":\"eth_estimateGas\",\"params\":[{\"gasPrice\":\"0xee6b280\",\"type\":\"0x0\",\"from\":\"0x36615cf349d7f6344891b1e7ca7c72883f5dc049\",\"to\":\"0x111c3e89ce80e62ee88318c2804920d4c96f92bb\",\"data\":\"0x76fb8b650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85bab911139cee81fed5ffd47f37abbc420853c00000000000000000000000098e7c6fa66cc23e78a20090c77774e238621531c\"}],\"id\":50,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="http://127.0.0.1:8011", code=SERVER_ERROR, version=web/5.7.1)
at Logger.makeError (/Users/dennis/Documents/Code/factory-example/node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
at Logger.throwError (/Users/dennis/Documents/Code/factory-example/node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
at /Users/dennis/Documents/Code/factory-example/node_modules/@ethersproject/web/src.ts/index.ts:341:28
at step (/Users/dennis/Documents/Code/factory-example/node_modules/@ethersproject/web/lib/index.js:33:23)
at Object.next (/Users/dennis/Documents/Code/factory-example/node_modules/@ethersproject/web/lib/index.js:14:53)
at fulfilled (/Users/dennis/Documents/Code/factory-example/node_modules/@ethersproject/web/lib/index.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
reason: 'processing response error',
code: 'SERVER_ERROR',
body: '{"jsonrpc":"2.0","error":{"code":3,"message":"execution reverted: Deployment failed","data":"0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000114465706c6f796d656e74206661696c6564000000000000000000000000000000"},"id":50}\n',
error: [Error],
requestBody: '{"method":"eth_estimateGas","params":[{"gasPrice":"0xee6b280","type":"0x0","from":"0x36615cf349d7f6344891b1e7ca7c72883f5dc049","to":"0x111c3e89ce80e62ee88318c2804920d4c96f92bb","data":"0x76fb8b650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85bab911139cee81fed5ffd47f37abbc420853c00000000000000000000000098e7c6fa66cc23e78a20090c77774e238621531c"}],"id":50,"jsonrpc":"2.0"}',
requestMethod: 'POST',
url: 'http://127.0.0.1:8011'
}
},
tx: {
data: '0x76fb8b650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85bab911139cee81fed5ffd47f37abbc420853c00000000000000000000000098e7c6fa66cc23e78a20090c77774e238621531c',
to: Promise { '0x111C3E89Ce80e62EE88318C2804920D4c96f92bb' },
from: '0x36615Cf349d7F6344891B1e7CA7C72883F5dc049',
type: 0,
gasPrice: Promise { [BigNumber] },
nonce: Promise { 2 },
gasLimit: Promise { <rejected> [Circular *1] },
chainId: Promise { 260 }
}
... |
Beta Was this translation helpful? Give feedback.
Hi @kirilaa,
It's been a while but I've been caught up with other prios, but I adapted the example repo (quickly and I think it is actually ugly code but it works) and deployed a working version to testnet. So, to reproduce you will need to first clone the example repo again: https://github.com/idea404/factory-example. Then, this is the sequence of commands I ran: