Content pfp
Content
@
0 reply
0 recast
0 reaction

Pierre H. โ€” q/dau pfp
Pierre H. โ€” q/dau
@rektorship
https://github.com/zkSync-Community-Hub/zksync-developers/discussions/639#discussioncomment-10693912 why are zksync builds non-deterministic (both foundry and hardhat)? why does updating the smart account change the proxy bytecode? and why is there only one proxy bytecode that works for my account factory? @bountybot pays 100 USD to the person who can answer *all* these questions.
9 replies
1 recast
4 reactions

gatedude.eth pfp
gatedude.eth
@gatedude
Hey fam, I visited the repo and read the conversation. A contributor actually suggested using ---no-optimization flag with Hardhat to reduce variability. Another also suggested you exploring @openzeppelin/contracts for deterministic builds. Here's my take on the question you asked: First, you need to understand that zkSync's build process involves generating random numbers (salts) for cryptographic purposes. Also these random numbers affect the compiled contract bytecode. But Foundry and Hardhat generate different random values, leading to non-deterministic builds. Also, the reason why updating the contract actually changes the proxy bytecode is because zkSync's smart accounts actually uses a proxy contract to manage account upgrades. When you update the smart contract, the proxy contract bytecode changes due to the "New account Logic" and the "Updated account-specefic data" like the public key for example.
2 replies
0 recast
1 reaction

gatedude.eth pfp
gatedude.eth
@gatedude
So, the change in bytecode actually ensures that the proxy contract reflects the updated smart contract configuration. Also, the reason why there's only one proxy bytecode that works for your account factory is because zkSync's account factory deploys proxy contract for new accounts and the proxy bytecode is generated based on account factory's configuration. Also, using a single proxy bytecode ensures consistency across all accounts created by the factory. But if you want to achieve deterministic builds and reusable proxy bytecode; I suggest you try using a fixed salt or a random number generator seed or Maybe try Utilizing a deterministic build tool or script. Lastly, you most ensure consistent configuration and dependencies. I hope this helps you fam...
0 reply
0 recast
1 reaction