feat(configs): allow clone for genesis file structs (#528)

This commit is contained in:
Clark Alesna 2024-12-15 03:42:14 +08:00 committed by GitHub
parent a0c0ffde1a
commit 8b511b7d81
4 changed files with 13 additions and 13 deletions

View file

@ -85,7 +85,7 @@ impl From<CostModelPerLanguage> for pallas_primitives::alonzo::CostModels {
} }
} }
#[derive(Deserialize)] #[derive(Deserialize, Clone)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct GenesisFile { pub struct GenesisFile {
#[serde(rename = "lovelacePerUTxOWord")] #[serde(rename = "lovelacePerUTxOWord")]

View file

@ -7,7 +7,7 @@ use serde_with::serde_as;
use serde_with::DisplayFromStr; use serde_with::DisplayFromStr;
use std::collections::HashMap; use std::collections::HashMap;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct GenesisFile { pub struct GenesisFile {
pub avvm_distr: HashMap<String, String>, pub avvm_distr: HashMap<String, String>,
@ -64,7 +64,7 @@ pub struct BlockVersionData {
pub update_vote_thd: u64, pub update_vote_thd: u64,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ProtocolConsts { pub struct ProtocolConsts {
pub k: usize, pub k: usize,
@ -77,7 +77,7 @@ pub struct ProtocolConsts {
pub type BootStakeWeight = u16; pub type BootStakeWeight = u16;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct HeavyDelegation { pub struct HeavyDelegation {
pub issuer_pk: String, pub issuer_pk: String,
@ -85,7 +85,7 @@ pub struct HeavyDelegation {
pub cert: String, pub cert: String,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct VssCert { pub struct VssCert {
pub vss_key: String, pub vss_key: String,

View file

@ -1,7 +1,7 @@
use serde::Deserialize; use serde::Deserialize;
use std::collections::HashMap; use std::collections::HashMap;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct GenesisFile { pub struct GenesisFile {
pub pool_voting_thresholds: PoolVotingThresholds, pub pool_voting_thresholds: PoolVotingThresholds,
@ -43,20 +43,20 @@ pub struct DRepVotingThresholds {
pub treasury_withdrawal: f32, pub treasury_withdrawal: f32,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Clone)]
pub struct Constitution { pub struct Constitution {
pub anchor: Anchor, pub anchor: Anchor,
pub script: String, pub script: String,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Anchor { pub struct Anchor {
pub data_hash: String, pub data_hash: String,
pub url: String, pub url: String,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Clone)]
pub struct Committee { pub struct Committee {
pub members: HashMap<String, u64>, pub members: HashMap<String, u64>,
pub threshold: Fraction, pub threshold: Fraction,

View file

@ -22,7 +22,7 @@ where
Ok(r) Ok(r)
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct GenDelegs { pub struct GenDelegs {
pub delegate: Option<String>, pub delegate: Option<String>,
@ -75,7 +75,7 @@ impl From<ExtraEntropy> for pallas_primitives::alonzo::Nonce {
} }
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ProtocolParams { pub struct ProtocolParams {
pub protocol_version: ProtocolVersion, pub protocol_version: ProtocolVersion,
@ -106,14 +106,14 @@ pub struct ProtocolParams {
pub a0: pallas_primitives::alonzo::RationalNumber, pub a0: pallas_primitives::alonzo::RationalNumber,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Staking { pub struct Staking {
pub pools: Option<HashMap<String, String>>, pub pools: Option<HashMap<String, String>>,
pub stake: Option<HashMap<String, String>>, pub stake: Option<HashMap<String, String>>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct GenesisFile { pub struct GenesisFile {
pub active_slots_coeff: Option<f32>, pub active_slots_coeff: Option<f32>,