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

Open
m-kus opened this issue Nov 21, 2024 · 4 comments · May be fixed by #1181
Open

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

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

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

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 baitcode linked a pull request Jan 3, 2025 that will close this issue
2 tasks
@baitcode
Copy link

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
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