Skip to content
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

Torii core store u64 primitive as string in db #1532

Merged
merged 1 commit into from
Feb 19, 2024
Merged

Conversation

broody
Copy link
Collaborator

@broody broody commented Feb 12, 2024

Currently, cairo u64 types are indexed as integers in db, but sqlite treat integers as i64. Values above 2^63 - 1 are converted to floating point. This results in precision loss and also error querying grpc/graphql

2024-02-07T19:54:41.297884Z ERROR torii_grpc::server::subscriptions::entity: error when publishing entity update: error occurred while decoding column "Round$duelist_a.salt": mismatched types; Rust type `i64` (as SQL type `INTEGER`) is not compatible with SQL type `REAL` target="subscription"

This PR changes indexing u64 types to strings. This affects dynamically created tables which we don't have a good way to apply migration.

Copy link

codecov bot commented Feb 12, 2024

Codecov Report

Attention: 658 lines in your changes are missing coverage. Please review.

Comparison is base (374f2bf) 70.06% compared to head (6147865) 70.63%.
Report is 35 commits behind head on main.

Files Patch % Lines
bin/katana/src/main.rs 0.00% 94 Missing ⚠️
crates/katana/runner/src/logs.rs 10.00% 72 Missing ⚠️
bin/saya/src/main.rs 0.00% 56 Missing ⚠️
crates/saya/core/src/lib.rs 13.79% 50 Missing ⚠️
bin/saya/src/args/mod.rs 48.64% 38 Missing ⚠️
crates/katana/primitives/src/genesis/mod.rs 92.40% 35 Missing ⚠️
...es/saya/core/src/data_availability/celestia/mod.rs 3.03% 32 Missing ⚠️
crates/katana/runner/src/prefunded.rs 0.00% 31 Missing ⚠️
bin/saya/src/args/data_availability.rs 0.00% 24 Missing ⚠️
bin/sozo/src/ops/migration/mod.rs 30.30% 23 Missing ⚠️
... and 41 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1532      +/-   ##
==========================================
+ Coverage   70.06%   70.63%   +0.57%     
==========================================
  Files         236      257      +21     
  Lines       22531    25056    +2525     
==========================================
+ Hits        15786    17698    +1912     
- Misses       6745     7358     +613     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@broody broody marked this pull request as ready for review February 18, 2024 17:57
@rsodre
Copy link

rsodre commented Feb 19, 2024

Is this targeted for Dojo 0.6.0?

@broody broody merged commit 77c37f7 into main Feb 19, 2024
12 checks passed
@broody broody deleted the store-u64-as-string branch February 19, 2024 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants