Skip to content

Commit

Permalink
CI Fixes + Deserialization regen (#312)
Browse files Browse the repository at this point in the history
Regen using dcSpark/cddl-codegen#225 to fix new clippy lint causing
several open PRs to fail

This also includes some enum deserialization check improvements
introduced in dcSpark/cddl-codegen#217

Also some minor updates to the .cddl spec to fix names in a few places
  • Loading branch information
rooooooooob authored Mar 7, 2024
1 parent 0c3c937 commit 28c9f4d
Show file tree
Hide file tree
Showing 18 changed files with 1,138 additions and 508 deletions.
48 changes: 24 additions & 24 deletions chain/rust/src/byron/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl Deserialize for AddressContent {
.map_err(|e: DeserializeError| e.annotate("addr_attributes"))?;
let addr_type = (|| -> Result<_, DeserializeError> {
let initial_position = raw.as_mut_ref().stream_position().unwrap();
match (|raw: &mut Deserializer<_>| -> Result<_, DeserializeError> {
let deser_variant = (|raw: &mut Deserializer<_>| -> Result<_, DeserializeError> {
let public_key_value = raw.unsigned_integer()?;
if public_key_value != 0 {
return Err(DeserializeFailure::FixedValueMismatch {
Expand All @@ -207,15 +207,15 @@ impl Deserialize for AddressContent {
.into());
}
Ok(())
})(raw)
{
})(raw);
match deser_variant {
Ok(()) => return Ok(ByronAddrType::PublicKey),
Err(_) => raw
.as_mut_ref()
.seek(SeekFrom::Start(initial_position))
.unwrap(),
};
match (|raw: &mut Deserializer<_>| -> Result<_, DeserializeError> {
let deser_variant = (|raw: &mut Deserializer<_>| -> Result<_, DeserializeError> {
let script_value = raw.unsigned_integer()?;
if script_value != 1 {
return Err(DeserializeFailure::FixedValueMismatch {
Expand All @@ -225,15 +225,15 @@ impl Deserialize for AddressContent {
.into());
}
Ok(())
})(raw)
{
})(raw);
match deser_variant {
Ok(()) => return Ok(ByronAddrType::Script),
Err(_) => raw
.as_mut_ref()
.seek(SeekFrom::Start(initial_position))
.unwrap(),
};
match (|raw: &mut Deserializer<_>| -> Result<_, DeserializeError> {
let deser_variant = (|raw: &mut Deserializer<_>| -> Result<_, DeserializeError> {
let redeem_value = raw.unsigned_integer()?;
if redeem_value != 2 {
return Err(DeserializeFailure::FixedValueMismatch {
Expand All @@ -243,8 +243,8 @@ impl Deserialize for AddressContent {
.into());
}
Ok(())
})(raw)
{
})(raw);
match deser_variant {
Ok(()) => return Ok(ByronAddrType::Redeem),
Err(_) => raw
.as_mut_ref()
Expand Down Expand Up @@ -419,7 +419,7 @@ impl Deserialize for SpendingData {
let len = raw.array()?;
let _read_len = CBORReadLen::from(len);
let initial_position = raw.as_mut_ref().stream_position().unwrap();
match (|raw: &mut Deserializer<_>| -> Result<_, DeserializeError> {
let deser_variant = (|raw: &mut Deserializer<_>| -> Result<_, DeserializeError> {
(|| -> Result<_, DeserializeError> {
let tag_value = raw.unsigned_integer()?;
if tag_value != 0 {
Expand Down Expand Up @@ -448,15 +448,15 @@ impl Deserialize for SpendingData {
},
}
Ok(Self::SpendingDataPubKey(pubkey))
})(raw)
{
})(raw);
match deser_variant {
Ok(variant) => return Ok(variant),
Err(_) => raw
.as_mut_ref()
.seek(SeekFrom::Start(initial_position))
.unwrap(),
};
match (|raw: &mut Deserializer<_>| -> Result<_, DeserializeError> {
let deser_variant = (|raw: &mut Deserializer<_>| -> Result<_, DeserializeError> {
(|| -> Result<_, DeserializeError> {
let tag_value = raw.unsigned_integer()?;
if tag_value != 1 {
Expand Down Expand Up @@ -485,15 +485,15 @@ impl Deserialize for SpendingData {
},
}
Ok(Self::SpendingDataScript(script))
})(raw)
{
})(raw);
match deser_variant {
Ok(variant) => return Ok(variant),
Err(_) => raw
.as_mut_ref()
.seek(SeekFrom::Start(initial_position))
.unwrap(),
};
match (|raw: &mut Deserializer<_>| -> Result<_, DeserializeError> {
let deser_variant = (|raw: &mut Deserializer<_>| -> Result<_, DeserializeError> {
(|| -> Result<_, DeserializeError> {
let tag_value = raw.unsigned_integer()?;
if tag_value != 2 {
Expand Down Expand Up @@ -522,8 +522,8 @@ impl Deserialize for SpendingData {
},
}
Ok(Self::SpendingDataRedeem(redeem))
})(raw)
{
})(raw);
match deser_variant {
Ok(variant) => return Ok(variant),
Err(_) => raw
.as_mut_ref()
Expand Down Expand Up @@ -572,7 +572,7 @@ impl Deserialize for StakeDistribution {
let len = raw.array()?;
let _read_len = CBORReadLen::from(len);
let initial_position = raw.as_mut_ref().stream_position().unwrap();
match (|raw: &mut Deserializer<_>| -> Result<_, DeserializeError> {
let deser_variant = (|raw: &mut Deserializer<_>| -> Result<_, DeserializeError> {
(|| -> Result<_, DeserializeError> {
let tag_value = raw.unsigned_integer()?;
if tag_value != 0 {
Expand Down Expand Up @@ -601,15 +601,15 @@ impl Deserialize for StakeDistribution {
},
}
Ok(Self::SingleKey(stakeholder_id))
})(raw)
{
})(raw);
match deser_variant {
Ok(variant) => return Ok(variant),
Err(_) => raw
.as_mut_ref()
.seek(SeekFrom::Start(initial_position))
.unwrap(),
};
match (|raw: &mut Deserializer<_>| -> Result<_, DeserializeError> {
let deser_variant = (|raw: &mut Deserializer<_>| -> Result<_, DeserializeError> {
let bootstrap_era_distr_value = raw.unsigned_integer()?;
if bootstrap_era_distr_value != 1 {
return Err(DeserializeFailure::FixedValueMismatch {
Expand All @@ -619,8 +619,8 @@ impl Deserialize for StakeDistribution {
.into());
}
Ok(())
})(raw)
{
})(raw);
match deser_variant {
Ok(()) => return Ok(StakeDistribution::BootstrapEra),
Err(_) => raw
.as_mut_ref()
Expand Down
Loading

0 comments on commit 28c9f4d

Please sign in to comment.