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: fix CBOR decoding of Conway params update #473

Merged
merged 2 commits into from
Jun 18, 2024
Merged
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
2 changes: 1 addition & 1 deletion pallas-applying/src/alonzo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ fn check_tx_ex_units(mtx: &MintedTx, prot_pps: &AlonzoProtParams) -> ValidationR
match &tx_wits.redeemer {
Some(redeemers_vec) => {
let mut steps: u64 = 0;
let mut mem: u32 = 0;
let mut mem: u64 = 0;
for Redeemer { ex_units, .. } in redeemers_vec {
mem += ex_units.mem;
steps += ex_units.steps;
Expand Down
2 changes: 1 addition & 1 deletion pallas-applying/src/babbage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ fn check_tx_ex_units(mtx: &MintedTx, prot_pps: &BabbageProtParams) -> Validation
match &tx_wits.redeemer {
Some(redeemers_vec) => {
let mut steps: u64 = 0;
let mut mem: u32 = 0;
let mut mem: u64 = 0;
for Redeemer { ex_units, .. } in redeemers_vec {
mem += ex_units.mem;
steps += ex_units.steps;
Expand Down
2 changes: 1 addition & 1 deletion pallas-configs/src/alonzo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl From<ExecutionPrices> for pallas_primitives::alonzo::ExUnitPrices {
#[derive(Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ExUnits {
pub ex_units_mem: u32,
pub ex_units_mem: u64,
pub ex_units_steps: u64,
}

Expand Down
2 changes: 1 addition & 1 deletion pallas-primitives/src/alonzo/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ where
#[derive(Serialize, Deserialize, Encode, Decode, Debug, PartialEq, Eq, Clone, Copy)]
pub struct ExUnits {
#[n(0)]
pub mem: u32,
pub mem: u64,
#[n(1)]
pub steps: u64,
}
Expand Down
10 changes: 6 additions & 4 deletions pallas-primitives/src/conway/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,11 +578,11 @@ pub struct ProtocolParamUpdate {
#[n(21)]
pub max_block_ex_units: Option<ExUnits>,
#[n(22)]
pub max_value_size: Option<u32>,
pub max_value_size: Option<u64>,
#[n(23)]
pub collateral_percentage: Option<u32>,
pub collateral_percentage: Option<u64>,
#[n(24)]
pub max_collateral_inputs: Option<u32>,
pub max_collateral_inputs: Option<u64>,

#[n(25)]
pub pool_voting_thresholds: Option<PoolVotingThresholds>,
Expand All @@ -601,7 +601,7 @@ pub struct ProtocolParamUpdate {
#[n(32)]
pub drep_inactivity_period: Option<Epoch>,
#[n(33)]
pub minfee_refscript_cost_per_byte: Option<Epoch>,
pub minfee_refscript_cost_per_byte: Option<UnitInterval>,
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
Expand Down Expand Up @@ -1712,6 +1712,8 @@ mod tests {
include_str!("../../../test_data/conway2.block"),
// interesting block with extreme values
include_str!("../../../test_data/conway3.block"),
// interesting block with extreme values
include_str!("../../../test_data/conway4.block"),
];

for (idx, block_str) in test_blocks.iter().enumerate() {
Expand Down
2 changes: 1 addition & 1 deletion pallas-txbuilder/src/transaction/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ pub enum RedeemerPurpose {

#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
pub struct ExUnits {
pub mem: u32,
pub mem: u64,
pub steps: u64,
}

Expand Down
1 change: 1 addition & 0 deletions test_data/conway4.block
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
820785828a1a0017c5581a01df4f585820cf2b018d4d68e3ac5ab33c11085153230ae952b3e0d13a96bc9e5aed52541ec45820e3c87f196ce9fc40a8d929f3365e247f8f71e1981bffaa7cbdb0aa3a83dc790d582054a580ddf99f67818e0312374cef1f7dcdd59450930898d4d2d10e606b963e49825840e37a5c63ef1feec844a20be27be90753908f00a770d04c4cde432221733c8c97256bab684104cab6f9198baed95e15de7171c90c60522aeb9d9c1c3fb80ec7905850b8a94265846dc46df0b8faaba1519f4824f8698c60f689a1a8161234eb9abb5d4f6685491929a282967fc28e22c3b6c61a20564d78831d11d680ecc7038daf515ad256c1df2d9361cc881896ff387a0c1903f658209c0119bdb58b76ff957cbdd4c045f8ce117fe944632329bc1c8820776376f20f84582039b66a10f6b78c541ea5ed6ecec4c6dd385b869026ec16c4e48414cb39cac38b0018ca584067ed816b48555012d669b2dd3a15a44adee1e750c01123a8012a9c198f86a91310b3ab894588c6205b85b09972ccf44e88ae75c22f73437dac12962490f58905820a005901c0a0493eef1358bf7c1a18b06414fd2ddc7265fc4d01d8928b5d7b1498b53d651c1246233f869dd18b9f46a30e0a0b49a619b518a7527296129dd417328a9cda07f391e1982fe47595f35ef1ef7f4ea5c7bc89e2e41d3f469c13e5c00fbf089d3cf19f0c870872a1c5b0ed20102f44aa25da749283852d02495d3b51a5125565c6593299ae354c7e2715c1c32cea5938c54810b2c0b731355046a93583bd0af93e42379bd42b3acd0a543b7dc46969c90c6de0ccb28ab12e1a4cbc43e6d1d0c2388c5b2997e60d76ff2fa8491323d7a263b3302989471420d6713ef8f3a495daaffa59fb0d02b4e24d8ee254410cc2313d9c7b27a1b78f7271ec5c12f0c45a4580b04f7290bb8c48bd9bbf081bed4a0177409849305e9b7b8f6bee1c443a7c9bc9d2ffde22ec9c87a37a2bf1d58bca70b70b1e619bcf2a72a282b82f824593c63150714b7cfc4cfd37eb284e5441ca05b0198deee41d82d92bb9250a125f9c83b453d64116e8b320eb3516fcf26e088f3f49175168843c699999a3520273e66167034b14327c2e6ffb92ead2f8a4165a3e4a1c44de677829e8e797547b3c0bac4b5ea89cb86c01d5b1e67aee3ba36b8cf9617484db2e4d1bfc37fed1fabb73ce3c81a400d90102818258202d96189c1c37e493e9dfec965f9272339f4b39e5fcb95c00415b8b22f5f34032000181825839006f611d10634f051543415d238a3b692d65ca46375a9342dcb0cf862934c4d772dea5eeed346e07c4b449ca828f91e0eac43641a70f17247b1b0000000ba435ce66021a00031e4114d9010281841b0000000ba43b7400581de034c4d772dea5eeed346e07c4b449ca828f91e0eac43641a70f17247b8400f6b81e001bffffffffffffffff011bffffffffffffffff021affffffff031affffffff0419ffff051bffffffffffffffff061bffffffffffffffff071affffffff081bffffffffffffffff09d81e821bfffffffffffffffe1bffffffffffffffff0ad81e821bfffffffffffffffe1bffffffffffffffff0bd81e821bfffffffffffffffe1bffffffffffffffff101bffffffffffffffff111bffffffffffffffff12a1008201021382d81e821bfffffffffffffffe1bffffffffffffffffd81e821bfffffffffffffffe1bffffffffffffffff14821b7fffffffffffffff1b7fffffffffffffff15821b7fffffffffffffff1b7fffffffffffffff161bffffffffffffffff171bffffffffffffffff18181bffffffffffffffff181985d81e821bfffffffffffffffe1bffffffffffffffffd81e821bfffffffffffffffe1bffffffffffffffffd81e821bfffffffffffffffe1bffffffffffffffffd81e821bfffffffffffffffe1bffffffffffffffffd81e821bfffffffffffffffe1bffffffffffffffff181a8ad81e821bfffffffffffffffe1bffffffffffffffffd81e821bfffffffffffffffe1bffffffffffffffffd81e821bfffffffffffffffe1bffffffffffffffffd81e821bfffffffffffffffe1bffffffffffffffffd81e821bfffffffffffffffe1bffffffffffffffffd81e821bfffffffffffffffe1bffffffffffffffffd81e821bfffffffffffffffe1bffffffffffffffffd81e821bfffffffffffffffe1bffffffffffffffffd81e821bfffffffffffffffe1bffffffffffffffffd81e821bfffffffffffffffe1bffffffffffffffff181b1bffffffffffffffff181c1affffffff181d1affffffff181e1bffffffffffffffff181f1bffffffffffffffff18201affffffff1821d81e821bfffffffffffffffe1bfffffffffffffffff6827368747470733a2f2f6578616d706c652e636f6d5820000000000000000000000000000000000000000000000000000000000000000081a100d9010281825820792f73fb52a526c6c82f20444000cc0ef2683531d02b991b31ac49151ef333b658407cb5d431cce00f9bb6dadd39993de1cf7a5f4778f88ce7b55d23761bc2b82f7b5f48080adfb7193a35cc739abc2a4b8279329b35c46c359a3e38cb8bba62e40aa080
Loading