-
Notifications
You must be signed in to change notification settings - Fork 56
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
feat: Migrate to NEAR Lake #326
Conversation
* refactor: Upgrade to NEAR Lake Framework 0.5.1 * remove .buildkite, add GH Actions workflows, drop redis requirement, fix clippy warnings * change the version to be relative to the original indexer-for-explorer
* Update test.yml * update rust version * update ubuntu version in the workflows * add libpq-dev to cross Dockerfile
* fix: Avoid recreating access key on transfer to implicit account * refactor: Remove `AccountDeletion` logic as its also covered by `AccessKeyDeletion` * chore: Update `CHANGELOG.md` * refactor: use `near_lake_framework` types rather than `near_primitives`
* build: Create Cargo workspace and empty `indexer` crate * build: Migrate crate root to workspaces
refactor: Extract database logic to library crate
… JSON RPC (#10) * feat: Add empty `circulating_supply` crate * feat: Add missing db adapaters/models to `database` lib * feat: Add core circulating supply files * refactor: Flatten/merge `circulating_supply` files * fix: Add missing dependencies and fix broken imports Excluding `near-indexer` and `near-client` as these will be replaced * refactor: Make in-use circulating_supply functions public * refactor: Replace `near_indexer::near_primitives` with `near_lake_framework::near_indexer_primitives` * refactor: Instantiate pg pool in `main` * refactor: Replace `ViewClient` calls with `JsonRpcClient` * refactor: `await` circulating_supply in `main` * chore: Rename `tracing` target `aggregated` -> `circulating_supply` * refactor: Extract json rpc url to environment variable * feat: Subscribe to tracing events via `RUST_LOG` env * feat: Improve logging * refactor: Replace `near-indexer-framework` with `near-indexer-primtives` * fix: Base64 decode lockup state before deserializing * feat: Print `anyhow` errors with cause * chore: Add note to ensure API use is updated when upgrading near-core * chore: Use kebab case for workspace crate
* chore: Update `indexer` to `10.2` * chore: Update `indexer` to `10.3`
* chore: Move `migrations` to same dir as `Diesel.toml` * chore: Remove unnecessary `.gitkeep` * feat: Add missing Diesel migrations * chore: Update `README.md` for running migrations
* feat: Enable JSON logging via environment variable * chore: Update CHANGELOG & Cargo version
* refactor: Move indexer stream to separate thread * feat: Standup HTTP server * fix: Ensure lake `ReceiverStream` finishes when process exits * feat: Serve block metrics via http * refactor: Rename `HTTP_PORT` -> `PORT` * chore: Update `CHANGELOG.md` and Cargo version * refactor: Rename block metrics for clarity
* refactor: Parse `port` via CLI and env rather than just env * refactor: Return `anyhow::Result` from `metrics::init_server`
ecfae9d
to
9cb7de8
Compare
5e59cc3
to
1112e68
Compare
f45108a
to
6b7edda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am approving this PR to avoid blocking it, though I'd wait for @telezhnaya inputs before merging.
Also, I want to draw everybody's attention to questions:
- Should we drop the Buildkite jobs since we can run checks via GitHub Actions and we're not going to build binaries with Buildkite anymore? (@ecp88 , @frol )
- Is FOSSA still a thing and we should add its check to GH Actions?
( @ecp88, @pkudinov ) - Is it worth switching to
[tokio::main]
instead of[actix::main]
? (@telezhnaya , @frol )
I don't know about the plans regarding Buildkite, but I would personally prefer Github Actions. Make your own judgement here.
I would say it is a low-priority, and should only be done after the upgrade to near-lake-framework 0.6+ (after nearcore dependencies are upgraded to 0.15+ versions, which dropped actix as their leaf dependency), also, you will need to replace |
6b7edda
to
5e79896
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work, thank you @morgsmccauley !
By the way, you've already migrated all the FT/NFT logic, as I see. We discussed that we need to keep the old indexer (node based) to collect FT/NFT stuff, but you've done everything we need, so we can kill the old instances, no blockers here from my side.
cc @khorolets
indexer/src/main.rs
Outdated
let config: near_lake_framework::LakeConfig = opts.to_lake_config().await; | ||
let (_, stream) = near_lake_framework::streamer(config); | ||
|
||
tokio::spawn(async move { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right that we use actix only because of diesel?
Anyway, I'm with @khorolets , let's use [tokio::main]
Thanks heaps @telezhnaya @khorolets !! I've addressed all comments which I could, these have been resolved. To make things easier, I've summarised the unresolved discussions below. From the comments that @khorolets left I think the majority can be addressed in future PRs, feel free to resolve these if you agree. There are still two discussions which require decisions.
|
@morgsmccauley @telezhnaya @ecp88
|
Thanks for creating all the relevant issues @khorolets 🙏🏽 |
This PR migrates the core indexing functionality to
near-lake-framework
by merging in the khorolets/near-indexer-for-explorer fork. Because the two branches have diverged, leading to many conflicts, it was easier to merge the fork in to a local branch, rather than creating a pull request from the fork directly.We are in the process of phasing out the live nearcore based
indexer-for-explorer
s, replacing them with this lake fork, which makes this a good time to merge this back in. I've pushed the currentmaster
to master-nearcore so that the previous state is still available to build in case we need it, can someone with admin access please make this branch protected?The code is mostly identical to khorolets/near-indexer-for-explorer:master-lake, I've commented inline where things differ.