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 const MAX_METADATA_PAIRS: usize = 64;
30 /// Maximum metadata key size.
31 const MAX_METADATA_KEY_SIZE: usize = 1024;
32 /// Maximum metadata value size.
33 const MAX_METADATA_VALUE_SIZE: usize = 16 * 1024;
34
35 /// Amount of stake required for maintaining an application.
36 ///
37 /// The stake is held in escrow and is returned to the administrator when the application is
38 /// removed.
39 const STAKE_APP_CREATE: token::BaseUnits =
40 token::BaseUnits::new(0, token::Denomination::NATIVE);
41
42 /// Maximum key identifier length for rofl.DeriveKey call.
43 const DERIVE_KEY_MAX_KEY_ID_LENGTH: usize = 128;
44
45 /// Maximum number of endorsment policy atoms.
46 const MAX_ENDORSEMENT_POLICY_ATOMS: usize = 32;
47
48 /// Maximum value of the `max_expiration` field in the app policy (in epochs).
49 const MAX_POLICY_EXPIRATION_EPOCHS: u64 = 24;
50
51 /// Endorsement policy evaluator.
52 type EndorsementPolicyEvaluator: EndorsementPolicyEvaluator;
53}