fix(network): adjust PoolDistr & ProtocolParam structs used for state queries (#551)

Signed-off-by: Pedro Sánchez Terraf <sterraf@users.noreply.github.com>
This commit is contained in:
Pedro Sánchez Terraf 2024-12-14 16:32:12 -03:00 committed by GitHub
parent ac66eb9473
commit a0c0ffde1a
3 changed files with 33 additions and 35 deletions

View file

@ -19,8 +19,8 @@ use pallas_network::{
},
};
use pallas_network::miniprotocols::localstate::queries_v16::{
self, Addr, Addrs, ChainBlockNumber, Fraction, Genesis, Snapshots, Stakes,
SystemStart, UnitInterval, Value, StakeAddr,
self, Addr, Addrs, ChainBlockNumber, Fraction, GenesisConfig, Snapshots, Stakes,
SystemStart, UnitInterval, Value, StakeAddr, RationalNumber,
};
use hex::FromHex;
@ -551,9 +551,9 @@ pub async fn local_state_query_server_and_client_happy_path() {
);
assert_eq!(*server.statequery().state(), localstate::State::Querying);
let fraction = Fraction { num: 10, dem: 20 };
let pool = queries_v16::Pool {
stakes: fraction.clone(),
let rational = RationalNumber { numerator: 10, denominator: 20 };
let pool = localstate::queries_v16::Pool {
stakes: rational.clone(),
hashes: b"pool1qv4qgv62s3ha74p0643nexee9zvcdydcyahqqnavhj90zheuykz"
.to_vec()
.into(),
@ -671,8 +671,7 @@ pub async fn local_state_query_server_and_client_happy_path() {
numerator: 3,
denominator: 1000000,
}),
protocol_version_major: Some(5),
protocol_version_minor: Some(0),
protocol_version: Some((5,0)),
min_pool_cost: Some(AnyUInt::U32(340000000)),
ada_per_utxo_byte: Some(AnyUInt::U16(44)),
cost_models_for_script_languages: None,
@ -751,7 +750,7 @@ pub async fn local_state_query_server_and_client_happy_path() {
assert_eq!(*server.statequery().state(), localstate::State::Querying);
let genesis = vec![Genesis {
let genesis = vec![GenesisConfig {
system_start: SystemStart {
year: 2021,
day_of_year: 150,
@ -759,7 +758,7 @@ pub async fn local_state_query_server_and_client_happy_path() {
},
network_magic: 42,
network_id: 42,
active_slots_coefficient: Fraction { num: 6, dem: 10 },
active_slots_coefficient: Fraction { num: 6, den: 10 },
security_param: 2160,
epoch_length: 432000,
slots_per_kes_period: 129600,
@ -910,9 +909,9 @@ pub async fn local_state_query_server_and_client_happy_path() {
.into_decode()
.unwrap();
let fraction = Fraction { num: 10, dem: 20 };
let pool = queries_v16::Pool {
stakes: fraction.clone(),
let rational = RationalNumber { numerator: 10, denominator: 20 };
let pool = localstate::queries_v16::Pool {
stakes: rational.clone(),
hashes: b"pool1qv4qgv62s3ha74p0643nexee9zvcdydcyahqqnavhj90zheuykz"
.to_vec()
.into(),
@ -1024,8 +1023,7 @@ pub async fn local_state_query_server_and_client_happy_path() {
numerator: 3,
denominator: 1000000,
}),
protocol_version_major: Some(5),
protocol_version_minor: Some(0),
protocol_version: Some((5,0)),
min_pool_cost: Some(AnyUInt::U32(340000000)),
ada_per_utxo_byte: Some(AnyUInt::U16(44)),
cost_models_for_script_languages: None,
@ -1087,7 +1085,7 @@ pub async fn local_state_query_server_and_client_happy_path() {
client.statequery().send_query(request).await.unwrap();
let result: Vec<Genesis> = client
let result: Vec<GenesisConfig> = client
.statequery()
.recv_while_querying()
.await
@ -1095,7 +1093,7 @@ pub async fn local_state_query_server_and_client_happy_path() {
.into_decode()
.unwrap();
let genesis = vec![Genesis {
let genesis = vec![GenesisConfig {
system_start: SystemStart {
year: 2021,
day_of_year: 150,
@ -1103,7 +1101,7 @@ pub async fn local_state_query_server_and_client_happy_path() {
},
network_magic: 42,
network_id: 42,
active_slots_coefficient: Fraction { num: 6, dem: 10 },
active_slots_coefficient: Fraction { num: 6, den: 10 },
security_param: 2160,
epoch_length: 432000,
slots_per_kes_period: 129600,