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

Jai pfp
Jai
@jaivsdawrld
1. zkSync builds are non-deterministic because of the underlying cryptography, gas costs, and off-chain factors like the L1/L2 interaction that make bytecode unpredictable across those two different tools you mentioned (foundry/Hardhat) 2. Updating the smart account alters the proxy bytecode because the initialization logic changes, creating a new contract setup. 3. Only one proxy bytecode works since it's uniquely generated by your account factory's deployment logic and structure. Did some digging and Got some information from here https://docs.zksync.io/build
1 reply
0 recast
1 reaction

Pierre H. — q/dau pfp
Pierre H. — q/dau
@rektorship
Thanks @jaivsdawrld for taking the time to answer! i can't wrap my mind around your second point though. if the implementation bytecode changes (the smart account implementation), it shouldn't affect the proxy bytecode. but again i might be missing something 🤷‍♀️ If you look at this very simple proxy contract in the screenshot, how on earth a change on the implementation modifies its bytecode? once deploy, you only need to udpate the proxy *storage* to point to the new implementation. And in fact, hardcoding the proxy bytecode (previous version) in the factory deployment script is my only option to make it work now. will pay the bounty if you can make the factory deployment work with the proxy bytecode from the build: https://github.com/openfort-xyz/openfort-zksync-contracts/blob/b89d4a262fd90522c00cd947c737828fa7ac95ff/tasks/deployFactory.ts#L32 glgl :))
2 replies
0 recast
0 reaction

Jai pfp
Jai
@jaivsdawrld
Once a proxy contract is deployed, its bytecode usually stays the same. The only thing that changes is the storage, like the address of the new logic contract it points to. To get the factory deployment to work with the proxy bytecode from the build, you'll want to make sure the proxy points to a fixed implementation. Alternatively, you could use an immutable proxy pattern I’m still assessing the code.
0 reply
0 recast
0 reaction