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

Change pubdata constants to 0 #7

Merged
merged 6 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions SystemConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"MAX_PUBDATA_PER_BATCH": 110000,
"PRIORITY_TX_MAX_PUBDATA": 99000,
"FAIR_L2_GAS_PRICE": 500000000,
"L1_GAS_PER_PUBDATA_BYTE": 17,
"L1_GAS_PER_PUBDATA_BYTE": 0,
"BATCH_OVERHEAD_L2_GAS": 1200000,
"BATCH_OVERHEAD_L1_GAS": 1000000,
"MAX_TRANSACTIONS_IN_BATCH": 1024,
Expand All @@ -16,4 +16,4 @@
"L1_TX_DELTA_FACTORY_DEPS_PUBDATA": 64,
"MAX_NEW_FACTORY_DEPS": 32,
"REQUIRED_L2_GAS_PRICE_PER_PUBDATA": 800
}
}
6 changes: 4 additions & 2 deletions l1-contracts/contracts/zksync/Config.sol
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ uint256 constant FAIR_L2_GAS_PRICE = $(FAIR_L2_GAS_PRICE);

/// @dev Even though the price for 1 byte of pubdata is 16 L1 gas, we have a slightly increased
/// value.
uint256 constant L1_GAS_PER_PUBDATA_BYTE = $(L1_GAS_PER_PUBDATA_BYTE);
// uint256 constant L1_GAS_PER_PUBDATA_BYTE = $(L1_GAS_PER_PUBDATA_BYTE);
uint256 constant L1_GAS_PER_PUBDATA_BYTE = 0;

/// @dev The computational overhead of processing an L2 batch.
uint256 constant BATCH_OVERHEAD_L2_GAS = $(BATCH_OVERHEAD_L2_GAS);
Expand All @@ -90,7 +91,8 @@ uint256 constant BATCH_OVERHEAD_L2_GAS = $(BATCH_OVERHEAD_L2_GAS);
uint256 constant BATCH_OVERHEAD_L1_GAS = $(BATCH_OVERHEAD_L1_GAS);

/// @dev The equivalent in L1 pubdata of L1 gas used for working with L1
uint256 constant BATCH_OVERHEAD_PUBDATA = BATCH_OVERHEAD_L1_GAS / L1_GAS_PER_PUBDATA_BYTE;
// uint256 constant BATCH_OVERHEAD_PUBDATA = BATCH_OVERHEAD_L1_GAS / L1_GAS_PER_PUBDATA_BYTE;
uint256 constant BATCH_OVERHEAD_PUBDATA = 0;

/// @dev The maximum number of transactions in L2 batch:
uint256 constant MAX_TRANSACTIONS_IN_BATCH = $(MAX_TRANSACTIONS_IN_BATCH);
Expand Down
30 changes: 16 additions & 14 deletions system-contracts/bootloader/bootloader.yul
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ object "Bootloader" {
/// we demand at least 17 to cover up for the costs of additional
/// hashing of it, etc.
function L1_GAS_PER_PUBDATA_BYTE() -> ret {
ret := 17
ret := 0
}

/// @dev The size of the bootloader memory that is to spent by the transaction's
Expand Down Expand Up @@ -1652,11 +1652,11 @@ object "Bootloader" {
debugLog("requiredOverhead", requiredOverhead)
debugLog("operatorOverheadForTransaction", operatorOverheadForTransaction)

// The required overhead is less than the overhead that the operator
// has requested from the user, meaning that the operator tried to overcharge the user
if lt(requiredOverhead, operatorOverheadForTransaction) {
assertionError("Operator's overhead too high")
}
// // The required overhead is less than the overhead that the operator
// // has requested from the user, meaning that the operator tried to overcharge the user
// if lt(requiredOverhead, operatorOverheadForTransaction) {
// assertionError("Operator's overhead too high")
// }

ret := operatorOverheadForTransaction
}
Expand Down Expand Up @@ -1866,7 +1866,8 @@ object "Bootloader" {
// pubdata to pay for.
// The difference between ceil and floor division here is negligible,
// so we prefer doing the cheaper operation for the end user
let pubdataEquivalentForL1Gas := safeDiv(l1GasOverhead, l1GasPerPubdata, "dd")
// let pubdataEquivalentForL1Gas := safeDiv(l1GasOverhead, l1GasPerPubdata, "dd")
let pubdataEquivalentForL1Gas := 0

ret := safeAdd(
computationOverhead,
Expand Down Expand Up @@ -1920,17 +1921,18 @@ object "Bootloader" {
totalBatchOverhead,
MAX_TRANSACTIONS_IN_BATCH()
)
ret := max(ret, overheadForSlot)

debugLog("overheadForSlot", overheadForSlot)

// In the proved batch we ensure that the gasPerPubdataByte is not zero
// to avoid the potential edge case of division by zero. In Yul, division by
// zero does not panic, but returns zero.
<!-- @if BOOTLOADER_TYPE=='proved_batch' -->
if and(iszero(gasPerPubdataByte), FORBID_ZERO_GAS_PER_PUBDATA()) {
assertionError("zero gasPerPubdataByte")
}
<!-- @endif -->
// <!-- @if BOOTLOADER_TYPE=='proved_batch' -->
// if and(iszero(gasPerPubdataByte), FORBID_ZERO_GAS_PER_PUBDATA()) {
// assertionError("zero gasPerPubdataByte")
// }
// <!-- @endif -->

ret := max(ret, overheadForSlot)
}

/// @dev A method where all panics in the nearCalls get to.
Expand Down
Loading