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] ERC20 indexing #2516

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

[torii] ERC20 indexing #2516

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

Comments

@notV4l
Copy link
Collaborator

notV4l commented Oct 10, 2024

Describe the bug

2024-10-10T12:03:54.208066Z  INFO torii_core::engine: Processed block. block_number=10240
[crates/torii/core/src/executor.rs:582:17] &balance_diff = I256 {
    value: U256(
        Uint(0x00000000000000000000000000000000000000000000000000583E7BE3672ED6),
    ),
    is_negative: true,
}
[crates/torii/core/src/executor.rs:582:17] balance = U256(
    Uint(0x0000000000000000000000000000000000000000000000000000000000000000),
)
[crates/torii/core/src/executor.rs:582:17] id = "0x78c43983fca31e2f0c0a755af505b8c80992e55e88109c70bd087bbeae17a0d/0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7/"
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
Error: channel closed

note it crashes on default blocks-chunk-size

also got this error on another run with --blocks-chunk-size 10

2024-10-10T12:50:26.667790Z ERROR torii_core::executor: Failed to execute query. type=Other error=Failed to execute query: "INSERT INTO tokens (id, contract_address, name, symbol, decimals) VALUES (?, ?, ?, ?, ?)", args: [String("0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"), FieldElement(0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7), String("Ether"), String("ETH"), Int(18)]

it seems impossible to run with default 10240 on mainnet excpect on a local node, i tried with cartridge rpc and some other, it seems to either hang for very long time or do nothing

To Reproduce

on mainnet
torii  -w 0x50c46c6f69ea9f12b24fcdd1569a584ae8893db0c70ea7884b605384da78ebc --contracts ERC20:0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7,ERC20:0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8,ERC20:0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d

Expected behavior
No crash

Additional context
alpha.15

@notV4l notV4l added bug Something isn't working torii labels Oct 10, 2024
@lambda-0x
Copy link
Contributor

looks like its issue specifically related to ETH erc20 contract, it looks like old version of the contract didn't comply with the ERC spec properly will have to dig deeper to figure out the exact issue.

it seems impossible to run with default 10240 on mainnet excpect on a local node, i tried with cartridge rpc and some other, it seems to either hang for very long time or do nothing

thats expected considering you are indexing ETH, STRK and USDC which all are very big contracts and fetching events for them takes longer. but you can use RUST_LOG="torii=debug" to see it fetching the events

@notV4l notV4l changed the title [torii] ERC indexing [torii] ERC20 indexing Oct 10, 2024
@lambda-0x
Copy link
Contributor

confirmed with voyager team that ETH on mainnet in early days didn't emit erc transfer events correctly. we would have to hardcode some patch specifically for it to get it working

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