Skip to content

Commit

Permalink
Change env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jorbush committed Feb 2, 2024
1 parent 99acb01 commit 94c0c3f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
6 changes: 3 additions & 3 deletions etc/env/base/chain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ compute_overhead_part=0.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

# 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
Expand All @@ -68,14 +68,14 @@ 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

# The version of the fee model to use.
# 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.
# Also, the fair L2 gas price is expected to only include the proving/computation price for the operator and not the costs that come from
# processing the batch on L1.
# - `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
1 change: 1 addition & 0 deletions etc/env/base/eth_sender.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ pricing_formula_parameter_b=1.0005
internal_l1_pricing_multiplier=0.8
# Node polling period in seconds.
poll_period=5
# internal_enforced_l1_gas_price = 45_000_000_000
24 changes: 24 additions & 0 deletions infrastructure/zk/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,30 @@ export async function init(initArgs: InitArgs = DEFAULT_ARGS) {
fs.writeFileSync(process.env.ENV_FILE!, envFileContent);
await announced(`Initializing in ${validiumMode ? 'Validium mode' : 'Roll-up mode'}`);

const filePath = 'etc/env/base/chain.toml';
const paramName = {
pubdata_overhead_part: validiumMode ? 0.0 : 1.0,
batch_overhead_l1_gas: validiumMode ? 1000000 : 800000,
max_pubdata_per_batch: validiumMode ? 1000000000000 : 100000
};

let tomlContent = fs.readFileSync(filePath, 'utf-8');
const lines = tomlContent.split('\n');

for (let i = 0; i < lines.length; i++) {
const line = lines[i];
for (const [key, value] of Object.entries(paramName)) {
if (line.includes(`${key}=`)) {
lines[i] = `${key}=${value}`;
break;
}
}
}
tomlContent = lines.join('\n');
fs.writeFileSync(filePath, tomlContent);

console.log(`The parameters have been updated in the ${filePath} file.`);

if (!process.env.CI && !skipEnvSetup) {
await announced('Pulling images', docker.pull());
await announced('Checking environment', checkEnv());
Expand Down

0 comments on commit 94c0c3f

Please sign in to comment.