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: don't charge for pubdata in Validium mode #32

Merged
merged 31 commits into from
Jan 19, 2024

Conversation

Oppen
Copy link

@Oppen Oppen commented Jan 11, 2024

What ❔

Check for the ETH_SENDER_SENDER_VALIDIUM_MODE variable while computing the fees to avoid charging for pubdata when that is set to true.
Adds an integration test that prints the fees of minting and transferring a token.

Why ❔

Users and operators expect reduced costs compared to rollup due to not storing the pubdata in the L1.

Run

  • Install zk tool:
    Inside zksync-era run
    export ZKSYNC_HOME=$(pwd)
    export PATH=$ZKSYNC_HOME/bin:$PATH
    zk
    
  • Run zk tool to initiate validium:
    zk init --validium-mode
    
  • Run example: follow validium.md guide.

Debugging

zk && zk clean --all && zk init --validium-mode

@Oppen Oppen force-pushed the validium_mode_pubdata_0_env branch from d4cc570 to 573975a Compare January 12, 2024 19:10
@Oppen Oppen force-pushed the validium_mode_pubdata_0_env branch from 0ea1067 to c71ff9c Compare January 15, 2024 15:06
ilitteri
ilitteri previously approved these changes Jan 15, 2024
Copy link
Collaborator

@ilitteri ilitteri left a comment

Choose a reason for hiding this comment

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

LGTM

* Add validium example readme

* update validium.md and change test name

* fmt

---------

Co-authored-by: toni-calvin <[email protected]>
@Oppen Oppen changed the base branch from validium_mode_pubdata_0 to validium_mode January 15, 2024 18:40
@Oppen Oppen dismissed ilitteri’s stale review January 15, 2024 18:40

The base branch was changed.

Copy link
Collaborator

@mationorato mationorato left a comment

Choose a reason for hiding this comment

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

  • please remove changes in older vms. we shoudl only modify vm_latests.
  • Look at the comment about the submodule

.gitmodules Outdated Show resolved Hide resolved
@Oppen Oppen changed the title Use ETH_SENDER_SENDER_VALIDIUM_MODE to check whether we need to cha… feat: don't charge for pubdata in Validium mode Jan 15, 2024
@Oppen Oppen marked this pull request as ready for review January 15, 2024 19:02
@ilitteri ilitteri changed the base branch from validium_mode to main January 15, 2024 20:46
Ivan Litteri and others added 3 commits January 15, 2024 18:03
* Update output readme

* Add a note for transactions

* Fix note
* remove logs from pubdata

* update comment
@ilitteri ilitteri changed the base branch from main to validium_mode January 16, 2024 21:31
* Refactor readme example

* Fix some comments

* Remove validium.md
Copy link

@popzxc popzxc left a comment

Choose a reason for hiding this comment

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

I understand that this is a PoC phase, so please don't treat my comments as criticism of the existing solution; I understand that there will be some refactoring/rework before validium mode is added to the main codebase.

I just thought it may be helpful to elaborate on our expectations code-wise.

// This value will typically be a lot less than u64
// unless the gas price on L1 goes beyond tens of millions of gwei
// TODO: make this check only once
let validium_mode = std::env::var("ETH_SENDER_SENDER_VALIDIUM_MODE") == Ok("true".to_string());
Copy link

Choose a reason for hiding this comment

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

VM should have no assumptions regarding available environment variables.
In general, the only source of environment variables right now is the zksync_env_config crate.
In the future, we'll have different configuration schemas not based on the env variables (think JSON configs), so you should present configuration in an explicit and serialization-agnostic form.

@@ -456,9 +456,17 @@ fn get_pubdata_price_bytes(initial_value: U256, final_value: U256, is_initial: b
compress_with_best_strategy(initial_value, final_value).len() as u32;

if is_initial {
(BYTES_PER_DERIVED_KEY as u32) + compressed_value_size
println!("is initial");
Copy link

Choose a reason for hiding this comment

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

Debugging statements obviously should not be present in the code that is to be merged.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Of course, there will be a clean PR to your repo when finished

Copy link
Collaborator

Choose a reason for hiding this comment

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

Btw, we'll remove this rn cause is not useful anymore

@@ -0,0 +1,23 @@
// SPDX-License-Identifier: MIT
Copy link

Choose a reason for hiding this comment

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

Once we get closer to the mergeable solution, we'd expect the proper logical structure of the project (this applies to test code as well -- I assume this package will evolve to some form of integration test).

Copy link
Collaborator

@ilitteri ilitteri left a comment

Choose a reason for hiding this comment

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

Left some comments

core/tests/ts-integration/src/diff_output.txt Outdated Show resolved Hide resolved
core/tests/ts-integration/src/diff_validium.txt Outdated Show resolved Hide resolved
core/tests/ts-integration/src/rollup_output.txt Outdated Show resolved Hide resolved
core/tests/ts-integration/src/validium_output.txt Outdated Show resolved Hide resolved
core/lib/multivm/src/versions/vm_latest/oracles/storage.rs Outdated Show resolved Hide resolved
@ilitteri
Copy link
Collaborator

ilitteri commented Jan 18, 2024

I understand that this is a PoC phase, so please don't treat my comments as criticism of the existing solution; I understand that there will be some refactoring/rework before validium mode is added to the main codebase.

I just thought it may be helpful to elaborate on our expectations code-wise.

Thanks for the review! It is very useful for us to have fast feedback on our changes in the codebase to converge on a solution that fits your expectations. I'll try to answer the comments asap.

As a suggestion for the future, our main branch is validium_mode (my intention in clarifying this is that it is a cleaner branch, and things like debug prints aren't there).

@ilitteri ilitteri enabled auto-merge (squash) January 19, 2024 14:21
Copy link
Collaborator

@ilitteri ilitteri left a comment

Choose a reason for hiding this comment

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

LGTM, we still need to update the era-contract branch, but this will be another PR

@ilitteri ilitteri disabled auto-merge January 19, 2024 14:21
@ilitteri ilitteri merged commit d3f703e into validium_mode Jan 19, 2024
6 of 9 checks passed
@ilitteri ilitteri deleted the validium_mode_pubdata_0_env branch January 19, 2024 14:22
juan518munoz pushed a commit that referenced this pull request Dec 27, 2024
feat: remove get_l1_processing_details method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants