Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adding (experimental) zkos support #534

Merged
merged 19 commits into from
Jan 15, 2025
Merged

Conversation

mm-zk
Copy link
Collaborator

@mm-zk mm-zk commented Jan 14, 2025

What 💻

  • Adding ZKOS as experimental backend
  • it is currently just the interface (with todo() - the real implementation is in separate branch, due to nightly compiler and private repos)

Why ✋

  • Allow us to test zkos early - and find any potential issues.
  • ZKOS should be compatible with EVM bytecode (so 'regular' forge should just work)

Evidence 📷

image

Changes required

  • allow_no_target - in zkos - always true
  • different keys for nonce & balances - created separate class to handle this
  • started using a trait (VM) instead of concrete struct (Vm) as in the past, added zkos implementation for VM trait
  • simplified kept bytecode to be <H256, Vec>

@mm-zk mm-zk requested a review from a team as a code owner January 14, 2025 17:47
@mm-zk
Copy link
Collaborator Author

mm-zk commented Jan 14, 2025

Stuff is currently failing as the zk_ee repo is private.

Cargo.toml Outdated
@@ -28,12 +28,14 @@ categories = ["cryptography"]
#########################
zksync_multivm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "core-v25.4.0" }
zksync_contracts = { git = "https://github.com/matter-labs/zksync-era.git", rev = "core-v25.4.0" }
zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "core-v25.4.0" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually needed? We purposefully got rid of it in favour of zksync_types

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using a bunch of methods from there (mostly to move things between u256 and h256) -- but as we have 'todo' Ican remove it for now.

@@ -1,3 +1,4 @@
#![cfg_attr(feature = "zkos", feature(allocator_api))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, we are using stable rust now, is this absolutely necessary for zkos?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes :-(

system_env,
storage,
// TODO: this might be causing a deadlock.. check..
&inner.fork_storage.inner.read().unwrap().raw_storage,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am in the process of getting rid of raw_storage (and hiding InMemoryStorage in general), what should be the appropriate interface here? I am guessing this is what you were talking about in the Slack thread, basically you need some sort of interface to be able to re-construct the tree (short-term, long-term we will figure something out)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, short term, I need a way to iterate over all elements from the storage.

@mm-zk mm-zk requested a review from itegulov January 15, 2025 09:54
@mm-zk mm-zk merged commit 35c3009 into main Jan 15, 2025
15 checks passed
@mm-zk mm-zk deleted the mmzk_0113_update_to_newest_take2 branch January 15, 2025 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants