-
Notifications
You must be signed in to change notification settings - Fork 2
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
neume version 2.1 #10
Open
il3ven
wants to merge
15
commits into
main
Choose a base branch
from
il3ven
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
View the discussion here for more context: https://github.com/orgs/neume-network/discussions/29#discussioncomment-5938752
LocalStorage is similar to the local-storage present in browsers. It is a simple key-value database powered by LevelDB. Each strategy can have its own localstorage and use it to store any data other than tracks. Strategies are free to use it however they wish. The purpose of localstorage is to store intermediate data. Here tracks are the final data. For example, a strategy like SoundProtocol needs to keep track of contracts which can mint NFTs and listen for updates on them. LocalStorage can be used here. Earlier, we created a JSON file to store the data required by SoundProtocol. LocalStorage replaces that JSON file as it is more generic and scalable.
Major changes: - The Strategy class has been changed. All strategies implement this class. - Introduce a concept of *components*. - Add Lens strategy. - Refactor Sound Protocol strategy according to the new strucutre. - Introduce multi-chain strategies. - Changes in daemon.ts, neume.ts to run the new refactored strategies. What are components? Each strategy is a class and it can define functions. What if we want to share some functions among strategies. The answer to do that is components. For example, `ethGetLogs` is a component that can be used to fetch logs. Difference between components and utils: Utils are simple functions which can be called from anywhere. Components can only be called from inside strategies. We use the `this` keyword to enforce it. TypeScript helps here by defining the type of `this`. Why can't we have utils instead of components? Components are aware that they will be called from a strategy. Therefore, they can use the `this` keyword to fetch information about the strategy and act upon it. For example, the `ethGetLogs` component can use `this.chain` to get the chain of the strategy and fetch logs from the appropriate chain. If `ethGetLogs` was a simple function we would have to pass the chain as an argument. It is okay if it is just chain but functions often need more information than just chain. Passing 10 parameters is not ideal and problematic from a refactor point of view. About `handleTransfer` component: It is a component that can be used by any strategy to listen for ERC721 transfer events. The component is heavily opnionated.
- use WAL mode for sqlite Under heavy load, I was facing knex timeout errors. WAL mode fixes it. - update test cases - more utility functions for the database and bug fixes
- update remaining strategies according to the new Strategy interface - catch a plethora of bugs; introduce many checks to catch incorrect tracks - block numbers are now saved per strategy
- Remove crawl and filter-contracts command. The daemon command now handles both functionalities. - Update init command. - Daemon now runs each strategy individually. Earlier, if a strategy A was at block number X then strategy B was at X too. Now, all strategies run independently. Very obvious but significant change. - Update sync command according to the new database. - Update JSON RPC endpoints for syncing.
do not create files if they already exists.
- Instead of using `upsertTrack` to update token, introduced `upsertToken` function. `upsertTrack` used more bandwidth and required calling `getTrack` before. - Instead of using multiple insert, use one insert for multiple writes.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check the individual commits for detailed description.