fix!: index tx receipts, remove tx_hash from events - #1606
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughSplits the indexer store into read/write traits and ReadOnlyStore; adds persistent transaction_receipts table, reader/writer and REST endpoints; removes Changes
Sequence Diagram(s)sequenceDiagram
participant Runtime as Engine Runtime
participant Tracker as StateTracker
participant WorkState as WorkingState
participant Store as Store (Write TX)
participant DB as SQLite DB
Runtime->>Tracker: execute transaction
Tracker->>WorkState: finalize_fee_receipt(substates_to_persist)
Note right of WorkState: compute FeeReceipt, apply refunds
WorkState-->>Tracker: FeeReceipt
Tracker->>WorkState: generate_substate_diff(substates_to_persist, downed_utxos, fee_withdrawals)
WorkState-->>Tracker: SubstateDiff
Tracker->>WorkState: finalize_transaction_receipt(diff, fee_receipt)
Note right of WorkState: build TransactionReceipt (diff_summary, fee_withdrawals, events, logs)
WorkState-->>Tracker: TransactionReceipt
Tracker->>Store: with_write_tx()
Store->>DB: batch_insert_transaction_receipts(receipts, filters)
Note right of DB: persist receipts and filtered events
DB-->>Store: OK
Store-->>Tracker: OK
sequenceDiagram
participant Client as REST Client
participant Handler as list_transaction_receipts Handler
participant Context as HandlerContext
participant ReadOnly as ReadOnlyStore
participant Reader as IndexerStoreReader
participant DB as SQLite
Client->>Handler: GET /transaction-receipts?limit=50
Handler->>Context: read_only_store()
Context-->>Handler: &ReadOnlyStore
Handler->>ReadOnly: list_transaction_receipts(last_id, limit, ordering)
ReadOnly->>Reader: with_read_tx(|tx| tx.list_transaction_receipts(...))
Reader->>DB: SELECT from transaction_receipts (pagination)
DB-->>Reader: rows [(addr, data), ...]
Reader-->>ReadOnly: Vec<(TransactionReceiptAddress, TransactionReceipt)>
ReadOnly-->>Handler: ListTransactionReceiptsResponse
Handler-->>Client: JSON { receipts: [...] }
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Large, cross-cutting changes across engine finalization, storage/schema/traits, reader/writer implementations, client bindings, REST surface, and UI; many signatures changed and behavior must be validated end-to-end. Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
5c1dbe2 to
5542218
Compare
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (9)
applications/tari_validator_node/web_ui/src/routes/Transactions/Events.tsx (1)
51-56: Fix table column alignment and colSpan after removing tx_hash
- Conditional rendering of the Substate Id cell causes rows to have fewer cells when substate_id is null.
- Collapse row still uses colSpan={5} though the header defines 4 columns.
Make column count consistent and update colSpan:
- {substate_id && ( - <DataTableCell> - {shortenSubstateId(substate_id)} - <CopyToClipboard copy={substateIdToString(substate_id)} /> - </DataTableCell> - )} + <DataTableCell> + {substate_id ? ( + <> + {shortenSubstateId(substate_id)} + <CopyToClipboard copy={substateIdToString(substate_id)} /> + </> + ) : ( + "—" + )} + </DataTableCell> ... - <DataTableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={5}> + <DataTableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={4}>Also applies to: 63-63
crates/wallet/sdk/src/apis/stealth_transfer.rs (1)
238-268: Critical lock leak confirmed — the review comment is accurate and requires immediate attentionThe analysis confirms the lock shadowing issue is a genuine resource leak:
Shadowing occurs at line 238: The
PreferConfidentialbranch creates a new lock viacreate_lock(), shadowing the caller-providedlock_idparameter.Leak mechanism:
- The caller (
transferfunction, lines 321-330) invokeslock_inputs_for_transferwith the originallock_idand wraps it withunlock_on_failure(lock_id, ...).- The
unlock_on_failurefunction (line 600) only releases the passed-in lock on errors.- When
PreferConfidentialbranch errors (lines 257-271), the shadow lock created at line 238 is never released—only the originallock_idis cleaned up by the caller.- On success, the shadow lock is also never explicitly released.
Other branches are correct:
ConfidentialOnly,RevealedOnly, andPreferRevealedall correctly reuse the parameterlock_idwithout shadowing.The fix is valid: remove the
create_lock()call and reuse the parameterlock_idconsistently.crates/consensus_tests/src/support/transaction.rs (1)
106-120: Fix test fixture to populate diff_summary from SubstateDiff.Production code in
crates/engine/src/runtime/working_state.rs:1001constructsTransactionReceiptwithdiff_summary: diff.into(), using theFrom<&SubstateDiff>impl. The test fixture should do the same to accurately reflect production behavior instead of usingDefault::default(). Replace line 113 withdiff_summary: diff.into().applications/tari_indexer/src/storage_sqlite/migrations/2023-02-16-145719_initial/up.sql (1)
50-64: Inconsistent with PR objective: tx_hash is still present in events and indexed.The PR says “remove tx_hash from events,” but this migration still creates the
tx_hashcolumn and an index on it. Given you already require deleting the data dir, update the initial migration (and Diesel schema) to droptx_hashand adjust indexes.Apply this diff:
create table events ( id integer not NULL primary key AUTOINCREMENT, template_address text not NULL, - tx_hash text not NULL, topic text not NULL, payload text not NULL, substate_id text NULL, created_at timestamp not null default current_timestamp ); --- DB index for faster collection scan queries -create index events_indexer on events (template_address, tx_hash); +-- DB index for faster collection scan queries (adjust as needed) +create index events_indexer on events (template_address, created_at);Follow-up: regenerate
schema.rsfrom Diesel after adjusting migrations. Based on PR objectives.applications/tari_indexer/src/storage_sqlite/schema.rs (1)
15-23: Schema still includes events.tx_hash; regenerate after migration fix.To align with “remove tx_hash from events,” drop the
tx_hash -> Textcolumn here. Don’t hand-edit this file; update migrations and re-run Diesel to generate.Apply this indicative diff after regenerating:
diesel::table! { events (id) { id -> Integer, template_address -> Text, - tx_hash -> Text, topic -> Text, payload -> Text, substate_id -> Nullable<Text>, created_at -> Timestamp, } }Based on PR objectives.
applications/tari_indexer/src/network_state_sync/block_scanner.rs (1)
67-74: Fix log wording: counting blocks, not events.
The counter increments by new blocks; message says “events”. Update for clarity.- info!( - target: LOG_TARGET, - "Scanned {} events", - block_count - ); + info!( + target: LOG_TARGET, + "Scanned {} blocks", + block_count + );applications/tari_walletd/web_ui/src/routes/Transactions/Events.tsx (1)
169-175: Remove “Transaction Hash” column and adjust colSpan to 4.
tx_hash was removed; header/body mismatch breaks table layout.<TableRow> <TableCell>Topic</TableCell> <TableCell>Substate Id</TableCell> <TableCell>Template Address</TableCell> - <TableCell>Transaction Hash</TableCell> <TableCell width={90}>Details</TableCell> </TableRow> @@ - colSpan={5} + colSpan={4}Also applies to: 145-146
applications/tari_indexer/src/storage_sqlite/store_factory.rs (1)
29-31: Avoid panic on paths without a parent directory.
path.parent().unwrap() will panic for filenames like "indexer.sqlite". Handle None safely.- create_dir_all(path.parent().unwrap()).map_err(|_| StorageError::FileSystemPathDoesNotExist)?; + if let Some(parent) = path.parent() { + if !parent.as_os_str().is_empty() { + create_dir_all(parent).map_err(|_| StorageError::FileSystemPathDoesNotExist)?; + } + }applications/tari_indexer/src/storage_sqlite/reader.rs (1)
237-267: Add database indexes for event filter columns.The events table in the migration file (
applications/tari_indexer/src/storage_sqlite/migrations/2023-02-16-145719_initial/up.sql) has no indexes onsubstate_idortopic. The new filtering code will perform full table scans on these columns, causing performance issues at scale. Add the following indexes:create index events_substate_id_idx on events (substate_id); create index events_topic_idx on events (topic);
🧹 Nitpick comments (28)
applications/tari_walletd/src/main.rs (1)
44-44: Consider refactoring to address the underlying complexity.While lint suppression is sometimes acceptable for main functions, the
too_many_lineswarning indicates the function has grown complex. Consider extracting logical sections (config loading, subcommand handling, etc.) into helper functions to improve maintainability.applications/tari_indexer/src/storage_sqlite/models/events.rs (1)
92-111: Consider removing commented code.The commented-out
TryFromimplementation should be removed unless there's a specific reason to keep it for reference during the migration period. Dead code increases maintenance burden.Apply this diff to remove the commented code:
-// impl TryFrom<EventData> for tari_engine_types::events::Event { -// type Error = anyhow::Error; -// -// fn try_from(event_data: EventData) -> Result<Self, Self::Error> { -// let substate_id = event_data -// .substate_id -// .clone() -// .map(|sub_id| SubstateId::from_str(&sub_id)) -// .transpose()?; -// let template_address = Hash::from_hex(&event_data.template_address)?; -// let payload = serde_json::from_str(event_data.payload.as_str())?; -// -// Ok(Self::new( -// substate_id, -// template_address, -// event_data.topic, -// payload, -// )) -// } -// }applications/tari_indexer/src/network_state_sync/worker.rs (1)
412-413: Address TODO: Remove unused substate transitions.The TODO comment indicates
batch_insert_substate_transitionsis no longer used. Consider removing this code or opening an issue to track its removal to reduce maintenance burden.Would you like me to help verify if this code is indeed unused across the codebase?
applications/tari_validator_node/web_ui/src/routes/Transactions/Events.tsx (2)
33-33: Tidy component signature and redundant keysRowData is used as a React component; it should accept a single props object. Also, the inner TableRow doesn’t need its own key since the list key is set on .
-function RowData({ substate_id, template_address, topic, payload }: Event, index: number) { +function RowData({ substate_id, template_address, topic, payload }: Event) { ... - <TableRow key={index}> + <TableRow>Also applies to: 37-38
86-96: Prefer a stable key over array indexUsing array index as key can cause subtle UI bugs on reordering/insertions. If available, compose a stable key from event data.
- {data.map(({ substate_id, template_address, topic, payload }: Event, index: number) => { + {data.map(({ substate_id, template_address, topic, payload }: Event, index: number) => { return ( <RowData substate_id={substate_id} template_address={template_address} topic={topic} payload={payload} - key={index} + key={substate_id ?? `${template_address}:${topic}:${JSON.stringify(payload).length}:${index}`} /> ); })}applications/tari_app_utilities/src/seed_peer.rs (1)
41-45: Avoid panics in to_peer_id; return None on invalid bytesEven with the invariant, library code should not panic on unexpected bytes. Convert the fallible conversion into an Option and propagate None.
- let pk = identity::PublicKey::from( - // invariant: we only construct SeedPeer with valid public keys - identity::sr25519::PublicKey::try_from_bytes(pk.as_bytes()).expect("invariant: valid public key"), - ); + let Some(sr_pk) = identity::sr25519::PublicKey::try_from_bytes(pk.as_bytes()).ok() else { + return None; + }; + let pk = identity::PublicKey::from(sr_pk);crates/wallet/sdk/src/apis/stealth_transfer.rs (1)
600-610: Consider an RAII guard for automatic lock releaseA small guard type that releases the lock on Drop would eliminate manual wrapping and ensure release on all early returns/panics. You can then “disarm” it on success.
struct LockGuard<'a> { api: &'a StealthOutputsApi<'a, TStore>, id: WalletLockId, disarmed: bool } // impl Drop for LockGuard { if !disarmed { let _ = api.release_lock(id); } } // guard.disarmed = true on successBased on learnings
applications/tari_indexer/src/rest_api/handlers/transaction_receipts.rs (1)
45-57: Consider adding cache control.Individual transaction receipts are immutable once finalized. Consider applying cache control similar to the list endpoint to improve performance.
Apply this diff to add cache control:
- Ok(Json(GetTransactionReceiptResponse { receipt })) + Ok(context.apply_cache_control( + Json(GetTransactionReceiptResponse { receipt }), + 3600, // Cache for 1 hour since receipts are immutable + ))applications/tari_indexer/src/storage_sqlite/writer.rs (1)
240-288: Consider batch inserting events for better performance.The implementation correctly handles transaction receipts and filters events. However, events are inserted one by one in a loop (lines 275-284), which could be slow for transactions with many events.
Consider collecting all event inserts and using a single batch insert:
- for result in events { - let event = result?; - - diesel::insert_into(events::table) - .values(event) - .execute(self.connection()) - .map_err(|e| StorageError::QueryError { - reason: format!("{OPERATION}: {}", e), - })?; - } + let events_to_insert: Vec<_> = events.collect::<Result<_, _>>()?; + + if !events_to_insert.is_empty() { + diesel::insert_into(events::table) + .values(&events_to_insert) + .execute(self.connection()) + .map_err(|e| StorageError::QueryError { + reason: format!("{OPERATION}: {}", e), + })?; + }clients/javascript/indexer_client/src/transports/fetch.ts (1)
69-76: Consider preserving existing Content-Type header.The automatic JSON handling correctly fixes the POST request issue mentioned in the PR objectives. However, the code unconditionally overwrites the
Content-Typeheader even if it was already set by the caller.Consider checking if the header already exists:
if (typeof request.body === "object" && request.body !== null) { // Add content-type header if (!request.headers) { request.headers = {}; } - request.headers["Content-Type"] = "application/json"; + if (!request.headers["Content-Type"]) { + request.headers["Content-Type"] = "application/json"; + } request.body = JSON.stringify(request.body); }This preserves any explicitly set Content-Type while still providing the default behavior for most cases.
crates/storage_sqlite/src/error.rs (1)
83-107: Make NotFound mapping robust and avoid shadowing; improve error messages.Use a nested match instead of equality guard, avoid reusing the
sourcename, and include the operation in non-NotFound errors. This also prevents relying onPartialEqfor diesel errors.Apply this diff:
-impl From<SqliteStorageError> for StorageError { - fn from(source: SqliteStorageError) -> Self { - match source { - SqliteStorageError::ConnectionError { .. } => StorageError::ConnectionError { - reason: source.to_string(), - }, - SqliteStorageError::DieselError { source, operation } if source == diesel::result::Error::NotFound => { - StorageError::NotFoundDbAdapter { - operation, - source: source.into(), - } - }, - SqliteStorageError::DieselError { .. } => StorageError::QueryError { - reason: source.to_string(), - }, - SqliteStorageError::MigrationError { .. } => StorageError::MigrationError { - reason: source.to_string(), - }, - SqliteStorageError::NotFound { item, key } => StorageError::NotFound { item, key }, - other => StorageError::General { - details: other.to_string(), - }, - } - } -} +impl From<SqliteStorageError> for StorageError { + fn from(err: SqliteStorageError) -> Self { + match err { + SqliteStorageError::ConnectionError { .. } => StorageError::ConnectionError { + reason: err.to_string(), + }, + SqliteStorageError::DieselError { source: diesel_err, operation } => match diesel_err { + diesel::result::Error::NotFound => StorageError::NotFoundDbAdapter { + operation, + source: diesel_err.into(), + }, + other => StorageError::QueryError { + reason: format!("{operation}: {other}"), + }, + }, + SqliteStorageError::MigrationError { .. } => StorageError::MigrationError { + reason: err.to_string(), + }, + SqliteStorageError::NotFound { item, key } => StorageError::NotFound { item, key }, + other => StorageError::General { + details: other.to_string(), + }, + } + } +}Also ensure call sites return
SqliteStorageError::DieselErrorinstead of directly mapping toStorageError, otherwiseIsNotFoundErrordetection is bypassed. Based on relevant snippets.bindings/src/types/tari-indexer-client/ListTransactionReceiptsResponse.ts (1)
1-5: Tuple response is faithful to the Rust type; OK for generated code.The
[TransactionReceiptAddress, TransactionReceipt]tuple is expected from ts-rs. If manual APIs consume this, an object shape can be nicer DX, but for generated bindings this is fine.applications/tari_indexer/src/network_state_sync/committee_client.rs (3)
42-67: Track past_failed_nodes growth and epoch changes.
past_failed_nodesaccumulates across calls and epochs; it can grow unbounded and inadvertently exclude healthy nodes on a fresh epoch. Consider pruning on epoch change and/or bounding its size (e.g., LRU of recent failures).
104-108: Log is helpful; consider including epoch and shard_group.Including
epochandself.shard_groupin this warning will aid ops diagnostics when triaging failures across committees.
142-146: Field naming is misleading; optional refactor recommended.The concern is valid.
attemptedrepresents validators that were attempted, and at line 143,attempted.len()equals the count of attempted validators. However, the field namecommittee_sizesuggests the actual total committee size rather than the count of attempted/failed validators. This semantic inconsistency is compounded by inconsistent usage across callsites (e.g., line 51 usesself.past_failed_nodes.len()).Renaming the field or documenting its purpose would improve code clarity without breaking changes (the only consumer uses pattern matching with
..).crates/storage_sqlite/src/global/backend_adapter.rs (1)
223-225: Align DieselError.operation labels with actual operations/tables.Several operation strings are inaccurate or inconsistent, which hurts observability and NotFound mapping context:
- Line 223: "exists::metadata" while querying templates.
- Line 337: "get_pending_template" (singular) while fetching multiple pending templates.
- Line 458: "remove::validator_nodes" while performing an update (deactivation).
- Lines 481 and 502: "get::get_validator_nodes_within_epochs" duplicated/misaligned with function names.
- Line 612: "validator_nodes_set_committee_bucket" vs shard terminology.
Recommend precise, consistent names. Patch:
- operation: "exists::metadata", + operation: "exists::templates",- operation: "get_pending_template", + operation: "get_pending_templates",- operation: "remove::validator_nodes", + operation: "deactivate::validator_nodes",- operation: "get::get_validator_nodes_within_epochs", + operation: "get::validator_nodes_within_start_epoch",- operation: "get::get_validator_nodes_within_epochs", + operation: "get::validator_nodes_within_committee_epoch",- operation: "validator_nodes_set_committee_bucket", + operation: "validator_nodes_set_committee_shard",Also consider centralizing operation labels as &'static str constants to avoid future drift.
Also applies to: 337-339, 458-460, 481-483, 502-504, 612-627
applications/tari_indexer/src/graphql/model/events.rs (1)
36-44: Optional: rename tx_hash to transaction_id (and expose as hex string).Engine events removed tx_hash; here it now carries a TransactionId. Consider:
- Renaming the GraphQL field to transaction_id for clarity.
- Returning a hex string (more client-friendly) instead of [u8; 32].
Example patch:
- pub tx_hash: [u8; 32], + pub transaction_id: String,- fn from_engine_event( - transaction_id: TransactionId, + fn from_engine_event( + transaction_id: TransactionId, event: tari_engine_types::events::Event, ) -> Result<Self, anyhow::Error> { Ok(Self { substate_id: event.substate_id().map(|sub_id| sub_id.to_string()), template_address: event.template_address().into_array(), - tx_hash: transaction_id.into_array(), + transaction_id: hex::encode(transaction_id), topic: event.topic().to_string(), payload: event.into_payload().into_iter().collect(), }) }This is a schema-breaking change; do only if GraphQL consumers agree.
Also applies to: 47-58, 93-95
applications/tari_indexer/src/network_state_sync/event_filter.rs (1)
10-14: Logic is correct; verify MSRV for Option::is_none_or.Early returns make intent clear; Box reduces clones. Ensure the project toolchain supports Option::is_none_or; otherwise replace with map_or:
- self.entity_id.as_ref().is_none_or(|entity_id| { + self.entity_id.as_ref().map_or(true, |entity_id| { event .substate_id() .map(|s| s.to_object_key().as_entity_id() == *entity_id) .unwrap_or(false) })Also applies to: 18-44
applications/tari_indexer/src/network_state_sync/block_scanner.rs (2)
261-323: Add an RPC deadline to avoid hangs on slow VNs.
Wrap client_connection/sync stream in a timeout to prevent indefinite awaits.Example:
let mut client = tokio::time::timeout(Duration::from_secs(30), rpc_client.client_connection()) .await?? ; let mut stream = tokio::time::timeout(Duration::from_secs(30), client.sync_blocks(req)).await??;
125-149: Batch DB writes per committee/epoch to reduce commit overhead.
Currently commits once per block. Consider batching updates within a single transaction per committee (or epoch) for fewer fsyncs.clients/tari_indexer_client/src/types.rs (1)
426-435: Clarify default for Ordering.
ordering has #[serde(default)] but TS type requires it. Document/default to a specific value (e.g., Desc) to avoid client confusion.clients/tari_indexer_client/src/rest_api_client.rs (1)
182-187: Percent-encode the receipt address in the URL path.
Defensive in case address includes non‑URL‑safe chars.- self.send_get(format!("transaction-receipts/{}", address), ()).await + self.send_get( + format!( + "transaction-receipts/{}", + urlencoding::encode(&address.to_string()) + ), + (), + ) + .awaitNote: adds a small urlencoding dependency (or use percent_encoding).
applications/tari_indexer/src/storage_sqlite/store_factory.rs (1)
35-38: Consider failing fast if migrations error.
Logging and continuing can leave schema inconsistent; prefer returning an error.- if let Err(err) = connection.run_pending_migrations(MIGRATIONS) { - log::error!(target: LOG_TARGET, "Error running migrations: {}", err); - } + connection + .run_pending_migrations(MIGRATIONS) + .map_err(|err| { + log::error!(target: LOG_TARGET, "Error running migrations: {}", err); + StorageError::DataInconsistency + })?;crates/engine/src/runtime/impl.rs (1)
1066-1073: Anchor update_nonfungible_data event to the NFT substate, not the resource.You already compute addr = NonFungibleAddress::new(...). Emit the std event with that substate so consumers can correlate precisely.
- self.emit_std_event( - "resource", - "update_nonfungible_data", - resource_address, - payload, - state_mut, - )?; + self.emit_std_event( + "resource", + "update_nonfungible_data", + SubstateId::NonFungible(addr), + payload, + state_mut, + )?;crates/engine_types/src/events.rs (1)
67-68: API tweaks look good; tiny message nit.
- topic() → &str and get_payload() → Option<&str> reduce copies. Good.
- Minor: validate_custom_topic() allows '.' but error says “letters, numbers and underscores”. Consider mentioning dots for clarity.
- return Err("topic can only contain letters, numbers and underscores".to_string()); + return Err("topic can only contain letters, numbers, dots and underscores".to_string());Also applies to: 111-117
crates/engine_types/src/transaction_receipt.rs (1)
86-95: DiffSummary/UpSubstate design is sound.Box<[T]> for events/logs and diff summary is memory‑friendly; From<&SubstateDiff> builds a concise summary with value hashes. Consider documenting ordering guarantees of up_iter() if clients rely on deterministic order; otherwise optional sort by (substate_id, version) before collect.
Also applies to: 101-114, 116-124
applications/tari_indexer/src/storage_sqlite/reader.rs (2)
100-131: Avoid lossy cast for version; use try_into with error mapping.This cast can silently wrap if DB contains a negative version. You already use try_into elsewhere; mirror it here.
- let version = s.version as u32; + let version = s.version.try_into().map_err(|e| StorageError::DataInconsistency { + details: format!("Version overflow {}", e), + })?;
264-310: Event row mapping looks good. Minor clarity nit.If TemplateAddress is a type alias to Hash this compiles; to reduce ambiguity consider TemplateAddress::from(template_hash) or
.into()for readability.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (62)
Cargo.toml(1 hunks)applications/tari_app_utilities/src/seed_peer.rs(3 hunks)applications/tari_indexer/src/bootstrap.rs(1 hunks)applications/tari_indexer/src/event_manager.rs(2 hunks)applications/tari_indexer/src/graphql/model/events.rs(3 hunks)applications/tari_indexer/src/lib.rs(1 hunks)applications/tari_indexer/src/network_state_sync/block_scanner.rs(1 hunks)applications/tari_indexer/src/network_state_sync/committee_client.rs(3 hunks)applications/tari_indexer/src/network_state_sync/event_filter.rs(1 hunks)applications/tari_indexer/src/network_state_sync/worker.rs(8 hunks)applications/tari_indexer/src/rest_api/context.rs(4 hunks)applications/tari_indexer/src/rest_api/handlers/mod.rs(1 hunks)applications/tari_indexer/src/rest_api/handlers/transaction_receipts.rs(1 hunks)applications/tari_indexer/src/rest_api/handlers/transactions.rs(1 hunks)applications/tari_indexer/src/rest_api/server.rs(2 hunks)applications/tari_indexer/src/storage_sqlite/migrations/2023-02-16-145719_initial/up.sql(1 hunks)applications/tari_indexer/src/storage_sqlite/models/events.rs(3 hunks)applications/tari_indexer/src/storage_sqlite/reader.rs(10 hunks)applications/tari_indexer/src/storage_sqlite/schema.rs(2 hunks)applications/tari_indexer/src/storage_sqlite/store_factory.rs(3 hunks)applications/tari_indexer/src/storage_sqlite/writer.rs(4 hunks)applications/tari_indexer/src/store.rs(1 hunks)applications/tari_indexer/src/substate_manager.rs(1 hunks)applications/tari_indexer/src/transaction_manager/mod.rs(1 hunks)applications/tari_indexer/web_ui/src/routes/Transaction/components/Events.tsx(1 hunks)applications/tari_validator_node/web_ui/src/routes/Transactions/Events.tsx(2 hunks)applications/tari_walletd/src/main.rs(2 hunks)applications/tari_walletd/web_ui/src/routes/Transactions/Events.tsx(5 hunks)bindings/package.json(1 hunks)bindings/src/index.ts(2 hunks)bindings/src/tari-indexer-client.ts(2 hunks)bindings/src/types/DiffSummary.ts(1 hunks)bindings/src/types/Event.ts(1 hunks)bindings/src/types/Hash64.ts(1 hunks)bindings/src/types/TransactionReceipt.ts(1 hunks)bindings/src/types/UpSubstate.ts(1 hunks)bindings/src/types/tari-indexer-client/GetTransactionReceiptResponse.ts(1 hunks)bindings/src/types/tari-indexer-client/ListTransactionReceiptsRequest.ts(1 hunks)bindings/src/types/tari-indexer-client/ListTransactionReceiptsResponse.ts(1 hunks)clients/javascript/indexer_client/package.json(1 hunks)clients/javascript/indexer_client/src/index.ts(3 hunks)clients/javascript/indexer_client/src/transports/fetch.ts(1 hunks)clients/javascript/wallet_daemon_client/package.json(1 hunks)clients/tari_indexer_client/src/rest_api_client.rs(4 hunks)clients/tari_indexer_client/src/types.rs(3 hunks)crates/consensus_tests/src/support/transaction.rs(2 hunks)crates/engine/src/runtime/impl.rs(13 hunks)crates/engine/src/runtime/tracker.rs(2 hunks)crates/engine/src/runtime/working_state.rs(2 hunks)crates/engine_types/src/commit_result.rs(3 hunks)crates/engine_types/src/events.rs(4 hunks)crates/engine_types/src/transaction_receipt.rs(2 hunks)crates/engine_types/src/validator_fee.rs(1 hunks)crates/storage_sqlite/src/error.rs(2 hunks)crates/storage_sqlite/src/global/backend_adapter.rs(32 hunks)crates/storage_sqlite/src/sqlite_db_factory.rs(1 hunks)crates/storage_sqlite/src/sqlite_transaction.rs(1 hunks)crates/template_builtin/templates/account/src/lib.rs(3 hunks)crates/transaction/src/transaction_id.rs(1 hunks)crates/wallet/sdk/src/apis/stealth_transfer.rs(8 hunks)crates/wallet/sdk/src/apis/substate.rs(1 hunks)integration_tests/tests/features/indexer.feature(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (32)
applications/tari_indexer/src/store.rs (6)
applications/tari_indexer/src/storage_sqlite/store_factory.rs (2)
create_write_tx(69-72)create_read_tx(60-63)applications/tari_indexer/src/storage_sqlite/reader.rs (17)
list_substates(73-133)get_substate(135-158)get_substates(160-181)get_non_fungible_count(183-195)get_non_fungibles_by_resource_address(197-235)get_events(237-310)get_oldest_scanned_epoch(312-330)get_last_scanned_block_id(332-354)list_recent_transactions(356-399)list_transaction_receipts(401-455)get_transaction_receipt(457-473)key_value_get_value(476-479)key_value_get_raw(481-496)utxos_get_max_state_version(498-517)utxos_get_updates(519-561)utxos_get_unspent_by_public_nonce_and_tag(563-610)new(63-65)applications/tari_indexer/src/rest_api/handlers/transactions.rs (1)
list_recent_transactions(95-112)applications/tari_indexer/src/transaction_manager/mod.rs (2)
list_recent_transactions(110-119)new(61-63)applications/tari_indexer/src/rest_api/handlers/transaction_receipts.rs (2)
list_transaction_receipts(21-38)get_transaction_receipt(45-57)applications/tari_indexer/src/storage_sqlite/writer.rs (13)
commit(56-59)rollback(61-64)key_value_set(66-80)batch_insert_substate_transitions(82-115)updates(93-109)batch_insert_utxo_updates(117-172)upsert_substate(174-238)batch_insert_transaction_receipts(240-288)save_scanned_block_id(290-309)delete_scanned_epochs_older_than(311-322)insert_or_ignore_transaction(324-339)insert_or_ignore_epoch_checkpoint(341-360)new(45-49)
crates/engine/src/runtime/working_state.rs (4)
crates/engine_types/src/indexed_value.rs (1)
diff(325-357)bindings/src/types/SubstateDiff.ts (1)
SubstateDiff(6-10)bindings/src/types/TransactionReceipt.ts (1)
TransactionReceipt(8-14)bindings/src/types/SubstateValue.ts (1)
SubstateValue(12-21)
applications/tari_indexer/src/storage_sqlite/models/events.rs (1)
crates/engine_types/src/events.rs (1)
std(70-83)
crates/template_builtin/templates/account/src/lib.rs (2)
crates/template_lib/src/models/vault.rs (2)
withdraw_non_fungible(238-240)deposit(210-218)crates/engine_types/src/vault.rs (1)
deposit(56-59)
bindings/src/types/Event.ts (3)
bindings/src/types/SubstateId.ts (1)
SubstateId(6-6)bindings/src/types/Hash.ts (1)
Hash(6-6)bindings/src/types/Metadata.ts (1)
Metadata(6-6)
crates/wallet/sdk/src/apis/substate.rs (3)
bindings/src/types/SubstateValue.ts (1)
SubstateValue(12-21)crates/engine_types/src/events.rs (1)
substate_id(103-105)bindings/src/types/SubstateId.ts (1)
SubstateId(6-6)
applications/tari_indexer/src/storage_sqlite/writer.rs (3)
bindings/src/types/TransactionReceipt.ts (1)
TransactionReceipt(8-14)applications/tari_indexer/src/store.rs (1)
batch_insert_transaction_receipts(175-179)applications/tari_indexer/src/storage_sqlite/reader.rs (1)
transaction_receipts(464-467)
applications/tari_indexer/src/rest_api/handlers/mod.rs (1)
applications/tari_indexer/src/storage_sqlite/reader.rs (1)
transaction_receipts(464-467)
crates/engine/src/runtime/tracker.rs (3)
crates/storage/src/consensus_models/substate_change.rs (1)
substate(58-63)bindings/src/types/SubstateValue.ts (1)
SubstateValue(12-21)crates/engine_types/src/substate.rs (2)
new(71-76)new(855-861)
applications/tari_indexer/src/graphql/model/events.rs (4)
bindings/src/types/TransactionId.ts (1)
TransactionId(3-3)integration_tests/tests/steps/indexer.rs (1)
events(127-131)bindings/src/types/Event.ts (1)
Event(6-6)crates/engine_types/src/events.rs (2)
topic(111-113)substate_id(103-105)
bindings/src/types/DiffSummary.ts (1)
bindings/src/types/UpSubstate.ts (1)
UpSubstate(4-4)
clients/tari_indexer_client/src/types.rs (5)
bindings/src/types/TransactionReceipt.ts (1)
TransactionReceipt(8-14)bindings/src/types/tari-indexer-client/ListTransactionReceiptsRequest.ts (1)
ListTransactionReceiptsRequest(5-9)crates/engine_types/src/substate_serde.rs (8)
serde(176-176)serde(180-180)serde(184-184)serde(188-188)serde(192-192)serde(196-196)serde(200-200)serde(204-204)bindings/src/types/tari-indexer-client/ListTransactionReceiptsResponse.ts (1)
ListTransactionReceiptsResponse(5-5)bindings/src/types/tari-indexer-client/GetTransactionReceiptResponse.ts (1)
GetTransactionReceiptResponse(4-4)
applications/tari_indexer/src/network_state_sync/event_filter.rs (3)
bindings/src/types/SubstateId.ts (1)
SubstateId(6-6)bindings/src/types/Event.ts (1)
Event(6-6)crates/engine_types/src/events.rs (1)
substate_id(103-105)
applications/tari_validator_node/web_ui/src/routes/Transactions/Events.tsx (1)
bindings/src/types/Event.ts (1)
Event(6-6)
crates/engine_types/src/commit_result.rs (5)
bindings/src/types/TransactionReceipt.ts (1)
TransactionReceipt(8-14)applications/tari_indexer/src/rest_api/handlers/transaction_receipts.rs (1)
get_transaction_receipt(45-57)applications/tari_indexer/src/storage_sqlite/reader.rs (1)
get_transaction_receipt(457-473)applications/tari_indexer/src/store.rs (2)
get_transaction_receipt(125-128)get_transaction_receipt(205-210)clients/tari_indexer_client/src/rest_api_client.rs (1)
get_transaction_receipt(182-187)
applications/tari_indexer/src/storage_sqlite/store_factory.rs (4)
applications/tari_indexer/src/store.rs (1)
create_read_tx(65-65)crates/storage_sqlite/src/sqlite_transaction.rs (1)
begin(37-44)applications/tari_indexer/src/storage_sqlite/reader.rs (1)
new(63-65)applications/tari_indexer/src/storage_sqlite/writer.rs (1)
new(45-49)
applications/tari_indexer/src/storage_sqlite/schema.rs (1)
applications/tari_indexer/src/storage_sqlite/reader.rs (1)
transaction_receipts(464-467)
applications/tari_indexer/src/rest_api/handlers/transaction_receipts.rs (7)
bindings/src/types/tari-indexer-client/GetTransactionReceiptResponse.ts (1)
GetTransactionReceiptResponse(4-4)bindings/src/types/tari-indexer-client/ListTransactionReceiptsRequest.ts (1)
ListTransactionReceiptsRequest(5-9)bindings/src/types/tari-indexer-client/ListTransactionReceiptsResponse.ts (1)
ListTransactionReceiptsResponse(5-5)applications/tari_indexer/src/storage_sqlite/reader.rs (2)
list_transaction_receipts(401-455)get_transaction_receipt(457-473)applications/tari_indexer/src/store.rs (4)
list_transaction_receipts(118-123)list_transaction_receipts(195-203)get_transaction_receipt(125-128)get_transaction_receipt(205-210)clients/tari_indexer_client/src/rest_api_client.rs (2)
list_transaction_receipts(175-180)get_transaction_receipt(182-187)applications/tari_indexer/src/rest_api/error.rs (1)
anyhow(44-48)
bindings/src/types/tari-indexer-client/ListTransactionReceiptsResponse.ts (1)
bindings/src/types/TransactionReceipt.ts (1)
TransactionReceipt(8-14)
crates/engine/src/runtime/impl.rs (4)
bindings/src/types/SubstateId.ts (1)
SubstateId(6-6)crates/engine_types/src/events.rs (6)
substate_id(103-105)payload(119-121)template_address(107-109)std(70-83)custom(61-68)topic(111-113)crates/engine/src/runtime/tracker.rs (1)
new(68-85)crates/engine/src/runtime/working_state.rs (1)
new(108-136)
applications/tari_indexer/src/lib.rs (2)
crates/engine/src/runtime/working_state.rs (1)
store(1438-1440)networking/libp2p-peersync/src/behaviour.rs (1)
store(166-168)
bindings/src/types/UpSubstate.ts (1)
bindings/src/types/SubstateId.ts (1)
SubstateId(6-6)
applications/tari_indexer/src/rest_api/server.rs (4)
applications/tari_indexer/src/storage_sqlite/reader.rs (3)
transaction_receipts(464-467)list_transaction_receipts(401-455)get_transaction_receipt(457-473)applications/tari_indexer/src/rest_api/handlers/transaction_receipts.rs (2)
list_transaction_receipts(21-38)get_transaction_receipt(45-57)applications/tari_indexer/src/store.rs (4)
list_transaction_receipts(118-123)list_transaction_receipts(195-203)get_transaction_receipt(125-128)get_transaction_receipt(205-210)clients/tari_indexer_client/src/rest_api_client.rs (2)
list_transaction_receipts(175-180)get_transaction_receipt(182-187)
applications/tari_indexer/src/rest_api/context.rs (1)
applications/tari_indexer/src/store.rs (1)
new(191-193)
clients/tari_indexer_client/src/rest_api_client.rs (7)
bindings/src/types/tari-indexer-client/GetTransactionReceiptResponse.ts (1)
GetTransactionReceiptResponse(4-4)bindings/src/types/tari-indexer-client/ListTransactionReceiptsRequest.ts (1)
ListTransactionReceiptsRequest(5-9)bindings/src/types/tari-indexer-client/ListTransactionReceiptsResponse.ts (1)
ListTransactionReceiptsResponse(5-5)applications/tari_indexer/src/rest_api/handlers/transaction_receipts.rs (2)
list_transaction_receipts(21-38)get_transaction_receipt(45-57)applications/tari_indexer/src/storage_sqlite/reader.rs (2)
list_transaction_receipts(401-455)get_transaction_receipt(457-473)applications/tari_indexer/src/store.rs (4)
list_transaction_receipts(118-123)list_transaction_receipts(195-203)get_transaction_receipt(125-128)get_transaction_receipt(205-210)crates/engine_types/src/commit_result.rs (1)
get_transaction_receipt(220-225)
applications/tari_indexer/src/event_manager.rs (3)
bindings/src/types/TransactionId.ts (1)
TransactionId(3-3)crates/engine_types/src/events.rs (2)
topic(111-113)substate_id(103-105)bindings/src/types/Event.ts (1)
Event(6-6)
clients/javascript/indexer_client/src/index.ts (3)
bindings/src/types/tari-indexer-client/ListTransactionReceiptsRequest.ts (1)
ListTransactionReceiptsRequest(5-9)bindings/src/types/tari-indexer-client/ListTransactionReceiptsResponse.ts (1)
ListTransactionReceiptsResponse(5-5)bindings/src/types/tari-indexer-client/GetTransactionReceiptResponse.ts (1)
GetTransactionReceiptResponse(4-4)
crates/engine_types/src/transaction_receipt.rs (5)
crates/engine_types/src/substate.rs (1)
hash_substate(111-118)bindings/src/types/SubstateDiff.ts (1)
SubstateDiff(6-10)bindings/src/types/SubstateId.ts (1)
SubstateId(6-6)bindings/src/types/ValidatorFeeWithdrawal.ts (1)
ValidatorFeeWithdrawal(4-4)bindings/src/types/UpSubstate.ts (1)
UpSubstate(4-4)
applications/tari_walletd/web_ui/src/routes/Transactions/Events.tsx (4)
applications/tari_walletd/web_ui/src/components/CopyAddress.tsx (1)
CopyAddress(32-43)crates/engine_types/src/events.rs (4)
payload(119-121)topic(111-113)substate_id(103-105)template_address(107-109)bindings/src/types/Event.ts (1)
Event(6-6)applications/tari_walletd/web_ui/src/utils/helpers.tsx (1)
substateIdToString(100-109)
bindings/src/types/tari-indexer-client/GetTransactionReceiptResponse.ts (1)
bindings/src/types/TransactionReceipt.ts (1)
TransactionReceipt(8-14)
bindings/src/types/TransactionReceipt.ts (2)
bindings/src/types/DiffSummary.ts (1)
DiffSummary(4-4)bindings/src/types/ValidatorFeeWithdrawal.ts (1)
ValidatorFeeWithdrawal(4-4)
applications/tari_indexer/src/storage_sqlite/reader.rs (5)
crates/engine_types/src/events.rs (4)
substate_id(103-105)template_address(107-109)topic(111-113)payload(119-121)crates/engine_types/src/transaction_receipt.rs (2)
from_str(80-83)from_hex(60-62)crates/engine_types/src/substate.rs (17)
from_str(493-538)from(307-309)from(313-315)from(319-321)from(325-327)from(331-333)from(337-339)from(343-345)from(349-351)from(355-357)from(793-795)from(799-801)from(805-807)from(811-813)from(817-819)from(823-825)from(829-831)applications/tari_indexer/src/rest_api/handlers/transaction_receipts.rs (2)
list_transaction_receipts(21-38)get_transaction_receipt(45-57)applications/tari_indexer/src/store.rs (4)
list_transaction_receipts(118-123)list_transaction_receipts(195-203)get_transaction_receipt(125-128)get_transaction_receipt(205-210)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: clippy
- GitHub Check: test
- GitHub Check: check nightly
Test Results (CI)478 tests 465 ✅ 1h 35m 37s ⏱️ For more details on these failures, see this check. Results for commit 5542218. |
Description
fix!: index tx receipts, remove tx_hash from events
bump version 0.13.0
fix failing POST request from JS indexer client
bump bindings, indexer client and wallet client JS package versions
Motivation and Context
Allows indexer clients to query transaction receipts.
tx_hash in events is redundant and was removed.
Adds a DiffSummary to the transaction receipt
How Has This Been Tested?
Manually, existing tests
Breaking Changes
Summary by CodeRabbit