-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(dojo-core): add read schema support #2932
Merged
glihm
merged 14 commits into
dojoengine:main
from
bengineer42:add-read-schema-support/0
Jan 27, 2025
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
66c882e
Made code changes needs testing
bengineer42 dbe3895
scheming
bengineer42 30c7d3c
scheming
bengineer42 77ea57a
Merge branch 'main' into add-read-schema-support/0
bengineer42 772f1a7
feat(model): Added the ability to read from a schema
bengineer42 33b5026
fix(tests): fmting
bengineer42 790bc56
fix(tests): fmting
bengineer42 b95b94b
feat(benchmark): add initial benchmark setup and model definitions
bengineer42 5dd114c
feat(benchmark): added model bvalues in for benchmarking
bengineer42 1ed7b99
Merge branch 'main' into add-read-schema-support/0
bengineer42 5643b53
chore: Addressing comments
bengineer42 95bdb30
merge main
glihm b3ea517
tests: regenerate test db
glihm 89883f7
fix: ensure bench example is only for tests
glihm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Code generated by scarb DO NOT EDIT. | ||
version = 1 | ||
|
||
[[package]] | ||
name = "dojo" | ||
version = "1.0.12" | ||
dependencies = [ | ||
"dojo_plugin", | ||
] | ||
|
||
[[package]] | ||
name = "dojo_benchmark" | ||
version = "0.1.0" | ||
dependencies = [ | ||
"dojo", | ||
"dojo_cairo_test", | ||
] | ||
|
||
[[package]] | ||
name = "dojo_cairo_test" | ||
version = "1.0.12" | ||
dependencies = [ | ||
"dojo", | ||
] | ||
|
||
[[package]] | ||
name = "dojo_plugin" | ||
version = "2.9.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[package] | ||
cairo-version = "=2.9.2" | ||
name = "dojo_benchmark" | ||
version = "0.1.0" | ||
edition = "2024_07" | ||
|
||
[[target.starknet-contract]] | ||
sierra = true | ||
casm = true | ||
build-external-contracts = ["dojo::world::world_contract::world"] | ||
|
||
[dependencies] | ||
dojo = { path = "../../crates/dojo/core" } | ||
starknet = "2.9.2" | ||
|
||
[dev-dependencies] | ||
cairo_test = "2.9.2" | ||
dojo_cairo_test = { path = "../../crates/dojo/core-cairo-test" } | ||
|
||
[features] | ||
default = [] | ||
|
||
[profile.sepolia] |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep this file to the minimum, I think only the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[world] | ||
description = "Benchmark world." | ||
name = "benchmark" | ||
seed = "benchmark" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add array bounds checking for safer array operations.
While the test is comprehensive, it could be more robust by checking the array length before accessing elements:
let mut values: Array<FooSchema> = world.read_schemas([foo.ptr(), foo_2.ptr()].span()); + assert!(values.len() == 2, "Expected 2 schemas"); let schema_1 = values.pop_front().unwrap(); let schema_2 = values.pop_front().unwrap();
📝 Committable suggestion