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

Feature: Preload application addresses #22

Merged

Conversation

brunomenezes
Copy link
Collaborator

Summary

Code changes to include preloading Cartesi application addresses created through CartesiDAppFactory contract. The goal is to decrease the indexing time when listening to the Cartesi Application event OwnershipTransferred. As currently the processor can't be changed dynamically, the two-pass indexing technique can be used to considerably bring the overhead of scanning a lot of data down.

Stats

Done on local machine using archive + rpc-node.

Network Time in minutes (before) Time in minutes (after) Result (How fast)
Sepolia 05:45 02:55 ≈ 50%
Mainnet 10:08 03:57 ≈ 61%

Changelog:

  • Added implementation to preload Cartesi application address, including new deps, a new sqd command and npm-script to run both Sepolia and Mainnet in parallel.
  • Remove leftover codegen definition for the initial architecture with both API + UI in the same repository.
  • Upgrade tests for the processor.
  • Added two new files with preloaded data.
  • Added a Preloaders README to explain and remember the intention behind the folder and files inside it.
  • Fix a problem with ambiguity when having an ERC-20 token and an NFT in the same batch of blocks. Subsquid will complain and throw errors stating that "_mass save is only for a set of the same entity", meaning the maps should be of a specific type. So changes for the ERC-20 Token / NFT / Erc721Deposit and Erc20Deposit entities storage was applied

Also include docs, dependencies, sqd-commands and npm-scripts.
Include test updates to account for pre-loaded data.
That fix the squid failed assertion check when saving these entities for a situation where both coexist in the same map.
@brunomenezes brunomenezes requested a review from tuler January 8, 2024 04:56
@brunomenezes brunomenezes self-assigned this Jan 8, 2024
@brunomenezes brunomenezes force-pushed the feature/preload-apps-addresses branch from 37c2f98 to 62d642e Compare January 14, 2024 21:24
Copy link
Contributor

@dandheedge dandheedge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

@brunomenezes brunomenezes merged commit d37fa6d into refactor/erc-20-deposit-handling Jan 16, 2024
2 checks passed
@brunomenezes brunomenezes deleted the feature/preload-apps-addresses branch January 16, 2024 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants