From 4265d9217d53ac3135b79d7e48b97ddfa2d0b0f5 Mon Sep 17 00:00:00 2001 From: Konstantinos Demartinos Date: Thu, 14 Nov 2024 09:25:22 +0200 Subject: [PATCH 1/5] fix(iota-indexer): add fallback query to get total packages metric (#4043) --- crates/iota-indexer/src/indexer_reader.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/iota-indexer/src/indexer_reader.rs b/crates/iota-indexer/src/indexer_reader.rs index 94fa737b6d6..3915588184f 100644 --- a/crates/iota-indexer/src/indexer_reader.rs +++ b/crates/iota-indexer/src/indexer_reader.rs @@ -63,7 +63,7 @@ use crate::{ }, schema::{ address_metrics, checkpoints, display, epochs, events, move_call_metrics, objects, - objects_snapshot, transactions, + objects_snapshot, packages, transactions, }, store::{diesel_macro::*, package_resolver::IndexerStorePackageResolver}, types::{IndexerResult, OwnerType}, @@ -1509,10 +1509,17 @@ impl IndexerReader { } pub fn get_latest_network_metrics(&self) -> IndexerResult { - let metrics = run_query!(&self.pool, |conn| { + let mut metrics = run_query!(&self.pool, |conn| { diesel::sql_query("SELECT * FROM network_metrics;") .get_result::(conn) })?; + if metrics.total_packages == -1 { + // this implies that the estimate is not available in the db + // so we fallback to the more expensive count query + metrics.total_packages = run_query!(&self.pool, |conn| { + packages::dsl::packages.count().get_result::(conn) + })?; + } Ok(metrics.into()) } From ac01bde0a7384dc98ec96f6809c8e964431e0abc Mon Sep 17 00:00:00 2001 From: Sergiu Popescu <44298302+sergiupopescu199@users.noreply.github.com> Date: Thu, 14 Nov 2024 09:06:43 +0100 Subject: [PATCH 2/5] docs(iota-indexer): update ERD diagram and README (#4028) * docs(iota-indexer): update ERD diagram and README * fixup! docs(iota-indexer): update ERD diagram and README --- crates/iota-indexer/database_schema.svg | 2 +- crates/iota-indexer/schema.md | 167 ++++++++++++++++++------ 2 files changed, 128 insertions(+), 41 deletions(-) diff --git a/crates/iota-indexer/database_schema.svg b/crates/iota-indexer/database_schema.svg index 86997161b05..4b785446071 100644 --- a/crates/iota-indexer/database_schema.svg +++ b/crates/iota-indexer/database_schema.svg @@ -1,4 +1,4 @@ -
display
PK
object_type text NN
bcs      bytea NN
id      bytea NN
version         int2 NN
objects
PK
object_id  bytea NN
checkpoint_sequence_number ref(checkpoints)    int8 NN
coin_balance                    int8
coint_type             text
df_kind            int2
df_name             bytea
df_object_id             bytea
df_object_type                  text
object_digest                 bytea NN
object_type            text
object_version                 in8 NN
owner_id             bytea
owner_type              int2 NN
serialized_object            bytea NN
objects_snapshot
PK
object_id  ref(objects_history) bytea NN
checkpoint_sequence_number   int8 NN
coin_balance                          int8
coint_type          text
df_kind              int2
df_name           bytea
df_object_id           bytea
df_object_type              text
object_digest                       bytea
object_status             int2 NN
object_type       text
object_version                     in8 NN
owner_id               bytea
owner_type                      int2
serialized_object                          bytea
objects_history
PK
checkpoint_sequence_number ref(checkpoints) int8 NN
PK
object_id  ref(objects) bytea NN
PK
object_version  int8 NN
coin_balance                                               int8
coint_type            text
df_kind           int2
df_name   bytea
df_object_id   bytea
df_object_type      text
object_digest                bytea
object_status           int2 NN
object_type      text
owner_id    bytea
owner_type                   int2
serialized_object                 bytea
epochs
PK
epoch  int8 NN
burn_leftover_amount             int8
burn_tokens_amount              int8
epoch_commitments      bytea
epoch_end_timestamp             int8
epoch_start_timestamp int8 NN
epoch_total_transactions             int8
first_checkpoint_id ref(checkpoints) int8 NN
last_checkpoint_id ref(checkpoints)            int8
minted_tokens_amount             int8
protocol_version                 int8 NN
reference_gas_price int8 NN
stake_subsidy_amount             int8
storage_charge             int8
storage_fund_balance int8 NN
storage_rebate             int8
system_state          bytea NN
total_gas_fees             int8
total_stake int8 NN
total_stake_reward_distributed            int8
checkpoints
PK
sequence_number  int8 NN
checkpoint_digest           bytea NN
epoch      int8 NN
network_total_transactions     int8 NN
previous_checkpoint_digest    bytea
end_of_epoch        bool NN
end_of_epoch_data    bytea
tx_digests    bytea[] NN
timestamp_ms                        int8 NN
total_gas_cost                        int8 NN
computation_cost                   int8 NN
storage_cost                           int8 NN
storage_rebate                       int8 NN
non_refundable_storage_fee int8 NN
checkpoint_commitments    bytea NN
validator_signature              bytea NN
end_of_epoch_data                   bytea
transactions
PK
checkpoint_sequence_number     ref(checkpoints) int8 NN
PK
tx_sequence_number int8 NN
balance_changes                         bytea[] NN
events                                           bytea[] NN
object_changes                                 bytea[] NN
raw_effects                                             bytea NN
raw_transaction                                   bytea NN
success_command_count                    int2 NN
timestamp_ms    ref(checkpoints)                                   int8 NN
transaction_digest    ref(checkpoints)                          bytea NN
transaction_kind                                    int2 NN
events
PK
event_ sequence_number int8 NN
PK
tx_sequence_number    ref(transactions) int8 NN
bcs                        bytea NN
checkpoint_sequence_number    ref(checkpoints) int8 NN
event_type         text NN
module text NN
package            bytea NN
senders                bytea[] NN
timestamp_ms    ref(checkpoints)                            int8 NN
transaction_digest    ref(transactions)                         bytea NN
tx_senders
PK
sender bytea NN
PK
tx_sequence_number    ref(transactions).    int8 NN
tx_recipients
PK
recipient bytea NN
PK
tx_sequence_number    ref(transactions).   int8 NN
tx_calls
PK
package    ref(packages)     bytea NN
PK
tx_sequence_number    ref(transactions)   int8 NN
bcs        bytea NN
id      bytea NN
version             int2 NN
tx_input_objects
PK
object_id bytea NN
PK
tx_sequence_number     ref(transactions)    int8 NN
tx_changed_objects
PK
object_id bytea NN
PK
tx_sequence_number     ref(transactions)  int8 NN
packages
PK
package_id bytea NN
move_package bytea NN
__diesel_schema_migrations
PK
version varchar(50) NN
run_on                       timestamp NN
Legend
Database schema
ref(< table-name >)    Possible Foreign Key link
tx_count_metrics
PK
checkpoint_sequence_number  ref(checkpoints) int8 NN
epoch ref(epochs) int8 NN
timestamp_ms       int8 NN
total_transaction_blocks       int8 NN
total_successful_transaction_blocks                    int8 NN
total_successful_transactions       int8 NN
move_calls
PK
transactions_sequence_number ref(transactions) int8 NN
PK
move_package     bytea NN
PK
move_module text NN
PK
move_function text NN
checkpoint_sequence_number ref(checkpoints) int8 NN
epoch ref(epochs) int8 NN
move_call_metrics
PK
id  bigserial NN
count  int8 NN
day   int8 NN
epoch ref(epochs)   int8 NN
move_function text NN
move_module text NN
move_package text NN
addresses
PK
address bytea NN
first_appearance_time   int8 NN
first_appearance_tx    int8 NN
last_appearance_time    int8 NN
last_appearance_tx int8 NN
active_addresses
PK
address bytea NN
first_appearance_time   int8 NN
first_appearance_tx    int8 NN
last_appearance_time    int8 NN
last_appearance_tx int8 NN
address_metrics
PK
checkpoint ref(checkpoints) int8 NN
cumulative_active_addresses   int8 NN
cumulative_addresses     int8 NN
daily_active_addresses     int8 NN
epoch ref(epochs) int8 NN
timestamp_ms int8 NN
epoch_peak_tps
PK
epoch ref(epochs) int8 NN
peak_tps          float8 NN
peak_tps_30d              float8 NN
\ No newline at end of file +
display
PK
object_type text NN
bcs      bytea NN
id      bytea NN
version         int2 NN
objects
PK
object_id  bytea NN
checkpoint_sequence_number ref(checkpoints)    int8 NN
coin_balance                    int8
coint_type             text
df_kind            int2
df_name             bytea
df_object_id             bytea
df_object_type                  text
object_digest                 bytea NN
object_type            text
object_type_module            text
object_type_name            text
object_type_package                bytea
object_version                 in8 NN
owner_id             bytea
owner_type              int2 NN
serialized_object            bytea NN
objects_snapshot
PK
object_id  ref(objects_history) bytea NN
checkpoint_sequence_number ref(checkpoints)    int8 NN
coin_balance                          int8
coint_type          text
df_kind                int2
df_name                 bytea
df_object_id                 bytea
df_object_type               text
object_digest                             bytea
object_status                 int2 NN
object_type        text
object_type_module         text
object_type_name        text
object_type_package             bytea
object_version                         in8 NN
owner_id                     bytea
owner_type                       int2
serialized_object                                bytea
objects_history
PK
checkpoint_sequence_number ref(checkpoints) int8 NN
PK
object_id  ref(objects) bytea NN
PK
object_version  int8 NN
coin_balance                                               int8
coint_type            text
df_kind           int2
df_name   bytea
df_object_id   bytea
df_object_type      text
object_digest                bytea
object_status           int2 NN
object_type      text
object_type_module      text
object_type_name      text
object_type_package   bytea
owner_id    bytea
owner_type                   int2
serialized_object                 bytea
epochs
PK
epoch  int8 NN
burn_tokens_amount              int8
epoch_commitments      bytea
epoch_end_timestamp             int8
epoch_start_timestamp int8 NN
epoch_total_transactions             int8
first_checkpoint_id ref(checkpoints) int8 NN
last_checkpoint_id ref(checkpoints)            int8
minted_tokens_amount             int8
protocol_version                 int8 NN
reference_gas_price int8 NN
storage_charge             int8
storage_fund_balance int8 NN
storage_rebate             int8
system_state          bytea NN
total_gas_fees             int8
total_stake int8 NN
total_stake_reward_distributed            int8
checkpoints
PK
sequence_number  int8 NN
checkpoint_commitments     bytea NN
checkpoint_digest            bytea NN
computation_cost                    int8 NN
end_of_epoch         bool NN
end_of_epoch_data     bytea
epoch       int8 NN
max_tx_sequence_number            int8
min_tx_sequence_number         int8
network_total_transactions      int8 NN
non_refundable_storage_fee   int8 NN
previous_checkpoint_digest    bytea
storage_cost                           int8 NN
storage_rebate                       int8 NN
timestamp_ms                        int8 NN
total_gas_cost                        int8 NN
tx_digests    bytea[] NN
validator_signature              bytea NN
transactions
PK
tx_sequence_number int8 NN
balance_changes                         bytea[] NN
checkpoint_sequence_number     ref(checkpoints) int8 NN
events                                           bytea[] NN
object_changes                                 bytea[] NN
raw_effects                                             bytea NN
raw_transaction                                   bytea NN
success_command_count                    int2 NN
timestamp_ms    ref(checkpoints)                                   int8 NN
transaction_digest    ref(checkpoints)                          bytea NN
transaction_kind                                    int2 NN
events
PK
event_ sequence_number int8 NN
PK
tx_sequence_number    ref(transactions) int8 NN
bcs                        bytea NN
event_type         text NN
module text NN
package            bytea NN
senders                bytea[] NN
timestamp_ms    ref(checkpoints)                            int8 NN
transaction_digest    ref(transactions)                         bytea NN
tx_senders
PK
sender bytea NN
PK
tx_sequence_number    ref(transactions)    int8 NN
tx_recipients
PK
recipient bytea NN
PK
tx_sequence_number    ref(transactions)   int8 NN
sender    bytea NN
packages
PK
original_id bytea NN
PK
package_id bytea NN
PK
package_version int8 NN
checkpoint_sequence_number ref(checkpoints)    int8 NN
move_package bytea NN
__diesel_schema_migrations
PK
version varchar(50) NN
run_on                       timestamp NN
Legend
Database schema
ref(< table-name >)    Possible Foreign Key link
Database View
tx_count_metrics
PK
checkpoint_sequence_number  ref(checkpoints) int8 NN
epoch ref(epochs) int8 NN
timestamp_ms       int8 NN
total_successful_transaction_blocks                    int8 NN
total_successful_transactions       int8 NN
total_transaction_blocks       int8 NN
move_calls
PK
move_function text NN
PK
move_module text NN
PK
move_package     bytea NN
PK
transactions_sequence_number ref(transactions) int8 NN
checkpoint_sequence_number ref(checkpoints) int8 NN
epoch ref(epochs) int8 NN
move_call_metrics
PK
id  bigserial NN
count  int8 NN
day   int8 NN
epoch ref(epochs)   int8 NN
move_function text NN
move_module text NN
move_package text NN
addresses
PK
address bytea NN
first_appearance_time   int8 NN
first_appearance_tx    int8 NN
last_appearance_time    int8 NN
last_appearance_tx int8 NN
active_addresses
PK
address bytea NN
first_appearance_time   int8 NN
first_appearance_tx    int8 NN
last_appearance_time    int8 NN
last_appearance_tx int8 NN
address_metrics
PK
checkpoint ref(checkpoints) int8 NN
cumulative_active_addresses   int8 NN
cumulative_addresses     int8 NN
daily_active_addresses     int8 NN
epoch ref(epochs) int8 NN
timestamp_ms int8 NN
epoch_peak_tps
PK
epoch ref(epochs) int8 NN
peak_tps          float8 NN
peak_tps_30d              float8 NN
chain_identifier
PK
checkpoint_digest ref(checkpoints) bytea NN
real_time_tps
recent_tps float8
tx_digests
PK
tx_digest    bytea NN
tx_sequence_number  ref(transactions)  int8 NN
tx_kinds
PK
tx_kind int2 NN
PK
tx_sequence_number ref(transactions)  int8 NN
event_senders
PK
event_sequence_number ref(events) int8 NN
PK
sender      bytea NN
PK
tx_sequence_number ref(transactions)   int8 NN
feature_flags
PK
flag_name text NN
PK
protocol_version int8 NN
flag_value        bool NN
protocol_configs
PK
config_name text NN
PK
protocol_version int8 NN
config_value               text
objects_version
PK
object_id ref(objects) bytea NN
PK
object_version ref(objects) int8 NN
cp_sequence_number ref(checkpoints) int8 NN
pruner_cp_watermark
PK
checkpoint_sequence_number ref(checkpoints) int8 NN
PK
max_tx_sequence_number int8 NN
min_tx_sequence_number int8 NN
tx_changed_objects
PK
object_id    ref(objects)  bytea NN
PK
tx_sequence_number    ref(transactions)   int8 NN
sender         bytea NN
tx_input_objects
PK
object_id    ref(objects)  bytea NN
PK
tx_sequence_number    ref(transactions)   int8 NN
sender         bytea NN
event_emit_package
PK
event_sequence_number    ref(events) int8 NN
PK
package    ref(packages)     bytea NN
PK
tx_sequence_number    ref(transactions) int8 NN
sender             bytea NN
event_struct_package
PK
event_sequence_number    ref(events) int8 NN
PK
package    ref(packages)     bytea NN
PK
tx_sequence_number    ref(transactions) int8 NN
sender             bytea NN
event_emit_module
PK
event_sequence_number    ref(events) int8 NN
PK
module text NN
PK
package    ref(packages)     bytea NN
PK
tx_sequence_number    ref(transactions) int8 NN
sender             bytea NN
network_metrics
current_checkpoint int8
current_epoch int8
current_tps     float8
total_addresses int8
total_objects int8
total_packages int8
tps_30_days     float8
event_struct_instantiation
PK
event_sequence_number    ref(events) int8 NN
PK
module text NN
PK
package    ref(packages)     bytea NN
PK
tx_sequence_number    ref(transactions) int8 NN
PK
type_instantiation text NN
sender             bytea NN
event_struct_name
PK
event_sequence_number    ref(events) int8 NN
PK
module text NN
PK
package    ref(packages)     bytea NN
PK
tx_sequence_number    ref(transactions) int8 NN
PK
type_name text NN
sender             bytea NN
tx_calls_fun
PK
func text NN
PK
module text NN
PK
package    ref(packages)     bytea NN
PK
tx_sequence_number    ref(transactions) int8 NN
sender             bytea NN
tx_calls_mod
PK
module text NN
PK
package    ref(packages)     bytea NN
PK
tx_sequence_number    ref(transactions) int8 NN
sender             bytea NN
tx_calls_pkg
PK
package    ref(packages)  bytea NN
PK
tx_sequence_number    ref(transactions)   int8 NN
sender         bytea NN
event_struct_module
PK
event_sequence_number    ref(events) int8 NN
PK
module text NN
PK
package    ref(packages)     bytea NN
PK
tx_sequence_number    ref(transactions) int8 NN
sender             bytea NN
\ No newline at end of file diff --git a/crates/iota-indexer/schema.md b/crates/iota-indexer/schema.md index 39b99baf6b2..675d030fb2b 100644 --- a/crates/iota-indexer/schema.md +++ b/crates/iota-indexer/schema.md @@ -11,7 +11,8 @@ The Indexer pulls checkpoint data from the full node and populates the tables sh > Migrations are generated by diesel cli, the basic schema can be found [schema.rs](src/schema.rs). > For more in depth understanding of the database tables, go to [migrations](migrations) folder, in the contained `SQL` the indexes, partitions & constraints are declared. > -> - Tables `objects_history` & `transactions` have partitions, each partition is created based on `checkpoint_sequence_number` (related form the `checkpoints` table) it goes from `0` to `MAXVALUE` +> - The table `objects_history` has partitions, each partition is created based on `checkpoint_sequence_number` (related from the `checkpoints` table) it goes from `0` to `MAXVALUE` +> - The table `transactions` has partitions, each partition is created based on `tx_sequence_number` (related from the `transactions` table) it goes from `0` to `MAXVALUE` > - `__diesel_schema_migrations` table is managed by `diesel` cli when applying migrations ## Indexes @@ -23,40 +24,83 @@ The Indexer pulls checkpoint data from the full node and populates the tables sh | checkpoints_epoch | epoch, sequence_number | | checkpoints_digest | checkpoint_digest | +### Table `event_emit_package` + +| Index name | Keys | +| ------------------------- | ---------------------------------------------------------- | +| event_emit_package_sender | sender, package, tx_sequence_number, event_sequence_number | + +### Table `event_emit_module` + +| Index name | Keys | +| ------------------------ | ------------------------------------------------------------------ | +| event_emit_module_sender | sender, package, module, tx_sequence_number, event_sequence_number | + +### Table `event_struct_package` + +| Index name | Keys | +| --------------------------- | ---------------------------------------------------------- | +| event_struct_package_sender | sender, package, tx_sequence_number, event_sequence_number | + +### Table `event_struct_module` + +| Index name | Keys | +| -------------------------- | ------------------------------------------------------------------ | +| event_struct_module_sender | sender, package, module, tx_sequence_number, event_sequence_number | + +### Table `event_struct_name` + +| Index name | Keys | +| ------------------------ | ----------------------------------------------------------------------------- | +| event_struct_name_sender | sender, package, module, type_name, tx_sequence_number, event_sequence_number | + +### Table `event_struct_instantiation` + +| Index name | Keys | +| --------------------------------- | -------------------------------------------------------------------------------------- | +| event_struct_instantiation_sender | sender, package, module, type_instantiation, tx_sequence_number, event_sequence_number | + ### Table `events` -| Index name | Keys | -| --------------------------------- | ----------------------------------------------------------------------- | -| events_package | package, tx_sequence_number, event_sequence_number | -| events_package_module | package, module, tx_sequence_number, event_sequence_number | -| events_event_type | event_type, text_pattern_ops, tx_sequence_number, event_sequence_number | -| events_checkpoint_sequence_number | checkpoint_sequence_number | +| Index name | Keys | +| --------------------- | ----------------------------------------------------------------------- | +| events_package | package, tx_sequence_number, event_sequence_number | +| events_package_module | package, module, tx_sequence_number, event_sequence_number | +| events_event_type | event_type, text_pattern_ops, tx_sequence_number, event_sequence_number | ### Table `objects` -| Index name | Keys | Condition | -| ---------------------------------- | -------------------------- | --------------------------------------------------------- | -| objects_owner | owner_type, owner_id | WHERE owner_type BETWEEN 1 AND 2 AND owner_id IS NOT NULL | -| objects_coin | owner_id, coin_type | WHERE coin_type IS NOT NULL AND owner_type = 1 | -| objects_checkpoint_sequence_number | checkpoint_sequence_number | | -| objects_type | object_type | | +| Index name | Keys | Condition | +| ------------------------------------------- | -------------------------------------------------------------------------------- | --------------------------------------------------------- | +| objects_owner | owner_type, owner_id | WHERE owner_type BETWEEN 1 AND 2 AND owner_id IS NOT NULL | +| objects_coin | owner_id, coin_type | WHERE coin_type IS NOT NULL AND owner_type = 1 | +| objects_checkpoint_sequence_number | checkpoint_sequence_number | | +| objects_package_module_name_full_type | object_type_package, object_type_module, object_type_name, object_type | | +| objects_owner_package_module_name_full_type | owner_id, object_type_package, object_type_module, object_type_name, object_type | | ### Table `objects_snapshot` -| Index name | Keys | Condition | -| ------------------------------------------- | ------------------------------- | --------------------------------------------------------- | -| objects_snapshot_checkpoint_sequence_number | checkpoint_sequence_number | | -| objects_snapshot_coin | owner_id, coin_type, object_id | WHERE coin_type IS NOT NULL AND owner_type = 1 | -| objects_snapshot_type | object_type, object_id | | -| objects_snapshot_owner | owner_type, owner_id, object_id | WHERE owner_type BETWEEN 1 AND 2 AND owner_id IS NOT NULL | +| Index name | Keys | Condition | +| ---------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------- | +| objects_snapshot_checkpoint_sequence_number | checkpoint_sequence_number | | +| objects_snapshot_owner | owner_type, owner_id, object_id | WHERE owner_type BETWEEN 1 AND 2 AND owner_id IS NOT NULL | +| objects_snapshot_coin_owner | owner_id, coin_type, object_id | WHERE coin_type IS NOT NULL AND owner_type = 1 | +| objects_snapshot_coin_only | coin_type, object_id | WHERE coin_type IS NOT NULL | +| objects_snapshot_type_id | object_type_package, object_type_module, object_type_name, object_type, object_id | | +| objects_snapshot_id_type | object_id, object_type_package, object_type_module, object_type_name, object_type | | +| objects_snapshot_owner_package_module_name_full_type | owner_id, object_type_package, object_type_module, object_type_name, object_type | | ### Table `objects_history` -| Index name | Keys | Condition | -| --------------------- | ------------------------------------------------ | --------------------------------------------------------- | -| objects_history_owner | checkpoint_sequence_number, owner_type, owner_id | WHERE owner_type BETWEEN 1 AND 2 AND owner_id IS NOT NULL | -| objects_history_coin | checkpoint_sequence_number, owner_id, coin_type | WHERE coin_type IS NOT NULL AND owner_type = 1 | -| objects_history_type | checkpoint_sequence_number, object_type | | +| Index name | Keys | Condition | +| --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------- | +| objects_history_id_version | object_id, object_version, checkpoint_sequence_number | | +| objects_history_owner | checkpoint_sequence_number, owner_type, owner_id | WHERE owner_type BETWEEN 1 AND 2 AND owner_id IS NOT NULL | +| objects_history_coin_owner | checkpoint_sequence_number, owner_id, coin_type, object_id | WHERE coin_type IS NOT NULL AND owner_type = 1 | +| objects_history_coin_only | checkpoint_sequence_number, coin_type, object_id | WHERE coin_type IS NOT NULL | +| objects_history_type | checkpoint_sequence_number, object_type | | +| objects_history_package_module_name_full_type | checkpoint_sequence_number, object_type_package, object_type_module, object_type_name, object_type | | +| objects_history_owner_package_module_name_full_type | checkpoint_sequence_number, owner_id, object_type_package, object_type_module, object_type_name, object_type | | ### Table `transactions` @@ -66,25 +110,18 @@ The Indexer pulls checkpoint data from the full node and populates the tables sh | transactions_checkpoint_sequence_number | checkpoint_sequence_number | | | transactions_transaction_kind | transaction_kind | WHERE transaction_kind = 1 | -### Table `tx_calls` +### Table `tx_input_objects` -| Index name | Keys | -| --------------------------- | ----------------------------------------- | -| tx_calls_module | package, module, tx_sequence_number | -| tx_calls_func | package, module, func, tx_sequence_number | -| tx_calls_tx_sequence_number | tx_sequence_number | - -### Table `tx_senders` - -| Index name | Keys | Condition | -| ----------------------------------- | ------------------ | --------- | -| tx_senders_tx_sequence_number_index | tx_sequence_number | ASC | +| Index name | Keys | Condition | +| ----------------------------------------- | ------------------------------------- | --------- | +| tx_input_objects_tx_sequence_number_index | tx_sequence_number | | +| tx_input_objects_sender | sender, object_id, tx_sequence_number | | ### Tables `tx_recipients` -| Index name | Keys | Condition | -| -------------------------------------- | ------------------ | --------- | -| tx_recipients_tx_sequence_number_index | tx_sequence_number | ASC | +| Index name | Keys | Condition | +| -------------------- | ------------------------------------- | --------- | +| tx_recipients_sender | sender, recipient, tx_sequence_number | | ### Table `tx_count_metrics` @@ -93,6 +130,37 @@ The Indexer pulls checkpoint data from the full node and populates the tables sh | tx_count_metrics_epoch | epoch | | tx_count_metrics_timestamp_ms | timestamp_ms | +### Table `tx_changed_objects` + +| Index name | Keys | +| ------------------------------------------- | ------------------------------------- | +| tx_changed_objects_tx_sequence_number_index | tx_sequence_number | +| tx_changed_objects_sender | sender, object_id, tx_sequence_number | + +### Table `tx_calls_pkg` + +| Index name | Keys | +| ------------------- | ----------------------------------- | +| tx_calls_pkg_sender | sender, package, tx_sequence_number | + +### Table `tx_calls_mod` + +| Index name | Keys | +| ------------------- | ------------------------------------------- | +| tx_calls_mod_sender | sender, package, module, tx_sequence_number | + +### Table `tx_calls_fun` + +| Index name | Keys | +| ------------------- | ------------------------------------------------- | +| tx_calls_fun_sender | sender, package, module, func, tx_sequence_number | + +### Table `tx_digests` + +| Index name | Keys | +| ----------------------------- | ------------------ | +| tx_digests_tx_sequence_number | tx_sequence_number | + ### Table `move_calls` | Index name | Keys | @@ -111,10 +179,29 @@ The Indexer pulls checkpoint data from the full node and populates the tables sh | ------------------------- | ----- | | address_metrics_epoch_idx | epoch | +### Table `packages` + +| Index name | Keys | +| ---------------------- | -------------------------------------------------------- | +| packages_cp_id_version | checkpoint_sequence_number, original_id, package_version | +| packages_id_version_cp | original_id, package_version, checkpoint_sequence_number | + ## Partitions -### Tables `transactions`, `objects_history` +### Table `objects_history` | Keys | Condition | | -------------------------- | --------------------------------- | | checkpoint_sequence_number | FOR VALUES FROM (0) TO (MAXVALUE) | + +### Table `objects_version` + +| Keys | Condition | +| --------- | ------------------------------------------------------------- | +| object_id | custom function, create a partition for each first byte value | + +### Tables `transactions` & `events` + +| Keys | Condition | +| ------------------ | --------------------------------- | +| tx_sequence_number | FOR VALUES FROM (0) TO (MAXVALUE) | From 0bafb38b4d8eda08423bf3f3a0c777b1d89eee9f Mon Sep 17 00:00:00 2001 From: Nonast <29281463+nonast@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:34:05 +0800 Subject: [PATCH 3/5] chore(docs): Fix typo in faucet example (#4032) --- docs/content/references/ts-sdk/typescript/hello-iota.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/references/ts-sdk/typescript/hello-iota.mdx b/docs/content/references/ts-sdk/typescript/hello-iota.mdx index cb0e4b79acc..686abee55a7 100644 --- a/docs/content/references/ts-sdk/typescript/hello-iota.mdx +++ b/docs/content/references/ts-sdk/typescript/hello-iota.mdx @@ -53,7 +53,7 @@ Create a new `index.js` file in the root of your project with the following code ```js import { getFullnodeUrl, IotaClient } from '@iota/iota-sdk/client'; -import { getFaucetHost, requestIotaFromFaucetv1 } from '@iota/iota-sdk/faucet'; +import { getFaucetHost, requestIotaFromFaucetV1 } from '@iota/iota-sdk/faucet'; import { NANOS_PER_IOTA } from '@iota/iota-sdk/utils'; // replace with your actual address, which is in the form 0x123... @@ -72,7 +72,7 @@ const iotaBefore = await iotaClient.getBalance({ owner: MY_ADDRESS, }); -await requestIotaFromFaucetv1({ +await requestIotaFromFaucetV1({ // use getFaucetHost to make sure you're using correct faucet address // you can also just use the address (see IOTA TypeScript SDK Quick Start for values) host: getFaucetHost('devnet'), From d5a3de6cce2020f25811708acee43d2572e64546 Mon Sep 17 00:00:00 2001 From: Juan Francisco Cerdan Lopez <104755989+FranCerdan@users.noreply.github.com> Date: Thu, 14 Nov 2024 10:01:52 +0100 Subject: [PATCH 4/5] feat(docs): update fullnode deployment testnet & devnet configurations (#4021) * Doc: update fullnode deployment alphanet and testnet configurations * Doc: update fullnode deployment devnet and testnet configurations * Doc: update fullnode deployment devnet and testnet configurations * Doc: update fullnode deployment devnet and testnet configurations * Doc: update fullnode deployment devnet and testnet configurations --- docker/fullnode/docker-compose.yaml | 1 + docs/content/operator/iota-full-node.mdx | 58 ++++++++++++++---------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/docker/fullnode/docker-compose.yaml b/docker/fullnode/docker-compose.yaml index b782937f4cd..021a9f76abc 100644 --- a/docker/fullnode/docker-compose.yaml +++ b/docker/fullnode/docker-compose.yaml @@ -12,6 +12,7 @@ services: volumes: - ./fullnode-template.yaml:/opt/iota/config/fullnode.yaml:ro - ./genesis.blob:/opt/iota/config/genesis.blob:ro + - ./migration.blob:/opt/iota/config/migration.blob:ro - ./iotadb:/opt/iota/db:rw command: [ "/opt/iota/bin/iota-node", diff --git a/docs/content/operator/iota-full-node.mdx b/docs/content/operator/iota-full-node.mdx index 1fad455a326..1850d9a41f3 100644 --- a/docs/content/operator/iota-full-node.mdx +++ b/docs/content/operator/iota-full-node.mdx @@ -111,34 +111,42 @@ Open a terminal or console to the `iota` directory you downloaded in the previou 1. Install the required prerequisites. 1. Make a copy of the [Full node YAML template](https://github.com/iotaledger/iota/blob/develop/crates/iota-config/data/fullnode-template.yaml): `cp crates/iota-config/data/fullnode-template.yaml fullnode.yaml` -1. Download the genesis blob for the network to use: - - [Testnet genesis blob](https://dbfiles.iota-rebased-testnet.iota.cafe/genesis.blob): - `curl -fLJO https://dbfiles.iota-rebased-testnet.iota.cafe/genesis.blob` - - [Testnet genesis blob](https://github.com/iotaledger/iota/TODO): - `curl -fLJO TODO` +1. Download the genesis and migration blob for the network to use: + - [Testnet genesis blob](https://dbfiles.testnet.iota.cafe/genesis.blob): + `curl -fLJO https://dbfiles.testnet.iota.cafe/genesis.blob` + - [Devnet genesis blob](https://dbfiles.devnet.iota.cafe/genesis.blob): + `curl -fLJO https://dbfiles.devnet.iota.cafe/genesis.blob` + - [Devnet migration blob](https://dbfiles.devnet.iota.cafe/migration.blob): + `curl -fLJO https://dbfiles.devnet.iota.cafe/migration.blob` - [Mainnet genesis blob](https://github.com/iotaledger/iota/TODO): `curl -fLJO TODO` -1. For Devnet or Testnet: Edit the `fullnode.yaml` file to include peer nodes for state synchronization. Append the following to the end of the current configuration: + - [Mainnet migration blob](https://github.com/iotaledger/iota/TODO): + `curl -fLJO TODO` +1. For Testnet or Devnet: Edit the `fullnode.yaml` file to include peer nodes for state synchronization. Append the following to the end of the current configuration: - + ```yaml p2p-config: seed-peers: - - address: /dns/access-0.r.iota-rebased-devnet.iota.cafe/udp/8084 - peer-id: 10cbea76ea5ec3f7ee827f0c11f612f0059949127876dd964b09304bf8808d18 + - address: /dns/access-0.r.testnet.iota.cafe/udp/8084 + peer-id: 46064108d0b689ed89d1f44153e532bb101ce8f8ca3a3d01ab991d4dea122cfc + - address: /dns/access-1.r.testnet.iota.cafe/udp/8084 + peer-id: 8ffd25fa4e86c30c3f8da7092695e8a103462d7a213b815d77d6da7f0a2a52f5 ``` - - + + ```yaml p2p-config: seed-peers: - - address: TODO # Example: /dns/yto-tnt-ssfn-01.testnet.iota.cafe/udp/8084 - peer-id: TODO # Example: 2ed53564d5581ded9b6773970ac2f1c84d39f9edf01308ff5a1ffe09b1add7b3 + - address: /dns/access-0.r.devnet.iota.cafe/udp/8084 + peer-id: 01589ac910a5993f80fbc34a6e0c8b2041ddc5526a951c838df3037e11ab0188 + - address: /dns/access-1.r.devnet.iota.cafe/udp/8084 + peer-id: 32875c547ea3b44fa08a711646cedb70fa0c97959d236578131505da09723add ``` @@ -153,7 +161,10 @@ Open a terminal or console to the `iota` directory you downloaded in the previou genesis: genesis-file-location: "/iota-fullnode/genesis.blob" ``` - +1. Update the `migration-tx-data-path` with the path to the migration.blob + ```yaml + migration-tx-data-path: "/opt/iota/config/migration.blob" + ``` ### Compiling the node Run the following command to compile the `iota-node`. @@ -217,9 +228,9 @@ If you followed the instructions for Building from Source, use the following ste ```shell cd iota ``` -1. Remove the database and 'genesis.blob' file: +1. Remove the database, 'genesis.blob' and 'migration.blob' file: ```shell - rm -r iotadb genesis.blob + rm -r iotadb genesis.blob migration.blob ``` 1. Fetch the source from the latest release: ```shell @@ -229,14 +240,13 @@ If you followed the instructions for Building from Source, use the following ste ```shell git checkout -B --track upstream/ ``` -1. Download the latest genesis blob: - - [Devnet genesis blob](https://github.com/iotaledger/iota): - ```shell - curl -fLJO TODO - ``` - - [Testnet genesis blob](https://github.com/iotaledger/iota): - ```shell - curl -fLJO TODO +1. Download the latest genesis and migration blob: + - [Testnet genesis blob](https://dbfiles.testnet.iota.cafe/genesis.blob): + `curl -fLJO https://dbfiles.testnet.iota.cafe/genesis.blob` + - [Devnet genesis blob](https://dbfiles.devnet.iota.cafe/genesis.blob): + `curl -fLJO https://dbfiles.devnet.iota.cafe/genesis.blob` + - [Devnet migration blob](https://dbfiles.devnet.iota.cafe/migration.blob): + `curl -fLJO https://dbfiles.devnet.iota.cafe/migration.blob` ``` 1. Update your `fullnode.yaml` configuration file, if needed. 1. Recompile your IOTA Full node with the same command as in [Compiling the node](#compiling-the-node): From d10724325cfde11da4f5597ac6958d254035a19e Mon Sep 17 00:00:00 2001 From: Lucas Tortora <85233773+lucas-tortora@users.noreply.github.com> Date: Thu, 14 Nov 2024 08:50:49 -0300 Subject: [PATCH 5/5] fix(devx): Update link to the crate docs (#4054) --- crates/iota-sdk/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/iota-sdk/README.md b/crates/iota-sdk/README.md index bb3ca4e99dc..843b15fe901 100644 --- a/crates/iota-sdk/README.md +++ b/crates/iota-sdk/README.md @@ -1,4 +1,4 @@ -This crate provides the IOTA Rust SDK, containing APIs to interact with the IOTA network. Auto-generated documentation for this crate is [here](https://github.com/iotaledger/iota/iota_sdk/index.html). +This crate provides the IOTA Rust SDK, containing APIs to interact with the IOTA network. Auto-generated documentation for this crate is [here](https://iotaledger.github.io/iota/iota_sdk/index.html). ## Getting started