diff --git a/core/lib/config/src/configs/api.rs b/core/lib/config/src/configs/api.rs index e039ab10116a..ca42cd5e5f8a 100644 --- a/core/lib/config/src/configs/api.rs +++ b/core/lib/config/src/configs/api.rs @@ -9,7 +9,7 @@ use std::{ use anyhow::Context as _; use serde::{de, Deserialize, Deserializer}; -use zksync_basic_types::{Address, H256}; +use zksync_basic_types::Address; pub use crate::configs::PrometheusConfig; @@ -165,10 +165,6 @@ pub struct Web3JsonRpcConfig { /// The multiplier to use when suggesting gas price. Should be higher than one, /// otherwise if the L1 prices soar, the suggested gas price won't be sufficient to be included in block pub gas_price_scale_factor: f64, - /// Timeout for requests (in s) - pub request_timeout: Option, - /// Private keys for accounts managed by node - pub account_pks: Option>, /// The factor by which to scale the gasLimit pub estimate_gas_scale_factor: f64, /// The max possible number of gas that `eth_estimateGas` is allowed to overestimate. @@ -239,8 +235,6 @@ impl Web3JsonRpcConfig { pubsub_polling_interval: Some(200), max_nonce_ahead: 50, gas_price_scale_factor: 1.2, - request_timeout: Default::default(), - account_pks: Default::default(), estimate_gas_scale_factor: 1.2, estimate_gas_acceptable_overestimation: 1000, max_tx_size: 1000000, @@ -287,14 +281,6 @@ impl Web3JsonRpcConfig { Duration::from_millis(self.pubsub_polling_interval.unwrap_or(200)) } - pub fn request_timeout(&self) -> Duration { - Duration::from_secs(self.request_timeout.unwrap_or(10)) - } - - pub fn account_pks(&self) -> Vec { - self.account_pks.clone().unwrap_or_default() - } - pub fn vm_concurrency_limit(&self) -> usize { // The default limit is large so that it does not create a bottleneck on its own. // VM execution can still be limited by Tokio runtime parallelism and/or the number diff --git a/core/lib/config/src/testonly.rs b/core/lib/config/src/testonly.rs index f3d6b98491be..3957991f0a15 100644 --- a/core/lib/config/src/testonly.rs +++ b/core/lib/config/src/testonly.rs @@ -68,8 +68,6 @@ impl Distribution for EncodeDist { pubsub_polling_interval: self.sample(rng), max_nonce_ahead: self.sample(rng), gas_price_scale_factor: self.sample(rng), - request_timeout: self.sample_opt(|| self.sample(rng)), - account_pks: self.sample_opt(|| self.sample_range(rng).map(|_| rng.gen()).collect()), estimate_gas_scale_factor: self.sample(rng), estimate_gas_acceptable_overestimation: self.sample(rng), max_tx_size: self.sample(rng), diff --git a/core/lib/env_config/src/api.rs b/core/lib/env_config/src/api.rs index 64d8696f50bb..c6485d54d6b0 100644 --- a/core/lib/env_config/src/api.rs +++ b/core/lib/env_config/src/api.rs @@ -49,7 +49,7 @@ mod tests { use std::num::{NonZeroU32, NonZeroUsize}; use super::*; - use crate::test_utils::{addr, hash, EnvMutex}; + use crate::test_utils::{addr, EnvMutex}; static MUTEX: EnvMutex = EnvMutex::new(); @@ -66,11 +66,6 @@ mod tests { subscriptions_limit: Some(10000), pubsub_polling_interval: Some(200), max_nonce_ahead: 5, - request_timeout: Some(10), - account_pks: Some(vec![ - hash("0x0000000000000000000000000000000000000000000000000000000000000001"), - hash("0x0000000000000000000000000000000000000000000000000000000000000002"), - ]), estimate_gas_scale_factor: 1.0f64, gas_price_scale_factor: 1.2, estimate_gas_acceptable_overestimation: 1000, @@ -130,10 +125,8 @@ mod tests { API_WEB3_JSON_RPC_PUBSUB_POLLING_INTERVAL=200 API_WEB3_JSON_RPC_MAX_NONCE_AHEAD=5 API_WEB3_JSON_RPC_GAS_PRICE_SCALE_FACTOR=1.2 - API_WEB3_JSON_RPC_REQUEST_TIMEOUT=10 API_WEB3_JSON_RPC_API_NAMESPACES=debug API_WEB3_JSON_RPC_EXTENDED_API_TRACING=true - API_WEB3_JSON_RPC_ACCOUNT_PKS="0x0000000000000000000000000000000000000000000000000000000000000001,0x0000000000000000000000000000000000000000000000000000000000000002" API_WEB3_JSON_RPC_WHITELISTED_TOKENS_FOR_AA="0x0000000000000000000000000000000000000001,0x0000000000000000000000000000000000000002" API_WEB3_JSON_RPC_ESTIMATE_GAS_SCALE_FACTOR=1.0 API_WEB3_JSON_RPC_ESTIMATE_GAS_ACCEPTABLE_OVERESTIMATION=1000 diff --git a/core/lib/protobuf_config/src/api.rs b/core/lib/protobuf_config/src/api.rs index 4eac849773f3..f4718c9f7960 100644 --- a/core/lib/protobuf_config/src/api.rs +++ b/core/lib/protobuf_config/src/api.rs @@ -7,7 +7,7 @@ use zksync_protobuf::{ required, }; -use crate::{parse_h160, parse_h256, proto::api as proto}; +use crate::{parse_h160, proto::api as proto}; impl ProtoRepr for proto::Api { type Type = ApiConfig; @@ -34,19 +34,6 @@ impl ProtoRepr for proto::Web3JsonRpc { type Type = api::Web3JsonRpcConfig; fn read(&self) -> anyhow::Result { - let account_pks = self - .account_pks - .iter() - .enumerate() - .map(|(i, k)| parse_h256(k).context(i)) - .collect::, _>>() - .context("account_pks")?; - let account_pks = if account_pks.is_empty() { - None - } else { - Some(account_pks) - }; - let max_response_body_size_overrides_mb = self .max_response_body_size_overrides .iter() @@ -91,8 +78,6 @@ impl ProtoRepr for proto::Web3JsonRpc { max_nonce_ahead: *required(&self.max_nonce_ahead).context("max_nonce_ahead")?, gas_price_scale_factor: *required(&self.gas_price_scale_factor) .context("gas_price_scale_factor")?, - request_timeout: self.request_timeout, - account_pks, estimate_gas_scale_factor: *required(&self.estimate_gas_scale_factor) .context("estimate_gas_scale_factor")?, estimate_gas_acceptable_overestimation: *required( @@ -157,7 +142,7 @@ impl ProtoRepr for proto::Web3JsonRpc { .enumerate() .map(|(i, k)| parse_h160(k).context(i)) .collect::, _>>() - .context("account_pks")?, + .context("whitelisted_tokens_for_aa")?, extended_api_tracing: self.extended_api_tracing.unwrap_or_default(), api_namespaces, }) @@ -178,12 +163,6 @@ impl ProtoRepr for proto::Web3JsonRpc { pubsub_polling_interval: this.pubsub_polling_interval, max_nonce_ahead: Some(this.max_nonce_ahead), gas_price_scale_factor: Some(this.gas_price_scale_factor), - request_timeout: this.request_timeout, - account_pks: this - .account_pks - .as_ref() - .map(|keys| keys.iter().map(|k| format!("{:?}", k)).collect()) - .unwrap_or_default(), estimate_gas_scale_factor: Some(this.estimate_gas_scale_factor), estimate_gas_acceptable_overestimation: Some( this.estimate_gas_acceptable_overestimation, diff --git a/core/lib/protobuf_config/src/proto/config/api.proto b/core/lib/protobuf_config/src/proto/config/api.proto index 4fea0691f79d..e08677adc445 100644 --- a/core/lib/protobuf_config/src/proto/config/api.proto +++ b/core/lib/protobuf_config/src/proto/config/api.proto @@ -20,8 +20,6 @@ message Web3JsonRpc { optional uint64 pubsub_polling_interval = 8; // optional optional uint32 max_nonce_ahead = 9; // required optional double gas_price_scale_factor = 10; // required - optional uint64 request_timeout = 11; // seconds - repeated string account_pks = 12; // optional optional double estimate_gas_scale_factor = 13; // required optional uint32 estimate_gas_acceptable_overestimation = 14; // required optional uint64 max_tx_size = 16; // required; B @@ -43,6 +41,8 @@ message Web3JsonRpc { repeated string api_namespaces = 32; // Optional, if empty all namespaces are available optional bool extended_api_tracing = 33; // optional, default false reserved 15; reserved "l1_to_l2_transactions_compatibility_mode"; + reserved 11; reserved "request_timeout"; + reserved 12; reserved "account_pks"; } diff --git a/core/tests/ts-integration/tests/contracts.test.ts b/core/tests/ts-integration/tests/contracts.test.ts index e22385a1b278..8b0bd347ce78 100644 --- a/core/tests/ts-integration/tests/contracts.test.ts +++ b/core/tests/ts-integration/tests/contracts.test.ts @@ -74,7 +74,7 @@ describe('Smart contract behavior checks', () => { const expensiveContract = await deployContract(alice, contracts.expensive, []); // First, check that the transaction that is too expensive would be rejected by the API server. - await expect(expensiveContract.expensive(3000)).toBeRejected(); + await expect(expensiveContract.expensive(15000)).toBeRejected(); // Second, check that processable transaction may fail with "out of gas" error. // To do so, we estimate gas for arg "1" and supply it to arg "20". diff --git a/etc/env/base/api.toml b/etc/env/base/api.toml index c8e0050ac310..126dcfd7d4dd 100644 --- a/etc/env/base/api.toml +++ b/etc/env/base/api.toml @@ -18,29 +18,6 @@ pubsub_polling_interval = 200 threads_per_server = 128 max_nonce_ahead = 50 gas_price_scale_factor = 1.2 -request_timeout = 10 -account_pks = [ - "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", - "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d", - "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a", - "0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6", - "0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a", - "0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba", - "0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e", - "0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356", - "0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97", - "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6", - "0xf214f2b2cd398c806f84e317254e0f0b801d0643303237d97a22a48e01628897", - "0x701b615bbdfb9de65240bc28bd21bbc0d996645a3dd57e7b12bc2bdf6f192c82", - "0xa267530f49f8280200edf313ee7af6b827f2a8bce2897751d06a843f644967b1", - "0x47c99abed3324a2707c28affff1267e45918ec8c3f20b8aa892e8b065d2942dd", - "0xc526ee95bf44d8fc405a158bb884d9d1238d99f0612e9f33d006bb0789009aaa", - "0x8166f546bab6da521a8369cab06c5d2b9e46670292d85c875ee9ec20e84ffb61", - "0xea6c44ac03bff858b476bba40716402b03e41b8e97e276d1baec7c37d42484a0", - "0x689af8efa8c651a91ad287602527f3af2fe9f6501a7ac4b061667b5a93e037fd", - "0xde9be858da4a475276426320d5e9262ecfc3ba460bfac56360bfa6c4c28b4ee0", - "0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e" -] estimate_gas_scale_factor = 1.2 estimate_gas_acceptable_overestimation = 1000 max_tx_size = 1000000 diff --git a/etc/env/file_based/general.yaml b/etc/env/file_based/general.yaml index 059b993d326b..d0a07b64b3ff 100644 --- a/etc/env/file_based/general.yaml +++ b/etc/env/file_based/general.yaml @@ -7,11 +7,11 @@ postgres: db: state_keeper_db_path: ./db/main/state_keeper merkle_tree: - multi_get_chunk_size: 1000 - block_cache_size_mb: 32 - memtable_capacity_mb: 512 - stalled_writes_timeout_sec: 50 - max_l1_batches_per_iter: 50 + multi_get_chunk_size: 500 + block_cache_size_mb: 128 + memtable_capacity_mb: 256 + stalled_writes_timeout_sec: 60 + max_l1_batches_per_iter: 20 path: "./db/main/tree" mode: FULL experimental: @@ -36,46 +36,20 @@ api: filters_limit: 10000 subscriptions_limit: 10000 pubsub_polling_interval: 200 - max_nonce_ahead: 50 - gas_price_scale_factor: 1.2 - request_timeout: 10 - account_pks: - - 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 - - 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d - - 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a - - 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 - - 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a - - 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba - - 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e - - 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356 - - 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 - - 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 - - 0xf214f2b2cd398c806f84e317254e0f0b801d0643303237d97a22a48e01628897 - - 0x701b615bbdfb9de65240bc28bd21bbc0d996645a3dd57e7b12bc2bdf6f192c82 - - 0xa267530f49f8280200edf313ee7af6b827f2a8bce2897751d06a843f644967b1 - - 0x47c99abed3324a2707c28affff1267e45918ec8c3f20b8aa892e8b065d2942dd - - 0xc526ee95bf44d8fc405a158bb884d9d1238d99f0612e9f33d006bb0789009aaa - - 0x8166f546bab6da521a8369cab06c5d2b9e46670292d85c875ee9ec20e84ffb61 - - 0xea6c44ac03bff858b476bba40716402b03e41b8e97e276d1baec7c37d42484a0 - - 0x689af8efa8c651a91ad287602527f3af2fe9f6501a7ac4b061667b5a93e037fd - - 0xde9be858da4a475276426320d5e9262ecfc3ba460bfac56360bfa6c4c28b4ee0 - - 0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e - estimate_gas_scale_factor: 1.2 - estimate_gas_acceptable_overestimation: 1000 + max_nonce_ahead: 20 + gas_price_scale_factor: 1.5 + estimate_gas_scale_factor: 1.3 + estimate_gas_acceptable_overestimation: 5000 max_tx_size: 1000000 api_namespaces: [en,eth,net,web3,zks,pubsub,debug] - max_response_body_size_overrides: - - method: eth_getTransactionReceipt # no size specified, meaning no size limit - - method: zks_getProof - size_mb: 64 state_keeper: - transaction_slots: 250 - max_allowed_l2_tx_gas_limit: 4000000000 + transaction_slots: 8192 + max_allowed_l2_tx_gas_limit: 15000000000 block_commit_deadline_ms: 2500 miniblock_commit_deadline_ms: 1000 miniblock_seal_queue_capacity: 10 miniblock_max_payload_size: 1000000 - max_single_tx_gas: 6000000 + max_single_tx_gas: 15000000 close_block_at_geometry_percentage: 0.95 close_block_at_eth_params_percentage: 0.95 close_block_at_gas_percentage: 0.95 @@ -87,24 +61,24 @@ state_keeper: pubdata_overhead_part: 1 batch_overhead_l1_gas: 800000 max_gas_per_batch: 200000000 - max_pubdata_per_batch: 100000 - fee_model_version: V1 + max_pubdata_per_batch: 500000 + fee_model_version: V2 validation_computational_gas_limit: 300000 save_call_traces: true - max_circuits_per_batch: 24100 + max_circuits_per_batch: 31100 protective_reads_persistence_enabled: true mempool: delay_interval: 100 sync_interval_ms: 10 sync_batch_size: 1000 capacity: 10000000 - stuck_tx_timeout: 86400 + stuck_tx_timeout: 172800 remove_stuck_txs: true operations_manager: delay_interval: 100 contract_verifier: - compilation_timeout: 30 + compilation_timeout: 240 polling_interval: 1000 prometheus_port: 3314 port: 3070 @@ -112,8 +86,8 @@ contract_verifier: threads_per_server: 128 circuit_breaker: - sync_interval_ms: 30000 - http_req_max_retry_number: 5 + sync_interval_ms: 120000 + http_req_max_retry_number: 10 replication_lag_limit_sec: 100 http_req_retry_interval_sec: 2 eth: @@ -124,21 +98,21 @@ eth: max_txs_in_flight: 30 proof_sending_mode: SKIP_EVERY_PROOF max_aggregated_blocks_to_commit: 1 - max_aggregated_blocks_to_execute: 10 + max_aggregated_blocks_to_execute: 45 aggregated_block_commit_deadline: 1 aggregated_block_prove_deadline: 10 aggregated_block_execute_deadline: 10 timestamp_criteria_max_allowed_lag: 30 max_eth_tx_data_size: 120000 aggregated_proof_sizes: [1] - max_aggregated_tx_gas: 4000000 + max_aggregated_tx_gas: 15000000 max_acceptable_priority_fee_in_gwei: 100000000000 pubdata_sending_mode: BLOBS gas_adjuster: default_priority_fee_per_gas: 1000000000 - max_base_fee_samples: 10000 + max_base_fee_samples: 100 pricing_formula_parameter_a: 1.5 - pricing_formula_parameter_b: 1.0005 + pricing_formula_parameter_b: 1.001 internal_l1_pricing_multiplier: 0.8 num_samples_for_blob_base_fee_estimate: 10 internal_pubdata_pricing_multiplier: 1.0 diff --git a/etc/env/file_based/overrides/mainnet/general.yaml b/etc/env/file_based/overrides/mainnet/general.yaml new file mode 100644 index 000000000000..7abe8eb54725 --- /dev/null +++ b/etc/env/file_based/overrides/mainnet/general.yaml @@ -0,0 +1,21 @@ +state_keeper: + block_commit_deadline_ms: 3600000 + minimal_l2_gas_price: 45250000 +eth: + sender: + tx_poll_period: 20 + aggregate_tx_poll_period: 2 + max_txs_in_flight: 100 + aggregated_block_commit_deadline: 300 + aggregated_block_prove_deadline: 300 + aggregated_block_execute_deadline: 300 + timestamp_criteria_max_allowed_lag: 104000 # 29h + gas_adjuster: + pricing_formula_parameter_a: 1.06 + internal_l1_pricing_multiplier: 1 + internal_pubdata_pricing_multiplier: 1.50 + poll_period: 60 +observability: + log_directives: zksync=info,zksync_state_keeper=debug,zksync_core=debug,zksync_server=debug,zksync_contract_verifier=debug,zksync_dal=debug,zksync_state=debug,zksync_utils=debug,zksync_eth_sender=debug,loadnext=debug,dev_ticker=info,vm=info,block_sizes_test=info,setup_key_generator_and_server=info,zksync_queued_job_processor=debug,slot_index_consistency_checker=debug,zksync_health_check=debug,zksync_consensus_bft=debug,zksync_consensus_network=debug,zksync_consensus_storage=debug,zksync_consensus_executor=debug, + +# remove eth_sender_wait_confirmations, eth_watcher_confirmations_for_eth_event variables diff --git a/etc/env/file_based/overrides/testnet/general.yaml b/etc/env/file_based/overrides/testnet/general.yaml new file mode 100644 index 000000000000..43a62f3f0dd8 --- /dev/null +++ b/etc/env/file_based/overrides/testnet/general.yaml @@ -0,0 +1,22 @@ +state_keeper: + block_commit_deadline_ms: 3600000 + minimal_l2_gas_price: 25000000 +eth: + sender: + tx_poll_period: 20 + aggregate_tx_poll_period: 2 + max_txs_in_flight: 100 + aggregated_block_commit_deadline: 300 + aggregated_block_prove_deadline: 300 + aggregated_block_execute_deadline: 300 + timestamp_criteria_max_allowed_lag: 104000 # 29h + gas_adjuster: + pricing_formula_parameter_a: 1.1 + internal_l1_pricing_multiplier: 1 + poll_period: 60 + watcher: + confirmations_for_eth_event: 10 +observability: + log_directives: zksync=info,zksync_state_keeper=debug,zksync_core=debug,zksync_server=debug,zksync_contract_verifier=debug,zksync_dal=debug,zksync_state=debug,zksync_utils=debug,zksync_eth_sender=debug,loadnext=debug,dev_ticker=info,vm=info,block_sizes_test=info,setup_key_generator_and_server=info,zksync_queued_job_processor=debug,slot_index_consistency_checker=debug,zksync_health_check=debug,zksync_consensus_bft=debug,zksync_consensus_network=debug,zksync_consensus_storage=debug,zksync_consensus_executor=debug, + +# remove eth_sender_wait_confirmations variable diff --git a/zk_toolbox/crates/config/src/manipulations.rs b/zk_toolbox/crates/config/src/manipulations.rs index f0497a5ba671..885447c5b173 100644 --- a/zk_toolbox/crates/config/src/manipulations.rs +++ b/zk_toolbox/crates/config/src/manipulations.rs @@ -7,6 +7,10 @@ use crate::consts::{CONFIGS_PATH, WALLETS_FILE}; pub fn copy_configs(shell: &Shell, link_to_code: &Path, target_path: &Path) -> anyhow::Result<()> { let original_configs = link_to_code.join(CONFIGS_PATH); for file in shell.read_dir(original_configs)? { + if file.is_dir() { + continue; + } + if let Some(name) = file.file_name() { // Do not copy wallets file if name != WALLETS_FILE {