Skip to content

Commit

Permalink
derive Serialize for PosParams and OwnedPosParams
Browse files Browse the repository at this point in the history
this would enable our client library `@fadroma/namada` to automatically convert the response from `/vp/pos/pos_params` without having to explicitly list every field (see https://github.com/hackbg/fadroma/blob/e7d5d551f818a6441ef54309a2517792b03ee7d3/packages/namada/src/decode.rs#L201-L223)
  • Loading branch information
egasimus authored Aug 26, 2024
1 parent 24eebc7 commit 704b193
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/proof_of_stake/src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use std::str::FromStr;

use borsh::{BorshDeserialize, BorshSerialize};
use serde::{Serialize, Deserialize};
use namada_core::arith::checked;
use namada_core::dec::Dec;
use namada_core::storage::Epoch;
Expand All @@ -17,7 +18,7 @@ use thiserror::Error;

/// Proof-of-Stake system parameters. This includes parameters that are used in
/// PoS but are read from other accounts storage (governance).
#[derive(Debug, Clone, BorshDeserialize, BorshDeserializer, BorshSerialize)]
#[derive(Debug, Clone, BorshDeserialize, BorshDeserializer, BorshSerialize, Serialize)]
pub struct PosParams {
/// PoS-owned params
pub owned: OwnedPosParams,
Expand All @@ -28,7 +29,7 @@ pub struct PosParams {

/// Proof-of-Stake system parameters owned by the PoS address, set at genesis
/// and can only be changed via governance
#[derive(Debug, Clone, BorshDeserialize, BorshDeserializer, BorshSerialize)]
#[derive(Debug, Clone, BorshDeserialize, BorshDeserializer, BorshSerialize, Serialize)]
pub struct OwnedPosParams {
/// A maximum number of consensus validators
pub max_validator_slots: u64,
Expand Down

0 comments on commit 704b193

Please sign in to comment.