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

Abstraction: Not charging for pubdata #70

Closed
mationorato opened this issue Jan 25, 2024 · 1 comment · Fixed by #98 or #103
Closed

Abstraction: Not charging for pubdata #70

mationorato opened this issue Jan 25, 2024 · 1 comment · Fixed by #98 or #103
Assignees
Labels

Comments

@mationorato
Copy link
Collaborator

mationorato commented Jan 25, 2024

Not charging for pubdata

When running the stack as a Validium, gas used calculations have to account for the fact that pubdata is no longer published, and thus certain operations like storage becomes cheaper (they don’t pay for pubdata inclusion on L1). Under the new fee model that was recently merged, every change needed here is managed through the following configuration values. With this in mind, all that’s needed is, when running zk init, if the user is initializing the stack in Validium mode (passing the --validium-mode flag) we should load the following config specified for Validium in the file etc/env/base/chain.toml:

chore(docs): Update documentation about our new fee model by mm-zk · Pull Request #904 · matter-labs/zksync-era

flag rollup with calldata rollup with 4844 (blobs) value for validium value for DA
l1_pubdata_price 510'000'000'000 3'000'000'000 0 5'000
max_pubdata_per_batch 120'000 250'000 1'000'000'000'000 1'000'000
pubdata_overhead_part 0.7 0.4 0 0.1
compute_overhead_part 0.5 0.7 1 1
batch_overhead_l1_gas 1'000'000 1'000'000 1'000'000 1'400'000

The only flag not available in the chain.toml is the l1_pubdata_price as it is computed and set by the function estimate_effective_pubdata_price() defined in the L1GasPriceProvider trait, implemented by GasAdjuster. To make this value equal to zero, we need to set the const L1_GAS_PER_PUBDATA_BYTE to zero for validium, and 17 for rollup. This required moving the const to the chain.toml configuration file.

EDIT: L1GasPriceProvider::estimate_effective_pubdata_price implementation for GasAdjuster<E> should look like:

fn estimate_effective_pubdata_price(&self) -> u64 {
    // For now, pubdata is only sent via calldata, so its price is pegged to the L1 gas price.
    self.estimate_effective_gas_price() * self.config.l1_gas_per_pubdata_byte
}

The config must be added to the chain.toml file in the gas_adjuster config and then we should update the GasAdjuster as needed for that new config.

@mationorato
Copy link
Collaborator Author

closed by #98

@ilitteri ilitteri linked a pull request Feb 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment