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] ERC721 indexing #2517

Open
notV4l opened this issue Oct 10, 2024 · 3 comments
Open

[torii] ERC721 indexing #2517

notV4l opened this issue Oct 10, 2024 · 3 comments
Labels
bug Something isn't working torii

Comments

@notV4l
Copy link
Collaborator

notV4l commented Oct 10, 2024

Describe the bug

2024-10-10T15:07:46.602207Z  INFO torii_core::engine: Processed block. block_number=789980
2024-10-10T15:08:32.756005Z  INFO torii_core::engine: Processed block. block_number=789994
[crates/torii/core/src/executor.rs:582:17] &balance_diff = I256 {
    value: U256(
        Uint(0x0000000000000000000000000000000000000000000000000000000000000001),
    ),
    is_negative: true,
}
[crates/torii/core/src/executor.rs:582:17] balance = U256(
    Uint(0x0000000000000000000000000000000000000000000000000000000000000000),
)
[crates/torii/core/src/executor.rs:582:17] id = "0x5f5b57c7d6994587df7a39a04ba455ff6405e61809f673aa6e59582b3f2a262/0x7b696af58c967c1b14c9dde0ace001720635a660a8e90c565ea459345318b30:0x00000000000000000000000000000000000000000000000000000000000b68d1"
thread 'tokio-runtime-worker' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/subtle-2.6.1/src/lib.rs:701:9:
assertion `left == right` failed
  left: 0
 right: 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2024-10-10T15:08:33.291308Z ERROR torii_core::engine: Processing fetched data. error=channel closed
2024-10-10T15:08:34.828332Z  INFO torii_core::engine: Syncing reestablished.
2024-10-10T15:08:34.828358Z ERROR torii_core::engine: Processing fetched data. error=channel closed
2024-10-10T15:08:36.392078Z  INFO torii_core::engine: Syncing reestablished.

To Reproduce
On mainnet indexing Blobert / LS / Ekubo positions

torii  -w 0x50c46c6f69ea9f12b24fcdd1569a584ae8893db0c70ea7884b605384da78ebc --contracts ERC721:0x00539f522b29ae9251dbf7443c7a950cf260372e69efab3710a11bf17a9599f1,ERC721:0x018108b32cea514a78ef1b0e4a0753e855cdf620bc0565202c02456f618c4dc4,ERC721:0x07b696af58c967c1b14c9dde0ace001720635a660a8e90c565ea459345318b30

Additional context
alpha.15

@notV4l notV4l added bug Something isn't working torii labels Oct 10, 2024
@akintewe
Copy link

akintewe commented Oct 10, 2024

Hello can i be assigned this issue

The bug seems to be related to an underflow condition when subtracting from a zero balance. The code is likely trying to prevent negative balances, but the check is failing because it's using a constant-time comparison (from the subtle crate) that's asserting equality when it should be asserting inequality (i.e., ensuring the balance doesn't go below zero).

@lambda-0x
Copy link
Collaborator

i tried indexing just the contract which caused the issue but cannot seem to reproduce it:
Screenshot 2024-10-10 at 17 06 28@2x
Screenshot 2024-10-10 at 17 08 47@2x

can you please share the DB file of the run that you are seeing this error in so i can debug this further @notV4l

@lambda-0x
Copy link
Collaborator

lambda-0x commented Oct 10, 2024

i was even able to index all the tokens together and didn't face that issue for some reason.

exact command i ran:

RUST_LOG="torii=debug" torii -w 0x50c46c6f69ea9f12b24fcdd1569a584ae8893db0c70ea7884b605384da78ebc --contracts ERC721:0x00539f522b29ae9251dbf7443c7a950cf260372e69efab3710a11bf17a9599f1,ERC721:0x018108b32cea514a78ef1b0e4a0753e855cdf620bc0565202c02456f618c4dc4,ERC721:0x07b696af58c967c1b14c9dde0ace001720635a660a8e90c565ea459345318b30 --rpc $TORII_RPC_URL --database test.db | tee test.log

$ torii --version
torii 1.0.0-alpha.15

only errors i see are related to network (due to my flaky internet) which are in "fetching data" part, and that can be safely retried by torii

Screenshot 2024-10-10 at 19 30 34@2x

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

3 participants