From c307fc2abd0e27f7088e2a236b39648795c17b9b Mon Sep 17 00:00:00 2001 From: Gabe Rodriguez Date: Tue, 5 Mar 2024 18:29:12 +0100 Subject: [PATCH] Add serde derives for GasPrices (#3948) Closes https://github.com/penumbra-zone/penumbra/issues/3941 --- crates/core/component/fee/src/gas.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/core/component/fee/src/gas.rs b/crates/core/component/fee/src/gas.rs index 8c95f6fd1c..b8165d5bd3 100644 --- a/crates/core/component/fee/src/gas.rs +++ b/crates/core/component/fee/src/gas.rs @@ -1,5 +1,7 @@ use std::{iter::Sum, ops::Add}; +use serde::{Deserialize, Serialize}; + use penumbra_num::Amount; use penumbra_proto::{core::component::fee::v1 as pb, DomainType}; @@ -49,7 +51,8 @@ impl Sum for Gas { /// These prices have an implicit denominator of 1,000 relative to the base unit /// of the staking token, so gas price 1,000 times 1 unit of gas is 1 base unit /// of staking token. -#[derive(Copy, Clone, Debug, Eq, PartialEq, Default)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Default, Serialize, Deserialize)] +#[serde(try_from = "pb::GasPrices", into = "pb::GasPrices")] pub struct GasPrices { pub block_space_price: u64, pub compact_block_space_price: u64,