Skip to content

Commit

Permalink
Merge pull request #3702 from hackbg/main
Browse files Browse the repository at this point in the history
derive Serialize for PosParams, OwnedPosParams, GovernanceParameters
  • Loading branch information
mergify[bot] committed Aug 29, 2024
2 parents cc0a448 + 2af1972 commit f92adcf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/improvements/3702-main.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Implement serde::Serialize for GovernanceParameters, PosParams, OwnedPosParams
([\#3702](https://github.com/anoma/namada/pull/3702))
2 changes: 2 additions & 0 deletions crates/governance/src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use namada_macros::BorshDeserializer;
#[cfg(feature = "migrations")]
use namada_migrations::*;
use namada_state::{Result, StorageRead, StorageWrite};
use serde::Serialize;

use super::storage::keys as goverance_storage;

Expand All @@ -18,6 +19,7 @@ use super::storage::keys as goverance_storage;
BorshSerialize,
BorshDeserialize,
BorshDeserializer,
Serialize,
)]
/// Governance parameter structure
pub struct GovernanceParameters {
Expand Down
9 changes: 7 additions & 2 deletions crates/proof_of_stake/src/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ use namada_governance::parameters::GovernanceParameters;
use namada_macros::BorshDeserializer;
#[cfg(feature = "migrations")]
use namada_migrations::*;
use serde::Serialize;
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 +31,9 @@ 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 f92adcf

Please sign in to comment.