forked from forbole/callisto
-
Notifications
You must be signed in to change notification settings - Fork 1
Migrate to Cosmos EVM and XRPLEVM v9 #5
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
Open
JordiParraCrespo
wants to merge
4
commits into
xrplevm:chains/exrp/devnet
Choose a base branch
from
JordiParraCrespo:chore/migrate-evmos-to-cosmos-evm
base: chains/exrp/devnet
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
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
62ac984
chore: improve local development setup
JordiParraCrespo ffee6aa
fix: autodetect platform and update hasura docker compose based on that
JordiParraCrespo 89b7577
chore: migrate to xrplevm v9 and cosmos/evm
JordiParraCrespo 3d4a710
fix: comments from copilot
JordiParraCrespo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ vendor/ | |
| *.toml | ||
| *.json | ||
| config.yaml | ||
| .env | ||
|
|
||
| # Coverage | ||
| coverage.* | ||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,227 @@ | ||
| # Callisto | ||
| [](https://github.com/forbole/bdjuno/actions?query=workflow%3ATests) | ||
| [](https://goreportcard.com/report/github.com/forbole/bdjuno) | ||
|  | ||
| # XRPL EVM Callisto - Blockchain Indexer | ||
|
|
||
| Callisto (formerly BDJuno) is the [Juno](https://github.com/forbole/juno) implementation | ||
| for [Big Dipper](https://github.com/forbole/big-dipper). | ||
| Callisto is a blockchain indexer (formerly BDJuno) built on the Juno framework designed to index and parse Cosmos blockchain data. It stores blockchain data in PostgreSQL and provides GraphQL APIs through Hasura. | ||
|
|
||
| It extends the custom Juno behavior by adding different handlers and custom operations to make it easier for Big Dipper | ||
| showing the data inside the UI. | ||
| ## Requirements | ||
|
|
||
| All the chains' data that are queried from the RPC and gRPC endpoints are stored inside | ||
| a [PostgreSQL](https://www.postgresql.org/) database on top of which [GraphQL](https://graphql.org/) APIs can then be | ||
| created using [Hasura](https://hasura.io/). | ||
| - Go 1.23.8 | ||
| - PostgreSQL 13+ | ||
| - Docker & Docker Compose | ||
| - Hasura 2.6.1+ (included in docker-compose) | ||
|
|
||
| ## Usage | ||
| To know how to setup and run Callisto, please refer to | ||
| the [docs website](https://docs.bigdipper.live/cosmos-based/parser/overview/). | ||
| ## Quick Start | ||
|
|
||
| ## Testing | ||
| If you want to test the code, you can do so by running | ||
| ### 1. Install Go | ||
|
|
||
| ```shell | ||
| $ make test-unit | ||
| Using GVM (Go Version Manager): | ||
|
|
||
| ```bash | ||
| gvm install go1.23.8 | ||
| gvm use go1.23.8 | ||
| ``` | ||
JordiParraCrespo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ### 2. Build | ||
|
|
||
| ```bash | ||
| make build | ||
| ``` | ||
|
|
||
| The binary will be created at `./build/callisto`. To install globally: | ||
|
|
||
| ```bash | ||
| make install | ||
| ``` | ||
|
|
||
| ### 3. Configuration | ||
|
|
||
| Running `callisto init` generates a default configuration file at `~/.callisto/config.yaml`: | ||
|
|
||
| ```bash | ||
| ./build/callisto init | ||
| ``` | ||
|
|
||
| Pre-configured network configs are provided in `configs/`: | ||
|
|
||
| - `configs/testnet-config.yaml` — XRPL EVM Sidechain testnet | ||
| - `configs/mainnet-config.yaml` — XRPL EVM Sidechain mainnet | ||
|
|
||
| Copy the desired config before starting: | ||
|
|
||
| ```bash | ||
| mkdir -p ~/.callisto | ||
| cp configs/testnet-config.yaml ~/.callisto/config.yaml | ||
| ``` | ||
|
|
||
| ### 4. Start Indexing | ||
|
|
||
| ```bash | ||
| # 1. Start PostgreSQL and Hasura | ||
| docker compose up -d | ||
|
|
||
| # 2. Build and start the indexer | ||
| make build | ||
| ./build/callisto start | ||
| ``` | ||
|
|
||
| ### 5. Start with Make Targets | ||
|
|
||
| Alternatively, Make targets are available that automate the above steps (build, copy config, start services, and launch the indexer) in a single command: | ||
|
|
||
| ```bash | ||
| # Testnet | ||
| make start-testnet | ||
|
|
||
| # Mainnet | ||
| make start-mainnet | ||
| ``` | ||
|
|
||
| For a clean start (drops and recreates the database schema): | ||
|
|
||
| ```bash | ||
| make start-testnet-clean | ||
| make start-mainnet-clean | ||
| ``` | ||
|
|
||
| You can also pass a custom config: | ||
|
|
||
| ```bash | ||
| make start CONFIG=path/to/config.yaml | ||
| ``` | ||
|
|
||
| ### 6. Database Management | ||
|
|
||
| Commands to interact with the database without restarting Docker containers: | ||
|
|
||
| ```bash | ||
| # Drop all tables and recreate empty schema | ||
| make db-schema-drop | ||
|
|
||
| # Apply all schema SQL files (database/schema/*.sql) in order | ||
| make db-schema-apply | ||
|
|
||
| # Full reset: drop + apply (wipes data, keeps containers running) | ||
| make db-schema-reset | ||
|
|
||
| # Open an interactive psql session | ||
| make db-shell | ||
|
|
||
| # List all tables | ||
| make db-tables | ||
|
|
||
| # Show size of each table | ||
| make db-size | ||
| ``` | ||
|
|
||
| Use `make db-schema-reset` when you need a fresh database without tearing down the Docker stack. The `start-*-clean` targets use this internally. | ||
|
|
||
| ## Services | ||
|
|
||
| | Service | URL | Description | | ||
| |---------|-----|-------------| | ||
| | Hasura Console & GraphQL API | http://localhost:8080 | GraphQL management console and endpoint | | ||
| | Callisto Actions | http://localhost:3000 | HTTP server for Hasura actions | | ||
| | PostgreSQL | localhost:5432 | Database connection | | ||
|
|
||
| Default database credentials (from docker-compose.yml): | ||
| - User: `user` | ||
| - Password: `password` | ||
| - Database: `database` | ||
|
|
||
| ## CLI Commands | ||
|
|
||
| | Command | Description | | ||
| |---------|-------------| | ||
| | `callisto init` | Generate default config at `~/.callisto/config.yaml` | | ||
| | `callisto start` | Start continuous block indexing | | ||
| | `callisto version` | Display version information | | ||
| | `callisto migrate` | Migrate database between versions | | ||
|
|
||
| ## Database Schema | ||
|
|
||
| The database schema is located in `database/schema/` and consists of: | ||
|
|
||
| | File | Module | Purpose | | ||
| |------|--------|---------| | ||
| | 00-cosmos.sql | Core | Blocks, transactions, validators, messages | | ||
| | 01-auth.sql | x/auth | Vesting accounts and periods | | ||
| | 02-bank.sql | x/bank | Total supply tracking | | ||
| | 03-staking.sql | x/staking | Validators, delegations, staking pool | | ||
| | 04-consensus.sql | Consensus | Pre-commits and validator state | | ||
| | 05-mint.sql | x/mint | Inflation and minting parameters (excluded, not used in XRPL EVM Sidechain) | | ||
| | 06-distribution.sql | x/distribution | Community pool and distribution | | ||
| | 07-pricefeed.sql | x/pricefeed | Token prices and market data | | ||
| | 08-gov.sql | x/gov | Proposals, votes, deposits | | ||
| | 09-modules.sql | Modules | Module tracking | | ||
| | 10-slashing.sql | x/slashing | Slashing parameters and signing info | | ||
| | 11-feegrant.sql | x/feegrant | Fee grant allowances | | ||
| | 12-upgrade.sql | x/upgrade | Software upgrade plans | | ||
|
|
||
| ## Development | ||
|
|
||
| ### Run Tests | ||
|
|
||
| ```bash | ||
| # Start test database | ||
| make start-docker-test | ||
|
|
||
| # Run unit tests | ||
| make test-unit | ||
|
|
||
| # Stop test database | ||
| make stop-docker-test | ||
| ``` | ||
|
|
||
| **Note**: Requires [Docker](https://docker.com). | ||
| ### Linting and Formatting | ||
|
|
||
| ```bash | ||
| # Run linter | ||
| make lint | ||
|
|
||
| # Auto-fix lint issues | ||
| make lint-fix | ||
|
|
||
| # Format code | ||
| make format | ||
| ``` | ||
|
|
||
| This will: | ||
| 1. Create a Docker container running a PostgreSQL database. | ||
| 2. Run all the tests using that database as support. | ||
| ### Clean Build | ||
|
|
||
| ```bash | ||
| make clean | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Block height not available | ||
|
|
||
| ``` | ||
| ERR re-enqueueing failed block err="failed to get block from node: error in json rpc client, with http response metadata: (Status: 200 OK, Protocol HTTP/1.1). RPC error -32603 - Internal error: height 4 is not available, lowest height is 4133001" height=5 | ||
| ``` | ||
|
|
||
| This error means the node you are connected to has pruned blocks below its lowest available height. To fix it, either: | ||
|
|
||
| 1. **Connect to an archive/full node** that has all block heights available by updating the RPC/gRPC endpoints in your config. | ||
| 2. **Update `start_height`** in your config (`parsing.start_height`) to the lowest height available on the node (e.g. `4133001` in the example above). | ||
|
|
||
| ### Hasura image platform mismatch | ||
|
|
||
| ``` | ||
| The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64/v3) and no specific platform was requested | ||
| ``` | ||
|
|
||
| This happens when the Hasura image in `docker-compose.yml` is set to the ARM variant. Update the image from: | ||
|
|
||
| ```yaml | ||
| image: hasura/graphql-engine:v2.6.1.cli-migrations-v3.ubuntu.arm64 | ||
| ``` | ||
|
|
||
| to: | ||
|
|
||
| ```yaml | ||
| image: hasura/graphql-engine:v2.6.1.cli-migrations-v3 | ||
| ``` | ||
|
|
||
| ## References | ||
|
|
||
| - [Official Documentation](https://docs.bigdipper.live/cosmos-based/parser/overview/) | ||
| - [GitHub Repository](https://github.com/forbole/callisto) | ||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
The
start/start-cleantargets always invokeupdate-config, butupdate-configwill fail with a crypticcperror whenCONFIGis not set (e.g.,make start). Consider adding a guard that errors with a clear message whenCONFIGis empty, or set a sensible default.