platform_version/version/fee/storage/
mod.rs

1use bincode::{Decode, Encode};
2
3pub mod v1;
4
5#[derive(Clone, Debug, Encode, Decode, Default, PartialEq, Eq)]
6pub struct FeeStorageVersion {
7    pub storage_disk_usage_credit_per_byte: u64,
8    pub storage_processing_credit_per_byte: u64,
9    pub storage_load_credit_per_byte: u64,
10    pub non_storage_load_credit_per_byte: u64,
11    pub storage_seek_cost: u64,
12}
13
14#[cfg(test)]
15mod tests {
16    use super::FeeStorageVersion;
17
18    #[test]
19    // If this test failed, then a new field was added in FeeProcessingVersion. And the corresponding eq needs to be updated as well
20    fn test_fee_storage_version_equality() {
21        let version1 = FeeStorageVersion {
22            storage_disk_usage_credit_per_byte: 1,
23            storage_processing_credit_per_byte: 2,
24            storage_load_credit_per_byte: 3,
25            non_storage_load_credit_per_byte: 4,
26            storage_seek_cost: 5,
27        };
28
29        let version2 = FeeStorageVersion {
30            storage_disk_usage_credit_per_byte: 1,
31            storage_processing_credit_per_byte: 2,
32            storage_load_credit_per_byte: 3,
33            non_storage_load_credit_per_byte: 4,
34            storage_seek_cost: 5,
35        };
36
37        // This assertion will check if all fields are considered in the equality comparison
38        assert_eq!(version1, version2, "FeeStorageVersion equality test failed. If a field was added or removed, update the Eq implementation.");
39    }
40}