testnets_common/
rococo.rs1pub mod currency {
17 use polkadot_core_primitives::Balance;
18 use rococo_runtime_constants as constants;
19
20 pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10;
22
23 pub const UNITS: Balance = constants::currency::UNITS;
24 pub const CENTS: Balance = constants::currency::CENTS;
25 pub const MILLICENTS: Balance = constants::currency::MILLICENTS;
26
27 pub const fn deposit(items: u32, bytes: u32) -> Balance {
28 constants::currency::deposit(items, bytes) / 100
30 }
31}
32
33pub mod fee {
34 use frame_support::{
35 pallet_prelude::Weight,
36 weights::{
37 constants::ExtrinsicBaseWeight, FeePolynomial, WeightToFeeCoefficient,
38 WeightToFeeCoefficients, WeightToFeePolynomial,
39 },
40 };
41 use polkadot_core_primitives::Balance;
42 use smallvec::smallvec;
43 pub use sp_runtime::Perbill;
44
45 pub const TARGET_BLOCK_FULLNESS: Perbill = Perbill::from_percent(25);
47
48 pub struct WeightToFee;
59 impl frame_support::weights::WeightToFee for WeightToFee {
60 type Balance = Balance;
61
62 fn weight_to_fee(weight: &Weight) -> Self::Balance {
63 let time_poly: FeePolynomial<Balance> = RefTimeToFee::polynomial().into();
64 let proof_poly: FeePolynomial<Balance> = ProofSizeToFee::polynomial().into();
65
66 time_poly.eval(weight.ref_time()).max(proof_poly.eval(weight.proof_size()))
68 }
69 }
70
71 pub struct RefTimeToFee;
73 impl WeightToFeePolynomial for RefTimeToFee {
74 type Balance = Balance;
75 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
76 let p = super::currency::CENTS;
79 let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time());
80
81 smallvec![WeightToFeeCoefficient {
82 degree: 1,
83 negative: false,
84 coeff_frac: Perbill::from_rational(p % q, q),
85 coeff_integer: p / q,
86 }]
87 }
88 }
89
90 pub struct ProofSizeToFee;
92 impl WeightToFeePolynomial for ProofSizeToFee {
93 type Balance = Balance;
94 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
95 let p = super::currency::CENTS;
97 let q = 10_000;
98
99 smallvec![WeightToFeeCoefficient {
100 degree: 1,
101 negative: false,
102 coeff_frac: Perbill::from_rational(p % q, q),
103 coeff_integer: p / q,
104 }]
105 }
106 }
107}
108
109pub mod consensus {
111 pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
114 pub const BLOCK_PROCESSING_VELOCITY: u32 = 1;
117 pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
119}