fix(primitives): Handle generic int in Plutus data (#202)
This commit is contained in:
parent
1e18603ed2
commit
c647e51510
3 changed files with 7 additions and 2 deletions
|
|
@ -868,7 +868,8 @@ impl<'b, C> minicbor::decode::Decode<'b, C> for BigInt {
|
|||
| minicbor::data::Type::I8
|
||||
| minicbor::data::Type::I16
|
||||
| minicbor::data::Type::I32
|
||||
| minicbor::data::Type::I64 => Ok(Self::Int(d.decode_with(ctx)?)),
|
||||
| minicbor::data::Type::I64
|
||||
| minicbor::data::Type::Int => Ok(Self::Int(d.decode_with(ctx)?)),
|
||||
minicbor::data::Type::Tag => {
|
||||
let tag = d.tag()?;
|
||||
|
||||
|
|
@ -946,7 +947,8 @@ impl<'b, C> minicbor::decode::Decode<'b, C> for PlutusData {
|
|||
| minicbor::data::Type::I8
|
||||
| minicbor::data::Type::I16
|
||||
| minicbor::data::Type::I32
|
||||
| minicbor::data::Type::I64 => Ok(Self::BigInt(d.decode_with(ctx)?)),
|
||||
| minicbor::data::Type::I64
|
||||
| minicbor::data::Type::Int => Ok(Self::BigInt(d.decode_with(ctx)?)),
|
||||
minicbor::data::Type::Map | minicbor::data::Type::MapIndef => {
|
||||
Ok(Self::Map(d.decode_with(ctx)?))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -682,6 +682,8 @@ mod tests {
|
|||
include_str!("../../../test_data/babbage5.block"),
|
||||
// peculiar block with map undef in plutus data
|
||||
include_str!("../../../test_data/babbage6.block"),
|
||||
// block with generic int in cbor
|
||||
include_str!("../../../test_data/babbage7.block"),
|
||||
];
|
||||
|
||||
for (idx, block_str) in test_blocks.iter().enumerate() {
|
||||
|
|
|
|||
1
test_data/babbage7.block
Normal file
1
test_data/babbage7.block
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue