You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Updated .env file to change the NODE_DOCKER_TAG version, modify RPC_URLS port, and update the DICTIONARY_URL port.
Enhanced docker-compose.yml by removing the --farmer option, using environment variables for DB_PORT, and updating the DICTIONARY URL to use a dynamic port.
⏱️ Estimated effort to review: 5 🔵🔵🔵🔵🔵
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review
Data Model Changes The PR introduces a significant change to the data model by replacing existing models with history models. This change impacts how data is stored and retrieved, which could affect performance and data integrity.
Ensure database client is always released after use
Ensure that the client.release() method is called in a finally block to guarantee that the database client is always released even if an error occurs during the transaction.
Why: Ensuring the database client is released even during errors is critical for preventing resource leaks, which can lead to performance issues.
10
Validate database configuration to prevent runtime errors
Validate environment variables for database configuration in connectToDB to ensure they meet expected formats or constraints before creating the PoolConfig.
Why: Proper error handling for network requests is essential to manage failures gracefully, especially in communication functions like sending Slack messages.
9
Confirm that formatSpaceInDecimal meets the formatting needs after replacing formatSpacePledged
Verify the replacement of formatSpacePledged with formatSpaceInDecimal to ensure it handles the formatting requirements correctly, as the new function might have different formatting behavior.
-{formatSpaceInDecimal(+{formatSpaceInDecimal( // Ensure this function formats as required
Suggestion importance[1-10]: 3
Why: The suggestion to verify the replacement function's behavior is valid but not directly actionable in code. It's more of a reminder to check functionality, which is useful but not a direct code improvement.
3
Verify that the URL generation for different networks is handled correctly
Ensure that the EXTERNAL_ROUTES.polkadot function is properly handling different network IDs to generate the correct URL for each network.
Why: The suggestion is not actionable as it only asks to verify the URL generation without providing a specific issue or improvement in the code.
1
Enhancement
Improve error handling for database connections
Handle potential exceptions from connectToDB() and pool.connect() separately to provide more specific error messages and possibly different recovery strategies.
-const pool: Pool = await connectToDB();-const client: PoolClient = await pool.connect();+let pool: Pool;+let client: PoolClient;+try {+ pool = await connectToDB();+ client = await pool.connect();+} catch (err) {+ console.error("Error connecting to the database:", err);+ throw new Error(`Database connection failed: ${err}`);+}
Suggestion importance[1-10]: 8
Why: Separating error handling for database connections provides clearer error messages and recovery strategies, improving the robustness of the database interaction.
8
Add error handling for Redis client to enhance server reliability
Implement error handling for the session setup and Redis connection to prevent crashes and ensure the server starts correctly.
Why: Adding error handling for the Redis client connection is a crucial enhancement for server reliability and robustness, especially in production environments.
7
Implement error handling for the useChain hook to prevent potential runtime errors
Add error handling for the useChain hook to manage cases where the chain data might be undefined or erroneous, which could lead to runtime errors if not checked.
Why: Adding error handling for the useChain hook is a good practice to prevent runtime errors, especially if the hook might return undefined or erroneous data. This enhances the robustness of the component.
4
Possible bug
Correct the handling of optional properties in the Incremental type to ensure proper functionality
Ensure that the Incremental type definition correctly handles the optional properties for keys other than $fragmentName and __typename. The current implementation might inadvertently exclude other properties that should be optional.
-export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };+export type Incremental<T> = T | { [P in keyof T]?: P extends '$fragmentName' | '__typename' ? T[P] : never };
Suggestion importance[1-10]: 5
Why: The suggestion correctly identifies a potential issue with the handling of optional properties in the Incremental type, which could affect functionality. The improvement is moderate as it ensures better type safety and clarity.
5
Safeguard the BigInt operations to prevent overflows
Ensure that the BigInt conversion and multiplication by 10^18 is safely handled to avoid potential overflows or precision issues.
Why: The suggestion to use 10**18 instead of the literal value does not inherently prevent overflows or precision issues, it only changes the notation.
2
Maintainability
Use a constant for the base value in the space formatting function
Consider using a constant for the base value (1000) in the formatSpaceInDecimal function to ensure consistency and maintainability.
Why: Using a named constant improves readability and maintainability of the code. The suggestion correctly identifies the line and provides a meaningful improvement.
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.
User description
Sync main with production
Including
PR Type
Enhancement, Configuration changes, Bug fix
Description
Changes walkthrough 📝
13 files
index.ts
Implement Taskboard Setup with BullMQ and Express
indexers/taskboard/src/index.ts
db.ts
Add Database Connection and Query Utilities
indexers/taskboard/src/utils/db.ts
consensus.ts
Implement Consensus Table Update Logic
indexers/taskboard/src/tasks/consensus.ts
updateAccount.ts
Add Update Account Task with Polkadot API Integration
indexers/taskboard/src/tasks/updateAccount.ts
db.ts
Refactor Leaderboard Mappings to Use History Tables
indexers/mainnet/leaderboard/src/mappings/db.ts
slack.ts
Add Slack Messaging Utility
indexers/taskboard/src/utils/slack.ts
slackNotification.ts
Implement Slack Notification Task
indexers/taskboard/src/tasks/slackNotification.ts
main.ts
Script to Convert Genesis Allocation JSON to SQL Seeds
indexers/db/scripts/genisis-allocation-to-seeds/main.ts
leaderboardSortAndRank.ts
Implement Leaderboard Sorting and Ranking Task
indexers/taskboard/src/tasks/leaderboardSortAndRank.ts
bull.ts
Add BullMQ Utilities for Task Processing
indexers/taskboard/src/utils/bull.ts
store.ts
Add Redis Connection and Utility Functions
indexers/taskboard/src/utils/store.ts
index.ts
Define Task Handlers and Cron Jobs
indexers/taskboard/src/tasks/index.ts
cron.ts
Add Utility for Setting Up Cron Tasks
indexers/taskboard/src/utils/cron.ts
2 files
docker-compose.yml
Enhance Docker Compose Configuration for Flexibility
docker-compose.yml
index.ts
Define Constants for Task Queues and Routes
indexers/taskboard/src/constants/index.ts
42 files
graphql.ts
...
explorer/gql/graphql.ts
...
init-db.sql
...
indexers/db/docker-entrypoint-initdb.d/init-db.sql
...
.env
...
.env
...
package.json
...
indexers/taskboard/package.json
...
package.json
...
indexers/package.json
...
postgresql.conf
...
indexers/db/postgresql.conf
...
index.ejs
...
indexers/taskboard/src/views/index.ejs
...
actions.yaml
...
indexers/db/metadata/actions.yaml
...
actions.graphql
...
indexers/db/metadata/actions.graphql
...
docker-compose.prod.yml
...
docker-compose.prod.yml
...
login.ejs
...
indexers/taskboard/src/views/login.ejs
...
package.json
...
indexers/db/package.json
...
tsconfig.json
...
indexers/taskboard/tsconfig.json
...
Dockerfile
...
indexers/taskboard/Dockerfile
...
deno.json
...
indexers/db/scripts/genisis-allocation-to-seeds/deno.json
...
consensus_events.yaml
...
indexers/db/metadata/databases/default/tables/consensus_events.yaml
...
README.md
...
indexers/db/scripts/genisis-allocation-to-seeds/README.md
...
consensus_extrinsics.yaml
...
indexers/db/metadata/databases/default/tables/consensus_extrinsics.yaml
...
README.md
...
indexers/db/scripts/README.md
...
leaderboard_nominator_deposits_total_value_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_nominator_deposits_total_value_histories.yaml
...
leaderboard_nominator_withdrawals_total_count_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_nominator_withdrawals_total_count_histories.yaml
...
leaderboard_farmer_vote_and_block_total_count_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_farmer_vote_and_block_total_count_histories.yaml
...
leaderboard_farmer_vote_and_block_total_value_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_farmer_vote_and_block_total_value_histories.yaml
...
leaderboard_account_extrinsic_failed_total_count_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_account_extrinsic_failed_total_count_histories.yaml
...
leaderboard_account_extrinsic_success_total_count_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_account_extrinsic_success_total_count_histories.yaml
...
leaderboard_account_transaction_fee_paid_total_value_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_account_transaction_fee_paid_total_value_histories.yaml
...
leaderboard_operator_deposits_total_count_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_operator_deposits_total_count_histories.yaml
...
leaderboard_operator_deposits_total_value_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_operator_deposits_total_value_histories.yaml
...
leaderboard_operator_withdrawals_total_count_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_operator_withdrawals_total_count_histories.yaml
...
leaderboard_account_extrinsic_total_count_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_account_extrinsic_total_count_histories.yaml
...
leaderboard_account_transfer_receiver_total_count_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_account_transfer_receiver_total_count_histories.yaml
...
leaderboard_account_transfer_receiver_total_value_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_account_transfer_receiver_total_value_histories.yaml
...
leaderboard_account_transfer_sender_total_count_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_account_transfer_sender_total_count_histories.yaml
...
leaderboard_account_transfer_sender_total_value_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_account_transfer_sender_total_value_histories.yaml
...
leaderboard_operator_total_rewards_collected_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_operator_total_rewards_collected_histories.yaml
...
leaderboard_operator_total_tax_collected_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_operator_total_tax_collected_histories.yaml
...
leaderboard_farmer_block_total_count_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_farmer_block_total_count_histories.yaml
...
leaderboard_farmer_block_total_value_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_farmer_block_total_value_histories.yaml
...
leaderboard_farmer_vote_total_count_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_farmer_vote_total_count_histories.yaml
...
leaderboard_farmer_vote_total_value_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_farmer_vote_total_value_histories.yaml
...
leaderboard_account_remark_count_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_account_remark_count_histories.yaml
...
leaderboard_operator_bundle_total_count_histories.yaml
...
indexers/db/metadata/databases/default/tables/leaderboard_operator_bundle_total_count_histories.yaml
...