Fix nested generics and phantom-types, and handle list special case

List of pairs are actually encoded as 'map'.
This commit is contained in:
KtorZ
2023-01-29 10:09:16 +01:00
parent 9a44cba007
commit aaa8cba0cf
2 changed files with 102 additions and 15 deletions

View File

@@ -529,4 +529,54 @@ mod test {
),
)
}
#[test]
fn validator_phantom_and_opaque_types() {
assert_validator(
r#"
type Dict<key, value> {
inner: List<(ByteArray, value)>
}
type UUID { UUID }
fn mint(redeemer: Dict<UUID, Int>, ctx: Void) {
True
}
"#,
json!(
{
"title": "test_module",
"purpose": "mint",
"hash": "da4a98cee05a17be402b07c414d59bf894c9ebd0487186417121de8f",
"redeemer": {
"title": "Dict",
"anyOf": [
{
"title": "Dict",
"dataType": "constructor",
"index": 0,
"fields": [
{
"title": "inner",
"dataType": "list",
"items": {
"dataType": "map",
"keys": {
"dataType": "bytes"
},
"values": {
"dataType": "integer"
}
}
}
]
}
]
},
"compiledCode": "581d010000210872656465656d657200210363747800533357349445261601"
}
),
);
}
}