diff --git a/chain/chain/src/runtime/mod.rs b/chain/chain/src/runtime/mod.rs index 32847c922f2..1d292538219 100644 --- a/chain/chain/src/runtime/mod.rs +++ b/chain/chain/src/runtime/mod.rs @@ -700,7 +700,7 @@ impl RuntimeAdapter for NightshadeRuntime { time_limit: Option, ) -> Result { let start_time = std::time::Instant::now(); - let PrepareTransactionsChunkContext { shard_id, gas_limit } = chunk; + let PrepareTransactionsChunkContext { shard_id, gas_limit, .. } = chunk; let epoch_id = self.epoch_manager.get_epoch_id_from_prev_block(&prev_block.block_hash)?; let protocol_version = self.epoch_manager.get_epoch_protocol_version(&epoch_id)?; @@ -777,23 +777,19 @@ impl RuntimeAdapter for NightshadeRuntime { usize::MAX }; - // In general, we limit the number of transactions via send_fees. - // However, as a second line of defense, we want to limit the byte size - // of transaction as well. Rather than introducing a separate config for - // the limit, we compute it heuristically from the gas limit and the - // cost of roundtripping a byte of data through disk. For today's value - // of parameters, this corresponds to about 13megs worth of - // transactions. - let size_limit = transactions_gas_limit - / (runtime_config.wasm_config.ext_costs.gas_cost(ExtCosts::storage_write_value_byte) - + runtime_config.wasm_config.ext_costs.gas_cost(ExtCosts::storage_read_value_byte)); + let size_limit: u64 = calculate_transactions_size_limit( + protocol_version, + &runtime_config, + chunk.last_chunk_transactions_size, + transactions_gas_limit, + ); // for metrics only let mut rejected_due_to_congestion = 0; let mut rejected_invalid_tx = 0; let mut rejected_invalid_for_chain = 0; // Add new transactions to the result until some limit is hit or the transactions run out. - loop { + 'add_txs_loop: while let Some(transaction_group_iter) = transaction_groups.next() { if total_gas_burnt >= transactions_gas_limit { result.limited_by = Some(PrepareTransactionsLimit::Gas); break; @@ -820,71 +816,90 @@ impl RuntimeAdapter for NightshadeRuntime { } } - if let Some(iter) = transaction_groups.next() { - while let Some(tx) = iter.next() { - num_checked_transactions += 1; - - if ProtocolFeature::CongestionControl.enabled(protocol_version) { - let receiving_shard = EpochManagerAdapter::account_id_to_shard_id( - self.epoch_manager.as_ref(), - tx.transaction.receiver_id(), - &epoch_id, - )?; - if let Some(congestion_info) = - prev_block.congestion_info.get(&receiving_shard) - { - let congestion_control = CongestionControl::new( - runtime_config.congestion_control_config, - congestion_info.congestion_info, - congestion_info.missed_chunks_count, - ); - if !congestion_control.shard_accepts_transactions() { - tracing::trace!(target: "runtime", tx=?tx.get_hash(), "discarding transaction due to congestion"); - rejected_due_to_congestion += 1; - continue; - } + if checked_feature!("stable", WitnessTransactionLimits, protocol_version) + && state_update.trie.recorded_storage_size() + > runtime_config + .witness_config + .new_transactions_validation_state_size_soft_limit + { + result.limited_by = Some(PrepareTransactionsLimit::StorageProofSize); + break; + } + + // Take a single transaction from this transaction group + while let Some(tx_peek) = transaction_group_iter.peek_next() { + // Stop adding transactions if the size limit would be exceeded + if checked_feature!("stable", WitnessTransactionLimits, protocol_version) + && total_size.saturating_add(tx_peek.get_size()) > size_limit as u64 + { + result.limited_by = Some(PrepareTransactionsLimit::Size); + break 'add_txs_loop; + } + + // Take the transaction out of the pool + let tx = transaction_group_iter + .next() + .expect("peek_next() returned Some, so next() should return Some as well"); + num_checked_transactions += 1; + + if ProtocolFeature::CongestionControl.enabled(protocol_version) { + let receiving_shard = EpochManagerAdapter::account_id_to_shard_id( + self.epoch_manager.as_ref(), + tx.transaction.receiver_id(), + &epoch_id, + )?; + if let Some(congestion_info) = prev_block.congestion_info.get(&receiving_shard) + { + let congestion_control = CongestionControl::new( + runtime_config.congestion_control_config, + congestion_info.congestion_info, + congestion_info.missed_chunks_count, + ); + if !congestion_control.shard_accepts_transactions() { + tracing::trace!(target: "runtime", tx=?tx.get_hash(), "discarding transaction due to congestion"); + rejected_due_to_congestion += 1; + continue; } } + } - // Verifying the transaction is on the same chain and hasn't expired yet. - if !chain_validate(&tx) { - tracing::trace!(target: "runtime", tx=?tx.get_hash(), "discarding transaction that failed chain validation"); - rejected_invalid_for_chain += 1; - continue; - } + // Verifying the transaction is on the same chain and hasn't expired yet. + if !chain_validate(&tx) { + tracing::trace!(target: "runtime", tx=?tx.get_hash(), "discarding transaction that failed chain validation"); + rejected_invalid_for_chain += 1; + continue; + } - // Verifying the validity of the transaction based on the current state. - match verify_and_charge_transaction( - runtime_config, - &mut state_update, - prev_block.next_gas_price, - &tx, - false, - Some(next_block_height), - protocol_version, - ) { - Ok(verification_result) => { - tracing::trace!(target: "runtime", tx=?tx.get_hash(), "including transaction that passed validation"); - state_update.commit(StateChangeCause::NotWritableToDisk); - total_gas_burnt += verification_result.gas_burnt; - total_size += tx.get_size(); - result.transactions.push(tx); - break; - } - Err(RuntimeError::InvalidTxError(err)) => { - tracing::trace!(target: "runtime", tx=?tx.get_hash(), ?err, "discarding transaction that is invalid"); - rejected_invalid_tx += 1; - state_update.rollback(); - } - Err(RuntimeError::StorageError(err)) => { - tracing::trace!(target: "runtime", tx=?tx.get_hash(), ?err, "discarding transaction due to storage error"); - return Err(Error::StorageError(err)); - } - Err(err) => unreachable!("Unexpected RuntimeError error {:?}", err), + // Verifying the validity of the transaction based on the current state. + match verify_and_charge_transaction( + runtime_config, + &mut state_update, + prev_block.next_gas_price, + &tx, + false, + Some(next_block_height), + protocol_version, + ) { + Ok(verification_result) => { + tracing::trace!(target: "runtime", tx=?tx.get_hash(), "including transaction that passed validation"); + state_update.commit(StateChangeCause::NotWritableToDisk); + total_gas_burnt += verification_result.gas_burnt; + total_size += tx.get_size(); + result.transactions.push(tx); + // Take one transaction from this group, no more. + break; + } + Err(RuntimeError::InvalidTxError(err)) => { + tracing::trace!(target: "runtime", tx=?tx.get_hash(), ?err, "discarding transaction that is invalid"); + rejected_invalid_tx += 1; + state_update.rollback(); } + Err(RuntimeError::StorageError(err)) => { + tracing::trace!(target: "runtime", tx=?tx.get_hash(), ?err, "discarding transaction due to storage error"); + return Err(Error::StorageError(err)); + } + Err(err) => unreachable!("Unexpected RuntimeError error {:?}", err), } - } else { - break; } } debug!(target: "runtime", "Transaction filtering results {} valid out of {} pulled from the pool", result.transactions.len(), num_checked_transactions); @@ -1358,6 +1373,36 @@ fn chunk_tx_gas_limit( } } +fn calculate_transactions_size_limit( + protocol_version: ProtocolVersion, + runtime_config: &RuntimeConfig, + last_chunk_transactions_size: usize, + transactions_gas_limit: Gas, +) -> u64 { + if checked_feature!("stable", WitnessTransactionLimits, protocol_version) { + // Sum of transactions in the previous and current chunks should not exceed the limit. + // Witness keeps transactions from both previous and current chunk, so we have to limit the sum of both. + runtime_config + .witness_config + .combined_transactions_size_limit + .saturating_sub(last_chunk_transactions_size) + .try_into() + .expect("Can't convert usize to u64!") + } else { + // In general, we limit the number of transactions via send_fees. + // However, as a second line of defense, we want to limit the byte size + // of transaction as well. Rather than introducing a separate config for + // the limit, we compute it heuristically from the gas limit and the + // cost of roundtripping a byte of data through disk. For today's value + // of parameters, this corresponds to about 13megs worth of + // transactions. + let roundtripping_cost = + runtime_config.wasm_config.ext_costs.gas_cost(ExtCosts::storage_write_value_byte) + + runtime_config.wasm_config.ext_costs.gas_cost(ExtCosts::storage_read_value_byte); + transactions_gas_limit / roundtripping_cost + } +} + impl node_runtime::adapter::ViewRuntimeAdapter for NightshadeRuntime { fn view_account( &self, diff --git a/chain/chain/src/runtime/tests.rs b/chain/chain/src/runtime/tests.rs index 264b04d3a32..6fe397e41d2 100644 --- a/chain/chain/src/runtime/tests.rs +++ b/chain/chain/src/runtime/tests.rs @@ -1643,6 +1643,7 @@ fn prepare_transactions( PrepareTransactionsChunkContext { shard_id, gas_limit: env.runtime.genesis_config.gas_limit, + last_chunk_transactions_size: 0, }, PrepareTransactionsBlockContext { next_gas_price: env.runtime.genesis_config.min_gas_price, diff --git a/chain/chain/src/types.rs b/chain/chain/src/types.rs index 518ab248503..736b3279e33 100644 --- a/chain/chain/src/types.rs +++ b/chain/chain/src/types.rs @@ -19,7 +19,6 @@ use near_primitives::merkle::{merklize, MerklePath}; use near_primitives::receipt::{PromiseYieldTimeout, Receipt}; use near_primitives::sandbox::state_patch::SandboxStatePatch; use near_primitives::shard_layout::{ShardLayout, ShardUId}; -use near_primitives::sharding::ShardChunkHeader; use near_primitives::state_part::PartId; use near_primitives::transaction::{ExecutionOutcomeWithId, SignedTransaction}; use near_primitives::types::validator_stake::{ValidatorStake, ValidatorStakeIter}; @@ -343,6 +342,7 @@ pub enum PrepareTransactionsLimit { Size, Time, ReceiptCount, + StorageProofSize, } pub struct PrepareTransactionsBlockContext { @@ -366,12 +366,9 @@ impl From<&Block> for PrepareTransactionsBlockContext { pub struct PrepareTransactionsChunkContext { pub shard_id: ShardId, pub gas_limit: Gas, -} - -impl From<&ShardChunkHeader> for PrepareTransactionsChunkContext { - fn from(header: &ShardChunkHeader) -> Self { - Self { shard_id: header.shard_id(), gas_limit: header.gas_limit() } - } + /// Size of transactions added in the last existing chunk. + /// Used to calculate the allowed size of transactions in a newly produced chunk. + pub last_chunk_transactions_size: usize, } /// Bridge between the chain and the runtime. diff --git a/chain/client/src/client.rs b/chain/client/src/client.rs index c3f789251e4..73740362752 100644 --- a/chain/client/src/client.rs +++ b/chain/client/src/client.rs @@ -76,11 +76,11 @@ use near_primitives::sharding::{ use near_primitives::transaction::SignedTransaction; use near_primitives::types::chunk_extra::ChunkExtra; use near_primitives::types::{AccountId, ApprovalStake, BlockHeight, EpochId, NumBlocks, ShardId}; -use near_primitives::unwrap_or_return; use near_primitives::utils::MaybeValidated; use near_primitives::validator_signer::ValidatorSigner; use near_primitives::version::PROTOCOL_VERSION; use near_primitives::views::{CatchupStatusView, DroppedReason}; +use near_primitives::{checked_feature, unwrap_or_return}; use near_store::ShardUId; use reed_solomon_erasure::galois_8::ReedSolomon; use std::cmp::max; @@ -898,8 +898,17 @@ impl Client { .get_chunk_extra(&prev_block_hash, &shard_uid) .map_err(|err| Error::ChunkProducer(format!("No chunk extra available: {}", err)))?; + let prev_shard_id = self.epoch_manager.get_prev_shard_id(prev_block.hash(), shard_id)?; + let last_chunk_header = + prev_block.chunks().get(prev_shard_id as usize).cloned().ok_or_else(|| { + Error::ChunkProducer(format!( + "No last chunk in prev_block_hash {:?}, prev_shard_id: {}", + prev_block_hash, prev_shard_id + )) + })?; + let last_chunk = self.chain.get_chunk(&last_chunk_header.chunk_hash())?; let prepared_transactions = - self.prepare_transactions(shard_uid, prev_block, chunk_extra.as_ref())?; + self.prepare_transactions(shard_uid, prev_block, &last_chunk, chunk_extra.as_ref())?; #[cfg(feature = "test_features")] let prepared_transactions = Self::maybe_insert_invalid_transaction( prepared_transactions, @@ -1027,11 +1036,11 @@ impl Client { &mut self, shard_uid: ShardUId, prev_block: &Block, + last_chunk: &ShardChunk, chunk_extra: &ChunkExtra, ) -> Result { let Self { chain, sharded_tx_pool, runtime_adapter: runtime, .. } = self; let shard_id = shard_uid.shard_id as ShardId; - let prepared_transactions = if let Some(mut iter) = sharded_tx_pool.get_pool_iterator(shard_uid) { @@ -1041,9 +1050,25 @@ impl Client { source: StorageDataSource::Db, state_patch: Default::default(), }; + let epoch_id = self.epoch_manager.get_epoch_id_from_prev_block(&prev_block.hash())?; + let protocol_version = self.epoch_manager.get_epoch_protocol_version(&epoch_id)?; + let last_chunk_transactions_size = + if checked_feature!("stable", WitnessTransactionLimits, protocol_version) { + borsh::to_vec(last_chunk.transactions()) + .map_err(|e| { + Error::ChunkProducer(format!("Failed to serialize transactions: {e}")) + })? + .len() + } else { + 0 + }; runtime.prepare_transactions( storage_config, - PrepareTransactionsChunkContext { shard_id, gas_limit: chunk_extra.gas_limit() }, + PrepareTransactionsChunkContext { + shard_id, + gas_limit: chunk_extra.gas_limit(), + last_chunk_transactions_size, + }, prev_block.into(), &mut iter, &mut chain.transaction_validity_check(prev_block.header().clone()), diff --git a/chain/client/src/stateless_validation/chunk_validator/mod.rs b/chain/client/src/stateless_validation/chunk_validator/mod.rs index 0cc9197d485..999d05feaaf 100644 --- a/chain/client/src/stateless_validation/chunk_validator/mod.rs +++ b/chain/client/src/stateless_validation/chunk_validator/mod.rs @@ -14,8 +14,8 @@ use near_chain::chain::{ }; use near_chain::sharding::shuffle_receipt_proofs; use near_chain::types::{ - ApplyChunkBlockContext, ApplyChunkResult, PreparedTransactions, RuntimeAdapter, - RuntimeStorageConfig, StorageDataSource, + ApplyChunkBlockContext, ApplyChunkResult, PrepareTransactionsChunkContext, + PreparedTransactions, RuntimeAdapter, RuntimeStorageConfig, StorageDataSource, }; use near_chain::validate::{ validate_chunk_with_chunk_extra, validate_chunk_with_chunk_extra_and_receipts_root, @@ -216,12 +216,17 @@ pub(crate) fn validate_prepared_transactions( chunk_header: &ShardChunkHeader, storage_config: RuntimeStorageConfig, transactions: &[SignedTransaction], + last_chunk_transactions: &[SignedTransaction], ) -> Result { let parent_block = chain.chain_store().get_block(chunk_header.prev_block_hash())?; - + let last_chunk_transactions_size = borsh::to_vec(last_chunk_transactions)?.len(); runtime_adapter.prepare_transactions( storage_config, - chunk_header.into(), + PrepareTransactionsChunkContext { + shard_id: chunk_header.shard_id(), + gas_limit: chunk_header.gas_limit(), + last_chunk_transactions_size, + }, (&parent_block).into(), &mut TransactionGroupIteratorWrapper::new(transactions), &mut chain.transaction_validity_check(parent_block.header().clone()), @@ -321,6 +326,7 @@ pub(crate) fn pre_validate_chunk_state_witness( &state_witness.chunk_header, transactions_validation_storage_config, &new_transactions, + &state_witness.transactions, ) { Ok(result) => { if result.transactions.len() != new_transactions.len() { diff --git a/chain/client/src/stateless_validation/shadow_validate.rs b/chain/client/src/stateless_validation/shadow_validate.rs index 34e1428227d..9c9af834788 100644 --- a/chain/client/src/stateless_validation/shadow_validate.rs +++ b/chain/client/src/stateless_validation/shadow_validate.rs @@ -53,6 +53,7 @@ impl Client { let shard_id = chunk.shard_id(); let chunk_hash = chunk.chunk_hash(); let chunk_header = chunk.cloned_header(); + let last_chunk = self.chain.get_chunk(&prev_chunk_header.chunk_hash())?; let transactions_validation_storage_config = RuntimeStorageConfig { state_root: chunk_header.prev_state_root(), @@ -69,6 +70,7 @@ impl Client { &chunk_header, transactions_validation_storage_config, chunk.transactions(), + last_chunk.transactions(), ) else { return Err(Error::Other( "Could not produce storage proof for new transactions".to_owned(), diff --git a/chain/pool/src/types.rs b/chain/pool/src/types.rs index d92640090fa..f79cfb346d3 100644 --- a/chain/pool/src/types.rs +++ b/chain/pool/src/types.rs @@ -36,4 +36,8 @@ impl TransactionGroup { None } } + + pub fn peek_next(&self) -> Option<&SignedTransaction> { + self.transactions.last() + } } diff --git a/core/parameters/res/runtime_configs/83.yaml b/core/parameters/res/runtime_configs/83.yaml index 0c0b089e043..a38e7147055 100644 --- a/core/parameters/res/runtime_configs/83.yaml +++ b/core/parameters/res/runtime_configs/83.yaml @@ -1 +1 @@ -storage_proof_size_soft_limit: {old: 999_999_999_999_999, new: 16_000_000} \ No newline at end of file +main_storage_proof_size_soft_limit: {old: 999_999_999_999_999, new: 16_000_000} \ No newline at end of file diff --git a/core/parameters/res/runtime_configs/85.yaml b/core/parameters/res/runtime_configs/85.yaml index bbd74ec65ba..62cf672bd54 100644 --- a/core/parameters/res/runtime_configs/85.yaml +++ b/core/parameters/res/runtime_configs/85.yaml @@ -1,2 +1,2 @@ -storage_proof_size_receipt_limit: {old: 999_999_999_999_999, new: 4_000_000} -storage_proof_size_soft_limit: {old: 16_000_000, new: 3_000_000} \ No newline at end of file +per_receipt_storage_proof_size_limit: {old: 999_999_999_999_999, new: 4_000_000} +main_storage_proof_size_soft_limit: {old: 16_000_000, new: 3_000_000} \ No newline at end of file diff --git a/core/parameters/res/runtime_configs/87.yaml b/core/parameters/res/runtime_configs/87.yaml new file mode 100644 index 00000000000..371da175240 --- /dev/null +++ b/core/parameters/res/runtime_configs/87.yaml @@ -0,0 +1,3 @@ +max_transaction_size: {old: 4_194_304, new: 1_572_864} +combined_transactions_size_limit: {old: 999_999_999_999_999, new: 2_097_152} +new_transactions_validation_state_size_soft_limit: {old: 999_999_999_999_999, new: 572_864} diff --git a/core/parameters/res/runtime_configs/parameters.snap b/core/parameters/res/runtime_configs/parameters.snap index 89248b9ac11..22bf854c843 100644 --- a/core/parameters/res/runtime_configs/parameters.snap +++ b/core/parameters/res/runtime_configs/parameters.snap @@ -4,8 +4,10 @@ description: THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. --- burnt_gas_reward 3 / 10 pessimistic_gas_price_inflation 103 / 100 -storage_proof_size_soft_limit 999_999_999_999_999 -storage_proof_size_receipt_limit 999_999_999_999_999 +main_storage_proof_size_soft_limit 999_999_999_999_999 +per_receipt_storage_proof_size_limit 999_999_999_999_999 +new_transactions_validation_state_size_soft_limit 999_999_999_999_999 +combined_transactions_size_limit 999_999_999_999_999 min_allowed_top_level_account_length 65 registrar_account_id registrar storage_amount_per_byte 10000000000000000000 diff --git a/core/parameters/res/runtime_configs/parameters.yaml b/core/parameters/res/runtime_configs/parameters.yaml index 33ee094fa74..ecc9a76d3f1 100644 --- a/core/parameters/res/runtime_configs/parameters.yaml +++ b/core/parameters/res/runtime_configs/parameters.yaml @@ -13,8 +13,10 @@ pessimistic_gas_price_inflation: { } # Stateless validation config -storage_proof_size_soft_limit: 999_999_999_999_999 -storage_proof_size_receipt_limit: 999_999_999_999_999 +main_storage_proof_size_soft_limit: 999_999_999_999_999 +per_receipt_storage_proof_size_limit: 999_999_999_999_999 +combined_transactions_size_limit: 999_999_999_999_999 +new_transactions_validation_state_size_soft_limit: 999_999_999_999_999 # Account creation config min_allowed_top_level_account_length: 32 diff --git a/core/parameters/res/runtime_configs/parameters_testnet.yaml b/core/parameters/res/runtime_configs/parameters_testnet.yaml index 8a4f784f365..9415eb3b836 100644 --- a/core/parameters/res/runtime_configs/parameters_testnet.yaml +++ b/core/parameters/res/runtime_configs/parameters_testnet.yaml @@ -9,8 +9,10 @@ pessimistic_gas_price_inflation: { } # Stateless validation config -storage_proof_size_soft_limit: 999_999_999_999_999 -storage_proof_size_receipt_limit: 999_999_999_999_999 +main_storage_proof_size_soft_limit: 999_999_999_999_999 +per_receipt_storage_proof_size_limit: 999_999_999_999_999 +combined_transactions_size_limit: 999_999_999_999_999 +new_transactions_validation_state_size_soft_limit: 999_999_999_999_999 # Account creation config min_allowed_top_level_account_length: 0 diff --git a/core/parameters/src/config.rs b/core/parameters/src/config.rs index 01d15b1443c..6149583d4a1 100644 --- a/core/parameters/src/config.rs +++ b/core/parameters/src/config.rs @@ -27,10 +27,10 @@ pub struct RuntimeConfig { pub wasm_config: crate::vm::Config, /// Config that defines rules for account creation. pub account_creation_config: AccountCreationConfig, - /// The maximum size of the storage proof in state witness after which we defer execution of any new receipts. - pub storage_proof_size_soft_limit: usize, /// The configuration for congestion control. pub congestion_control_config: CongestionControlConfig, + /// Configuration specific to ChunkStateWitness. + pub witness_config: WitnessConfig, } impl RuntimeConfig { @@ -57,8 +57,8 @@ impl RuntimeConfig { fees: RuntimeFeesConfig::test(), wasm_config, account_creation_config: AccountCreationConfig::default(), - storage_proof_size_soft_limit: usize::MAX, congestion_control_config: runtime_config.congestion_control_config, + witness_config: runtime_config.witness_config, } } @@ -73,8 +73,8 @@ impl RuntimeConfig { fees: RuntimeFeesConfig::free(), wasm_config, account_creation_config: AccountCreationConfig::default(), - storage_proof_size_soft_limit: usize::MAX, congestion_control_config: runtime_config.congestion_control_config, + witness_config: runtime_config.witness_config, } } @@ -208,3 +208,17 @@ impl CongestionControlConfig { } } } + +/// Configuration specific to ChunkStateWitness. +#[derive(Debug, Copy, Clone, PartialEq)] +pub struct WitnessConfig { + /// Size limit for storage proof generated while executing receipts in a chunk. + /// After this limit is reached we defer execution of any new receipts. + pub main_storage_proof_size_soft_limit: usize, + /// Maximum size of transactions contained inside ChunkStateWitness. + /// A witness contains transactions from both the previous chunk and the current one. + /// This parameter limits the sum of sizes of transactions from both of those chunks. + pub combined_transactions_size_limit: usize, + /// Soft size limit of storage proof used to validate new transactions in ChunkStateWitness. + pub new_transactions_validation_state_size_soft_limit: usize, +} diff --git a/core/parameters/src/config_store.rs b/core/parameters/src/config_store.rs index 7d027d42f38..1ae2d50c2e8 100644 --- a/core/parameters/src/config_store.rs +++ b/core/parameters/src/config_store.rs @@ -41,6 +41,7 @@ static CONFIG_DIFFS: &[(ProtocolVersion, &str)] = &[ (67, include_config!("67.yaml")), (83, include_config!("83.yaml")), (85, include_config!("85.yaml")), + (87, include_config!("87.yaml")), (129, include_config!("129.yaml")), // Introduce ETH-implicit accounts. (138, include_config!("138.yaml")), diff --git a/core/parameters/src/parameter.rs b/core/parameters/src/parameter.rs index d1232412dd5..87e37cbdffe 100644 --- a/core/parameters/src/parameter.rs +++ b/core/parameters/src/parameter.rs @@ -20,10 +20,18 @@ pub enum Parameter { BurntGasReward, PessimisticGasPriceInflation, - // Stateless validation config - StorageProofSizeSoftLimit, - // Hard per-receipt limit of recorded trie storage proof - StorageProofSizeReceiptLimit, + /// Stateless validation config + /// Size limit for storage proof generated while executing receipts in a chunk. + /// After this limit is reached we defer execution of any new receipts. + MainStorageProofSizeSoftLimit, + /// Hard limit on the size of storage proof generated while executing a single receipt. + PerReceiptStorageProofSizeLimit, + /// Soft size limit of storage proof used to validate new transactions in ChunkStateWitness. + NewTransactionsValidationStateSizeSoftLimit, + /// Maximum size of transactions contained inside ChunkStateWitness. + /// A witness contains transactions from both the previous chunk and the current one. + /// This parameter limits the sum of sizes of transactions from both of those chunks. + CombinedTransactionsSizeLimit, // Account creation config MinAllowedTopLevelAccountLength, @@ -249,7 +257,7 @@ impl Parameter { Parameter::AccountIdValidityRulesVersion, Parameter::YieldTimeoutLengthInBlocks, Parameter::MaxYieldPayloadSize, - Parameter::StorageProofSizeReceiptLimit, + Parameter::PerReceiptStorageProofSizeLimit, ] .iter() } diff --git a/core/parameters/src/parameter_table.rs b/core/parameters/src/parameter_table.rs index 063882dd491..e0adf1c7f3a 100644 --- a/core/parameters/src/parameter_table.rs +++ b/core/parameters/src/parameter_table.rs @@ -1,5 +1,5 @@ use super::config::{AccountCreationConfig, RuntimeConfig}; -use crate::config::CongestionControlConfig; +use crate::config::{CongestionControlConfig, WitnessConfig}; use crate::cost::{ ActionCosts, ExtCostsConfig, Fee, ParameterCost, RuntimeFeesConfig, StorageUsageConfig, }; @@ -333,8 +333,15 @@ impl TryFrom<&ParameterTable> for RuntimeConfig { .get(Parameter::MinAllowedTopLevelAccountLength)?, registrar_account_id: params.get(Parameter::RegistrarAccountId)?, }, - storage_proof_size_soft_limit: params.get(Parameter::StorageProofSizeSoftLimit)?, congestion_control_config: get_congestion_control_config(params)?, + witness_config: WitnessConfig { + main_storage_proof_size_soft_limit: params + .get(Parameter::MainStorageProofSizeSoftLimit)?, + combined_transactions_size_limit: params + .get(Parameter::CombinedTransactionsSizeLimit)?, + new_transactions_validation_state_size_soft_limit: params + .get(Parameter::NewTransactionsValidationStateSizeSoftLimit)?, + }, }) } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__0.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__0.json.snap index 9d43ed34cc6..98961be9369 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__0.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__0.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -215,11 +214,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__129.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__129.json.snap index ac0ec16da8b..53261bddf79 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__129.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__129.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 3000000 + ] }, "wasm_config": { "ext_costs": { @@ -206,7 +205,7 @@ expression: config_view "max_arguments_length": 4194304, "max_length_returned_data": 4194304, "max_contract_size": 4194304, - "max_transaction_size": 4194304, + "max_transaction_size": 1572864, "max_length_storage_key": 2048, "max_length_storage_value": 4194304, "max_promises_per_function_call_action": 1024, @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 4000000 + "per_receipt_storage_proof_size_limit": 4000000 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 3000000, + "combined_transactions_size_limit": 2097152, + "new_transactions_validation_state_size_soft_limit": 572864 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__138.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__138.json.snap index bb5d7b8ea62..156ed6e8718 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__138.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__138.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 3000000 + ] }, "wasm_config": { "ext_costs": { @@ -206,7 +205,7 @@ expression: config_view "max_arguments_length": 4194304, "max_length_returned_data": 4194304, "max_contract_size": 4194304, - "max_transaction_size": 4194304, + "max_transaction_size": 1572864, "max_length_storage_key": 2048, "max_length_storage_value": 4194304, "max_promises_per_function_call_action": 1024, @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 4000000 + "per_receipt_storage_proof_size_limit": 4000000 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 3000000, + "combined_transactions_size_limit": 2097152, + "new_transactions_validation_state_size_soft_limit": 572864 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__139.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__139.json.snap index bb5d7b8ea62..fb511a178c8 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__139.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__139.json.snap @@ -103,7 +103,9 @@ expression: config_view 103, 100 ], - "storage_proof_size_soft_limit": 3000000 + "main_storage_proof_size_soft_limit": 3000000, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 }, "wasm_config": { "ext_costs": { @@ -206,7 +208,7 @@ expression: config_view "max_arguments_length": 4194304, "max_length_returned_data": 4194304, "max_contract_size": 4194304, - "max_transaction_size": 4194304, + "max_transaction_size": 1572864, "max_length_storage_key": 2048, "max_length_storage_value": 4194304, "max_promises_per_function_call_action": 1024, @@ -217,7 +219,7 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 4000000 + "per_receipt_storage_proof_size_limit": 4000000 } }, "account_creation_config": { diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__142.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__142.json.snap index bb5d7b8ea62..156ed6e8718 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__142.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__142.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 3000000 + ] }, "wasm_config": { "ext_costs": { @@ -206,7 +205,7 @@ expression: config_view "max_arguments_length": 4194304, "max_length_returned_data": 4194304, "max_contract_size": 4194304, - "max_transaction_size": 4194304, + "max_transaction_size": 1572864, "max_length_storage_key": 2048, "max_length_storage_value": 4194304, "max_promises_per_function_call_action": 1024, @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 4000000 + "per_receipt_storage_proof_size_limit": 4000000 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 3000000, + "combined_transactions_size_limit": 2097152, + "new_transactions_validation_state_size_soft_limit": 572864 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__35.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__35.json.snap index 7750372684b..e5d9a1f9a26 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__35.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__35.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -215,11 +214,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__42.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__42.json.snap index 474b1bd2fd7..105a414dcd6 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__42.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__42.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -215,11 +214,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__46.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__46.json.snap index cdf4315e9ab..80f699ead57 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__46.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__46.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -215,11 +214,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__48.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__48.json.snap index ca9925e98cb..4a8e3c270a1 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__48.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__48.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -215,11 +214,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__49.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__49.json.snap index 148a5647dba..5075e5f38e4 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__49.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__49.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -216,11 +215,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__50.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__50.json.snap index 6cf18f26963..8a9285e51fd 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__50.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__50.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -216,11 +215,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__52.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__52.json.snap index 4f199d21a58..b1abdab3fae 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__52.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__52.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -216,11 +215,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__53.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__53.json.snap index a58d403c9b4..4101dfe863e 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__53.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__53.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__55.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__55.json.snap index c8003eeb81d..e6da32a2a96 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__55.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__55.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__57.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__57.json.snap index fcc8aecaf6b..51d09d69eb7 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__57.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__57.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__59.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__59.json.snap index 7f362eaf27b..72a1fe84822 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__59.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__59.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__61.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__61.json.snap index c288b69255f..170e148403b 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__61.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__61.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__62.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__62.json.snap index b65b313bdfd..eec8c5a7c2b 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__62.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__62.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__63.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__63.json.snap index 8b60a520037..961e67e7198 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__63.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__63.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__64.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__64.json.snap index c5ec27c1a62..e709f702a8d 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__64.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__64.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__66.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__66.json.snap index 48550a4faae..04bb62f7e1c 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__66.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__66.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__67.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__67.json.snap index 1663a04f129..ead0b9830ff 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__67.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__67.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__83.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__83.json.snap index 750af8c5be3..b7d4d565e0e 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__83.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__83.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 16000000 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 16000000, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__85.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__85.json.snap index 60349cb7759..9f43f2f2168 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__85.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__85.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 3000000 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 4000000 + "per_receipt_storage_proof_size_limit": 4000000 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 3000000, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__87.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__87.json.snap new file mode 100644 index 00000000000..8c90815cf02 --- /dev/null +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__87.json.snap @@ -0,0 +1,231 @@ +--- +source: core/parameters/src/config_store.rs +expression: config_view +--- +{ + "storage_amount_per_byte": "10000000000000000000", + "transaction_costs": { + "action_receipt_creation_config": { + "send_sir": 108059500000, + "send_not_sir": 108059500000, + "execution": 108059500000 + }, + "data_receipt_creation_config": { + "base_cost": { + "send_sir": 36486732312, + "send_not_sir": 36486732312, + "execution": 36486732312 + }, + "cost_per_byte": { + "send_sir": 17212011, + "send_not_sir": 17212011, + "execution": 17212011 + } + }, + "action_creation_config": { + "create_account_cost": { + "send_sir": 3850000000000, + "send_not_sir": 3850000000000, + "execution": 3850000000000 + }, + "deploy_contract_cost": { + "send_sir": 184765750000, + "send_not_sir": 184765750000, + "execution": 184765750000 + }, + "deploy_contract_cost_per_byte": { + "send_sir": 6812999, + "send_not_sir": 6812999, + "execution": 64572944 + }, + "function_call_cost": { + "send_sir": 200000000000, + "send_not_sir": 200000000000, + "execution": 780000000000 + }, + "function_call_cost_per_byte": { + "send_sir": 2235934, + "send_not_sir": 2235934, + "execution": 2235934 + }, + "transfer_cost": { + "send_sir": 115123062500, + "send_not_sir": 115123062500, + "execution": 115123062500 + }, + "stake_cost": { + "send_sir": 141715687500, + "send_not_sir": 141715687500, + "execution": 102217625000 + }, + "add_key_cost": { + "full_access_cost": { + "send_sir": 101765125000, + "send_not_sir": 101765125000, + "execution": 101765125000 + }, + "function_call_cost": { + "send_sir": 102217625000, + "send_not_sir": 102217625000, + "execution": 102217625000 + }, + "function_call_cost_per_byte": { + "send_sir": 1925331, + "send_not_sir": 1925331, + "execution": 1925331 + } + }, + "delete_key_cost": { + "send_sir": 94946625000, + "send_not_sir": 94946625000, + "execution": 94946625000 + }, + "delete_account_cost": { + "send_sir": 147489000000, + "send_not_sir": 147489000000, + "execution": 147489000000 + }, + "delegate_cost": { + "send_sir": 200000000000, + "send_not_sir": 200000000000, + "execution": 200000000000 + } + }, + "storage_usage_config": { + "num_bytes_account": 100, + "num_extra_bytes_record": 40 + }, + "burnt_gas_reward": [ + 3, + 10 + ], + "pessimistic_gas_price_inflation_ratio": [ + 103, + 100 + ] + }, + "wasm_config": { + "ext_costs": { + "base": 264768111, + "contract_loading_base": 35445963, + "contract_loading_bytes": 1089295, + "read_memory_base": 2609863200, + "read_memory_byte": 3801333, + "write_memory_base": 2803794861, + "write_memory_byte": 2723772, + "read_register_base": 2517165186, + "read_register_byte": 98562, + "write_register_base": 2865522486, + "write_register_byte": 3801564, + "utf8_decoding_base": 3111779061, + "utf8_decoding_byte": 291580479, + "utf16_decoding_base": 3543313050, + "utf16_decoding_byte": 163577493, + "sha256_base": 4540970250, + "sha256_byte": 24117351, + "keccak256_base": 5879491275, + "keccak256_byte": 21471105, + "keccak512_base": 5811388236, + "keccak512_byte": 36649701, + "ripemd160_base": 853675086, + "ripemd160_block": 680107584, + "ed25519_verify_base": 210000000000, + "ed25519_verify_byte": 9000000, + "ecrecover_base": 278821988457, + "log_base": 3543313050, + "log_byte": 13198791, + "storage_write_base": 64196736000, + "storage_write_key_byte": 70482867, + "storage_write_value_byte": 31018539, + "storage_write_evicted_byte": 32117307, + "storage_read_base": 56356845750, + "storage_read_key_byte": 30952533, + "storage_read_value_byte": 5611005, + "storage_remove_base": 53473030500, + "storage_remove_key_byte": 38220384, + "storage_remove_ret_value_byte": 11531556, + "storage_has_key_base": 54039896625, + "storage_has_key_byte": 30790845, + "storage_iter_create_prefix_base": 0, + "storage_iter_create_prefix_byte": 0, + "storage_iter_create_range_base": 0, + "storage_iter_create_from_byte": 0, + "storage_iter_create_to_byte": 0, + "storage_iter_next_base": 0, + "storage_iter_next_key_byte": 0, + "storage_iter_next_value_byte": 0, + "touching_trie_node": 16101955926, + "read_cached_trie_node": 2280000000, + "promise_and_base": 1465013400, + "promise_and_per_promise": 5452176, + "promise_return": 560152386, + "validator_stake_base": 911834726400, + "validator_total_stake_base": 911834726400, + "contract_compile_base": 0, + "contract_compile_bytes": 0, + "alt_bn128_g1_multiexp_base": 713000000000, + "alt_bn128_g1_multiexp_element": 320000000000, + "alt_bn128_g1_sum_base": 3000000000, + "alt_bn128_g1_sum_element": 5000000000, + "alt_bn128_pairing_check_base": 9686000000000, + "alt_bn128_pairing_check_element": 5102000000000, + "yield_create_base": 153411779276, + "yield_create_byte": 15643988, + "yield_resume_base": 1195627285210, + "yield_resume_byte": 1195627285210 + }, + "grow_mem_cost": 1, + "regular_op_cost": 822756, + "vm_kind": "", + "disable_9393_fix": false, + "storage_get_mode": "FlatStorage", + "fix_contract_loading_cost": false, + "implicit_account_creation": true, + "math_extension": true, + "ed25519_verify": true, + "alt_bn128": true, + "function_call_weight": true, + "eth_implicit_accounts": false, + "yield_resume_host_functions": true, + "limit_config": { + "max_gas_burnt": 300000000000000, + "max_stack_height": 262144, + "contract_prepare_version": 2, + "initial_memory_pages": 1024, + "max_memory_pages": 2048, + "registers_memory_limit": 1073741824, + "max_register_size": 104857600, + "max_number_registers": 100, + "max_number_logs": 100, + "max_total_log_length": 16384, + "max_total_prepaid_gas": 300000000000000, + "max_actions_per_receipt": 100, + "max_number_bytes_method_names": 2000, + "max_length_method_name": 256, + "max_arguments_length": 4194304, + "max_length_returned_data": 4194304, + "max_contract_size": 4194304, + "max_transaction_size": 1572864, + "max_length_storage_key": 2048, + "max_length_storage_value": 4194304, + "max_promises_per_function_call_action": 1024, + "max_number_input_data_dependencies": 128, + "max_functions_number_per_contract": 10000, + "wasmer2_stack_limit": 204800, + "max_locals_per_contract": 1000000, + "account_id_validity_rules_version": 1, + "yield_timeout_length_in_blocks": 200, + "max_yield_payload_size": 1024, + "per_receipt_storage_proof_size_limit": 4000000 + } + }, + "account_creation_config": { + "min_allowed_top_level_account_length": 65, + "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 3000000, + "combined_transactions_size_limit": 2097152, + "new_transactions_validation_state_size_soft_limit": 572864 + } +} diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_0.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_0.json.snap index 9d43ed34cc6..98961be9369 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_0.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_0.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -215,11 +214,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_129.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_129.json.snap index ac0ec16da8b..53261bddf79 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_129.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_129.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 3000000 + ] }, "wasm_config": { "ext_costs": { @@ -206,7 +205,7 @@ expression: config_view "max_arguments_length": 4194304, "max_length_returned_data": 4194304, "max_contract_size": 4194304, - "max_transaction_size": 4194304, + "max_transaction_size": 1572864, "max_length_storage_key": 2048, "max_length_storage_value": 4194304, "max_promises_per_function_call_action": 1024, @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 4000000 + "per_receipt_storage_proof_size_limit": 4000000 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 3000000, + "combined_transactions_size_limit": 2097152, + "new_transactions_validation_state_size_soft_limit": 572864 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_138.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_138.json.snap index bb5d7b8ea62..156ed6e8718 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_138.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_138.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 3000000 + ] }, "wasm_config": { "ext_costs": { @@ -206,7 +205,7 @@ expression: config_view "max_arguments_length": 4194304, "max_length_returned_data": 4194304, "max_contract_size": 4194304, - "max_transaction_size": 4194304, + "max_transaction_size": 1572864, "max_length_storage_key": 2048, "max_length_storage_value": 4194304, "max_promises_per_function_call_action": 1024, @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 4000000 + "per_receipt_storage_proof_size_limit": 4000000 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 3000000, + "combined_transactions_size_limit": 2097152, + "new_transactions_validation_state_size_soft_limit": 572864 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_139.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_139.json.snap index bb5d7b8ea62..fb511a178c8 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_139.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_139.json.snap @@ -103,7 +103,9 @@ expression: config_view 103, 100 ], - "storage_proof_size_soft_limit": 3000000 + "main_storage_proof_size_soft_limit": 3000000, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 }, "wasm_config": { "ext_costs": { @@ -206,7 +208,7 @@ expression: config_view "max_arguments_length": 4194304, "max_length_returned_data": 4194304, "max_contract_size": 4194304, - "max_transaction_size": 4194304, + "max_transaction_size": 1572864, "max_length_storage_key": 2048, "max_length_storage_value": 4194304, "max_promises_per_function_call_action": 1024, @@ -217,7 +219,7 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 4000000 + "per_receipt_storage_proof_size_limit": 4000000 } }, "account_creation_config": { diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_142.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_142.json.snap index bb5d7b8ea62..156ed6e8718 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_142.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_142.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 3000000 + ] }, "wasm_config": { "ext_costs": { @@ -206,7 +205,7 @@ expression: config_view "max_arguments_length": 4194304, "max_length_returned_data": 4194304, "max_contract_size": 4194304, - "max_transaction_size": 4194304, + "max_transaction_size": 1572864, "max_length_storage_key": 2048, "max_length_storage_value": 4194304, "max_promises_per_function_call_action": 1024, @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 4000000 + "per_receipt_storage_proof_size_limit": 4000000 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 3000000, + "combined_transactions_size_limit": 2097152, + "new_transactions_validation_state_size_soft_limit": 572864 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_35.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_35.json.snap index 7750372684b..e5d9a1f9a26 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_35.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_35.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -215,11 +214,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_42.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_42.json.snap index 474b1bd2fd7..105a414dcd6 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_42.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_42.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -215,11 +214,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_46.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_46.json.snap index cdf4315e9ab..80f699ead57 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_46.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_46.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -215,11 +214,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_48.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_48.json.snap index ca9925e98cb..4a8e3c270a1 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_48.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_48.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -215,11 +214,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_49.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_49.json.snap index 148a5647dba..5075e5f38e4 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_49.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_49.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -216,11 +215,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_50.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_50.json.snap index 6cf18f26963..8a9285e51fd 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_50.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_50.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -216,11 +215,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_52.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_52.json.snap index 4f199d21a58..b1abdab3fae 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_52.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_52.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -216,11 +215,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_53.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_53.json.snap index a58d403c9b4..4101dfe863e 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_53.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_53.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_55.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_55.json.snap index c8003eeb81d..e6da32a2a96 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_55.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_55.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 0, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_57.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_57.json.snap index fcc8aecaf6b..51d09d69eb7 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_57.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_57.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_59.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_59.json.snap index 7f362eaf27b..72a1fe84822 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_59.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_59.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_61.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_61.json.snap index c288b69255f..170e148403b 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_61.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_61.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_62.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_62.json.snap index b65b313bdfd..eec8c5a7c2b 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_62.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_62.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_63.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_63.json.snap index 8b60a520037..961e67e7198 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_63.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_63.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 32, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_64.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_64.json.snap index c5ec27c1a62..e709f702a8d 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_64.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_64.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_66.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_66.json.snap index 48550a4faae..04bb62f7e1c 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_66.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_66.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_67.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_67.json.snap index 1663a04f129..ead0b9830ff 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_67.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_67.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_83.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_83.json.snap index 750af8c5be3..b7d4d565e0e 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_83.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_83.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 16000000 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 16000000, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_85.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_85.json.snap index 60349cb7759..9f43f2f2168 100644 --- a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_85.json.snap +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_85.json.snap @@ -102,8 +102,7 @@ expression: config_view "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 3000000 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: config_view "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 4000000 + "per_receipt_storage_proof_size_limit": 4000000 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 3000000, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_87.json.snap b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_87.json.snap new file mode 100644 index 00000000000..8c90815cf02 --- /dev/null +++ b/core/parameters/src/snapshots/near_parameters__config_store__tests__testnet_87.json.snap @@ -0,0 +1,231 @@ +--- +source: core/parameters/src/config_store.rs +expression: config_view +--- +{ + "storage_amount_per_byte": "10000000000000000000", + "transaction_costs": { + "action_receipt_creation_config": { + "send_sir": 108059500000, + "send_not_sir": 108059500000, + "execution": 108059500000 + }, + "data_receipt_creation_config": { + "base_cost": { + "send_sir": 36486732312, + "send_not_sir": 36486732312, + "execution": 36486732312 + }, + "cost_per_byte": { + "send_sir": 17212011, + "send_not_sir": 17212011, + "execution": 17212011 + } + }, + "action_creation_config": { + "create_account_cost": { + "send_sir": 3850000000000, + "send_not_sir": 3850000000000, + "execution": 3850000000000 + }, + "deploy_contract_cost": { + "send_sir": 184765750000, + "send_not_sir": 184765750000, + "execution": 184765750000 + }, + "deploy_contract_cost_per_byte": { + "send_sir": 6812999, + "send_not_sir": 6812999, + "execution": 64572944 + }, + "function_call_cost": { + "send_sir": 200000000000, + "send_not_sir": 200000000000, + "execution": 780000000000 + }, + "function_call_cost_per_byte": { + "send_sir": 2235934, + "send_not_sir": 2235934, + "execution": 2235934 + }, + "transfer_cost": { + "send_sir": 115123062500, + "send_not_sir": 115123062500, + "execution": 115123062500 + }, + "stake_cost": { + "send_sir": 141715687500, + "send_not_sir": 141715687500, + "execution": 102217625000 + }, + "add_key_cost": { + "full_access_cost": { + "send_sir": 101765125000, + "send_not_sir": 101765125000, + "execution": 101765125000 + }, + "function_call_cost": { + "send_sir": 102217625000, + "send_not_sir": 102217625000, + "execution": 102217625000 + }, + "function_call_cost_per_byte": { + "send_sir": 1925331, + "send_not_sir": 1925331, + "execution": 1925331 + } + }, + "delete_key_cost": { + "send_sir": 94946625000, + "send_not_sir": 94946625000, + "execution": 94946625000 + }, + "delete_account_cost": { + "send_sir": 147489000000, + "send_not_sir": 147489000000, + "execution": 147489000000 + }, + "delegate_cost": { + "send_sir": 200000000000, + "send_not_sir": 200000000000, + "execution": 200000000000 + } + }, + "storage_usage_config": { + "num_bytes_account": 100, + "num_extra_bytes_record": 40 + }, + "burnt_gas_reward": [ + 3, + 10 + ], + "pessimistic_gas_price_inflation_ratio": [ + 103, + 100 + ] + }, + "wasm_config": { + "ext_costs": { + "base": 264768111, + "contract_loading_base": 35445963, + "contract_loading_bytes": 1089295, + "read_memory_base": 2609863200, + "read_memory_byte": 3801333, + "write_memory_base": 2803794861, + "write_memory_byte": 2723772, + "read_register_base": 2517165186, + "read_register_byte": 98562, + "write_register_base": 2865522486, + "write_register_byte": 3801564, + "utf8_decoding_base": 3111779061, + "utf8_decoding_byte": 291580479, + "utf16_decoding_base": 3543313050, + "utf16_decoding_byte": 163577493, + "sha256_base": 4540970250, + "sha256_byte": 24117351, + "keccak256_base": 5879491275, + "keccak256_byte": 21471105, + "keccak512_base": 5811388236, + "keccak512_byte": 36649701, + "ripemd160_base": 853675086, + "ripemd160_block": 680107584, + "ed25519_verify_base": 210000000000, + "ed25519_verify_byte": 9000000, + "ecrecover_base": 278821988457, + "log_base": 3543313050, + "log_byte": 13198791, + "storage_write_base": 64196736000, + "storage_write_key_byte": 70482867, + "storage_write_value_byte": 31018539, + "storage_write_evicted_byte": 32117307, + "storage_read_base": 56356845750, + "storage_read_key_byte": 30952533, + "storage_read_value_byte": 5611005, + "storage_remove_base": 53473030500, + "storage_remove_key_byte": 38220384, + "storage_remove_ret_value_byte": 11531556, + "storage_has_key_base": 54039896625, + "storage_has_key_byte": 30790845, + "storage_iter_create_prefix_base": 0, + "storage_iter_create_prefix_byte": 0, + "storage_iter_create_range_base": 0, + "storage_iter_create_from_byte": 0, + "storage_iter_create_to_byte": 0, + "storage_iter_next_base": 0, + "storage_iter_next_key_byte": 0, + "storage_iter_next_value_byte": 0, + "touching_trie_node": 16101955926, + "read_cached_trie_node": 2280000000, + "promise_and_base": 1465013400, + "promise_and_per_promise": 5452176, + "promise_return": 560152386, + "validator_stake_base": 911834726400, + "validator_total_stake_base": 911834726400, + "contract_compile_base": 0, + "contract_compile_bytes": 0, + "alt_bn128_g1_multiexp_base": 713000000000, + "alt_bn128_g1_multiexp_element": 320000000000, + "alt_bn128_g1_sum_base": 3000000000, + "alt_bn128_g1_sum_element": 5000000000, + "alt_bn128_pairing_check_base": 9686000000000, + "alt_bn128_pairing_check_element": 5102000000000, + "yield_create_base": 153411779276, + "yield_create_byte": 15643988, + "yield_resume_base": 1195627285210, + "yield_resume_byte": 1195627285210 + }, + "grow_mem_cost": 1, + "regular_op_cost": 822756, + "vm_kind": "", + "disable_9393_fix": false, + "storage_get_mode": "FlatStorage", + "fix_contract_loading_cost": false, + "implicit_account_creation": true, + "math_extension": true, + "ed25519_verify": true, + "alt_bn128": true, + "function_call_weight": true, + "eth_implicit_accounts": false, + "yield_resume_host_functions": true, + "limit_config": { + "max_gas_burnt": 300000000000000, + "max_stack_height": 262144, + "contract_prepare_version": 2, + "initial_memory_pages": 1024, + "max_memory_pages": 2048, + "registers_memory_limit": 1073741824, + "max_register_size": 104857600, + "max_number_registers": 100, + "max_number_logs": 100, + "max_total_log_length": 16384, + "max_total_prepaid_gas": 300000000000000, + "max_actions_per_receipt": 100, + "max_number_bytes_method_names": 2000, + "max_length_method_name": 256, + "max_arguments_length": 4194304, + "max_length_returned_data": 4194304, + "max_contract_size": 4194304, + "max_transaction_size": 1572864, + "max_length_storage_key": 2048, + "max_length_storage_value": 4194304, + "max_promises_per_function_call_action": 1024, + "max_number_input_data_dependencies": 128, + "max_functions_number_per_contract": 10000, + "wasmer2_stack_limit": 204800, + "max_locals_per_contract": 1000000, + "account_id_validity_rules_version": 1, + "yield_timeout_length_in_blocks": 200, + "max_yield_payload_size": 1024, + "per_receipt_storage_proof_size_limit": 4000000 + } + }, + "account_creation_config": { + "min_allowed_top_level_account_length": 65, + "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 3000000, + "combined_transactions_size_limit": 2097152, + "new_transactions_validation_state_size_soft_limit": 572864 + } +} diff --git a/core/parameters/src/snapshots/near_parameters__view__tests__runtime_config_view.snap b/core/parameters/src/snapshots/near_parameters__view__tests__runtime_config_view.snap index 5951499fd93..04334405093 100644 --- a/core/parameters/src/snapshots/near_parameters__view__tests__runtime_config_view.snap +++ b/core/parameters/src/snapshots/near_parameters__view__tests__runtime_config_view.snap @@ -102,8 +102,7 @@ expression: "&view" "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: "&view" "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/core/parameters/src/view.rs b/core/parameters/src/view.rs index 39487c24989..c723d050a3b 100644 --- a/core/parameters/src/view.rs +++ b/core/parameters/src/view.rs @@ -1,3 +1,4 @@ +use crate::config::WitnessConfig; use crate::{ActionCosts, ExtCosts, Fee, ParameterCost}; use near_account_id::AccountId; use near_primitives_core::serialize::dec_format; @@ -18,6 +19,8 @@ pub struct RuntimeConfigView { pub wasm_config: VMConfigView, /// Config that defines rules for account creation. pub account_creation_config: AccountCreationConfigView, + /// Configuration specific to ChunkStateWitness. + pub witness_config: WitnessConfigView, } #[derive(Debug, serde::Serialize, serde::Deserialize, Clone)] @@ -40,9 +43,6 @@ pub struct RuntimeFeesConfigView { /// Pessimistic gas price inflation ratio. pub pessimistic_gas_price_inflation_ratio: Rational32, - - /// The maximum size of the state witness after which we defer execution of any new receipts. - pub storage_proof_size_soft_limit: usize, } /// The structure describes configuration for creation of new accounts. @@ -182,7 +182,6 @@ impl From for RuntimeConfigView { pessimistic_gas_price_inflation_ratio: config .fees .pessimistic_gas_price_inflation_ratio, - storage_proof_size_soft_limit: config.storage_proof_size_soft_limit, }, wasm_config: VMConfigView::from(config.wasm_config), account_creation_config: AccountCreationConfigView { @@ -191,6 +190,7 @@ impl From for RuntimeConfigView { .min_allowed_top_level_account_length, registrar_account_id: config.account_creation_config.registrar_account_id, }, + witness_config: WitnessConfigView::from(config.witness_config), } } } @@ -610,6 +610,31 @@ impl From for crate::ExtCostsConfig { } } +/// Configuration specific to ChunkStateWitness. +#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, Hash, PartialEq, Eq)] +pub struct WitnessConfigView { + /// Size limit for storage proof generated while executing receipts in a chunk. + /// After this limit is reached we defer execution of any new receipts. + pub main_storage_proof_size_soft_limit: usize, + // Maximum size of transactions contained inside ChunkStateWitness. + /// A witness contains transactions from both the previous chunk and the current one. + /// This parameter limits the sum of sizes of transactions from both of those chunks. + pub combined_transactions_size_limit: usize, + /// Soft size limit of storage proof used to validate new transactions in ChunkStateWitness. + pub new_transactions_validation_state_size_soft_limit: usize, +} + +impl From for WitnessConfigView { + fn from(config: WitnessConfig) -> Self { + Self { + main_storage_proof_size_soft_limit: config.main_storage_proof_size_soft_limit, + combined_transactions_size_limit: config.combined_transactions_size_limit, + new_transactions_validation_state_size_soft_limit: config + .new_transactions_validation_state_size_soft_limit, + } + } +} + #[cfg(test)] #[cfg(not(feature = "nightly"))] #[cfg(not(feature = "statelessnet_protocol"))] diff --git a/core/parameters/src/vm.rs b/core/parameters/src/vm.rs index f2f7a46af35..8c62246caf9 100644 --- a/core/parameters/src/vm.rs +++ b/core/parameters/src/vm.rs @@ -136,8 +136,8 @@ pub struct LimitConfig { pub yield_timeout_length_in_blocks: u64, /// Maximum number of bytes for payload passed over a yield resume. pub max_yield_payload_size: u64, - /// Maximum size of the recorded trie storage proof. - pub storage_proof_size_receipt_limit: usize, + /// Hard limit on the size of storage proof generated while executing a single receipt. + pub per_receipt_storage_proof_size_limit: usize, } /// Dynamic configuration parameters required for the WASM runtime to diff --git a/core/primitives-core/src/version.rs b/core/primitives-core/src/version.rs index 1e0ac19e996..9e079bb415b 100644 --- a/core/primitives-core/src/version.rs +++ b/core/primitives-core/src/version.rs @@ -159,6 +159,8 @@ pub enum ProtocolFeature { CongestionControl, // Stateless validation: Distribute state witness as reed solomon encoded parts PartialEncodedStateWitness, + /// Size limits for transactions included in a ChunkStateWitness. + WitnessTransactionLimits, } impl ProtocolFeature { @@ -221,6 +223,7 @@ impl ProtocolFeature { ProtocolFeature::StateWitnessSizeLimit => 83, ProtocolFeature::PerReceiptHardStorageProofLimit => 85, ProtocolFeature::PartialEncodedStateWitness => 86, + ProtocolFeature::WitnessTransactionLimits => 87, // Nightly features #[cfg(feature = "protocol_feature_fix_staking_threshold")] @@ -252,7 +255,7 @@ const STABLE_PROTOCOL_VERSION: ProtocolVersion = 67; /// Largest protocol version supported by the current binary. pub const PROTOCOL_VERSION: ProtocolVersion = if cfg!(feature = "statelessnet_protocol") { // Current StatelessNet protocol version. - 86 + 87 } else if cfg!(feature = "nightly_protocol") { // On nightly, pick big enough version to support all features. 143 diff --git a/core/primitives/src/snapshots/near_primitives__views__tests__runtime_config_view.snap b/core/primitives/src/snapshots/near_primitives__views__tests__runtime_config_view.snap index e7df3feb636..be77c2d52c4 100644 --- a/core/primitives/src/snapshots/near_primitives__views__tests__runtime_config_view.snap +++ b/core/primitives/src/snapshots/near_primitives__views__tests__runtime_config_view.snap @@ -102,8 +102,7 @@ expression: "&view" "pessimistic_gas_price_inflation_ratio": [ 103, 100 - ], - "storage_proof_size_soft_limit": 999999999999999 + ] }, "wasm_config": { "ext_costs": { @@ -217,11 +216,16 @@ expression: "&view" "account_id_validity_rules_version": 1, "yield_timeout_length_in_blocks": 200, "max_yield_payload_size": 1024, - "storage_proof_size_receipt_limit": 999999999999999 + "per_receipt_storage_proof_size_limit": 999999999999999 } }, "account_creation_config": { "min_allowed_top_level_account_length": 65, "registrar_account_id": "registrar" + }, + "witness_config": { + "main_storage_proof_size_soft_limit": 999999999999999, + "combined_transactions_size_limit": 999999999999999, + "new_transactions_validation_state_size_soft_limit": 999999999999999 } } diff --git a/integration-tests/src/tests/client/benchmarks.rs b/integration-tests/src/tests/client/benchmarks.rs index ebd1860a628..0f9cde0c7ec 100644 --- a/integration-tests/src/tests/client/benchmarks.rs +++ b/integration-tests/src/tests/client/benchmarks.rs @@ -8,7 +8,9 @@ use near_chain_configs::Genesis; use near_client::test_utils::{create_chunk_on_height, TestEnv}; use near_client::{ProcessTxResponse, ProduceChunkResult}; use near_crypto::{InMemorySigner, KeyType}; +use near_primitives::checked_feature; use near_primitives::transaction::{Action, DeployContractAction, SignedTransaction}; +use near_primitives::version::PROTOCOL_VERSION; use nearcore::test_utils::TestEnvNightshadeSetupExt; /// How long does it take to produce a large chunk? @@ -24,7 +26,11 @@ fn benchmark_large_chunk_production_time() { let mb = 1024usize.pow(2); let n_txes = 20; - let tx_size = 3 * mb; + let tx_size = if checked_feature!("stable", WitnessTransactionLimits, PROTOCOL_VERSION) { + mb / 2 + } else { + 3 * mb + }; let genesis = Genesis::test(vec!["test0".parse().unwrap(), "test1".parse().unwrap()], 1); let mut env = TestEnv::builder(&genesis.config).nightshade_runtimes(&genesis).build(); @@ -56,5 +62,9 @@ fn benchmark_large_chunk_production_time() { // Check that we limit the size of the chunk and not include all `n_txes` // transactions in the chunk. - assert!(30 * mb < size && size < 40 * mb, "{size}"); + if checked_feature!("stable", WitnessTransactionLimits, PROTOCOL_VERSION) { + assert!(2 * mb < size && size < 4 * mb, "{size}"); + } else { + assert!(30 * mb < size && size < 40 * mb, "{size}"); + } } diff --git a/runtime/near-vm-runner/src/logic/logic.rs b/runtime/near-vm-runner/src/logic/logic.rs index 68c60341c82..d9979b81a67 100644 --- a/runtime/near-vm-runner/src/logic/logic.rs +++ b/runtime/near-vm-runner/src/logic/logic.rs @@ -155,7 +155,7 @@ impl<'a> VMLogic<'a> { ); let recorded_storage_counter = RecordedStorageCounter::new( ext.get_recorded_storage_size(), - config.limit_config.storage_proof_size_receipt_limit, + config.limit_config.per_receipt_storage_proof_size_limit, ); Self { ext, diff --git a/runtime/runtime-params-estimator/src/action_costs.rs b/runtime/runtime-params-estimator/src/action_costs.rs index 8184e9059a2..d886dd701df 100644 --- a/runtime/runtime-params-estimator/src/action_costs.rs +++ b/runtime/runtime-params-estimator/src/action_costs.rs @@ -791,8 +791,8 @@ impl ActionSize { // calling "noop" requires 4 bytes ActionSize::Min => 4, // max_arguments_length: 4_194_304 - // max_transaction_size: 4_194_304 - ActionSize::Max => (4_194_304 / 100) - 35, + // max_transaction_size: 1_572_864 + ActionSize::Max => (1_572_864 / 100) - 35, } } @@ -813,7 +813,7 @@ impl ActionSize { // fails with `InvalidTxError(TransactionSizeExceeded`, it could be a // protocol change due to the TX limit computation changing. // The test `test_deploy_contract_tx_max_size` checks this. - ActionSize::Max => 4 * 1024 * 1024 - 182, + ActionSize::Max => 1_572_864 - 182, } } } @@ -827,7 +827,7 @@ mod tests { fn test_deploy_contract_tx_max_size() { // The size of a transaction constructed from this must be exactly at the limit. let deploy_action = deploy_action(ActionSize::Max); - let limit = 4_194_304; + let limit = 1_572_864; // We also need some account IDs constructed the same way as in the estimator. // Let's try multiple index sizes to ensure this does not affect the length. diff --git a/runtime/runtime-params-estimator/src/costs_to_runtime_config.rs b/runtime/runtime-params-estimator/src/costs_to_runtime_config.rs index 98ba718c652..4b4d8c521b5 100644 --- a/runtime/runtime-params-estimator/src/costs_to_runtime_config.rs +++ b/runtime/runtime-params-estimator/src/costs_to_runtime_config.rs @@ -38,8 +38,8 @@ pub fn costs_to_runtime_config(cost_table: &CostTable) -> anyhow::Result GasCost { let config_store = RuntimeConfigStore::new(None); let vm_config = config_store.get_config(PROTOCOL_VERSION).wasm_config.clone(); let small_code = generate_data_only_contract(0, &vm_config); - let large_code = generate_data_only_contract(bytesize::mb(4u64) as usize, &vm_config); + let large_code = generate_data_only_contract( + vm_config.limit_config.max_transaction_size as usize - 2000, + &vm_config, + ); let small_code_len = small_code.len(); let large_code_len = large_code.len(); let cost_empty = deploy_contract_cost(ctx, small_code, Some(b"main")); - let cost_4mb = deploy_contract_cost(ctx, large_code, Some(b"main")); + let cost_max = deploy_contract_cost(ctx, large_code, Some(b"main")); - (cost_4mb - cost_empty) / (large_code_len - small_code_len) as u64 + (cost_max - cost_empty) / (large_code_len - small_code_len) as u64 } /// Base cost for a fn call action, without receipt creation or contract loading. @@ -749,7 +752,7 @@ fn action_function_call_per_byte(ctx: &mut EstimatorContext) -> GasCost { // X values below 1M have a rather high variance. Therefore, use one small X // value and two larger values to fit a curve that gets the slope about // right. - let xs = [1, 1_000_000, 4_000_000]; + let xs = [1, 1_000_000, 1_500_000]; let ys: Vec = xs .iter() .map(|&arg_len| inner_action_function_call_per_byte(ctx, arg_len as usize)) @@ -800,7 +803,7 @@ fn function_call_per_storage_byte(ctx: &mut EstimatorContext) -> GasCost { let small_code = generate_data_only_contract(0, &vm_config); let small_cost = fn_cost_in_contract(ctx, "main", &small_code, n_actions); - let large_code = generate_data_only_contract(4_000_000, &vm_config); + let large_code = generate_data_only_contract(1_500_000, &vm_config); let large_cost = fn_cost_in_contract(ctx, "main", &large_code, n_actions); large_cost.saturating_sub(&small_cost, &NonNegativeTolerance::PER_MILLE) diff --git a/runtime/runtime/src/lib.rs b/runtime/runtime/src/lib.rs index 05c2ea22d35..30759db13c8 100644 --- a/runtime/runtime/src/lib.rs +++ b/runtime/runtime/src/lib.rs @@ -1548,7 +1548,7 @@ impl Runtime { let compute_limit = apply_state.gas_limit.unwrap_or(Gas::max_value()); let proof_size_limit = if checked_feature!("stable", StateWitnessSizeLimit, protocol_version) { - Some(apply_state.config.storage_proof_size_soft_limit) + Some(apply_state.config.witness_config.main_storage_proof_size_soft_limit) } else { None }; @@ -3128,17 +3128,17 @@ mod tests { } #[test] - fn test_storage_proof_size_soft_limit() { + fn test_main_storage_proof_size_soft_limit() { if !checked_feature!("stable", StateWitnessSizeLimit, PROTOCOL_VERSION) { return; } let (runtime, tries, root, mut apply_state, signer, epoch_info_provider) = setup_runtime(to_yocto(1_000_000), to_yocto(500_000), 10u64.pow(15)); - // Change storage_proof_size_soft_limit to a smaller value + // Change main_storage_proof_size_soft_limit to a smaller value // The value of 500 is small enough to let the first receipt go through but not the second let mut runtime_config = RuntimeConfig::test(); - runtime_config.storage_proof_size_soft_limit = 5000; + runtime_config.witness_config.main_storage_proof_size_soft_limit = 5000; apply_state.config = Arc::new(runtime_config); let create_acc_fn = |account_id| { @@ -3184,7 +3184,7 @@ mod tests { ) }; - // The function call to bob_account should hit the storage_proof_size_soft_limit + // The function call to bob_account should hit the main_storage_proof_size_soft_limit let apply_result = runtime .apply( tries.get_trie_for_shard(ShardUId::single_shard(), root).recording_reads(),