Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
remybar committed Apr 27, 2024
1 parent 71bb92a commit 8f40214
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 58 deletions.
6 changes: 4 additions & 2 deletions crates/dojo-lang/src/introspect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,12 @@ fn handle_introspect_internal(
let primitive_sizes = primitive_type_introspection();
let mut layout = match composite_type {
CompositeType::Enum => {
vec!["dojo::database::introspect::ItemLayout {
vec![
"dojo::database::introspect::ItemLayout {
layout: dojo::database::introspect::Introspect::<u8>::layout()
}"
.to_string()]
.to_string(),
]
}
CompositeType::Struct => vec![],
};
Expand Down
78 changes: 55 additions & 23 deletions crates/dojo-world/src/contracts/abi/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,27 @@ abigen!(
],
"state_mutability": "view"
},
{
"type": "enum",
"name": "core::option::Option::<core::integer::u32>",
"variants": [
{
"name": "Some",
"type": "core::integer::u32"
},
{
"name": "None",
"type": "()"
}
]
},
{
"type": "function",
"name": "unpacked_size",
"inputs": [],
"outputs": [
{
"type": "core::integer::u32"
"type": "core::option::Option::<core::integer::u32>"
}
],
"state_mutability": "view"
Expand All @@ -33,7 +47,7 @@ abigen!(
"inputs": [],
"outputs": [
{
"type": "core::integer::u32"
"type": "core::option::Option::<core::integer::u32>"
}
],
"state_mutability": "view"
Expand All @@ -49,54 +63,68 @@ abigen!(
]
},
{
"type": "enum",
"name": "dojo::model::FieldLayout",
"variants": [
"type": "struct",
"name": "dojo::database::introspect::FieldLayout",
"members": [
{
"name": "Fixed",
"type": "core::array::Span::<core::integer::u8>"
"name": "selector",
"type": "core::felt252"
},
{
"name": "Array",
"type": "core::array::Span::<core::integer::u8>"
"name": "layout",
"type": "dojo::database::introspect::Layout"
}
]
},
{
"type": "struct",
"name": "dojo::model::FieldData",
"name": "core::array::Span::<dojo::database::introspect::FieldLayout>",
"members": [
{
"name": "selector",
"type": "core::felt252"
},
"name": "snapshot",
"type": "@core::array::Array::<dojo::database::introspect::FieldLayout>"
}
]
},
{
"type": "struct",
"name": "dojo::database::introspect::ItemLayout",
"members": [
{
"name": "field_layout",
"type": "dojo::model::FieldLayout"
"name": "layout",
"type": "dojo::database::introspect::Layout"
}
]
},
{
"type": "struct",
"name": "core::array::Span::<dojo::model::FieldData>",
"name": "core::array::Span::<dojo::database::introspect::ItemLayout>",
"members": [
{
"name": "snapshot",
"type": "@core::array::Array::<dojo::model::FieldData>"
"type": "@core::array::Array::<dojo::database::introspect::ItemLayout>"
}
]
},
{
"type": "enum",
"name": "dojo::model::ModelLayout",
"name": "dojo::database::introspect::Layout",
"variants": [
{
"name": "Serial",
"name": "Fixed",
"type": "core::array::Span::<core::integer::u8>"
},
{
"name": "Hash",
"type": "core::array::Span::<dojo::model::FieldData>"
"name": "Struct",
"type": "core::array::Span::<dojo::database::introspect::FieldLayout>"
},
{
"name": "Tuple",
"type": "core::array::Span::<dojo::database::introspect::ItemLayout>"
},
{
"name": "Array",
"type": "core::array::Span::<dojo::database::introspect::ItemLayout>"
}
]
},
Expand All @@ -106,7 +134,7 @@ abigen!(
"inputs": [],
"outputs": [
{
"type": "dojo::model::ModelLayout"
"type": "dojo::database::introspect::Layout"
}
],
"state_mutability": "view"
Expand Down Expand Up @@ -198,8 +226,12 @@ abigen!(
"type": "core::array::Span::<core::array::Span::<core::felt252>>"
},
{
"name": "Array",
"name": "FixedSizeArray",
"type": "core::integer::u32"
},
{
"name": "DynamicSizeArray",
"type": "()"
}
]
},
Expand Down
80 changes: 47 additions & 33 deletions crates/dojo-world/src/contracts/abi/world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,54 +45,68 @@ abigen!(
]
},
{
"type": "enum",
"name": "dojo::model::FieldLayout",
"variants": [
"type": "struct",
"name": "dojo::database::introspect::FieldLayout",
"members": [
{
"name": "Fixed",
"type": "core::array::Span::<core::integer::u8>"
"name": "selector",
"type": "core::felt252"
},
{
"name": "Array",
"type": "core::array::Span::<core::integer::u8>"
"name": "layout",
"type": "dojo::database::introspect::Layout"
}
]
},
{
"type": "struct",
"name": "dojo::model::FieldData",
"name": "core::array::Span::<dojo::database::introspect::FieldLayout>",
"members": [
{
"name": "selector",
"type": "core::felt252"
},
"name": "snapshot",
"type": "@core::array::Array::<dojo::database::introspect::FieldLayout>"
}
]
},
{
"type": "struct",
"name": "dojo::database::introspect::ItemLayout",
"members": [
{
"name": "field_layout",
"type": "dojo::model::FieldLayout"
"name": "layout",
"type": "dojo::database::introspect::Layout"
}
]
},
{
"type": "struct",
"name": "core::array::Span::<dojo::model::FieldData>",
"name": "core::array::Span::<dojo::database::introspect::ItemLayout>",
"members": [
{
"name": "snapshot",
"type": "@core::array::Array::<dojo::model::FieldData>"
"type": "@core::array::Array::<dojo::database::introspect::ItemLayout>"
}
]
},
{
"type": "enum",
"name": "dojo::model::ModelLayout",
"name": "dojo::database::introspect::Layout",
"variants": [
{
"name": "Serial",
"name": "Fixed",
"type": "core::array::Span::<core::integer::u8>"
},
{
"name": "Hash",
"type": "core::array::Span::<dojo::model::FieldData>"
"name": "Struct",
"type": "core::array::Span::<dojo::database::introspect::FieldLayout>"
},
{
"name": "Tuple",
"type": "core::array::Span::<dojo::database::introspect::ItemLayout>"
},
{
"name": "Array",
"type": "core::array::Span::<dojo::database::introspect::ItemLayout>"
}
]
},
Expand Down Expand Up @@ -251,7 +265,7 @@ abigen!(
},
{
"name": "layout",
"type": "dojo::model::ModelLayout"
"type": "dojo::database::introspect::Layout"
}
],
"outputs": [
Expand Down Expand Up @@ -279,23 +293,12 @@ abigen!(
},
{
"name": "layout",
"type": "dojo::model::ModelLayout"
"type": "dojo::database::introspect::Layout"
}
],
"outputs": [],
"state_mutability": "external"
},
{
"type": "function",
"name": "base",
"inputs": [],
"outputs": [
{
"type": "core::starknet::class_hash::ClassHash"
}
],
"state_mutability": "view"
},
{
"type": "function",
"name": "delete_entity",
Expand All @@ -310,12 +313,23 @@ abigen!(
},
{
"name": "layout",
"type": "dojo::model::ModelLayout"
"type": "dojo::database::introspect::Layout"
}
],
"outputs": [],
"state_mutability": "external"
},
{
"type": "function",
"name": "base",
"inputs": [],
"outputs": [
{
"type": "core::starknet::class_hash::ClassHash"
}
],
"state_mutability": "view"
},
{
"type": "function",
"name": "is_owner",
Expand Down

0 comments on commit 8f40214

Please sign in to comment.