1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617/// Storage migration is not required for this change, as SponsoringRateLimit has same encoding as Option<u32>18#[test]19fn sponsoring_rate_limit_has_same_encoding_as_option_u32() {20 use crate::SponsoringRateLimit;21 use codec::Encode;2223 fn limit_to_option(limit: SponsoringRateLimit) -> Option<u32> {24 match limit {25 SponsoringRateLimit::SponsoringDisabled => None,26 SponsoringRateLimit::Blocks(v) => Some(v),27 }28 }2930 fn test_to_option(limit: SponsoringRateLimit) {31 let encoded = limit.encode();32 let option = limit_to_option(limit);33 let encoded_option = option.encode();3435 assert_eq!(encoded, encoded_option);36 }3738 test_to_option(SponsoringRateLimit::SponsoringDisabled);39 test_to_option(SponsoringRateLimit::Blocks(10));40}difftreelog
source
primitives/data-structs/src/migration.rs1.4 KiBsourcehistory