near_primitives_core/
config.rs

1use crate::types::Gas;
2use std::hash::Hash;
3
4/// Defines value size threshold for flat state inlining.
5/// It means that values having size greater than the threshold will be stored
6/// in FlatState as `FlatStateValue::Ref`, otherwise the whole value will be
7/// stored as `FlatStateValue::Inlined`.
8/// See the following comment for reasoning behind the threshold value:
9/// <https://github.com/near/nearcore/issues/8243#issuecomment-1523049994>
10///
11/// Note that this value then propagates to memtrie, and then to the "small read"
12/// costs. As such, changing it is a protocol change, and it should be turned
13/// into a protocol parameter if we ever want to change it.
14pub const INLINE_DISK_VALUE_THRESHOLD: usize = 4000;
15
16#[derive(
17    Debug,
18    Clone,
19    Copy,
20    Hash,
21    PartialEq,
22    Eq,
23    serde_repr::Serialize_repr,
24    serde_repr::Deserialize_repr,
25)]
26#[repr(u8)]
27pub enum AccountIdValidityRulesVersion {
28    /// Skip account ID validation according to legacy rules.
29    V0,
30    /// Limit `receiver_id` in `FunctionCallPermission` to be a valid account ID.
31    V1,
32}
33
34impl AccountIdValidityRulesVersion {
35    pub fn v0() -> AccountIdValidityRulesVersion {
36        AccountIdValidityRulesVersion::V0
37    }
38}
39
40/// Configuration of view methods execution, during which no costs should be charged.
41#[derive(Default, Clone, serde::Serialize, serde::Deserialize, Debug, Hash, PartialEq, Eq)]
42pub struct ViewConfig {
43    /// If specified, defines max burnt gas per view method.
44    pub max_gas_burnt: Gas,
45}