Skip to content

Commit 5dfc32e

Browse files
committed
Reverted the previous changes and updated the witness-set field-4 serialization
1 parent 270a518 commit 5dfc32e

File tree

7 files changed

+10
-20
lines changed

7 files changed

+10
-20
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cardano-serialization-lib",
3-
"version": "10.0.4-beta.3",
3+
"version": "10.0.4-beta.4",
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; wasm-pack pack) && npm run js:flowgen",

rust/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cardano-serialization-lib"
3-
version = "10.0.4-beta.3"
3+
version = "10.0.4-beta.4"
44
edition = "2018"
55
authors = ["EMURGO"]
66
license = "MIT"

rust/src/plutus.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -475,13 +475,6 @@ impl PlutusList {
475475
}
476476
}
477477

478-
pub(crate) fn clone_as_definite(&self) -> Self {
479-
Self {
480-
elems: self.elems.clone(),
481-
definite_encoding: Some(true),
482-
}
483-
}
484-
485478
pub fn len(&self) -> usize {
486479
self.elems.len()
487480
}
@@ -1279,12 +1272,12 @@ mod tests {
12791272
// witness_set should have fixed length array
12801273
let mut witness_set = TransactionWitnessSet::new();
12811274
witness_set.set_plutus_data(&list);
1282-
assert_eq!("a1048101", hex::encode(witness_set.to_bytes()));
1275+
assert_eq!("a1049f01ff", hex::encode(witness_set.to_bytes()));
12831276

12841277
list = PlutusList::new();
12851278
list.add(&datum);
12861279
witness_set.set_plutus_data(&list);
1287-
assert_eq!(format!("a10481{}", datum_cli), hex::encode(witness_set.to_bytes()));
1280+
assert_eq!(format!("a1049f{}ff", datum_cli), hex::encode(witness_set.to_bytes()));
12881281
}
12891282

12901283
#[test]

rust/src/serialization.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,10 +1806,7 @@ impl cbor_event::se::Serialize for TransactionWitnessSet {
18061806
}
18071807
if let Some(field) = &self.plutus_data {
18081808
serializer.write_unsigned_integer(4)?;
1809-
serializer.write_array(cbor_event::Len::Len(field.len() as u64))?;
1810-
for i in 0..field.len() {
1811-
field.get(i).serialize(serializer)?;
1812-
}
1809+
field.serialize(serializer)?;
18131810
}
18141811
if let Some(field) = &self.redeemers {
18151812
serializer.write_unsigned_integer(5)?;

rust/src/utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ pub fn hash_script_data(redeemers: &Redeemers, cost_models: &Costmdls, datums: O
908908
*/
909909
buf.push(0x80);
910910
if let Some(d) = &datums {
911-
buf.extend(d.clone_as_definite().to_bytes());
911+
buf.extend(d.to_bytes());
912912
}
913913
buf.push(0xA0);
914914
} else {
@@ -921,7 +921,7 @@ pub fn hash_script_data(redeemers: &Redeemers, cost_models: &Costmdls, datums: O
921921
*/
922922
buf.extend(redeemers.to_bytes());
923923
if let Some(d) = &datums {
924-
buf.extend(d.clone_as_definite().to_bytes());
924+
buf.extend(d.to_bytes());
925925
}
926926
buf.extend(cost_models.language_views_encoding());
927927
}
@@ -2173,7 +2173,7 @@ mod tests {
21732173

21742174
assert_eq!(
21752175
hex::encode(script_data_hash.to_bytes()),
2176-
"57240d358f8ab6128c4a66340271e4fec39b4971232add308f01a5809313adcf"
2176+
"4415e6667e6d6bbd992af5092d48e3c2ba9825200d0234d2470068f7f0f178b3"
21772177
);
21782178
}
21792179

0 commit comments

Comments
 (0)