Skip to content

fix!: large byte buf fix, engine optimise, integration tests - #1589

Merged
sdbondi merged 3 commits into
tari-project:developmentfrom
sdbondi:integration-tests
Sep 30, 2025
Merged

fix!: large byte buf fix, engine optimise, integration tests#1589
sdbondi merged 3 commits into
tari-project:developmentfrom
sdbondi:integration-tests

Conversation

@sdbondi

@sdbondi sdbondi commented Sep 30, 2025

Copy link
Copy Markdown
Member

Description

fix(engine)!: template calls with large bytes (> 64k) work
fix(engine): fix possible use after free in template ABI
fix(engine): adds Bytes type to improve serialization of byte buffers for template developers
fix(network): increase gossip size to allow 2Mib payloads to allow for bigger transactions to finalize more quickly
fix(tests): integration tests output management reworked to make it easier to use the correct accounts/resources
fix(tests): fix integration tests (may still break in CI due to rocksdb, too many open files)
minimum template version 0.13.0 -> 0.14.0

Motivation and Context

Due to lack of specialisation in rust, an implementation (e.g. ciborium) cannot implement serialisation for Vec<T> and have optimal serialisation for Vec<u8> unless crates like serde_with or custom implementations (#[serde(with = "...")]) are used.

This causes byte arrays to serialize in CBOR (roughly) as {array}{len}{integer}{value}{integer}{value}.... instead of {bytes}{value}. This causes OOMs in templates for large byte vecs and greatly inflates the storage cost of byte vecs.

This PR fixes some of the internal de/serialisation to represent bytes in a more optimal way for engine calls and adds the Bytes type that template devs can use to reduce storage costs. Vec<u8> in a component is still serialised in the inflated way (perhaps the template macro could detect and add the required attributes but that is left for another time).

All cucumbers use the new network spec step for initial setup.

How Has This Been Tested?

Cucumber tests, existing tests, new unit tests

What process can a PR reviewer use to test or verify this change?

Run cucumbers

Breaking Changes

  • None
  • Requires data directory to be deleted
  • Other - Please specify

BREAKING CHANGE: all templates will need to be recompiled to use ABI 0.14.0

Summary by CodeRabbit

  • New Features

    • JSON‑RPC endpoint for network sync state; indexer exposes separate block/state scan intervals; UI stealth UTXOs route scoped by resource; tests can wait for indexer sync.
  • Changes

    • Wallet CLI adds transaction wait/timeouts and fee display; wallet daemon responses now return only transaction_id; events query accepts optional offset/limit with caps; consensus status may include per‑shard state_versions; NFT faucet symbol now "tNFT".
  • Bug Fixes

    • More resilient committee session retries; stealth/confidential transfers validate resource types.
  • Chores

    • Bumped template libraries and related packages to 0.14.0.

@coderabbitai

coderabbitai Bot commented Sep 30, 2025

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

Walkthrough

Bumps template workspace crates to 0.14.0; introduces a boxed Bytes type and migrates many arg/ABI surfaces to Bytes; adds engine/WASM limits and runtime guards; expands indexer state‑sync, JSON‑RPC and sync persistence; simplifies walletd transfer responses; and refactors tests, bindings and web UI routing.

Changes

Cohort / File(s) Summary
Workspace & template crates
Cargo.toml, crates/template_abi/Cargo.toml, crates/template_lib/Cargo.toml, crates/template_lib_types/Cargo.toml, crates/template_macros/Cargo.toml
Bump template workspace crates and package versions to 0.14.0 and update package metadata.
Bytes type & template-lib-types
crates/template_lib_types/src/bytes.rs, crates/template_lib_types/src/lib.rs, crates/template_lib_types/src/serde_helpers.rs, crates/template_lib_types/src/engine_args.rs
Add boxed Bytes type, public bytes module, and update serde helpers and engine-arg types to use Bytes.
Template lib macros & managers
crates/template_lib/src/args/{mod.rs,types.rs}, crates/template_lib/src/prelude.rs, crates/template_lib/src/component/manager.rs, crates/template_lib/src/template/manager.rs
Add invoke_arg! macro, change invoke_args to produce Vec<Bytes>, re-export Bytes in prelude, and make managers generic over Into<Bytes>.
Engine runtime & WASM
crates/engine/src/runtime/{engine_args.rs,impl.rs,mod.rs}, crates/engine_types/src/limits.rs, crates/engine/src/wasm/{error.rs,module.rs,environment.rs,process.rs,compile.rs}, crates/engine/tests/*
Migrate runtime arg payloads to Bytes, remove RuntimeInterface.get_substate, add engine limits (max_internal_call_size, max_memory_pages), WASM memory and function validation, new errors, memory_size helper, internal-call-size guard, compile refactor and limits tests/templates.
Transaction & conversions
crates/transaction/src/{args.rs,builder/mod.rs,special_json_arg_syntax.rs,transaction.rs}, crates/p2p/src/conversions/transaction.rs
Change InstructionArg::Literal to Bytes, add raw_literal_bytes constructor, update conversions and serialization/deserialization tests and call-sites.
Template ABI runtime glue
crates/template_abi/src/abi/mod.rs, crates/template_abi/src/version.rs
Bump template ABI version constants to 0.14.0; use Vec::as_mut_ptr for engine input pointer and drop input buffer after call.
Indexer: config, state sync & RPC
applications/tari_app_utilities/config_presets/d_indexer.toml, applications/tari_indexer/src/{config.rs,lib.rs,bootstrap.rs}, applications/tari_indexer/src/network_state_sync/{mod.rs,committee_client.rs,worker.rs}, applications/tari_indexer/src/substate_manager.rs
Split scanning_interval into block_scanning_interval and state_scanning_interval; wire state interval into state-sync; make committee session retry loop and mutable pool bindings; persist SyncProgress when missing; add SubstateManager::get_sync_progress and re-export sync_progress.
Indexer JSON‑RPC & GraphQL
applications/tari_indexer/src/json_rpc/{handlers.rs,server.rs,error.rs}, applications/tari_indexer/src/graphql/model/events.rs, clients/tari_indexer_client/{src/json_rpc_client.rs,src/types.rs}, bindings/src/types/tari-indexer-client/*
Add get_network_sync_state RPC (server handler and client), new types (GetNetworkSyncStateResponse, NetworkDescription, SyncProgress); make GraphQL get_events offset/limit optional with validation; consolidate internal_error logging.
Validator node & client types
applications/tari_validator_node/src/{json_rpc/handlers.rs,genesis_state.rs}, clients/validator_node_client/{Cargo.toml,src/types.rs}, bindings/src/types/validator-node-client/GetConsensusStatusResponse.ts
Streamline RPC handlers, add optional state_versions to consensus responses (IndexMap/TS mapping), change NFT faucet symbol to "tNFT".
JSON‑RPC internal_error consistency
applications/tari_indexer/src/json_rpc/error.rs, applications/tari_validator_node/src/json_rpc/jrpc_errors.rs
Always log internal errors; include detailed error messages only under debug/assert/CI/DEBUG_MODE gates.
Walletd: transfer responses & helpers
applications/tari_walletd/src/handlers/{accounts.rs,helpers.rs,validator.rs}, clients/wallet_daemon_client/src/types.rs, bindings/src/types/wallet-daemon-client/*
Simplify Accounts/Confidential transfer responses to only transaction_id; conditionally load inputs for confirmed accounts; add XTR input handling and refactor fee/claim deposit flows; update client types and TS bindings.
Watcher monitoring rename
applications/tari_watcher/src/{monitoring.rs,manager.rs}
Rename public TransactionTransactionRefInBlock, update ProcessStatus::Submitted variant and callers.
Commit/result helpers & indexed value
crates/engine_types/src/commit_result.rs, crates/engine_types/src/indexed_value.rs
Add accept(&self) accessors, rename into_acceptinto_any_accept, and remove serde hex-vec wrapper from non_fungible_addresses.
Template test tooling & NFT faucet metadata
crates/template_test_tooling/src/builtin_component_state.rs, applications/tari_validator_node/src/genesis_state.rs
Set NFT faucet metadata token symbol to "tNFT" in built-in state and genesis.
Wallet SDK confidentiality guard
crates/wallet/sdk/src/apis/confidential_transfer.rs
Validate the source vault resource is confidential; return InvalidParameter if not.
Integration tests & harness refactor
integration_tests/{Cargo.toml,src/**/*.rs,tests/**,tests/features/**}
Large test-harness refactor: add deps and cucumber_log helper, rename world fields (wallet_accounts, consensus_constants), switch many feature scenarios from "free coins" to XTR, rename confidential→stealth flows, add indexer sync wait step, remove/replace some long-running features and update many step implementations and startup logs.
Web UI routing & components
applications/tari_walletd/web_ui/src/App.tsx, applications/tari_walletd/web_ui/src/components/Breadcrumbs.tsx, applications/tari_walletd/web_ui/src/routes/**/StealthUtxoList.tsx, applications/tari_walletd/web_ui/src/routes/AssetVault/Tokens/Tokens.tsx
Make Stealth UTXOs route dynamic (/stealth-utxos/:resource_address), update breadcrumbs and components to use route params and navigate with resource address.
Misc small changes & bindings
crates/common_types/src/{lib.rs,shard_state_versions.rs}, multiple bindings bindings/src/types/**
Add engine_types re-export, add ShardStateVersions::convert_to_map, update various TS types and bindings to align with new Rust types.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client as IndexerJsonRpcClient
  participant Server as Indexer JSON-RPC Server
  participant Handlers as Handlers.get_network_sync_state
  participant EpochMgr as epoch_manager
  participant SubstateMgr as substate_manager

  Client->>Server: get_network_sync_state()
  Server->>Handlers: dispatch
  rect rgb(235,245,255)
    Handlers->>EpochMgr: get_network_description()
    EpochMgr-->>Handlers: NetworkDescription
  end
  rect rgb(240,255,240)
    Handlers->>SubstateMgr: get_sync_progress() (optional)
    SubstateMgr-->>Handlers: SyncProgress | error
  end
  Handlers-->>Server: GetNetworkSyncStateResponse
  Server-->>Client: result
Loading
sequenceDiagram
  autonumber
  participant Worker as StateSync Worker
  participant Pools as ValidatorCommitteeRpcPool
  participant Committee as Committee Member

  loop until session established
    Worker->>Pools: new_session()
    Pools->>Committee: try open session with random member
    alt success
      Committee-->>Pools: session
      Pools-->>Worker: session
    else failure
      Committee-->>Pools: error (record failed address)
      Pools-->>Worker: retry
    end
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🥕 I am a rabbit, boxes snug and light,
I pack Vecs to Bytes and hop through the night.
Indexers sync, workers try again,
tNFTs gleam and UTXOs hop like rain.
Tiny paws, big changes — code takes flight.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title is a comma-separated list of broad topics (“large byte buf fix, engine optimise, integration tests”) rather than a clear, concise sentence that highlights the single most important change from the developer’s perspective. Please revise the title to a concise, single-sentence summary of the primary breaking change—for example, “feat!: introduce Bytes type for efficient large buffer support and update engine serialization and integration tests.”
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 905a096 and 0abbe63.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (107)
  • Cargo.toml (1 hunks)
  • applications/tari_app_utilities/config_presets/d_indexer.toml (1 hunks)
  • applications/tari_indexer/src/bootstrap.rs (1 hunks)
  • applications/tari_indexer/src/config.rs (2 hunks)
  • applications/tari_indexer/src/graphql/model/events.rs (2 hunks)
  • applications/tari_indexer/src/json_rpc/error.rs (2 hunks)
  • applications/tari_indexer/src/json_rpc/handlers.rs (4 hunks)
  • applications/tari_indexer/src/json_rpc/server.rs (2 hunks)
  • applications/tari_indexer/src/lib.rs (1 hunks)
  • applications/tari_indexer/src/network_state_sync/committee_client.rs (1 hunks)
  • applications/tari_indexer/src/network_state_sync/mod.rs (1 hunks)
  • applications/tari_indexer/src/network_state_sync/worker.rs (2 hunks)
  • applications/tari_indexer/src/substate_manager.rs (3 hunks)
  • applications/tari_validator_node/src/genesis_state.rs (1 hunks)
  • applications/tari_validator_node/src/json_rpc/handlers.rs (6 hunks)
  • applications/tari_validator_node/src/json_rpc/jrpc_errors.rs (2 hunks)
  • applications/tari_validator_node_cli/src/command/transaction.rs (2 hunks)
  • applications/tari_wallet_cli/src/command/transaction.rs (2 hunks)
  • applications/tari_walletd/src/handlers/accounts.rs (3 hunks)
  • applications/tari_walletd/src/handlers/helpers.rs (1 hunks)
  • applications/tari_walletd/src/handlers/validator.rs (3 hunks)
  • applications/tari_walletd/web_ui/src/App.tsx (2 hunks)
  • applications/tari_walletd/web_ui/src/components/Breadcrumbs.tsx (1 hunks)
  • applications/tari_walletd/web_ui/src/routes/AssetVault/Tokens/Tokens.tsx (1 hunks)
  • applications/tari_walletd/web_ui/src/routes/StealthUtxoList/StealthUtxoList.tsx (3 hunks)
  • applications/tari_watcher/src/manager.rs (3 hunks)
  • applications/tari_watcher/src/monitoring.rs (2 hunks)
  • bindings/src/tari-indexer-client.ts (2 hunks)
  • bindings/src/types/tari-indexer-client/NetworkDescription.ts (1 hunks)
  • bindings/src/types/tari-indexer-client/SyncProgress.ts (1 hunks)
  • bindings/src/types/validator-node-client/GetConsensusStatusResponse.ts (1 hunks)
  • bindings/src/types/wallet-daemon-client/AccountsTransferResponse.ts (1 hunks)
  • bindings/src/types/wallet-daemon-client/ConfidentialTransferResponse.ts (1 hunks)
  • bindings/src/types/wallet-daemon-client/WalletSubstateInfo.ts (1 hunks)
  • clients/tari_indexer_client/src/json_rpc_client.rs (2 hunks)
  • clients/tari_indexer_client/src/types.rs (2 hunks)
  • clients/validator_node_client/Cargo.toml (1 hunks)
  • clients/validator_node_client/src/types.rs (3 hunks)
  • clients/wallet_daemon_client/src/types.rs (0 hunks)
  • crates/common_types/src/lib.rs (1 hunks)
  • crates/common_types/src/shard_state_versions.rs (2 hunks)
  • crates/consensus/src/hotstuff/state_machine/state.rs (4 hunks)
  • crates/engine/src/runtime/engine_args.rs (2 hunks)
  • crates/engine/src/runtime/impl.rs (3 hunks)
  • crates/engine/src/runtime/mod.rs (0 hunks)
  • crates/engine/src/wasm/compile.rs (3 hunks)
  • crates/engine/src/wasm/environment.rs (1 hunks)
  • crates/engine/src/wasm/error.rs (3 hunks)
  • crates/engine/src/wasm/module.rs (4 hunks)
  • crates/engine/src/wasm/process.rs (3 hunks)
  • crates/engine/tests/limits.rs (1 hunks)
  • crates/engine/tests/templates/buggy/Cargo.toml (1 hunks)
  • crates/engine/tests/templates/buggy/src/lib.rs (1 hunks)
  • crates/engine/tests/templates/composability/src/lib.rs (1 hunks)
  • crates/engine/tests/templates/limits/Cargo.toml (1 hunks)
  • crates/engine/tests/templates/limits/src/lib.rs (1 hunks)
  • crates/engine/tests/test.rs (2 hunks)
  • crates/engine_types/src/commit_result.rs (3 hunks)
  • crates/engine_types/src/indexed_value.rs (0 hunks)
  • crates/engine_types/src/limits.rs (1 hunks)
  • crates/engine_types/src/serde_with/hex.rs (3 hunks)
  • crates/p2p/src/conversions/transaction.rs (2 hunks)
  • crates/template_abi/Cargo.toml (1 hunks)
  • crates/template_abi/src/abi/mod.rs (1 hunks)
  • crates/template_abi/src/version.rs (1 hunks)
  • crates/template_lib/Cargo.toml (1 hunks)
  • crates/template_lib/src/args/mod.rs (1 hunks)
  • crates/template_lib/src/args/types.rs (11 hunks)
  • crates/template_lib/src/component/manager.rs (3 hunks)
  • crates/template_lib/src/prelude.rs (1 hunks)
  • crates/template_lib/src/template/manager.rs (3 hunks)
  • crates/template_lib_types/Cargo.toml (1 hunks)
  • crates/template_lib_types/src/bytes.rs (1 hunks)
  • crates/template_lib_types/src/engine_args.rs (2 hunks)
  • crates/template_lib_types/src/lib.rs (1 hunks)
  • crates/template_lib_types/src/serde_helpers.rs (5 hunks)
  • crates/template_macros/Cargo.toml (1 hunks)
  • crates/template_test_tooling/src/builtin_component_state.rs (2 hunks)
  • crates/transaction/src/args.rs (4 hunks)
  • crates/transaction/src/builder/mod.rs (1 hunks)
  • crates/transaction/src/special_json_arg_syntax.rs (1 hunks)
  • crates/transaction/src/transaction.rs (2 hunks)
  • crates/wallet/sdk/src/apis/confidential_transfer.rs (1 hunks)
  • integration_tests/Cargo.toml (2 hunks)
  • integration_tests/src/base_node.rs (1 hunks)
  • integration_tests/src/indexer.rs (4 hunks)
  • integration_tests/src/lib.rs (8 hunks)
  • integration_tests/src/miner.rs (2 hunks)
  • integration_tests/src/template.rs (1 hunks)
  • integration_tests/src/templates/fees/Cargo.toml (1 hunks)
  • integration_tests/src/templates/fees/src/lib.rs (1 hunks)
  • integration_tests/src/util.rs (1 hunks)
  • integration_tests/src/validator_node.rs (7 hunks)
  • integration_tests/src/validator_node_cli.rs (3 hunks)
  • integration_tests/src/wallet.rs (4 hunks)
  • integration_tests/src/wallet_daemon.rs (2 hunks)
  • integration_tests/src/wallet_daemon_client.rs (18 hunks)
  • integration_tests/tests/cucumber.rs (15 hunks)
  • integration_tests/tests/features/claim_burn.feature (2 hunks)
  • integration_tests/tests/features/claim_fees.feature (2 hunks)
  • integration_tests/tests/features/committee.feature (1 hunks)
  • integration_tests/tests/features/concurrency.feature (1 hunks)
  • integration_tests/tests/features/counter.feature (2 hunks)
  • integration_tests/tests/features/epoch_change.feature (2 hunks)
  • integration_tests/tests/features/eviction.feature (1 hunks)
  • integration_tests/tests/features/fungible.feature (1 hunks)
  • integration_tests/tests/features/indexer.feature (4 hunks)
⛔ Files not processed due to max files limit (20)
  • integration_tests/tests/features/leader_failure.feature
  • integration_tests/tests/features/leader_failure.feature.ignore
  • integration_tests/tests/features/nft.feature
  • integration_tests/tests/features/state_sync.feature
  • integration_tests/tests/features/substates.feature
  • integration_tests/tests/features/transfer.feature
  • integration_tests/tests/features/wallet_daemon.feature
  • integration_tests/tests/steps/indexer.rs
  • integration_tests/tests/steps/miner.rs
  • integration_tests/tests/steps/mod.rs
  • integration_tests/tests/steps/network.rs
  • integration_tests/tests/steps/network/mod.rs
  • integration_tests/tests/steps/network/spec.rs
  • integration_tests/tests/steps/network/step.rs
  • integration_tests/tests/steps/outputs.rs
  • integration_tests/tests/steps/validator_node.rs
  • integration_tests/tests/steps/wallet.rs
  • integration_tests/tests/steps/wallet_daemon.rs
  • networking/core/src/error.rs
  • networking/swarm/src/config.rs

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.

❤️ Share
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 15

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
applications/tari_watcher/src/monitoring.rs (1)

17-26: Fields should be public or use getters.

The struct fields id and block are currently private, but they are accessed directly in lines 122, 222, and 230 (e.g., tx.id, tx.block). This will cause compilation errors.

Apply this diff to make the fields public:

 pub struct TransactionRefInBlock {
-    id: u64,
-    block: u64,
+    pub id: u64,
+    pub block: u64,
 }

Alternatively, if you prefer to keep fields private, add getter methods:

 impl TransactionRefInBlock {
     pub fn new(id: u64, block: u64) -> Self {
         Self { id, block }
     }
+
+    pub fn id(&self) -> u64 {
+        self.id
+    }
+
+    pub fn block(&self) -> u64 {
+        self.block
+    }
 }

And update the access sites to use tx.id() and tx.block().

integration_tests/src/wallet_daemon_client.rs (1)

101-197: Remove commented-out code block.

The large commented-out section (lines 134-172) should be deleted rather than left in the codebase. If this code might be needed for reference, move it to version control history or documentation.

Apply this diff to remove the dead code:

     .await
     .unwrap();
 
-    // let signing_key_index = account.key_index;
-    //
-    //
-    // let resource_address = STEALTH_TARI_RESOURCE_ADDRESS;
-    //
-    // let create_transfer_proof_req = ProofsGenerateRequest {
-    //     account: Some(source_account_name),
-    //     amount: amount.into(),
-    //     reveal_amount: Amount::zero(),
-    //     resource_address,
-    //     destination_public_key,
-    // };
-    //
-    // let transfer_proof_resp = client.create_transfer_proof(create_transfer_proof_req).await.unwrap();
-    // let withdraw_proof = transfer_proof_resp.proof;
-    // let proof_id = transfer_proof_resp.proof_id;
-    //
-    // let transaction = transaction_builder()
-    //     .fee_transaction_pay_from_component(source_component_address, 5000)
-    //     .call_method(source_component_address, "withdraw_confidential", args![
-    //         resource_address,
-    //         withdraw_proof
-    //     ])
-    //     .put_last_instruction_output_on_workspace("bucket")
-    //     .call_method(destination_account, "deposit", args![Workspace("bucket")])
-    //     .with_min_epoch(min_epoch)
-    //     .with_max_epoch(max_epoch)
-    //     .build_unsigned_transaction();
-    //
-    // let submit_req = TransactionSubmitRequest {
-    //     transaction,
-    //     signing_key_index: Some(signing_key_index),
-    //     proof_ids: vec![proof_id],
-    //     detect_inputs: true,
-    //     detect_inputs_use_unversioned: true,
-    // };
-    //
-    // let submit_resp = client.submit_transaction(submit_req).await.unwrap();
-    //
     let wait_req = TransactionWaitResultRequest {
crates/engine/tests/templates/composability/src/lib.rs (1)

23-23: Add Bytes to the template prelude
The Bytes type used in crates/engine/tests/templates/composability/src/lib.rs isn’t currently re-exported by tari_template_lib::prelude. In crates/template_lib/src/prelude.rs, add a line such as:

pub use crate::bytes::Bytes;

so template authors can use tari_template_lib::prelude::* to access Bytes.

integration_tests/tests/features/indexer.feature (1)

59-68: Inconsistent naming: IDX vs INDEXER.

This scenario uses IDX (line 64, 67) while other scenarios use INDEXER. Additionally, it uses the old initialization pattern (base node + indexer) instead of the new network setup pattern used elsewhere in this file.

Consider updating this scenario to match the pattern used in other scenarios:

   Scenario: Indexer GraphQL requests work
-    # Initialize a base node, wallet, miner and VN
-    Given a base node BASE
-
-    # Initialize an indexer
-    Given an indexer IDX connected to base node BASE
+    Given a network with registered validator VN and wallet daemon WALLET_D
 
     # Check GraphQL request
-    Then IDX indexer GraphQL request works
+    Then INDEXER indexer GraphQL request works
♻️ Duplicate comments (1)
applications/tari_walletd/src/handlers/accounts.rs (1)

883-886: Same pattern: dry_run result discarded.

As with handle_transfer (lines 815-819), the dry_run execution result is ignored here. This is consistent across handlers but prevents clients from validating transactions before submission. See earlier comment for verification request.

🧹 Nitpick comments (19)
integration_tests/tests/features/substates.feature (1)

26-26: Minor typo in comment.

The comment contains "thas" which should be "that": "the same component version that has already been downed".

Apply this diff:

-    # We should get an error if we se as inputs the same component version thas has already been downed from previous transactions
+    # We should get an error if we use as inputs the same component version that has already been downed from previous transactions

Note: Also corrected "se" → "use" for clarity.

integration_tests/tests/features/claim_fees.feature (1)

40-50: Consider extracting common network spec to Background.

The network spec (lines 40-50) is identical to the first scenario (lines 9-19). In Gherkin, you can use a Background section to avoid duplication and ensure consistency across scenarios.

Consider refactoring to:

@claim_fees
Feature: Claim Fees

  Background:
    Given a network with spec
    """
    validators:
      - name: VN
        fee_claim_account: VN_FEES
    walletds:
      - name: WALLET_D
        with_account: VN_FEES
    indexer:
      name: IDX
    """

  @serial @fixed
  Scenario: Claim validator fees
    # Run some transactions to generate fees
    ...

  @serial
  Scenario: Prevent double claim of validator fees
    # Run some transactions to generate fees
    ...
applications/tari_wallet_cli/src/command/transaction.rs (1)

448-448: Consider displaying refunded fee amount for consistency.

The handle_send function displays both the total fee and refunded amount (lines 398-402), but handle_confidential_transfer only shows the total fee. For consistency and better user experience, consider showing the refund information here as well.

Apply this diff to add refund information:

     println!("Transaction: {}", resp.transaction_id);
-    println!("Fee: {}", resp.final_fee);
+    println!(
+        "Fee: {} ({} refunded)",
+        resp.final_fee,
+        result.fee_receipt.total_refunded()
+    );
     println!();
     summarize_finalize_result(&result);
applications/tari_walletd/src/handlers/validator.rs (1)

135-169: Fee building refactor is correct; consider the optimization noted in TODOs.

The two-phase bucket handling (collect via workspace, then deposit each separately) is logically sound and handles the account creation case properly. However, as noted in the TODO comments:

  • Lines 161-164 highlight that depositing buckets individually increases gas costs. The suggested improvement—collecting all buckets and depositing once—would be more efficient.
  • Lines 140-145 note that making create_account idempotent or auto-adding inputs from instructions could simplify the conditional logic.

Consider prioritizing the workspace bucket collection improvement to reduce transaction gas costs, especially for users claiming fees from many shards.

integration_tests/tests/features/leader_failure.feature (3)

1-3: Consider updating the copyright year.

This is a new file created in 2025, but the copyright year is 2022. Update the year to 2025 to reflect the actual creation date.

Apply this diff:

-# Copyright 2022 The Tari Project
+# Copyright 2025 The Tari Project
 # SPDX-License-Identifier: BSD-3-Clause

21-21: Use "When" instead of "Then" for the stop action.

Line 21 performs an action (stopping VN4) rather than asserting an outcome. In Gherkin, "When" is the conventional keyword for actions, while "Then" is reserved for assertions and outcomes.

Apply this diff:

-    Then I stop validator node VN4
+    When I stop validator node VN4

28-54: Document the reason for ignoring this scenario.

The second scenario is marked with @ignore, which disables it. Consider adding a comment explaining why it's ignored (e.g., resource constraints, known RocksDB "too many open files" issue mentioned in the PR objectives, or a specific ticket number).

This will help maintainers understand when the test can be re-enabled. For example:

  # Ignored due to RocksDB file descriptor limits in CI (see issue #XXXX)
  @serial @ignore
  Scenario: Leader failure with multiple committees

Also note the inconsistency: this scenario correctly uses "When" for the stop action (line 49), while the first scenario uses "Then" (line 21). Applying the suggested fix to line 21 will resolve this inconsistency.

applications/tari_indexer/src/graphql/model/events.rs (1)

71-74: Consider removing trailing punctuation.

The log message has a trailing comma and space after the last parameter. While not incorrect, it's inconsistent with typical log formatting.

Apply this diff to clean up the formatting:

-            "Querying events. topic: {}, substate_id: {}, offset: {}, limit: {}, ", topic.display(), substate_id.display(), offset.display(), limit.display(),
+            "Querying events. topic: {}, substate_id: {}, offset: {}, limit: {}", topic.display(), substate_id.display(), offset.display(), limit.display()
crates/common_types/src/shard_state_versions.rs (1)

80-91: Add documentation and consider validation.

The logic correctly maps indices to shards (global at 0, then shard_group.start() + offset). However, the method lacks documentation and doesn't validate that the provided shard_group matches the internal structure.

Consider these improvements:

  1. Add documentation explaining the preconditions:
+    /// Converts the internal state versions into a map from shard to state version.
+    ///
+    /// # Arguments
+    /// * `shard_group` - The shard group that was used to construct this ShardStateVersions.
+    ///                   Must match the original shard group or the mapping will be incorrect.
+    ///
+    /// # Returns
+    /// An IndexMap where index 0 maps to the global shard, and subsequent indices map to
+    /// shards starting from shard_group.start().
     pub fn convert_to_map(&self, shard_group: ShardGroup) -> IndexMap<Shard, StateVersion> {
  1. Add validation (optional but recommended):
pub fn convert_to_map(&self, shard_group: ShardGroup) -> IndexMap<Shard, StateVersion> {
    // Validate that the length matches expected structure
    let expected_len = shard_group.len() + 1; // +1 for global shard
    if self.len() != expected_len {
        panic!(
            "Length mismatch: ShardStateVersions has {} elements but shard_group expects {}",
            self.len(),
            expected_len
        );
    }
    
    let mut map = IndexMap::with_capacity(self.len());
    // ... rest of implementation
}

This validation would catch mismatches between the shard group and internal state, preventing silent data corruption.

integration_tests/tests/features/fungible.feature (1)

12-12: Document scenario-specific XTR funding amounts.
Extract the varied funding values into shared constants or add inline comments explaining why simple tests use 1–2 XTR while committee/transfer/NFT scenarios require 2 000 000 XTR.

crates/engine/tests/test.rs (1)

152-167: Consider removing or documenting the commented debug code.

The commented-out ABI-printing block serves as a development utility but adds clutter to the test file. Consider either:

  • Removing it if it's no longer needed
  • Moving it to a separate developer utilities module
  • Adding a brief comment explaining when/why developers would uncomment it
crates/engine/src/wasm/process.rs (1)

258-261: Verify eprintln usage for production.

The improved error handling with EngineArgDecodeFailed is good, but using eprintln! for decoding errors may not be appropriate for production. In a WASM/engine context, stderr might not be captured or monitored.

Consider using the structured log::error! macro (already available via use log::*;) for consistency with the rest of the codebase.

Apply this diff to use structured logging:

-        let decoded = decode_exact(&args).map_err(|e| {
-            eprintln!("Failed to decode args: {}", e);
-            WasmExecutionError::EngineArgDecodeFailed(e)
-        })?;
+        let decoded = decode_exact(&args).map_err(|e| {
+            log::error!(target: LOG_TARGET, "Failed to decode engine args: {}", e);
+            WasmExecutionError::EngineArgDecodeFailed(e)
+        })?;
crates/engine/tests/templates/limits/src/lib.rs (1)

1-23: LGTM! Clean test template for Bytes validation.

The template structure correctly uses the new Bytes type and follows tari_template_lib conventions. The implementation is appropriately minimal for testing large payload handling.

Optional: Consider adding a getter method.

If test scenarios need to verify the stored data, you might want to add a getter:

     pub fn set_data(&mut self, data: Bytes) {
         self.data = data;
     }
+
+    pub fn get_data(&self) -> &Bytes {
+        &self.data
+    }
crates/engine/tests/limits.rs (1)

37-37: TODO: add tests for other engine limits.

The comment notes missing test coverage for other limits (e.g., max memory pages, recursion depth). Consider creating tests for these limits in a follow-up to ensure comprehensive validation of engine safety guardrails.

Would you like me to generate a test scaffold for memory and recursion limits, or open an issue to track this task?

crates/engine_types/src/limits.rs (1)

26-36: Consider documenting the distinction between max_call_size and max_internal_call_size.

Both limits are set to 1 MiB. While having separate limits for external and internal calls provides flexibility, a brief comment explaining when each limit applies would improve maintainability.

Consider adding documentation:

 pub struct EngineLimits {
     pub max_substate_outputs: usize,
     pub max_substate_size: usize,
+    /// Maximum size for external/public API calls
     pub max_call_size: usize,
+    /// Maximum size for internal engine calls
     pub max_internal_call_size: usize,
     pub max_logs: usize,
integration_tests/tests/features/state_sync.feature (1)

31-32: Remove or restore commented-out wait patterns.

The commented wait steps suggest uncertainty about the correct synchronization approach. Either restore them if needed for test stability, or remove them to keep the test clean.

If these waits are no longer needed, apply this diff:

-#    When I wait for validator VN has leaf block height of at least 1 at epoch 4
-#    When I wait for validator VN2 has leaf block height of at least 1 at epoch 4
-
integration_tests/tests/steps/indexer.rs (1)

222-298: Clarify epoch sync target (prev_epoch) and document is_none_or predicate

  • prev_epoch = epoch.checked_sub(Epoch(1)) intentionally targets N−1; switch to epoch if you need indexer to reach the current epoch.
  • .is_none_or(|sv| sv > v) on Option<&StateVersion> correctly pauses when a shard is missing or the validator’s version is ahead; consider adding an inline comment (and ensure the OptionExt trait is in scope) for future readers.
crates/template_lib_types/src/bytes.rs (1)

17-21: Optional: Consider removing redundant from_vec in favor of From trait.

The from_vec method duplicates functionality provided by the From<Vec<u8>> trait (lines 37-41). While not harmful, users can simply use Bytes::from(vec) or vec.into(). Consider removing from_vec to reduce API surface, or keep it if explicit construction is preferred for ergonomics.

crates/engine_types/src/serde_with/hex.rs (1)

133-140: Consider adding a test for non-human-readable serialization.

The current test only covers the human-readable (JSON/hex) path. Since the PR's main goal is to optimize byte buffer serialization in non-human-readable formats (CBOR), consider adding a test using a binary format like ciborium or bincode to verify the optimization.

Add a test for binary serialization:

#[test]
fn test_serialize_binary() {
    let data = TestCase {
        fixed: [1; 32],
        vec: vec![5; 100],
    };
    // Using ciborium for CBOR serialization
    let mut serialized = Vec::new();
    ciborium::ser::into_writer(&data, &mut serialized).unwrap();
    let deserialized: TestCase = ciborium::de::from_reader(&serialized[..]).unwrap();
    assert_eq!(data.fixed, deserialized.fixed);
    assert_eq!(data.vec, deserialized.vec);
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3873c11 and cb401cc.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (107)
  • Cargo.toml (1 hunks)
  • applications/tari_app_utilities/config_presets/d_indexer.toml (1 hunks)
  • applications/tari_indexer/src/bootstrap.rs (1 hunks)
  • applications/tari_indexer/src/config.rs (2 hunks)
  • applications/tari_indexer/src/graphql/model/events.rs (2 hunks)
  • applications/tari_indexer/src/json_rpc/error.rs (1 hunks)
  • applications/tari_indexer/src/json_rpc/handlers.rs (3 hunks)
  • applications/tari_indexer/src/json_rpc/server.rs (2 hunks)
  • applications/tari_indexer/src/lib.rs (1 hunks)
  • applications/tari_indexer/src/network_state_sync/committee_client.rs (1 hunks)
  • applications/tari_indexer/src/network_state_sync/mod.rs (1 hunks)
  • applications/tari_indexer/src/network_state_sync/worker.rs (2 hunks)
  • applications/tari_indexer/src/substate_manager.rs (3 hunks)
  • applications/tari_validator_node/src/genesis_state.rs (1 hunks)
  • applications/tari_validator_node/src/json_rpc/handlers.rs (6 hunks)
  • applications/tari_validator_node/src/json_rpc/jrpc_errors.rs (1 hunks)
  • applications/tari_validator_node_cli/src/command/transaction.rs (2 hunks)
  • applications/tari_wallet_cli/src/command/transaction.rs (2 hunks)
  • applications/tari_walletd/src/handlers/accounts.rs (3 hunks)
  • applications/tari_walletd/src/handlers/helpers.rs (1 hunks)
  • applications/tari_walletd/src/handlers/validator.rs (3 hunks)
  • applications/tari_watcher/src/manager.rs (3 hunks)
  • applications/tari_watcher/src/monitoring.rs (2 hunks)
  • bindings/src/types/validator-node-client/GetConsensusStatusResponse.ts (1 hunks)
  • bindings/src/types/wallet-daemon-client/AccountsTransferResponse.ts (1 hunks)
  • bindings/src/types/wallet-daemon-client/ConfidentialTransferResponse.ts (1 hunks)
  • bindings/src/types/wallet-daemon-client/WalletSubstateInfo.ts (1 hunks)
  • clients/tari_indexer_client/src/json_rpc_client.rs (2 hunks)
  • clients/tari_indexer_client/src/types.rs (2 hunks)
  • clients/validator_node_client/Cargo.toml (1 hunks)
  • clients/validator_node_client/src/types.rs (3 hunks)
  • clients/wallet_daemon_client/src/types.rs (0 hunks)
  • crates/common_types/src/shard_state_versions.rs (2 hunks)
  • crates/consensus/src/hotstuff/state_machine/state.rs (4 hunks)
  • crates/engine/src/runtime/engine_args.rs (2 hunks)
  • crates/engine/src/runtime/impl.rs (3 hunks)
  • crates/engine/src/runtime/mod.rs (0 hunks)
  • crates/engine/src/wasm/compile.rs (2 hunks)
  • crates/engine/src/wasm/environment.rs (1 hunks)
  • crates/engine/src/wasm/error.rs (3 hunks)
  • crates/engine/src/wasm/module.rs (4 hunks)
  • crates/engine/src/wasm/process.rs (3 hunks)
  • crates/engine/tests/limits.rs (1 hunks)
  • crates/engine/tests/templates/buggy/Cargo.toml (1 hunks)
  • crates/engine/tests/templates/buggy/src/lib.rs (1 hunks)
  • crates/engine/tests/templates/composability/src/lib.rs (1 hunks)
  • crates/engine/tests/templates/limits/Cargo.toml (1 hunks)
  • crates/engine/tests/templates/limits/src/lib.rs (1 hunks)
  • crates/engine/tests/test.rs (2 hunks)
  • crates/engine_types/src/commit_result.rs (3 hunks)
  • crates/engine_types/src/indexed_value.rs (0 hunks)
  • crates/engine_types/src/limits.rs (1 hunks)
  • crates/engine_types/src/serde_with/hex.rs (3 hunks)
  • crates/p2p/src/conversions/transaction.rs (2 hunks)
  • crates/template_abi/Cargo.toml (1 hunks)
  • crates/template_abi/src/abi/mod.rs (1 hunks)
  • crates/template_abi/src/version.rs (1 hunks)
  • crates/template_lib/Cargo.toml (1 hunks)
  • crates/template_lib/src/args/mod.rs (1 hunks)
  • crates/template_lib/src/args/types.rs (11 hunks)
  • crates/template_lib/src/component/manager.rs (3 hunks)
  • crates/template_lib/src/prelude.rs (1 hunks)
  • crates/template_lib/src/template/manager.rs (3 hunks)
  • crates/template_lib_types/Cargo.toml (1 hunks)
  • crates/template_lib_types/src/bytes.rs (1 hunks)
  • crates/template_lib_types/src/engine_args.rs (2 hunks)
  • crates/template_lib_types/src/lib.rs (1 hunks)
  • crates/template_lib_types/src/serde_helpers.rs (5 hunks)
  • crates/template_macros/Cargo.toml (1 hunks)
  • crates/template_test_tooling/src/builtin_component_state.rs (2 hunks)
  • crates/transaction/src/args.rs (4 hunks)
  • crates/transaction/src/builder/mod.rs (1 hunks)
  • crates/transaction/src/special_json_arg_syntax.rs (1 hunks)
  • crates/transaction/src/transaction.rs (2 hunks)
  • crates/wallet/sdk/src/apis/confidential_transfer.rs (1 hunks)
  • integration_tests/Cargo.toml (2 hunks)
  • integration_tests/src/base_node.rs (1 hunks)
  • integration_tests/src/indexer.rs (4 hunks)
  • integration_tests/src/lib.rs (8 hunks)
  • integration_tests/src/miner.rs (2 hunks)
  • integration_tests/src/template.rs (1 hunks)
  • integration_tests/src/templates/fees/Cargo.toml (1 hunks)
  • integration_tests/src/templates/fees/src/lib.rs (1 hunks)
  • integration_tests/src/util.rs (1 hunks)
  • integration_tests/src/validator_node.rs (7 hunks)
  • integration_tests/src/validator_node_cli.rs (3 hunks)
  • integration_tests/src/wallet.rs (4 hunks)
  • integration_tests/src/wallet_daemon.rs (2 hunks)
  • integration_tests/src/wallet_daemon_client.rs (18 hunks)
  • integration_tests/tests/cucumber.rs (15 hunks)
  • integration_tests/tests/features/claim_burn.feature (2 hunks)
  • integration_tests/tests/features/claim_fees.feature (2 hunks)
  • integration_tests/tests/features/committee.feature (1 hunks)
  • integration_tests/tests/features/concurrency.feature (1 hunks)
  • integration_tests/tests/features/counter.feature (2 hunks)
  • integration_tests/tests/features/epoch_change.feature (2 hunks)
  • integration_tests/tests/features/eviction.feature (1 hunks)
  • integration_tests/tests/features/fungible.feature (1 hunks)
  • integration_tests/tests/features/indexer.feature (4 hunks)
  • integration_tests/tests/features/leader_failure.feature (1 hunks)
  • integration_tests/tests/features/leader_failure.feature.ignore (0 hunks)
  • integration_tests/tests/features/nft.feature (3 hunks)
  • integration_tests/tests/features/state_sync.feature (1 hunks)
  • integration_tests/tests/features/substates.feature (1 hunks)
  • integration_tests/tests/features/transfer.feature (1 hunks)
  • integration_tests/tests/features/wallet_daemon.feature (2 hunks)
  • integration_tests/tests/steps/indexer.rs (5 hunks)
⛔ Files not processed due to max files limit (12)
  • integration_tests/tests/steps/miner.rs
  • integration_tests/tests/steps/mod.rs
  • integration_tests/tests/steps/network.rs
  • integration_tests/tests/steps/network/mod.rs
  • integration_tests/tests/steps/network/spec.rs
  • integration_tests/tests/steps/network/step.rs
  • integration_tests/tests/steps/outputs.rs
  • integration_tests/tests/steps/validator_node.rs
  • integration_tests/tests/steps/wallet.rs
  • integration_tests/tests/steps/wallet_daemon.rs
  • networking/core/src/error.rs
  • networking/swarm/src/config.rs
💤 Files with no reviewable changes (4)
  • integration_tests/tests/features/leader_failure.feature.ignore
  • clients/wallet_daemon_client/src/types.rs
  • crates/engine_types/src/indexed_value.rs
  • crates/engine/src/runtime/mod.rs
🧰 Additional context used
🧬 Code graph analysis (42)
crates/transaction/src/args.rs (2)
bindings/src/types/InstructionArg.ts (1)
  • InstructionArg (7-7)
crates/tari_bor/src/lib.rs (1)
  • decode_exact (123-132)
applications/tari_validator_node_cli/src/command/transaction.rs (2)
bindings/src/types/InstructionArg.ts (1)
  • InstructionArg (7-7)
crates/transaction/src/args.rs (1)
  • raw_literal_bytes (85-87)
integration_tests/src/miner.rs (1)
integration_tests/src/util.rs (1)
  • cucumber_log (12-17)
applications/tari_watcher/src/manager.rs (1)
applications/tari_watcher/src/monitoring.rs (3)
  • process_status_alert (163-239)
  • process_status_log (97-128)
  • new (23-25)
crates/transaction/src/special_json_arg_syntax.rs (1)
bindings/src/types/InstructionArg.ts (1)
  • InstructionArg (7-7)
applications/tari_indexer/src/json_rpc/handlers.rs (2)
clients/tari_indexer_client/src/json_rpc_client.rs (1)
  • get_network_sync_state (170-172)
applications/tari_indexer/src/json_rpc/error.rs (1)
  • internal_error (13-26)
applications/tari_validator_node/src/genesis_state.rs (1)
bindings/src/types/Metadata.ts (1)
  • Metadata (6-6)
crates/template_test_tooling/src/builtin_component_state.rs (1)
crates/engine_types/src/resource.rs (1)
  • metadata (203-205)
crates/engine/src/wasm/process.rs (1)
crates/tari_bor/src/lib.rs (1)
  • decode_exact (123-132)
integration_tests/src/util.rs (1)
utilities/tariswap_test_bench/src/timer.rs (1)
  • info (32-34)
integration_tests/src/indexer.rs (3)
integration_tests/src/helpers.rs (4)
  • check_join_handle (104-123)
  • get_address_from_output (125-139)
  • get_os_assigned_ports (21-23)
  • wait_listener_on_local_port (55-102)
integration_tests/src/logging.rs (1)
  • get_base_dir_for_scenario (32-42)
integration_tests/src/util.rs (1)
  • cucumber_log (12-17)
bindings/src/types/wallet-daemon-client/AccountsTransferResponse.ts (1)
bindings/src/types/TransactionId.ts (1)
  • TransactionId (3-3)
applications/tari_wallet_cli/src/command/transaction.rs (3)
bindings/src/types/wallet-daemon-client/TransactionWaitResultRequest.ts (1)
  • TransactionWaitResultRequest (4-4)
crates/engine_types/src/fees.rs (1)
  • total_refunded (34-38)
applications/tari_validator_node_cli/src/command/transaction.rs (1)
  • summarize_finalize_result (428-512)
crates/engine_types/src/commit_result.rs (1)
bindings/src/types/SubstateDiff.ts (1)
  • SubstateDiff (6-10)
integration_tests/src/validator_node.rs (4)
integration_tests/src/util.rs (1)
  • cucumber_log (12-17)
integration_tests/src/helpers.rs (2)
  • get_os_assigned_ports (21-23)
  • get_os_assigned_port (16-19)
integration_tests/tests/cucumber.rs (3)
  • world (316-316)
  • world (523-523)
  • world (629-638)
integration_tests/tests/steps/validator_node.rs (2)
  • world (104-113)
  • world (457-461)
applications/tari_walletd/src/handlers/accounts.rs (3)
bindings/src/types/wallet-daemon-client/AccountsTransferResponse.ts (1)
  • AccountsTransferResponse (4-4)
applications/tari_walletd/src/handlers/context.rs (2)
  • transaction_service (85-87)
  • notifier (55-57)
bindings/src/types/wallet-daemon-client/ConfidentialTransferResponse.ts (1)
  • ConfidentialTransferResponse (4-4)
crates/wallet/sdk/src/apis/confidential_transfer.rs (4)
crates/engine_types/src/resource_container.rs (2)
  • resource_address (176-183)
  • resource_type (185-192)
crates/engine_types/src/vault.rs (2)
  • resource_address (122-124)
  • resource_type (126-128)
crates/template_lib/src/models/vault.rs (3)
  • resource_address (138-143)
  • resource_address (348-357)
  • resource_type (360-362)
crates/engine_types/src/resource.rs (1)
  • resource_type (107-109)
integration_tests/tests/cucumber.rs (5)
integration_tests/src/wallet.rs (1)
  • spawn_minotari_wallet (116-225)
integration_tests/src/wallet_daemon.rs (1)
  • spawn_wallet_daemon (70-113)
integration_tests/src/validator_node_cli.rs (1)
  • create_component (20-65)
integration_tests/src/wallet_daemon_client.rs (4)
  • call_component (695-763)
  • concurrent_call_component (765-819)
  • submit_manifest (477-560)
  • submit_manifest_with_signing_keys (391-475)
clients/wallet_daemon_client/src/lib.rs (1)
  • list_account_nfts (413-418)
crates/transaction/src/builder/mod.rs (1)
bindings/src/types/InstructionArg.ts (1)
  • InstructionArg (7-7)
integration_tests/src/lib.rs (3)
bindings/src/types/SubstateRequirement.ts (1)
  • SubstateRequirement (3-3)
bindings/src/types/AccountWithAddress.ts (1)
  • AccountWithAddress (5-5)
crates/consensus/src/consensus_constants.rs (1)
  • devnet (53-69)
bindings/src/types/wallet-daemon-client/ConfidentialTransferResponse.ts (1)
bindings/src/types/TransactionId.ts (1)
  • TransactionId (3-3)
integration_tests/src/validator_node_cli.rs (3)
bindings/src/helpers/consts.ts (1)
  • ACCOUNT_TEMPLATE_ADDRESS (6-6)
crates/engine_types/src/substate.rs (1)
  • component (590-595)
crates/engine_types/src/resource.rs (1)
  • token_symbol (207-209)
clients/tari_indexer_client/src/types.rs (5)
bindings/src/types/Shard.ts (1)
  • Shard (3-3)
bindings/src/types/SubstateType.ts (1)
  • SubstateType (3-12)
bindings/src/types/Epoch.ts (1)
  • Epoch (3-3)
bindings/src/types/NumPreshards.ts (1)
  • NumPreshards (3-3)
bindings/src/types/ShardGroup.ts (1)
  • ShardGroup (4-4)
integration_tests/src/template.rs (1)
integration_tests/src/wallet_daemon_client.rs (1)
  • get_auth_wallet_daemon_client (904-906)
bindings/src/types/validator-node-client/GetConsensusStatusResponse.ts (1)
bindings/src/types/Shard.ts (1)
  • Shard (3-3)
integration_tests/src/wallet_daemon.rs (1)
integration_tests/src/util.rs (1)
  • cucumber_log (12-17)
integration_tests/tests/steps/indexer.rs (3)
integration_tests/src/indexer.rs (1)
  • spawn_indexer (129-205)
integration_tests/src/util.rs (1)
  • cucumber_log (12-17)
bindings/src/types/Epoch.ts (1)
  • Epoch (3-3)
clients/validator_node_client/src/types.rs (1)
bindings/src/types/Shard.ts (1)
  • Shard (3-3)
clients/tari_indexer_client/src/json_rpc_client.rs (1)
applications/tari_indexer/src/json_rpc/handlers.rs (1)
  • get_network_sync_state (701-731)
crates/engine/src/wasm/module.rs (3)
bindings/src/types/FunctionDef.ts (1)
  • FunctionDef (5-5)
bindings/src/types/TemplateDef.ts (1)
  • TemplateDef (4-4)
crates/template_macros/src/template/abi.rs (2)
  • func (50-54)
  • tuple (190-201)
integration_tests/src/base_node.rs (1)
integration_tests/src/util.rs (1)
  • cucumber_log (12-17)
integration_tests/src/wallet.rs (1)
integration_tests/src/util.rs (1)
  • cucumber_log (12-17)
applications/tari_indexer/src/substate_manager.rs (2)
applications/tari_indexer/src/bootstrap.rs (1)
  • tx (345-345)
applications/tari_indexer/src/network_state_sync/worker.rs (1)
  • tx (154-154)
crates/engine/src/wasm/compile.rs (1)
applications/tari_swarm_daemon/src/process_manager/instances/instance.rs (1)
  • envs (76-78)
applications/tari_validator_node/src/json_rpc/handlers.rs (2)
applications/tari_validator_node/src/json_rpc/jrpc_errors.rs (2)
  • internal_error (47-60)
  • not_found (62-71)
bindings/src/types/validator-node-client/GetConsensusStatusResponse.ts (1)
  • GetConsensusStatusResponse (7-12)
bindings/src/types/wallet-daemon-client/WalletSubstateInfo.ts (2)
bindings/src/types/SubstateId.ts (1)
  • SubstateId (6-6)
bindings/src/types/Hash.ts (1)
  • Hash (6-6)
crates/p2p/src/conversions/transaction.rs (1)
crates/transaction/src/args.rs (1)
  • raw_literal_bytes (85-87)
crates/common_types/src/shard_state_versions.rs (2)
bindings/src/types/ShardGroup.ts (1)
  • ShardGroup (4-4)
crates/common_types/src/shard.rs (1)
  • global (29-31)
crates/engine/tests/limits.rs (1)
bindings/src/types/RejectReason.ts (1)
  • RejectReason (4-12)
crates/engine_types/src/serde_with/hex.rs (1)
crates/template_lib_types/src/crypto/range_proof.rs (1)
  • serde_helpers (67-67)
crates/template_abi/src/abi/mod.rs (1)
crates/engine/tests/templates/buggy/src/lib.rs (1)
  • tari_engine (58-58)
integration_tests/src/wallet_daemon_client.rs (8)
bindings/src/types/ResourceAddress.ts (1)
  • ResourceAddress (6-6)
integration_tests/src/validator_node_cli.rs (1)
  • add_outputs_from_diff (67-165)
bindings/src/types/Amount.ts (1)
  • Amount (12-12)
bindings/src/types/ConfidentialTransferInputSelection.ts (1)
  • ConfidentialTransferInputSelection (3-7)
bindings/src/types/AccountWithAddress.ts (1)
  • AccountWithAddress (5-5)
bindings/src/types/wallet-daemon-client/AccountsCreateRequest.ts (1)
  • AccountsCreateRequest (3-3)
bindings/src/types/wallet-daemon-client/AccountsCreateFreeTestCoinsRequest.ts (1)
  • AccountsCreateFreeTestCoinsRequest (5-9)
bindings/src/types/wallet-daemon-client/TransactionWaitResultRequest.ts (1)
  • TransactionWaitResultRequest (4-4)
⏰ 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: check nightly
  • GitHub Check: clippy
  • GitHub Check: test

Comment thread applications/tari_indexer/src/graphql/model/events.rs
Comment thread applications/tari_indexer/src/json_rpc/error.rs Outdated
Comment on lines +41 to 60
pub async fn new_session(&mut self) -> Result<ValidatorRpcSession, ValidatorCommitteeClientError> {
let epoch = self.epoch_manager.get_current_epoch();
let member = self
.epoch_manager
.get_random_committee_member(epoch, Some(self.shard_group), self.past_failed_nodes.clone())
.await?;
self.session_for_peer(member.address).await
loop {
let member = self
.epoch_manager
.get_random_committee_member(epoch, Some(self.shard_group), self.past_failed_nodes.clone())
.await?;
let result = self.session_for_peer(member.address).await;
match result {
Ok(session) => return Ok(session),
Err(err) => {
warn!(
target: LOG_TARGET,
"Failed to create session for validator '{}': {}", member, err
);
self.past_failed_nodes.push(member.address);
},
}
}
}

@coderabbitai coderabbitai Bot Sep 30, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Potential infinite loop risk in new_session retry logic.

The indefinite retry loop (lines 43-59) lacks a termination condition and could block forever if:

  1. All committee members fail repeatedly
  2. get_random_committee_member continues returning members despite all having failed
  3. No timeout is enforced at this layer

Additionally, past_failed_nodes accumulates across calls and is never cleared, which may exhaust the available pool over time.

Consider adopting the pattern from try_with_random_members (lines 91-99), which properly handles exhaustion:

 pub async fn new_session(&mut self) -> Result<ValidatorRpcSession, ValidatorCommitteeClientError> {
     let epoch = self.epoch_manager.get_current_epoch();
+    let mut attempted = vec![];
     loop {
-        let member = self
+        let Some(member) = self
             .epoch_manager
-            .get_random_committee_member(epoch, Some(self.shard_group), self.past_failed_nodes.clone())
-            .await?;
+            .get_random_committee_member(epoch, Some(self.shard_group), attempted.clone())
+            .await
+            .optional()?
+        else {
+            return Err(ValidatorCommitteeClientError::AllValidatorsFailed {
+                committee_size: attempted.len(),
+                last_error: Some("No more committee members available".to_string()),
+            });
+        };
+
         let result = self.session_for_peer(member.address).await;
         match result {
             Ok(session) => return Ok(session),
             Err(err) => {
                 warn!(
                     target: LOG_TARGET,
                     "Failed to create session for validator '{}': {}", member, err
                 );
-                self.past_failed_nodes.push(member.address);
+                attempted.push(member.address);
             },
         }
     }
 }

Verify the behavior of get_random_committee_member when the excluded list exhausts all committee members:


🏁 Script executed:

#!/bin/bash
# Description: Check how get_random_committee_member handles exhaustion of available members

# Search for the implementation of get_random_committee_member
ast-grep --pattern $'fn get_random_committee_member($$$) {
  $$$
}'

# Also check for Optional-related return handling
rg -nP -A10 'fn get_random_committee_member' --type rust

Length of output: 4828


Prevent unbounded retries and reset failure state in new_session
new_session currently loops forever on session_for_peer errors and never clears past_failed_nodes. Add a max retry limit (or timeout/backoff) to avoid infinite loops if all peers fail, and reset past_failed_nodes at the start of each call.

🤖 Prompt for AI Agents
In applications/tari_indexer/src/network_state_sync/committee_client.rs around
lines 41–60, new_session currently resets no state and may loop forever when
session_for_peer keeps failing; reset self.past_failed_nodes at the start of the
function and add a bounded retry policy (e.g. const MAX_ATTEMPTS = N) or a
timeout/backoff loop: clear past_failed_nodes, perform up to MAX_ATTEMPTS
attempts calling get_random_committee_member and session_for_peer, on each
failure push the failed address and await a short backoff (tokio::time::sleep
with exponential backoff) before retrying, and if attempts are exhausted return
a ValidatorCommitteeClientError indicating no available peers rather than
looping forever.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_random_committee_member will error if no member is found

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find the implementation of get_random_committee_member to verify error handling
ast-grep --pattern 'async fn get_random_committee_member($$$) -> $$$ {
  $$$
}'

Length of output: 4273


🏁 Script executed:

#!/bin/bash
# Search for how get_random_committee_member handles the case when no members are available
rg -nP -B3 -A15 'pub async fn get_random_committee_member' --type rust

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Check how past_failed_nodes is used elsewhere in the codebase
rg -nP 'past_failed_nodes' --type rust -C3

Length of output: 3757


@sdbondi, thank you for the clarification! You're absolutely right—the ? operator on line 47 will propagate the error from get_random_committee_member when no members are available, which prevents the infinite loop concern CodeRabbit raised.

Looking at the test implementation, when all validators are excluded, it returns:

EpochManagerError::StorageError(StorageError::NotFound {
    item: "validator_nodes",
    key: format!("in shard group {shard_group}"),
})

So the loop will terminate with an error rather than running forever.

One design note: past_failed_nodes accumulates across multiple new_session calls and is never cleared (unlike try_with_random_members which uses a local attempted vec). This appears intentional—to maintain a persistent failure list across the lifetime of the pool and avoid repeatedly trying nodes that have failed before. If this is the intended behavior, the current implementation is fine.

Comment thread applications/tari_wallet_cli/src/command/transaction.rs
Comment thread applications/tari_wallet_cli/src/command/transaction.rs
Comment thread crates/wallet/sdk/src/apis/confidential_transfer.rs
Comment thread integration_tests/src/templates/fees/Cargo.toml Outdated
Comment thread integration_tests/tests/features/claim_fees.feature
Comment thread integration_tests/tests/features/leader_failure.feature
Comment thread integration_tests/tests/features/substates.feature Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
applications/tari_walletd/web_ui/src/App.tsx (1)

282-289: Fix redirect target for Stealth UTXOs to include default resource_address
The GuardedRoute’s redirect currently points to /stealth-utxos—no matching route exists for the base path. Update it to:

import { XTR } from "@tari-project/typescript-bindings";

<GuardedRoute
  isAuthenticated={isAuthenticated}
  redirect={`/stealth-utxos/${XTR}`}
  component={StealthUtxoListPage}
/>

—or alternatively add a Route path="stealth-utxos" that redirects to the default segment.

🧹 Nitpick comments (2)
applications/tari_walletd/web_ui/src/components/Breadcrumbs.tsx (1)

45-46: Consider consistent text transformation approach.

The last breadcrumb applies toLowerCase() twice: once in the style transform and once on the label itself (line 46). Consider using only CSS text-transform: 'lowercase' for consistency with other breadcrumb items.

Apply this diff to rely solely on CSS transformation:

-        <span key={breadcrumbLabel} style={{ textTransform: "lowercase", fontWeight: "bold" }}>
-          {breadcrumbLabel.toLowerCase()}
+        <span key={breadcrumbLabel} style={{ textTransform: "lowercase", fontWeight: "bold" }}>
+          {breadcrumbLabel}
         </span>
applications/tari_walletd/web_ui/src/routes/StealthUtxoList/StealthUtxoList.tsx (1)

43-44: Handle missing balance data gracefully.

If balancesData is undefined or the resource isn't found in balances, currencySymbol becomes an empty string. While this prevents crashes, displaying currency values without a symbol (line 106) might confuse users.

Consider adding a fallback symbol or loading state:

-  const resourceBalance = balancesData?.balances?.find((balance) => balance.resource_address === resourceAddress);
-  const currencySymbol = resourceBalance ? resourceBalance.token_symbol || "" : "";
+  const resourceBalance = balancesData?.balances?.find((balance) => balance.resource_address === resourceAddress);
+  const currencySymbol = resourceBalance?.token_symbol || (resourceAddress === XTR ? "XTR" : "");
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cb401cc and 6dca897.

📒 Files selected for processing (4)
  • applications/tari_walletd/web_ui/src/App.tsx (2 hunks)
  • applications/tari_walletd/web_ui/src/components/Breadcrumbs.tsx (1 hunks)
  • applications/tari_walletd/web_ui/src/routes/AssetVault/Tokens/Tokens.tsx (1 hunks)
  • applications/tari_walletd/web_ui/src/routes/StealthUtxoList/StealthUtxoList.tsx (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
applications/tari_walletd/web_ui/src/routes/StealthUtxoList/StealthUtxoList.tsx (5)
bindings/src/types/Account.ts (1)
  • Account (4-10)
bindings/src/types/OutputStatus.ts (1)
  • OutputStatus (3-3)
applications/tari_walletd/web_ui/src/services/api/hooks/useAccounts.ts (1)
  • useAccountsGetBalances (263-277)
applications/tari_walletd/web_ui/src/utils/helpers.tsx (1)
  • substateIdToString (100-109)
bindings/src/helpers/consts.ts (1)
  • XTR (10-10)
⏰ 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). (6)
  • GitHub Check: test
  • GitHub Check: file licenses
  • GitHub Check: check nightly
  • GitHub Check: check stable
  • GitHub Check: clippy
  • GitHub Check: machete
🔇 Additional comments (5)
applications/tari_walletd/web_ui/src/routes/AssetVault/Tokens/Tokens.tsx (1)

114-120: LGTM! Navigation updated to use dynamic resource routing.

The change correctly passes resource_address as a route parameter, enabling resource-specific stealth UTXO views. This aligns with the dynamic routing pattern introduced in App.tsx.

applications/tari_walletd/web_ui/src/App.tsx (1)

126-129: LGTM! Breadcrumb route configuration updated for dynamic routing.

The breadcrumb route correctly reflects the new parameterized path with dynamic: true, enabling proper breadcrumb rendering for resource-specific stealth UTXO pages.

applications/tari_walletd/web_ui/src/routes/StealthUtxoList/StealthUtxoList.tsx (2)

40-41: LGTM! Route parameter handling with sensible default.

The component correctly reads resource_address from route parameters and defaults to XTR, providing a consistent user experience when accessing the route without a parameter.


59-63: LGTM! Clean integration with API hook.

The hook invocation correctly passes the route-derived resourceAddress and status filter, simplifying the component logic compared to the previous implementation.

applications/tari_walletd/web_ui/src/components/Breadcrumbs.tsx (1)

41-64: Use actual path for undefined breadcrumb segments
The fallback branch currently links any unmatched breadcrumb to “/”. Either ensure every route segment is covered by your breadcrumbRoutes so match.route is never undefined, or update the else‐case to use the actual segment path (e.g. to={match.pathname}) instead of hardcoding “/”.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
clients/tari_indexer_client/src/types.rs (1)

406-436: Fix duplicate TypeScript rename attribute causing type collisions.

Line 413 uses rename = "IndexerGetEpochManagerStatsResponse", which is the same rename already used by GetEpochManagerStatsResponse at line 308. This causes a TypeScript export name collision where both structs overwrite the same exported type.

Additionally, NetworkDescription (line 422) and SyncProgress (line 431) lack explicit rename attributes, resulting in inconsistent naming compared to other types in this file that use the "Indexer" prefix convention.

Apply this diff to fix the TypeScript rename attributes:

 #[derive(Debug, Clone, Serialize, Deserialize)]
 #[cfg_attr(
     feature = "ts",
     derive(ts_rs::TS),
     ts(
         export,
         export_to = "tari-indexer-client/",
-        rename = "IndexerGetEpochManagerStatsResponse"
+        rename = "IndexerGetNetworkSyncStateResponse"
     )
 )]
 pub struct GetNetworkSyncStateResponse {
     pub network_desc: NetworkDescription,
     pub sync_progress: Option<SyncProgress>,
 }

 #[derive(Debug, Clone, Serialize, Deserialize)]
-#[cfg_attr(feature = "ts", derive(ts_rs::TS), ts(export, export_to = "tari-indexer-client/"))]
+#[cfg_attr(
+    feature = "ts",
+    derive(ts_rs::TS),
+    ts(export, export_to = "tari-indexer-client/", rename = "IndexerNetworkDescription")
+)]
 pub struct NetworkDescription {
     pub epoch: Epoch,
     // (shard group, num members)
     pub shard_groups: Vec<(ShardGroup, u32)>,
     pub num_preshards: NumPreshards,
 }

 #[derive(Debug, Clone, Serialize, Deserialize)]
-#[cfg_attr(feature = "ts", derive(ts_rs::TS), ts(export, export_to = "tari-indexer-client/"))]
+#[cfg_attr(
+    feature = "ts",
+    derive(ts_rs::TS),
+    ts(export, export_to = "tari-indexer-client/", rename = "IndexerSyncProgress")
+)]
 pub struct SyncProgress {
     pub last_epoch: Epoch,
     pub checkpoint_progress: Vec<(ShardGroup, Epoch)>,
     pub last_state_versions: Vec<(Shard, (StateVersion, Epoch))>,
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6dca897 and 905a096.

📒 Files selected for processing (12)
  • applications/tari_indexer/src/graphql/model/events.rs (2 hunks)
  • applications/tari_indexer/src/json_rpc/error.rs (2 hunks)
  • applications/tari_indexer/src/json_rpc/handlers.rs (4 hunks)
  • applications/tari_validator_node/src/json_rpc/jrpc_errors.rs (2 hunks)
  • bindings/src/tari-indexer-client.ts (2 hunks)
  • bindings/src/types/tari-indexer-client/NetworkDescription.ts (1 hunks)
  • bindings/src/types/tari-indexer-client/SyncProgress.ts (1 hunks)
  • clients/tari_indexer_client/src/types.rs (2 hunks)
  • crates/wallet/sdk/src/apis/confidential_transfer.rs (1 hunks)
  • integration_tests/src/templates/fees/Cargo.toml (1 hunks)
  • integration_tests/tests/features/claim_fees.feature (2 hunks)
  • integration_tests/tests/features/substates.feature (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • integration_tests/src/templates/fees/Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (4)
  • applications/tari_validator_node/src/json_rpc/jrpc_errors.rs
  • crates/wallet/sdk/src/apis/confidential_transfer.rs
  • applications/tari_indexer/src/graphql/model/events.rs
  • applications/tari_indexer/src/json_rpc/error.rs
🧰 Additional context used
🧬 Code graph analysis (4)
bindings/src/types/tari-indexer-client/SyncProgress.ts (3)
bindings/src/types/Epoch.ts (1)
  • Epoch (3-3)
bindings/src/types/ShardGroup.ts (1)
  • ShardGroup (4-4)
bindings/src/types/Shard.ts (1)
  • Shard (3-3)
bindings/src/types/tari-indexer-client/NetworkDescription.ts (3)
bindings/src/types/Epoch.ts (1)
  • Epoch (3-3)
bindings/src/types/ShardGroup.ts (1)
  • ShardGroup (4-4)
bindings/src/types/NumPreshards.ts (1)
  • NumPreshards (3-3)
applications/tari_indexer/src/json_rpc/handlers.rs (4)
bindings/src/types/tari-indexer-client/NetworkDescription.ts (1)
  • NetworkDescription (6-10)
bindings/src/types/tari-indexer-client/SyncProgress.ts (1)
  • SyncProgress (7-11)
clients/tari_indexer_client/src/json_rpc_client.rs (1)
  • get_network_sync_state (170-172)
applications/tari_indexer/src/json_rpc/error.rs (1)
  • internal_error (13-29)
clients/tari_indexer_client/src/types.rs (6)
bindings/src/types/Shard.ts (1)
  • Shard (3-3)
bindings/src/types/Epoch.ts (1)
  • Epoch (3-3)
bindings/src/types/NumPreshards.ts (1)
  • NumPreshards (3-3)
bindings/src/types/ShardGroup.ts (1)
  • ShardGroup (4-4)
bindings/src/types/tari-indexer-client/NetworkDescription.ts (1)
  • NetworkDescription (6-10)
bindings/src/types/tari-indexer-client/SyncProgress.ts (1)
  • SyncProgress (7-11)
⏰ 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). (5)
  • GitHub Check: check nightly
  • GitHub Check: machete
  • GitHub Check: clippy
  • GitHub Check: test
  • GitHub Check: check stable
🔇 Additional comments (17)
integration_tests/tests/features/claim_fees.feature (10)

9-19: LGTM! Declarative network spec improves test maintainability.

The migration to a declarative network specification consolidates setup and makes the test more readable. The spec correctly defines the validator VN with fee_claim_account VN_FEES, wallet daemon WALLET_D with access to VN_FEES, and indexer IDX.


22-24: Fee generation setup is clear.

The test creates an account with 10 XTR, publishes a template, and runs up 550k in fees. This provides sufficient setup for the fee claim scenarios.


32-33: Past review comment addressed.

The comment has been updated from "Claim fees into ACC2" to "Claim fees into VN_FEES" to match the implementation.


30-30: Initial balance check ensures clean state.

Verifying that VN_FEES starts at exactly 0 before the claim establishes a known baseline for the subsequent balance assertions.


35-36: Conservative balance threshold reduces test brittleness.

Checking for "at least 500000" when 550000 fees were generated accounts for the claim transaction's own fee costs, making the test more robust.


38-38: Verify removal of @fixed tag.

The first scenario uses @serial @fixed while this scenario uses only @serial. Ensure the removal of the @fixed tag is intentional.


40-50: Network spec duplication is standard for independent scenarios.

Each Gherkin scenario should be independently executable, so duplicating the network spec is expected and correct.


62-62: Negative test ensures claim authorization.

Testing that claiming fees with the wrong account (ACC1) fails correctly validates the authorization logic.


64-69: Higher balance threshold appropriate for double-claim test.

This scenario checks for "at least 550000" compared to the first scenario's "at least 500000". The stricter threshold is appropriate here because this test is specifically verifying the exact behavior of double claims, and the comment correctly notes the actual fees are "just over 600k".


71-73: Second claim logic correctly validates fee-from-fee behavior.

The comment and assertion correctly capture that the second claim succeeds (because the first claim transaction itself generated a fee) but only yields a small additional amount. The upper bound of 700000 appropriately constrains the test to verify no double-counting occurs.

integration_tests/tests/features/substates.feature (1)

12-12: Approve funding amount 10 XTR initial funding is sufficient and consistent with other tests; no action needed.

bindings/src/tari-indexer-client.ts (1)

16-16: LGTM!

The new exports for NetworkDescription and SyncProgress follow the existing pattern and correctly expose the types needed for the network sync state API.

Also applies to: 41-41

bindings/src/types/tari-indexer-client/SyncProgress.ts (1)

1-11: LGTM!

The generated SyncProgress type correctly represents the network synchronization progress with proper TypeScript types for last_epoch, checkpoint_progress, and last_state_versions.

bindings/src/types/tari-indexer-client/NetworkDescription.ts (1)

1-10: LGTM!

The generated NetworkDescription type correctly represents the network configuration with proper TypeScript types for epoch, shard_groups, and num_preshards.

clients/tari_indexer_client/src/types.rs (1)

18-25: LGTM!

The updated imports correctly include the types needed for the new network sync state structures (Shard, Epoch, NumPreshards, ShardGroup, StateVersion).

applications/tari_indexer/src/json_rpc/handlers.rs (2)

49-49: LGTM!

The new imports for GetNetworkSyncStateResponse, NetworkDescription, and SyncProgress are correctly added to support the new network sync state endpoint.

Also applies to: 74-74, 77-77


701-731: LGTM!

The new get_network_sync_state handler correctly:

  • Fetches network description from the epoch manager
  • Optionally retrieves sync progress from the substate manager
  • Maps internal structures to API response types with proper error handling
  • Constructs and returns the GetNetworkSyncStateResponse

Comment on lines +851 to +860
if limit > 1000 {
return Err(JsonRpcResponse::error(
answer_id.clone(),
JsonRpcError::new(
JsonRpcErrorReason::InvalidParams,
"Limit cannot be greater than 1000".to_string(),
json::Value::Null,
),
));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove unreachable duplicate limit check.

The check at line 851 is unreachable because:

  1. Line 839 already rejects requests where req.limit > 1000
  2. Line 850 uses unwrap_or(100), so limit can only exceed 1000 if req.limit was Some(value > 1000)
  3. That case is already handled by the first check

Apply this diff to remove the duplicate check:

     let limit = req.limit.unwrap_or(100);
-    if limit > 1000 {
-        return Err(JsonRpcResponse::error(
-            answer_id.clone(),
-            JsonRpcError::new(
-                JsonRpcErrorReason::InvalidParams,
-                "Limit cannot be greater than 1000".to_string(),
-                json::Value::Null,
-            ),
-        ));
-    }

     let transactions = self
🤖 Prompt for AI Agents
In applications/tari_indexer/src/json_rpc/handlers.rs around lines 851-860,
there's an unreachable duplicate check that returns an error when limit > 1000;
remove that redundant if-block (the check and its JsonRpcResponse::error return)
because req.limit > 1000 is already handled earlier (line ~839) and limit is
derived with unwrap_or(100), so this branch can never be hit.

@github-actions

Copy link
Copy Markdown

Test Results (CI)

71 tests   - 370   67 ✅  - 361   8m 32s ⏱️ - 1h 15m 1s
 7 suites  -  66    0 💤 ±  0 
 1 files    -   1    4 ❌  -   9 

For more details on these failures, see this check.

Results for commit 905a096. ± Comparison against base commit 3873c11.

This pull request removes 370 tests.
Scenario: Claim and transfer confidential assets via wallet daemon: tests/features/wallet_daemon.feature:55:3
Scenario: Claim base layer burn funds with wallet daemon: tests/features/claim_burn.feature:9:3
Scenario: Claim validator fees: tests/features/claim_fees.feature:8:3
Scenario: Concurrent calls to the Counter template: tests/features/concurrency.feature:7:3
Scenario: Confidential transfer to account that does not previously exist: tests/features/transfer.feature:115:3
Scenario: Counter template registration and invocation multiple times: tests/features/counter.feature:28:3
Scenario: Counter template registration and invocation once: tests/features/counter.feature:8:3
Scenario: Create account and transfer faucets via wallet daemon: tests/features/wallet_daemon.feature:8:3
Scenario: Create and mint account NFT: tests/features/wallet_daemon.feature:77:3
Scenario: Create resource and mint in one transaction: tests/features/nft.feature:61:3
…

@sdbondi
sdbondi merged commit cede658 into tari-project:development Sep 30, 2025
10 of 12 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Nov 12, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants