dojo icon indicating copy to clipboard operation
dojo copied to clipboard

[BUG] bindings generation command crashes due to "not found in filtered tokens"

Open alexhaloETH opened this issue 1 year ago • 3 comments

When running the command sozo build --unity the build process runs fine but the creation of the bindings for the unity game engine seem to error out

Although not 100% sure, I believe to reproduce this bug you would need a model with a generic type, in our case I believe TStats model can either be a i8 or u8 Link to our repo and where i think the issue generates from

The bindings should generate full without any errors

Proof alexhalo@Legion:~/Work-Repos/blob-arena-contracts$ sozo build --unity Updating git repository https://github.com/dojoengine/dojo Compiling blob_arena v0.7.1 (/home/alexhalo/Work-Repos/blob-arena-contracts/Scarb.toml) Finished dev profile target(s) in 13 seconds thread 'main' panicked at /home/runner/.cargo/git/checkouts/cainome-971a2d0b3a80c185/5c2616c/crates/parser/src/tokens/mod.rs:161:25: Composite blob_arena::stats::TStats::<core::integer::u8> not found in filtered tokens note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

This error was was reproduced in 1.0.1 1.0.4 1.0.5 version of dojo PS: the v0.7.1 in the naming you can ignore the project is based on dojo version 1.0.1

alexhaloETH avatar Dec 06 '24 09:12 alexhaloETH

As an update, I changed the name as I have noticed this happens also for the typescript

Also I have tried 1.0.8 version and the problem still persists

-- Edit, this is the specific way to replicate this error #[derive(Copy, Drop, Serde, PartialEq, IntrospectPacked, Default)] struct TStats<T> { strength: T, vitality: T, dexterity: T, luck: T, } type UStats = TStats;

#[dojo::model] #[derive(Drop, Serde, Copy)] struct BlobertItem { #[key] key: felt252, stats: UStats, } `

alexhaloETH avatar Dec 20 '24 05:12 alexhaloETH

Sorry for the delay on that, will have a look or @Larkooo.

glihm avatar Jan 16 '25 18:01 glihm

Currently having an identical error with the following code:

#[derive(Serde, Copy, Drop, Introspect, PartialEq, Debug)]
pub enum InspectableActions {
    set_visible,
    read_description,
}

// Inspectable component
#[derive(Clone, Drop, Serde, Introspect, Debug)]
#[dojo::model]
pub struct Inspectable {
    #[key]
    pub inst: felt252,
    pub is_inspectable: bool,
    // properties
    pub is_visible: bool,
    pub description: Array<ByteArray>,
    pub action_map: Array<ActionMap<InspectableActions>>,
}

#[derive(Clone, Drop, Serde, Introspect, Debug)]
pub struct ActionMap<T> {
    pub action: ByteArray,
    pub inst: felt252,
    pub action_fn: T,
}
thread 'main' panicked at /Users/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cainome-parser-0.1.0/src/tokens/mod.rs:183:25:
Composite lore::components::inspectable::ActionMap::<lore::components::inspectable::InspectableActions> not found in filtered tokens
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Cygnusfear avatar Mar 31 '25 18:03 Cygnusfear