Skip to main content

oasis_runtime_sdk/modules/rofl/
config.rs

1use crate::types::token;
2
3use super::policy::EndorsementPolicyEvaluator;
4
5/// Module configuration.
6pub trait Config: 'static {
7    /// Gas cost of rofl.Create call.
8    const GAS_COST_CALL_CREATE: u64 = 100_000;
9    /// Gas cost of rofl.Update call.
10    const GAS_COST_CALL_UPDATE: u64 = 100_000;
11    /// Gas cost of rofl.Remove call.
12    const GAS_COST_CALL_REMOVE: u64 = 10_000;
13    /// Gas cost of rofl.Register call.
14    const GAS_COST_CALL_REGISTER: u64 = 100_000;
15    /// Gas cost of rofl.IsAuthorizedOrigin call.
16    const GAS_COST_CALL_IS_AUTHORIZED_ORIGIN: u64 = 1000;
17    /// Gas cost of rofl.AuthorizedOriginNode call.
18    const GAS_COST_CALL_AUTHORIZED_ORIGIN_NODE: u64 = 2000;
19    /// Gas cost of rofl.AuthorizedOriginEntity call.
20    const GAS_COST_CALL_AUTHORIZED_ORIGIN_ENTITY: u64 = 2000;
21    /// Gas cost of rofl.OriginApp call.
22    const GAS_COST_CALL_ORIGIN_APP: u64 = 1000;
23    /// Gas cost of rofl.StakeThresholds call.
24    const GAS_COST_CALL_STAKE_THRESHOLDS: u64 = 10;
25    /// Gas cost of rofl.DeriveKey call.
26    const GAS_COST_CALL_DERIVE_KEY: u64 = 10_000;
27
28    /// Maximum number of metadata key-value pairs.
29    /// TODO: Enforce cumulative metadata size limit instead of fixed per-pair sizes.
30    /// See https://github.com/oasisprotocol/oasis-sdk/issues/2489.
31    const MAX_METADATA_PAIRS: usize = 128;
32    /// Maximum metadata key size.
33    const MAX_METADATA_KEY_SIZE: usize = 1024;
34    /// Maximum metadata value size.
35    const MAX_METADATA_VALUE_SIZE: usize = 16 * 1024;
36
37    /// Amount of stake required for maintaining an application.
38    ///
39    /// The stake is held in escrow and is returned to the administrator when the application is
40    /// removed.
41    const STAKE_APP_CREATE: token::BaseUnits = token::BaseUnits::native(0);
42
43    /// Maximum key identifier length for rofl.DeriveKey call.
44    const DERIVE_KEY_MAX_KEY_ID_LENGTH: usize = 128;
45
46    /// Maximum number of endorsment policy atoms.
47    const MAX_ENDORSEMENT_POLICY_ATOMS: usize = 32;
48
49    /// Maximum value of the `max_expiration` field in the app policy (in epochs).
50    const MAX_POLICY_EXPIRATION_EPOCHS: u64 = 24;
51
52    /// Endorsement policy evaluator.
53    type EndorsementPolicyEvaluator: EndorsementPolicyEvaluator;
54}