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

[Starknet] Allow contract addresses starting with '0x0' #1141

Closed
m-kus opened this issue Nov 21, 2024 · 5 comments · Fixed by #1181
Closed

[Starknet] Allow contract addresses starting with '0x0' #1141

m-kus opened this issue Nov 21, 2024 · 5 comments · Fixed by #1181
Assignees
Labels
improvement Misc goodies not big enough to be called "feature"
Milestone

Comments

@m-kus
Copy link
Member

m-kus commented Nov 21, 2024

It might be more user friendly to allow contract addresses that are left padded with zero (that's what block explorers provide).

  • Both Starknet node RPC and Subsquid expect truncated address (starknet_py does the truncation under the hood, but matcher does not - hence the indexing issues).
  • Note that ctx.add_contract should ideally also account for that
@Dhir0808
Copy link

Hi @m-kus I would like to take this issue

@baitcode
Copy link
Contributor

Happy to work on that one!

@dmirgaleev dmirgaleev assigned dmirgaleev and baitcode and unassigned dmirgaleev Dec 18, 2024
@dmirgaleev
Copy link
Member

Hey @baitcode! Assigned:)

baitcode added a commit to baitcode/dipdup that referenced this issue Jan 3, 2025
Added function to truncate addresses during matching so that 0x0 addresses could be matched correctly.
Small fix in starknet demo config

Fixes dipdup-io#1141
@baitcode
Copy link
Contributor

baitcode commented Jan 3, 2025

@m-kus @dmirgaleev
Please check the PR.

I decided not to change ctx.add_contract as it saves data to db, which might confusing to some users who explicitly configured contract with padded address.

I added truncation on both addresses (one received from datasource and other from config) inside matching procedure (which might slow matching down, not cool I know), but that allows achieve the desired result without changing stored data. Let me know if that assumption was wrong.

Also while doing this I discovered couple of things, that might be important, but also might be not:

  1. Startknet indexers are poorly tested (to put mildly)

  2. Locally running indexer upon switching to real-time indexing produces weird logs:
    image

  3. [this on is defo not important ] Config package would much easier to work with if packages were grouped by their base classes, like:

    • datasource_evm_etherscan
    • handler_starknet_event

I understand that event are always in handlers, but it just easier to navigate especially because the config structure is
one of the first thing you learn.

@droserasprout droserasprout added the improvement Misc goodies not big enough to be called "feature" label Jan 4, 2025
droserasprout pushed a commit to baitcode/dipdup that referenced this issue Jan 8, 2025
Added function to truncate addresses during matching so that 0x0 addresses could be matched correctly.
Small fix in starknet demo config

Fixes dipdup-io#1141
@droserasprout droserasprout added this to the 8.1.4 milestone Jan 14, 2025
@droserasprout
Copy link
Member

Hi @baitcode !

I'll answer to your questions in this thread for consistency, but please feel free to open a separate issues even for small questions/suggestions.

  1. Yup. The easiest way you can help with improving the situation is to find a complex real-world example, find a slice of blocks to cover the cases we're interested in, then drop a test config to tests/configs.

  2. Logging for Subsquid+Node indexes is to be improved in 8.2 release.

  3. We'd like to keep the package structure (both dipdup and user's one) as it is, because breaking changes bring a lot of pain in codegen, docs and migration between major versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Misc goodies not big enough to be called "feature"
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants