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

[BUG] Torii error with i128 #2834

Open
rsodre opened this issue Dec 20, 2024 · 0 comments
Open

[BUG] Torii error with i128 #2834

rsodre opened this issue Dec 20, 2024 · 0 comments
Labels
bug Something isn't working torii

Comments

@rsodre
Copy link

rsodre commented Dec 20, 2024

Describe the bug

Storing some data on a i128 field breaks torii client

To Reproduce

After storing negative value to this model...

#[derive(Copy, Drop, Serde)]
#[dojo::model]
pub struct ChallengeFameBalance {
    #[key]
    pub duel_id: u128,
    //-------------------------
    pub balance_a: i128,
    pub balance_b: i128,
}

there was this on the log...

2024-12-20T19:31:30.103239Z  INFO torii_core::processors::event_message: Store event message. namespace=pistols name=PlayerActivity system=0x63418f4f6eae9f10d23d4ce980a6ba593d4c9ac70f1dec1da378fbd5173c3ce
2024-12-20T19:31:30.105558Z  INFO torii_core::engine: Processed block. block_number=31
2024-12-20T19:31:30.106071Z  INFO torii_core::processors::store_set_record: Store set record. namespace=pistols name=Scoreboard entity_id="0x713838728c102fbabb4eb56d70568db971ca80f4ba42ed8ed358c8e498dfb13"
2024-12-20T19:31:30.106409Z  INFO torii_core::processors::store_set_record: Store set record. namespace=pistols name=Scoreboard entity_id="0x4a2471747639cc1846a1d83c60a1151fd0f233ba92477a42c8816d4ab5222ea"
2024-12-20T19:31:30.107504Z  INFO torii_core::processors::store_set_record: Store set record. namespace=pistols name=Round entity_id="0x579e8877c7755365d5ec1ec7d3a94a457eff5d1f40482bbe9729c064cdead2"
2024-12-20T19:31:30.107545Z  INFO torii_core::processors::store_set_record: Store set record. namespace=pistols name=Duelist entity_id="0x579e8877c7755365d5ec1ec7d3a94a457eff5d1f40482bbe9729c064cdead2"
2024-12-20T19:31:30.107990Z  INFO torii_core::processors::store_set_record: Store set record. namespace=pistols name=Challenge entity_id="0x579e8877c7755365d5ec1ec7d3a94a457eff5d1f40482bbe9729c064cdead2"
2024-12-20T19:31:30.108050Z  INFO torii_core::processors::store_del_record: Store delete record. namespace=pistols name=Pact entity_id="0x6586463363cc72c0dd589089336638f745820570a59ed63f30e0b0f3f9a0505"
2024-12-20T19:31:30.108296Z  INFO torii_core::processors::store_set_record: Store set record. namespace=pistols name=Duelist entity_id="0x20185e0ab367a55b068e0f8b7abda935f15b418737e7b67d84aaee133ec2572"
2024-12-20T19:31:30.108561Z  INFO torii_core::processors::store_set_record: Store set record. namespace=pistols name=ChallengeFameBalance entity_id="0x579e8877c7755365d5ec1ec7d3a94a457eff5d1f40482bbe9729c064cdead2"
2024-12-20T19:31:30.119936Z ERROR torii_grpc::server::subscriptions::event: Processing event update. target="torii::grpc::server::subscriptions::event" error=Parsing error: Failed to create Felt from string

The client raises this error when retrieving the entity, and nothing syncs anymore...

Screenshot 2024-12-20 at 16 33 46

But I can see the stored value with graphQL and sozo model, but balance_a doesn't look correct, it's padded with ffffffffffffff:

$ sozo model get pistols-ChallengeFameBalance 1
{
    duel_id         : 0x0000000000000000000000000000000000000000000000000000000000000001,
    balance_a       : 0x00000000000000000000000000000000ffffffffffffffe4e51b291d10b00000,
    balance_b       : 0x00000000000000000000000000000000000000000000001b1ae4d6e2ef500000
}

Expected behavior

Torii client should retrieve the negative value.

@rsodre rsodre added the bug Something isn't working label Dec 20, 2024
@glihm glihm added the torii label Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working torii
Projects
None yet
Development

No branches or pull requests

2 participants