Skip to content

Commit

Permalink
Do not charge for pubdata in Validium mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ilitteri committed Jan 25, 2024
1 parent 24cd669 commit af06969
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
14 changes: 9 additions & 5 deletions core/lib/zksync_core/src/fee_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,15 @@ impl BatchFeeModelInputProvider for MainNodeFeeInputProvider {
config,
l1_gas_price: self.provider.estimate_effective_gas_price(),
}),
FeeModelConfig::V2(config) => FeeParams::V2(FeeParamsV2 {
config,
l1_gas_price: self.provider.estimate_effective_gas_price(),
l1_pubdata_price: self.provider.estimate_effective_pubdata_price(),
}),
FeeModelConfig::V2(config) => {
let validium_mode = std::env::var("VALIDIUM_MODE") == Ok("true".to_owned());
FeeParams::V2(FeeParamsV2 {
config,
l1_gas_price: self.provider.estimate_effective_gas_price(),
l1_pubdata_price: self.provider.estimate_effective_pubdata_price()
* !validium_mode as u64,
})
}
}
}
}
Expand Down
14 changes: 9 additions & 5 deletions etc/env/base/chain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,25 @@ minimal_l2_gas_price=100000000
# The constant that represents the possibility that a batch can be sealed because of overuse of computation resources.
# It has range from 0 to 1. If it is 0, the compute will not depend on the cost for closing the batch.
# If it is 1, the gas limit per batch will have to cover the entire cost of closing the batch.
compute_overhead_part=0.0
# compute_overhead_part=0.0
compute_overhead_part=1.0

# The constant that represents the possibility that a batch can be sealed because of overuse of pubdata.
# It has range from 0 to 1. If it is 0, the pubdata will not depend on the cost for closing the batch.
# If it is 1, the pubdata limit per batch will have to cover the entire cost of closing the batch.
pubdata_overhead_part=1.0
# pubdata_overhead_part=1.0
pubdata_overhead_part=0

# The constant amount of L1 gas that is used as the overhead for the batch. It includes the price for batch verification, etc.
batch_overhead_l1_gas=800000
# batch_overhead_l1_gas=800000
batch_overhead_l1_gas=1000000

# The maximum amount of gas that can be used by the batch. This value is derived from the circuits limitation per batch.
max_gas_per_batch=200000000

# The maximum amount of pubdata that can be used by the batch. Note that if the calldata is used as pubdata, this variable should not exceed 128kb.
max_pubdata_per_batch=100000
# max_pubdata_per_batch=100000
max_pubdata_per_batch=1000000000000

# The version of the fee model to use.
# - `V1`, the first model that was used in zkSync Era. In this fee model, the pubdata price must be pegged to the L1 gas price.
Expand All @@ -75,7 +79,7 @@ max_pubdata_per_batch=100000
# - `V2`, the second model that was used in zkSync Era. There the pubdata price might be independent from the L1 gas price. Also,
# The fair L2 gas price is expected to both the proving/computation price for the operator and the costs that come from
# processing the batch on L1.
fee_model_version="V1"
fee_model_version="V2"

# Max number of computational gas that validation step is allowed to take.
validation_computational_gas_limit=300000
Expand Down

0 comments on commit af06969

Please sign in to comment.