Skip to content

Commit cdecf67

Browse files
authored
Merge pull request #566 from Emurgo/release/11.2.1
Release 11.2.1 "Unbelievable protocol params"
2 parents f90602b + 977470c commit cdecf67

File tree

6 files changed

+46
-4
lines changed

6 files changed

+46
-4
lines changed

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cardano-serialization-lib",
3-
"version": "11.2.0",
3+
"version": "11.2.1",
44
"description": "(De)serialization functions for the Cardano blockchain along with related utility functions",
55
"scripts": {
66
"rust:build-nodejs": "(rimraf ./rust/pkg && cd rust; wasm-pack build --target=nodejs; cd ..; npm run js:ts-json-gen; cd rust; wasm-pack pack) && npm run js:flowgen",

rust/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cardano-serialization-lib"
3-
version = "11.2.0"
3+
version = "11.2.1"
44
edition = "2018"
55
authors = ["EMURGO"]
66
license = "MIT"

rust/json-gen/Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/src/lib.rs

+36
Original file line numberDiff line numberDiff line change
@@ -3695,6 +3695,7 @@ impl From<&NativeScripts> for RequiredSignersSet {
36953695

36963696
#[cfg(test)]
36973697
mod tests {
3698+
use crate::tx_builder_constants::TxBuilderConstants;
36983699
use super::*;
36993700

37003701
#[test]
@@ -3946,4 +3947,39 @@ mod tests {
39463947
assert!(pks4.contains(&keyhash2));
39473948
assert!(pks4.contains(&keyhash3));
39483949
}
3950+
3951+
#[test]
3952+
fn protocol_params_update_cbor_roundtrip() {
3953+
let mut orig_ppu = ProtocolParamUpdate::new();
3954+
orig_ppu.set_max_tx_size(1234);
3955+
orig_ppu.set_max_block_body_size(5678);
3956+
orig_ppu.set_max_block_header_size(91011);
3957+
orig_ppu.set_minfee_a(&Coin::from(1u32));
3958+
orig_ppu.set_minfee_b(&Coin::from(2u32));
3959+
orig_ppu.set_key_deposit(&Coin::from(3u32));
3960+
orig_ppu.set_pool_deposit(&Coin::from(4u32));
3961+
orig_ppu.set_max_epoch(5);
3962+
orig_ppu.set_n_opt(6);
3963+
orig_ppu.set_pool_pledge_influence(&Rational::new(&BigNum::from(7u32), &BigNum::from(77u32)));
3964+
orig_ppu.set_expansion_rate(&UnitInterval::new(&BigNum::from(8u32), &BigNum::from(9u32)));
3965+
orig_ppu.set_treasury_growth_rate(&UnitInterval::new(&BigNum::from(10u32), &BigNum::from(11u32)));
3966+
orig_ppu.set_protocol_version(&ProtocolVersion::new(12u32,13u32));
3967+
orig_ppu.set_min_pool_cost(&Coin::from(14u32));
3968+
orig_ppu.set_ada_per_utxo_byte(&Coin::from(15u32));
3969+
orig_ppu.set_cost_models(&TxBuilderConstants::plutus_vasil_cost_models());
3970+
orig_ppu.set_execution_costs(&ExUnitPrices::new(
3971+
&SubCoin::new(&BigNum::from(16u32), &BigNum::from(17u32)),
3972+
&SubCoin::new(&BigNum::from(18u32), &BigNum::from(19u32))));
3973+
orig_ppu.set_max_tx_ex_units(&ExUnits::new(&BigNum::from(20u32), &BigNum::from(21u32)));
3974+
orig_ppu.set_max_block_ex_units(&ExUnits::new(&BigNum::from(22u32), &BigNum::from(23u32)));
3975+
orig_ppu.set_max_value_size(24);
3976+
orig_ppu.set_collateral_percentage(25);
3977+
orig_ppu.set_max_collateral_inputs(25);
3978+
3979+
let encoded = orig_ppu.to_bytes();
3980+
let dencoded = ProtocolParamUpdate::from_bytes(encoded).unwrap();
3981+
3982+
assert_eq!(dencoded, orig_ppu);
3983+
assert_eq!(dencoded.to_bytes(), orig_ppu.to_bytes());
3984+
}
39493985
}

rust/src/serialization.rs

+6
Original file line numberDiff line numberDiff line change
@@ -3722,6 +3722,12 @@ impl cbor_event::se::Serialize for ProtocolParamUpdate {
37223722
} + match &self.max_value_size {
37233723
Some(_) => 1,
37243724
None => 0,
3725+
} + match &self.collateral_percentage {
3726+
Some(_) => 1,
3727+
None => 0,
3728+
} + match &self.max_collateral_inputs {
3729+
Some(_) => 1,
3730+
None => 0,
37253731
},
37263732
))?;
37273733
if let Some(field) = &self.minfee_a {

0 commit comments

Comments
 (0)