Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(network): correct PoolDistr and update ProtocolParam #551

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/n2c-miniprotocols/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ async fn do_localstate_query(client: &mut NodeClient) {

async fn do_chainsync(client: &mut NodeClient) {
let known_points = vec![Point::Specific(
43847831u64,
hex::decode("15b9eeee849dd6386d3770b0745e0450190f7560e5159b1b3ab13b14b2684a45").unwrap(),
77110778u64,
hex::decode("18e6eeaa592c42113280ba47a0829355e6bed1c9ce67cce4be502d6031d0679a").unwrap(),
)];

let (point, _) = client
Expand Down
31 changes: 16 additions & 15 deletions pallas-network/src/miniprotocols/localstate/queries_v16/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ pub type PositiveInterval = RationalNumber;

pub type ProtocolVersionMajor = u64;
pub type ProtocolVersionMinor = u64;
pub type ProtocolVersion = (ProtocolVersionMajor, ProtocolVersionMinor);

pub type CostModel = Vec<i64>;

Expand Down Expand Up @@ -169,26 +170,24 @@ pub struct ProtocolParam {
#[n(11)]
pub treasury_growth_rate: Option<UnitInterval>,
#[n(12)]
pub protocol_version_major: Option<ProtocolVersionMajor>,
pub protocol_version: Option<ProtocolVersion>,
#[n(13)]
pub protocol_version_minor: Option<ProtocolVersionMinor>,
#[n(14)]
pub min_pool_cost: Option<Coin>,
#[n(15)]
#[n(14)]
pub ada_per_utxo_byte: Option<Coin>,
#[n(16)]
#[n(15)]
pub cost_models_for_script_languages: Option<CostMdls>,
#[n(17)]
#[n(16)]
pub execution_costs: Option<ExUnitPrices>,
#[n(18)]
#[n(17)]
pub max_tx_ex_units: Option<ExUnits>,
#[n(19)]
#[n(18)]
pub max_block_ex_units: Option<ExUnits>,
#[n(20)]
#[n(19)]
pub max_value_size: Option<u32>,
#[n(21)]
#[n(20)]
pub collateral_percentage: Option<u32>,
#[n(22)]
#[n(21)]
pub max_collateral_inputs: Option<u32>,
}

Expand All @@ -201,19 +200,21 @@ pub struct StakeDistribution {
#[derive(Debug, Encode, Decode, PartialEq, Clone)]
pub struct Pool {
#[n(0)]
pub stakes: Fraction,
pub stakes: RationalNumber,

#[n(1)]
pub hashes: Bytes,
}

/// Type used at [GenesisConfig], which is a fraction that is CBOR-encoded
/// as an untagged array.
#[derive(Debug, Encode, Decode, PartialEq, Clone)]
pub struct Fraction {
#[n(0)]
pub num: u64,

#[n(1)]
pub dem: u64,
pub den: u64,
}

pub type Addr = Bytes;
Expand Down Expand Up @@ -316,7 +317,7 @@ pub struct Stakes {
}

#[derive(Debug, Encode, Decode, PartialEq)]
pub struct Genesis {
pub struct GenesisConfig {
#[n(0)]
pub system_start: SystemStart,

Expand Down Expand Up @@ -469,7 +470,7 @@ pub async fn get_cbor(
pub async fn get_genesis_config(
client: &mut Client,
era: u16,
) -> Result<Vec<Genesis>, ClientError> {
) -> Result<Vec<GenesisConfig>, ClientError> {
let query = BlockQuery::GetGenesisConfig;
let query = LedgerQuery::BlockQuery(era, query);
let query = Request::LedgerQuery(query);
Expand Down